清理项目
This commit is contained in:
@@ -1,96 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// 登录页面
|
||||
/// </summary>
|
||||
public class UILoginPage : ModuleUIPage {
|
||||
|
||||
private UILoginPanel loginPanel;
|
||||
private UIRegisterPanel registerPanel;
|
||||
|
||||
public override VisualElement Element => root.Q<VisualElement>("LoginPage");
|
||||
|
||||
public VisualElement LoginPanel => Q<VisualElement>("LoginPanel");
|
||||
public VisualElement RegisterPanel => Q<VisualElement>("RegisterPanel");
|
||||
|
||||
private void Awake() {
|
||||
loginPanel = new UILoginPanel(LoginPanel, this);
|
||||
registerPanel = new UIRegisterPanel(RegisterPanel, this);
|
||||
|
||||
ModuleUI.OnJumpPage += ModuleUI_OnJumpPage;
|
||||
}
|
||||
|
||||
private void ModuleUI_OnJumpPage(Page page) {
|
||||
Element.EnableInClassList("document-page-hide", page != Page.Login);
|
||||
if (page != Page.Login) { return; }
|
||||
OpenLoginPanel();
|
||||
}
|
||||
public void OpenLoginPanel() {
|
||||
loginPanel.Resetting(false);
|
||||
registerPanel.Resetting(true);
|
||||
}
|
||||
public void OpenRegisterPanel() {
|
||||
loginPanel.Resetting(true);
|
||||
registerPanel.Resetting(false);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 登录面板
|
||||
/// </summary>
|
||||
public class UILoginPanel : ModuleUIPanel {
|
||||
|
||||
private string username;
|
||||
private string password;
|
||||
|
||||
public Label Title => Q<Label>("Title");
|
||||
public UITextField InputField1 => Q<UITextField>("InputField1");
|
||||
public UITextField InputField2 => Q<UITextField>("InputField2");
|
||||
public Button Button1 => Q<Button>("Button1");
|
||||
public Button Button2 => Q<Button>("Button2");
|
||||
|
||||
public UILoginPanel(VisualElement element, UILoginPage parent) : base(element) {
|
||||
InputField1.RegisterCallback<ChangeEvent<string>>(evt => { username = evt.newValue; });
|
||||
InputField2.RegisterCallback<ChangeEvent<string>>(evt => { password = evt.newValue; });
|
||||
Button1.clicked += () => parent.OpenRegisterPanel();
|
||||
Button2.clicked += () => ManagerRequest.I.Login(username, password, (s) => {
|
||||
ModuleUI.Settings(Page.None);
|
||||
Debug.Log(s);
|
||||
});
|
||||
}
|
||||
public void Resetting(bool isHide) {
|
||||
InputField1.value = username = "";
|
||||
InputField2.value = password = "";
|
||||
element.EnableInClassList("login-hide", isHide);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 注册面板
|
||||
/// </summary>
|
||||
public class UIRegisterPanel : ModuleUIPanel {
|
||||
|
||||
private string username;
|
||||
private string password;
|
||||
|
||||
public Label Title => Q<Label>("Title");
|
||||
public UITextField InputField1 => Q<UITextField>("InputField1");
|
||||
public UITextField InputField2 => Q<UITextField>("InputField2");
|
||||
public Button Button1 => Q<Button>("Button1");
|
||||
public Button Button2 => Q<Button>("Button2");
|
||||
|
||||
public UIRegisterPanel(VisualElement element, UILoginPage parent) : base(element) {
|
||||
InputField1.RegisterCallback<ChangeEvent<string>>(evt => { username = evt.newValue; });
|
||||
InputField2.RegisterCallback<ChangeEvent<string>>(evt => { password = evt.newValue; });
|
||||
Button1.clicked += () => parent.OpenLoginPanel();
|
||||
Button2.clicked += () => { };
|
||||
}
|
||||
public void Resetting(bool isHide) {
|
||||
InputField1.value = "";
|
||||
InputField2.value = "";
|
||||
element.EnableInClassList("login-hide", isHide);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71f4d873d8595a04b9f0e23ece70c12f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,56 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// 测试页面
|
||||
/// </summary>
|
||||
public class UITestPage : ModuleUIPage {
|
||||
|
||||
public VisualTreeAsset SlideButtonTemplate;
|
||||
|
||||
public UISlideButton<UIOption, Option> slideButton;
|
||||
|
||||
public override VisualElement Element => root;
|
||||
public VisualElement SlideButton => Q<VisualElement>("SlideButton");
|
||||
|
||||
public void Awake() {
|
||||
slideButton = new UISlideButton<UIOption, Option>(SlideButton, root, SlideButtonTemplate, (data, element) => new UIOption(data, element));
|
||||
|
||||
List<Option> options = new List<Option>();
|
||||
options.Add(new Option());
|
||||
options.Add(new Option());
|
||||
options.Add(new Option());
|
||||
options.Add(new Option());
|
||||
slideButton.Create(options);
|
||||
|
||||
slideButton.Items[1].Select();
|
||||
}
|
||||
public void Update() {
|
||||
slideButton.Update();
|
||||
}
|
||||
|
||||
public class Option : DataSlideButton {
|
||||
|
||||
}
|
||||
|
||||
public class UIOption : ModuleUIItem<Option> {
|
||||
|
||||
public Button Button => Q<Button>("Button");
|
||||
|
||||
public UIOption(Option value, VisualElement element) : base(value, element) {
|
||||
value.element = element;
|
||||
Button.clicked += Select;
|
||||
}
|
||||
public override void SelectState() {
|
||||
Button.EnableInClassList("slidebutton-button-s", true);
|
||||
}
|
||||
public override void DefaultState() {
|
||||
Button.EnableInClassList("slidebutton-button-s", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be9d3ba84a127e14abd0d56796e7d7e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user