galgame,编辑器内蓝图

This commit is contained in:
FloatGaming
2026-03-08 13:11:52 +08:00
parent 1f4077cf21
commit 4aa8d0492a
17 changed files with 5046 additions and 314 deletions
+76
View File
@@ -0,0 +1,76 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class galPrefab : MonoBehaviour
{
[Header("NowUsing")]
[SerializeField] private int nowUsing = 0; // 0: none, 1: RoleHost, 2: RoleHint, 3: Narration, 4: HintOrLyrics
[Header("publics")]
public Color defaultTextColor;
[Header("mode1: RoleHost")]
public Image roleHostBGbar;
public Image L_roleHostImage;
public Image R_roleHosetImage;
public TextMeshProUGUI roleHostName;
public TextMeshProUGUI roleHostMessage;
public Button host_nextButton;
[Header("mode2: RoleHint")]
public Image roleHintBGbar;
public Image roleHintImage;
public TextMeshProUGUI roleHintName;
public TextMeshProUGUI roleHintMessage;
public Button hint_nextButton;
[Header("mode3: Narration")]
public Image narrationBGbar;
public TextMeshProUGUI narrationMessage;
[Header("mode4: HintOrLyrics")]
public Image hintOrLyricsBGbar;
public TextMeshProUGUI hintOrLyricsMessage;
[Header("fathers of 4modes")]
public GameObject roleHostFather;
public GameObject roleHintFather;
public GameObject narrationFather;
public GameObject hintOrLyricsFather;
private void Start()
{
// Try to find cameras from Camera.allCameras first
Camera foundCamera = null;
Camera[] cameras = Camera.allCameras;
if (cameras != null && cameras.Length > 0)
{
foundCamera = cameras[0];
}
else
{
Camera[] camObjs = FindObjectsOfType<Camera>();
if (camObjs != null && camObjs.Length > 0)
{
foundCamera = camObjs[0];
}
camObjs = null; // release temporary reference
}
if (foundCamera == null)
foundCamera = Camera.main;
if (foundCamera != null)
{
Canvas parentCanvas = GetComponentInParent<Canvas>();
if (parentCanvas != null)
{
parentCanvas.worldCamera = foundCamera;
}
}
// release temporary reference
cameras = null;
}
}