1
0
Fork 0

add ui function

master
zc 2023-09-13 15:31:44 +08:00
parent be561802fd
commit d34228cff5
8 changed files with 82 additions and 13 deletions

View File

@ -29950,6 +29950,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 410c143c96354285abf864ad1f7f28db, type: 3} m_Script: {fileID: 11500000, guid: 410c143c96354285abf864ad1f7f28db, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
uiType: 3
left: left:
role: {fileID: 1265401989} role: {fileID: 1265401989}
content: {fileID: 1272850033} content: {fileID: 1272850033}
@ -39624,7 +39625,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 188a37a0916d47e8bb368b803dc1041a, type: 3} m_Script: {fileID: 11500000, guid: 188a37a0916d47e8bb368b803dc1041a, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
text: {fileID: 0} uiType: 2
text: {fileID: 145330838}
--- !u!1 &1249638670 --- !u!1 &1249638670
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -42869,6 +42871,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2e775744d67d4d7d83432cdd23929ad6, type: 3} m_Script: {fileID: 11500000, guid: 2e775744d67d4d7d83432cdd23929ad6, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
uiType: 0
images: images:
- {fileID: 1862209240} - {fileID: 1862209240}
- {fileID: 842584874} - {fileID: 842584874}
@ -45621,6 +45624,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b967c97a49204ffb827fdc272dc04f79, type: 3} m_Script: {fileID: 11500000, guid: b967c97a49204ffb827fdc272dc04f79, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
uiType: 1
titleText: {fileID: 1430372477} titleText: {fileID: 1430372477}
contentText: {fileID: 74636445} contentText: {fileID: 74636445}
btnLeft: {fileID: 1508883186} btnLeft: {fileID: 1508883186}
@ -59939,6 +59943,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 1864616516} - component: {fileID: 1864616516}
- component: {fileID: 1864616517}
m_Layer: 0 m_Layer: 0
m_Name: UI m_Name: UI
m_TagString: Untagged m_TagString: Untagged
@ -59962,6 +59967,36 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1864616517
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1864616515}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f649c2f837524dc68a634d0ea3844730, type: 3}
m_Name:
m_EditorClassIdentifier:
serializationData:
SerializedFormat: 2
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
Prefab: {fileID: 0}
PrefabModificationsReferencedUnityObjects: []
PrefabModifications: []
SerializationNodes: []
uiObjectData:
- uiType: 0
ui: {fileID: 1352941224}
- uiType: 0
ui: {fileID: 1448946252}
- uiType: 0
ui: {fileID: 1248219822}
- uiType: 0
ui: {fileID: 834112896}
--- !u!1 &1866609136 --- !u!1 &1866609136
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -6,7 +6,7 @@ using UnityEngine.UI;
namespace UnityTest.ZXL namespace UnityTest.ZXL
{ {
public class DialogueUI : MonoBehaviour public class DialogueUI : UI
{ {
public DialogueStr left; public DialogueStr left;
public DialogueStr right; public DialogueStr right;

View File

@ -7,7 +7,7 @@ using UnityEngine.UI;
namespace UnityTest.ZXL namespace UnityTest.ZXL
{ {
//章节 //章节
public class ChapterUI : MonoBehaviour public class ChapterUI : UI
{ {
public List<GameObject> images = new List<GameObject>(); public List<GameObject> images = new List<GameObject>();
public Image blackImage; public Image blackImage;

View File

@ -5,7 +5,7 @@ using UnityEngine.UI;
namespace UnityTest.ZXL namespace UnityTest.ZXL
{ {
//强提示 //强提示
public class StrongTipsUI : MonoBehaviour public class StrongTipsUI : UI
{ {
public TextMeshProUGUI titleText; public TextMeshProUGUI titleText;
public TextMeshProUGUI contentText; public TextMeshProUGUI contentText;

View File

@ -0,0 +1,9 @@
using UnityEngine;
namespace UnityTest.ZXL
{
public class UI : MonoBehaviour
{
public UIType uiType;
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 059209d21f9f470295c74db08ab385b4
timeCreated: 1694589070

View File

@ -1,25 +1,47 @@
using System.Collections.Generic; using System;
using System.Collections.Generic;
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
using UnityEngine; using UnityEngine;
namespace UnityTest.ZXL namespace UnityTest.ZXL
{ {
public class UIManager : SerializedMonoBehaviour public class UIManager : BaseAutoMono<UIManager>
{ {
public List<UIObjectData> uiObjectData = new List<UIObjectData>(); public List<UIObjectData> uiObjectData = new List<UIObjectData>();
public void ShowUI(UIType uiType)
{
}
public void HideUI(UIType uiType)
{
}
#if UNITY_EDITOR
[Button]
void Add()
{
var uis = this.gameObject.GetComponentAllChild<UI>();
foreach (var ui in uis)
{
uiObjectData.Add(new UIObjectData() {uiType = ui.uiType, ui = ui});
}
}
#endif
} }
public enum UIType public enum UIType
{ {
Chapter, //章节
StrongTips, //强提示
WeakTips, //弱提示
Dialogue, //对话
} }
[System.Serializable] [System.Serializable]
public struct UIObjectData public struct UIObjectData
{ {
public string uiName; public UIType uiType;
public GameObject ui; public UI ui;
} }
} }

View File

@ -5,7 +5,7 @@ using UnityEngine.UI;
namespace UnityTest.ZXL namespace UnityTest.ZXL
{ {
// 若提示 // 若提示
public class WeakTipsUI : MonoBehaviour public class WeakTipsUI : UI
{ {
public TextMeshProUGUI text; public TextMeshProUGUI text;