1
This commit is contained in:
@@ -8,24 +8,50 @@ using MuHua;
|
||||
/// <summary>
|
||||
/// UI模块
|
||||
/// </summary>
|
||||
public class ModuleUI : ModuleSingle<ModuleUI> {
|
||||
public static EnumPage page;
|
||||
public static event Action<EnumPage> OnJumpPage;
|
||||
public class ModuleUI : ModuleUISingle<ModuleUI> {
|
||||
/// <summary> 当前页面 </summary>
|
||||
public static Page Current;
|
||||
/// <summary> 回退页面 </summary>
|
||||
public static Page BackPage;
|
||||
/// <summary> 控件列表 </summary>
|
||||
public static List<UIControl> controls = new List<UIControl>();
|
||||
/// <summary> 页面跳转事件 </summary>
|
||||
public static event Action<Page> OnJumpPage;
|
||||
|
||||
public UIDocument document;// 绑定文档
|
||||
/// <summary> 跳转页面 </summary>
|
||||
public static void Settings(Page pageType) {
|
||||
BackPage = Current;
|
||||
Current = pageType;
|
||||
OnJumpPage?.Invoke(Current);
|
||||
}
|
||||
/// <summary> 回退页面 </summary>
|
||||
public static void Back() {
|
||||
Current = BackPage;
|
||||
OnJumpPage?.Invoke(Current);
|
||||
}
|
||||
/// <summary> 添加控件 </summary>
|
||||
public static void AddControl(UIControl control) {
|
||||
controls.Add(control);
|
||||
}
|
||||
/// <summary> 移除控件 </summary>
|
||||
public static void RemoveControl(UIControl control) {
|
||||
controls.Remove(control);
|
||||
}
|
||||
|
||||
/// <summary> 根目录文档 </summary>
|
||||
public VisualElement root => document.rootVisualElement;
|
||||
public override VisualElement Element => document.rootVisualElement;
|
||||
|
||||
protected override void Awake() => NoReplace();
|
||||
|
||||
/// <summary> 跳转页面 </summary>
|
||||
public static void Settings(EnumPage pageType) => OnJumpPage?.Invoke(pageType);
|
||||
private void Update() => controls.ForEach(control => control.Update());
|
||||
|
||||
private void OnDestroy() => controls.ForEach(control => control.Dispose());
|
||||
}
|
||||
/// <summary>
|
||||
/// 页面
|
||||
/// </summary>
|
||||
public enum EnumPage {
|
||||
public enum Page {
|
||||
/// <summary> 无 </summary>
|
||||
None,
|
||||
/// <summary> 登录 </summary>
|
||||
Login,
|
||||
}
|
||||
@@ -25,9 +25,9 @@ public class UILoginPage : ModuleUIPage {
|
||||
ModuleUI.OnJumpPage += ModuleUI_OnJumpPage;
|
||||
}
|
||||
|
||||
private void ModuleUI_OnJumpPage(EnumPage page) {
|
||||
Element.EnableInClassList("document-page-hide", page != EnumPage.Login);
|
||||
if (page != EnumPage.Login) { return; }
|
||||
private void ModuleUI_OnJumpPage(Page page) {
|
||||
Element.EnableInClassList("document-page-hide", page != Page.Login);
|
||||
if (page != Page.Login) { return; }
|
||||
OpenLoginPanel();
|
||||
}
|
||||
public void OpenLoginPanel() {
|
||||
@@ -58,7 +58,7 @@ public class UILoginPanel : ModuleUIPanel {
|
||||
InputField2.RegisterCallback<ChangeEvent<string>>(evt => { password = evt.newValue; });
|
||||
Button1.clicked += () => parent.OpenRegisterPanel();
|
||||
Button2.clicked += () => ManagerRequest.I.Login(username, password, (s) => {
|
||||
ModuleUI.Settings(EnumPage.None);
|
||||
ModuleUI.Settings(Page.None);
|
||||
Debug.Log(s);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,25 +7,11 @@ using MuHua;
|
||||
/// <summary>
|
||||
/// UI弹出管理器
|
||||
/// </summary>
|
||||
public class UIPopupManager : ModuleUIPage {
|
||||
|
||||
// public UIPopup dialog;
|
||||
public class UIPopupManager : ModuleUISingle<UIPopupManager> {
|
||||
|
||||
public override VisualElement Element => root.Q<VisualElement>("Popup");
|
||||
|
||||
public VisualElement PopupDialog => Q<VisualElement>("PopupDialog");
|
||||
|
||||
private void Awake() {
|
||||
// dialog = new UIPopup(PopupDialog);
|
||||
}
|
||||
private void OnDestroy() {
|
||||
// config.Release();
|
||||
// configMaterial.Release();
|
||||
// equipmentSelection.Release();
|
||||
// paramrInput.Release();
|
||||
}
|
||||
private void Update() {
|
||||
// config.Update();
|
||||
// configMaterial.Update();
|
||||
}
|
||||
protected override void Awake() => NoReplace(false);
|
||||
}
|
||||
|
||||
@@ -132,13 +132,14 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 670296964}
|
||||
- component: {fileID: 670296963}
|
||||
- component: {fileID: 670296965}
|
||||
m_Layer: 5
|
||||
m_Name: "----\u754C\u9762\u6587\u6863----"
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!114 &670296963
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -171,6 +172,19 @@ Transform:
|
||||
- {fileID: 1621578791}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &670296965
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 670296962}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ea89ac05041b5d74582ee9d0add233ac, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
document: {fileID: 670296963}
|
||||
--- !u!1 &705507993
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
Reference in New Issue
Block a user