Initial commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// UI模块
|
||||
/// </summary>
|
||||
public class ModuleUI : ModuleSingle<ModuleUI> {
|
||||
public static EnumPage page;
|
||||
public static event Action<EnumPage> OnJumpPage;
|
||||
|
||||
public UIDocument document;// 绑定文档
|
||||
|
||||
/// <summary> 根目录文档 </summary>
|
||||
public VisualElement root => document.rootVisualElement;
|
||||
|
||||
protected override void Awake() => NoReplace();
|
||||
|
||||
/// <summary> 跳转页面 </summary>
|
||||
public static void Jump(EnumPage pageType) => OnJumpPage?.Invoke(pageType);
|
||||
}
|
||||
/// <summary>
|
||||
/// 页面
|
||||
/// </summary>
|
||||
public enum EnumPage {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea89ac05041b5d74582ee9d0add233ac
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8f196d318cab0f47a3c84eade044392
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// 测试页面
|
||||
/// </summary>
|
||||
public class UITestPage : ModuleUIPage {
|
||||
public VisualTreeAsset TemplateAsset;
|
||||
public List<string> list;
|
||||
|
||||
private UIToggle toggle;
|
||||
private UIDropdown<string> dropdown;
|
||||
private UIScrollView scrollView1;
|
||||
private UIScrollView scrollView2;
|
||||
private UIScrollView scrollView3;
|
||||
private UIScrollView scrollView4;
|
||||
|
||||
public override VisualElement Element => root;
|
||||
|
||||
public VisualElement Toggle => Q<VisualElement>("Toggle");
|
||||
public VisualElement Dropdown => Q<VisualElement>("Dropdown");
|
||||
public VisualElement ScrollView1 => Q<VisualElement>("ScrollView1");
|
||||
public VisualElement ScrollView2 => Q<VisualElement>("ScrollView2");
|
||||
public VisualElement ScrollView3 => Q<VisualElement>("ScrollView3");
|
||||
public VisualElement ScrollView4 => Q<VisualElement>("ScrollView4");
|
||||
|
||||
private void Awake() {
|
||||
toggle = new UIToggle(Toggle);
|
||||
toggle.ValueChanged += (value) => Debug.Log(value);
|
||||
|
||||
dropdown = new UIDropdown<string>(Dropdown, root, TemplateAsset);
|
||||
dropdown.SetValue(list);
|
||||
dropdown.ValueChanged += (value) => Debug.Log(value);
|
||||
|
||||
scrollView1 = new UIScrollView(ScrollView1, root, UIDirection.Vertical, UIDirection.FromLeftToRight, UIDirection.FromTopToBottom);
|
||||
scrollView2 = new UIScrollView(ScrollView2, root, UIDirection.Vertical, UIDirection.FromLeftToRight, UIDirection.FromBottomToTop);
|
||||
scrollView3 = new UIScrollView(ScrollView3, root, UIDirection.Horizontal, UIDirection.FromLeftToRight);
|
||||
scrollView4 = new UIScrollView(ScrollView4, root, UIDirection.Horizontal, UIDirection.FromLeftToRight);
|
||||
}
|
||||
private void Update() {
|
||||
dropdown.Update();
|
||||
scrollView1.Update();
|
||||
scrollView2.Update();
|
||||
scrollView3.Update();
|
||||
scrollView4.Update();
|
||||
}
|
||||
private void OnDestroy() {
|
||||
dropdown.Release();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a47690fe988195040a2e528bb2e8bce6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6be8605ab2df3348bdd03749d5ca2c5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user