新增数值系统
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 45818eb64c9b04441b20b29f0230edb7, type: 3}
|
||||||
|
m_Name: "\u707E\u7978\u4E4B\u77ED\u5251"
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
sprite: {fileID: 0}
|
||||||
|
level: 0
|
||||||
|
rarity: 0
|
||||||
|
type: 0
|
||||||
|
category: 0
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d9f2593221f759045a7a8c191b7c7842
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &-9179132900460120086
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: e49882beb2bb280438028a6a8a591abf, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
type: 0
|
||||||
|
minValue: 0
|
||||||
|
maxValue: 9999
|
||||||
|
baseValue: 0
|
||||||
|
container: {fileID: 11400000}
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 11c3d0ab6f395eb41bcf0e66676f68a3, type: 3}
|
||||||
|
m_Name: New Value Container Const
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
instances:
|
||||||
|
- {fileID: -9179132900460120086}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 533df5779dbd0d94198fc1659c24f228
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -29,7 +29,7 @@ MonoBehaviour:
|
|||||||
m_Name: "\u9632\u5FA1"
|
m_Name: "\u9632\u5FA1"
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
type: 0
|
type: 0
|
||||||
defaultValue: 0
|
defaultValue: 5
|
||||||
minValue: 0
|
minValue: 0
|
||||||
maxValue: 9999
|
maxValue: 9999
|
||||||
container: {fileID: 11400000}
|
container: {fileID: 11400000}
|
||||||
|
|||||||
@@ -29,8 +29,9 @@ public class SingleManager : ModuleSingle<SingleManager> {
|
|||||||
shortcutMenu.Add("背包", () => { ModuleUI.Settings(Page.Backpack); });
|
shortcutMenu.Add("背包", () => { ModuleUI.Settings(Page.Backpack); });
|
||||||
shortcutMenu.Add("奖励/材料", RewardMaterial);
|
shortcutMenu.Add("奖励/材料", RewardMaterial);
|
||||||
shortcutMenu.Add("奖励/装备", RewardEquipment);
|
shortcutMenu.Add("奖励/装备", RewardEquipment);
|
||||||
}
|
|
||||||
|
|
||||||
|
ValueSystem.I.Initial();
|
||||||
|
}
|
||||||
|
|
||||||
private void RewardMaterial() {
|
private void RewardMaterial() {
|
||||||
(InventoryItem item, int count) = materialReward.Get(10);
|
(InventoryItem item, int count) = materialReward.Get(10);
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using MuHua;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数值系统
|
||||||
|
/// </summary>
|
||||||
|
public class ValueSystem : Module<ValueSystem> {
|
||||||
|
/// <summary> 对战数值 </summary>
|
||||||
|
public ValueContainer battle;
|
||||||
|
|
||||||
|
/// <summary> 初始化 </summary>
|
||||||
|
public void Initial() {
|
||||||
|
battle = new ValueContainer();
|
||||||
|
battle.AddInstance(ValueType.Integer, "生命");
|
||||||
|
battle.AddInstance(ValueType.Integer, "金币");
|
||||||
|
battle.AddInstance(ValueType.Integer, "水晶");
|
||||||
|
|
||||||
|
Debug.Log(battle["生命"].value);
|
||||||
|
|
||||||
|
ValueModifier modifier = new ValueModifier { Fixed = 100 };
|
||||||
|
battle["生命"].AddModifier(modifier, true);
|
||||||
|
|
||||||
|
Debug.Log(battle["生命"].value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b9b82c2b1930d5f4b8b002d671c4e28c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 58401524a84c7e94395366062aec97d6
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 66d3229212a595846b9682dc5c914e06
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9b1b38b68dd638d4e940b836f4f37092
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,206 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UIElements;
|
||||||
|
using UnityEditor;
|
||||||
|
using MuHua;
|
||||||
|
using PlasticGui;
|
||||||
|
|
||||||
|
namespace MuHuaEditor {
|
||||||
|
/// <summary>
|
||||||
|
/// 数值容器 - UI面板
|
||||||
|
/// </summary>
|
||||||
|
public class UIValueContainerConst : ModuleUIPanel, UIControl {
|
||||||
|
/// <summary> 模板资源 </summary>
|
||||||
|
public VisualTreeAsset templateAsset;
|
||||||
|
/// <summary> 数值列表 </summary>
|
||||||
|
public ValueContainerConst container;
|
||||||
|
/// <summary> 项目列表 </summary>
|
||||||
|
public ModuleUIItems<UIItem, ValueInstanceConst> items;
|
||||||
|
/// <summary> 列表拖拽 </summary>
|
||||||
|
public UIValueContainerConstDrag valueContainerConstDrag;
|
||||||
|
|
||||||
|
public UIValueContainerConst(VisualElement element, VisualTreeAsset templateAsset) : base(element) {
|
||||||
|
this.templateAsset = templateAsset;
|
||||||
|
items = new ModuleUIItems<UIItem, ValueInstanceConst>(element, templateAsset,
|
||||||
|
(data, element) => new UIItem(data, element, this));
|
||||||
|
|
||||||
|
valueContainerConstDrag = new UIValueContainerConstDrag(element, templateAsset);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update() => valueContainerConstDrag.Update();
|
||||||
|
|
||||||
|
public void Dispose() => items.Release();
|
||||||
|
|
||||||
|
/// <summary> 初始化 </summary>
|
||||||
|
public void Initial(ValueContainerConst container) {
|
||||||
|
this.container = container;
|
||||||
|
items.Create(container.instances);
|
||||||
|
valueContainerConstDrag.Initial(container);
|
||||||
|
}
|
||||||
|
/// <summary> 设置值 </summary>
|
||||||
|
public void Settings(VisualElement element, ValueInstanceConst value) {
|
||||||
|
valueContainerConstDrag.Settings(element, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> UI项 </summary>
|
||||||
|
public class UIItem : ModuleUIItem<ValueInstanceConst> {
|
||||||
|
|
||||||
|
public UIValueContainerConst parent;
|
||||||
|
|
||||||
|
public UIAttributePanel attributePanel;
|
||||||
|
|
||||||
|
public Label Range => Q<Label>("Range");
|
||||||
|
public TextField Name => Q<TextField>("Name");
|
||||||
|
public EnumField Type => Q<EnumField>("Type");
|
||||||
|
public FloatField Base => Q<FloatField>("Base");
|
||||||
|
public Toggle Boolean => Q<Toggle>("Boolean");
|
||||||
|
|
||||||
|
public UIItem(ValueInstanceConst value, VisualElement element) : base(value, element) {
|
||||||
|
Initial();
|
||||||
|
}
|
||||||
|
public UIItem(ValueInstanceConst value, VisualElement element, UIValueContainerConst parent) : base(value, element) {
|
||||||
|
this.parent = parent;
|
||||||
|
Initial();
|
||||||
|
element.RegisterCallback<MouseDownEvent>(MouseDownEvent);
|
||||||
|
}
|
||||||
|
private void Initial() {
|
||||||
|
Name.SetValueWithoutNotify(value.name);
|
||||||
|
Type.Init(value.type);
|
||||||
|
Base.SetValueWithoutNotify(value.baseValue);
|
||||||
|
Boolean.value = value.baseValue == value.maxValue;
|
||||||
|
|
||||||
|
VisualElement temp = value.type == ValueType.Boolean ? Base : Boolean;
|
||||||
|
temp.style.display = DisplayStyle.None;
|
||||||
|
|
||||||
|
string symbol = value.type == ValueType.Percentage ? "%" : "";
|
||||||
|
Range.text = $"{value.minValue}{symbol} ~ {value.maxValue}{symbol}";
|
||||||
|
|
||||||
|
Name.RegisterCallback<FocusOutEvent>(evt => ModifyName());
|
||||||
|
Type.RegisterValueChangedCallback(evt => ModifyType((ValueType)evt.newValue));
|
||||||
|
Base.RegisterCallback<FocusOutEvent>(evt => ModifyValue());
|
||||||
|
Boolean.RegisterValueChangedCallback(evt => ModifyBoolean());
|
||||||
|
}
|
||||||
|
private void MouseDownEvent(MouseDownEvent evt) => parent.Settings(element, value);
|
||||||
|
|
||||||
|
/// <summary> 修改名字 </summary>
|
||||||
|
private void ModifyName() { value.name = Name.value; Dirty(); }
|
||||||
|
/// <summary> 修改类型 </summary>
|
||||||
|
private void ModifyType(ValueType type) {
|
||||||
|
if (type == ValueType.Float) { value.InitialFloat(); }
|
||||||
|
if (type == ValueType.Integer) { value.InitialInteger(); }
|
||||||
|
if (type == ValueType.Boolean) { value.InitialBoolean(); }
|
||||||
|
if (type == ValueType.Percentage) { value.InitialPercentage(); }
|
||||||
|
|
||||||
|
VisualElement temp = value.type == ValueType.Boolean ? Base : Boolean;
|
||||||
|
temp.style.display = DisplayStyle.None;
|
||||||
|
|
||||||
|
Dirty();
|
||||||
|
}
|
||||||
|
/// <summary> 修改默认值 </summary>
|
||||||
|
private void ModifyValue() { value.baseValue = Base.value; Dirty(); }
|
||||||
|
/// <summary> 修改布尔值 </summary>
|
||||||
|
private void ModifyBoolean() { value.baseValue = Boolean.value ? value.maxValue : value.minValue; Dirty(); }
|
||||||
|
|
||||||
|
/// <summary> 保存资源 </summary>
|
||||||
|
private void Dirty() {
|
||||||
|
EditorUtility.SetDirty(value);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class UIValueContainerConstDrag : ModuleUIPanel, UIControl {
|
||||||
|
/// <summary> 模板资源 </summary>
|
||||||
|
public VisualTreeAsset templateAsset;
|
||||||
|
/// <summary> 偏移位置 </summary>
|
||||||
|
public Vector2 mouseOffset;
|
||||||
|
/// <summary> 鼠标偏移 </summary>
|
||||||
|
public Vector2 mousePosition;
|
||||||
|
/// <summary> 位置偏移 </summary>
|
||||||
|
public Vector2 positionOffset;
|
||||||
|
/// <summary> 移动目标 </summary>
|
||||||
|
public VisualElement moving;
|
||||||
|
/// <summary> 拖拽预览 </summary>
|
||||||
|
public VisualElement preview;
|
||||||
|
/// <summary> 项目预览 </summary>
|
||||||
|
public UIValueContainerConst.UIItem previewItem;
|
||||||
|
/// <summary> 数值列表 </summary>
|
||||||
|
public ValueContainerConst container;
|
||||||
|
|
||||||
|
public UIValueContainerConstDrag(VisualElement element, VisualTreeAsset templateAsset) : base(element) {
|
||||||
|
this.templateAsset = templateAsset;
|
||||||
|
element.RegisterCallback<MouseUpEvent>(MouseUpEvent);
|
||||||
|
element.RegisterCallback<MouseLeaveEvent>(MouseUpEvent);
|
||||||
|
element.RegisterCallback<MouseMoveEvent>(MouseMoveEvent);
|
||||||
|
}
|
||||||
|
private void MouseUpEvent(EventBase evt) {
|
||||||
|
if (preview == null) { return; }
|
||||||
|
preview.parent.Remove(preview);
|
||||||
|
preview = null;
|
||||||
|
moving.EnableInClassList("value-hide", false);
|
||||||
|
if (previewItem != null) { previewItem.Dispose(); }
|
||||||
|
|
||||||
|
EditorUtility.SetDirty(container);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
}
|
||||||
|
private void MouseMoveEvent(MouseMoveEvent evt) {
|
||||||
|
mousePosition = evt.mousePosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update() {
|
||||||
|
if (preview == null) { return; }
|
||||||
|
preview.transform.position = positionOffset + mousePosition - mouseOffset;
|
||||||
|
int insertIndex = GetInsertIndex(element, preview);
|
||||||
|
int oldIndex = element.IndexOf(moving);
|
||||||
|
// 修正插入索引
|
||||||
|
if (insertIndex > oldIndex) insertIndex--;
|
||||||
|
if (oldIndex != insertIndex) { MovePreviewElement(oldIndex, insertIndex); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose() {
|
||||||
|
// throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> 初始化 </summary>
|
||||||
|
public void Initial(ValueContainerConst container) {
|
||||||
|
this.container = container;
|
||||||
|
}
|
||||||
|
/// <summary> 设置值 </summary>
|
||||||
|
public void Settings(VisualElement moving, ValueInstanceConst value) {
|
||||||
|
this.moving = moving;
|
||||||
|
moving.EnableInClassList("value-hide", true);
|
||||||
|
|
||||||
|
preview = templateAsset.Instantiate();
|
||||||
|
previewItem = new UIValueContainerConst.UIItem(value, preview);
|
||||||
|
element.Add(preview);
|
||||||
|
|
||||||
|
preview.EnableInClassList("value-preview", true);
|
||||||
|
// Debug.Log($"{preview.transform.position} , {preview.worldBound.position} , {moving.worldBound.position}");
|
||||||
|
mouseOffset = mousePosition;
|
||||||
|
// preview.transform.position的默认值
|
||||||
|
positionOffset = moving.worldBound.position - preview.worldBound.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> 获取插入索引 </summary>
|
||||||
|
private int GetInsertIndex(VisualElement parent, VisualElement preview) {
|
||||||
|
Vector2 previewCenter = preview.worldBound.center;
|
||||||
|
int insertIndex = 0;
|
||||||
|
for (int i = 0; i < parent.childCount - 1; i++) {
|
||||||
|
VisualElement child = parent[i];
|
||||||
|
if (child == preview) continue;
|
||||||
|
if (previewCenter.y - 10 < child.worldBound.center.y) { insertIndex = i; break; }
|
||||||
|
insertIndex = i + 1;
|
||||||
|
}
|
||||||
|
return insertIndex;
|
||||||
|
}
|
||||||
|
/// <summary> 移动预览元素到新位置 </summary>
|
||||||
|
private void MovePreviewElement(int oldIndex, int newIndex) {
|
||||||
|
VisualElement temp = element[oldIndex];
|
||||||
|
element.Insert(newIndex, temp);
|
||||||
|
|
||||||
|
ValueInstanceConst instanceConst = container.instances[oldIndex];
|
||||||
|
container.instances.RemoveAt(oldIndex);
|
||||||
|
container.instances.Insert(newIndex, instanceConst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9a1008ce7dfbfa54482a6ce5d31267a1
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UIElements;
|
||||||
|
using UnityEditor;
|
||||||
|
using MuHua;
|
||||||
|
|
||||||
|
namespace MuHuaEditor {
|
||||||
|
/// <summary>
|
||||||
|
/// 数值实例 - UI面板
|
||||||
|
/// </summary>
|
||||||
|
public class UIValueInstanceConst : ModuleUIPanel {
|
||||||
|
|
||||||
|
private ValueInstanceConst value;
|
||||||
|
|
||||||
|
public TextField Name => Q<TextField>("Name");
|
||||||
|
public EnumField Type => Q<EnumField>("Type");
|
||||||
|
public FloatField Min => Q<FloatField>("Min");
|
||||||
|
public FloatField Max => Q<FloatField>("Max");
|
||||||
|
public FloatField Base => Q<FloatField>("Base");
|
||||||
|
public Toggle Boolean => Q<Toggle>("Boolean");
|
||||||
|
|
||||||
|
public UIValueInstanceConst(ValueInstanceConst value, VisualElement element) : base(element) {
|
||||||
|
this.value = value;
|
||||||
|
|
||||||
|
Name.SetValueWithoutNotify(value.name);
|
||||||
|
Type.Init(value.type);
|
||||||
|
Min.SetValueWithoutNotify(value.minValue);
|
||||||
|
Max.SetValueWithoutNotify(value.maxValue);
|
||||||
|
Base.SetValueWithoutNotify(value.baseValue);
|
||||||
|
Boolean.value = value.baseValue == value.maxValue;
|
||||||
|
|
||||||
|
VisualElement temp = value.type == ValueType.Boolean ? Base : Boolean;
|
||||||
|
temp.style.display = DisplayStyle.None;
|
||||||
|
|
||||||
|
Name.RegisterCallback<FocusOutEvent>(evt => ModifyName());
|
||||||
|
Type.RegisterValueChangedCallback(evt => ModifyType((ValueType)evt.newValue));
|
||||||
|
Min.RegisterCallback<FocusOutEvent>(evt => ModifyMin());
|
||||||
|
Max.RegisterCallback<FocusOutEvent>(evt => ModifyMax());
|
||||||
|
Base.RegisterCallback<FocusOutEvent>(evt => ModifyValue());
|
||||||
|
Boolean.RegisterValueChangedCallback(evt => ModifyBoolean());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> 修改名字 </summary>
|
||||||
|
private void ModifyName() { value.name = Name.value; Dirty(); }
|
||||||
|
/// <summary> 修改类型 </summary>
|
||||||
|
private void ModifyType(ValueType type) {
|
||||||
|
if (type == ValueType.Float) { value.InitialFloat(); }
|
||||||
|
if (type == ValueType.Integer) { value.InitialInteger(); }
|
||||||
|
if (type == ValueType.Boolean) { value.InitialBoolean(); }
|
||||||
|
if (type == ValueType.Percentage) { value.InitialPercentage(); }
|
||||||
|
|
||||||
|
VisualElement temp = value.type == ValueType.Boolean ? Base : Boolean;
|
||||||
|
temp.style.display = DisplayStyle.None;
|
||||||
|
|
||||||
|
Dirty();
|
||||||
|
}
|
||||||
|
/// <summary> 修改最小值 </summary>
|
||||||
|
private void ModifyMin() { value.minValue = Min.value; Dirty(); }
|
||||||
|
/// <summary> 修改最大值 </summary>
|
||||||
|
private void ModifyMax() { value.maxValue = Max.value; Dirty(); }
|
||||||
|
/// <summary> 修改默认值 </summary>
|
||||||
|
private void ModifyValue() { value.baseValue = Base.value; Dirty(); }
|
||||||
|
/// <summary> 修改布尔值 </summary>
|
||||||
|
private void ModifyBoolean() { value.baseValue = Boolean.value ? value.maxValue : value.minValue; Dirty(); }
|
||||||
|
|
||||||
|
/// <summary> 保存资源 </summary>
|
||||||
|
private void Dirty() {
|
||||||
|
EditorUtility.SetDirty(value);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 38504fa83fe40614fb1b801bb9b49501
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UIElements;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace MuHuaEditor {
|
||||||
|
/// <summary>
|
||||||
|
/// 数值容器 - 自定义编辑器
|
||||||
|
/// </summary>
|
||||||
|
[CustomEditor(typeof(ValueContainerConst))]
|
||||||
|
public class ValueContainerConstEditor : ModuleUIEditor<ValueContainerConst> {
|
||||||
|
|
||||||
|
public VisualTreeAsset ValueTemplate = default;
|
||||||
|
|
||||||
|
private UIValueContainerConst valueContainer;
|
||||||
|
|
||||||
|
public VisualElement ValueList => Q<VisualElement>("ValueList");
|
||||||
|
public Button Button1 => Q<Button>("Button1");// 创建属性
|
||||||
|
public Button Button2 => Q<Button>("Button2");// 删除全部
|
||||||
|
|
||||||
|
public override void Initial() {
|
||||||
|
valueContainer = new UIValueContainerConst(ValueList, ValueTemplate);
|
||||||
|
valueContainer.Initial(value);
|
||||||
|
AddControl(valueContainer);
|
||||||
|
|
||||||
|
Button1.clicked += GenerateAttribute;
|
||||||
|
Button2.clicked += DeleteInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> 创建属性实例 </summary>
|
||||||
|
private void GenerateAttribute() {
|
||||||
|
ValueInstanceConst instance = CreateInstance<ValueInstanceConst>();
|
||||||
|
instance.container = value;
|
||||||
|
// 加入容器
|
||||||
|
value.instances.Add(instance);
|
||||||
|
AssetDatabase.AddObjectToAsset(instance, value);
|
||||||
|
EditorUtility.SetDirty(instance);
|
||||||
|
EditorUtility.SetDirty(value);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
}
|
||||||
|
/// <summary> 删除全部实例 </summary>
|
||||||
|
private void DeleteInstance() {
|
||||||
|
for (int i = value.instances.Count; i-- > 0;) {
|
||||||
|
ValueInstanceConst instance = value.instances[i];
|
||||||
|
value.instances.Remove(instance);
|
||||||
|
Undo.DestroyObjectImmediate(instance);
|
||||||
|
}
|
||||||
|
EditorUtility.SetDirty(value);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3a8123b2aa6e9a14db8ce320df4b476c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences:
|
||||||
|
- VisualTreeAsset: {fileID: 9197481963319205126, guid: e4dff0385b7d2cd46b08821071a517c7, type: 3}
|
||||||
|
- ValueTemplate: {fileID: 9197481963319205126, guid: d53f6d483079a3048aa12c1433cd3748, type: 3}
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UIElements;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace MuHuaEditor {
|
||||||
|
/// <summary>
|
||||||
|
/// 数值实例 - 自定义编辑器
|
||||||
|
/// </summary>
|
||||||
|
[CustomEditor(typeof(ValueInstanceConst))]
|
||||||
|
public class ValueInstanceConstEditor : ModuleUIEditor<ValueInstanceConst> {
|
||||||
|
|
||||||
|
public UIValueInstanceConst valueInstance;
|
||||||
|
|
||||||
|
public Button Delete => Q<Button>("Delete");
|
||||||
|
|
||||||
|
public override void Initial() {
|
||||||
|
valueInstance = new UIValueInstanceConst(value, Element);
|
||||||
|
|
||||||
|
Delete.clicked += DeleteInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> 删除实例 </summary>
|
||||||
|
private void DeleteInstance() {
|
||||||
|
ValueContainerConst container = value.container;
|
||||||
|
container?.instances.Remove(value);
|
||||||
|
EditorUtility.SetDirty(container);
|
||||||
|
Undo.DestroyObjectImmediate(value);
|
||||||
|
AssetDatabase.SaveAssets();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 020141a705f09bd4caca2ffc73ba9abc
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences:
|
||||||
|
- VisualTreeAsset: {fileID: 9197481963319205126, guid: 303114e9196fa664c9f9cabda3fb5a37, type: 3}
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 354cf3e0d4a855c418bd9fbe004034df
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数值容器
|
||||||
|
/// </summary>
|
||||||
|
public class ValueContainer {
|
||||||
|
/// <summary> 数值字典 </summary>
|
||||||
|
public Dictionary<string, ValueInstance> dictionary = new Dictionary<string, ValueInstance>();
|
||||||
|
|
||||||
|
/// <summary> 所引器 </summary>
|
||||||
|
public ValueInstance this[string id] => dictionary[id];
|
||||||
|
|
||||||
|
/// <summary> 循环集合 </summary>
|
||||||
|
public void ForEach(Action<string, ValueInstance> action) {
|
||||||
|
foreach (var item in dictionary) { action?.Invoke(item.Key, item.Value); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> 添加数值 </summary>
|
||||||
|
public void AddInstance(ValueType type, string name) {
|
||||||
|
var instance = new ValueInstance(type, name);
|
||||||
|
AddInstance(instance);
|
||||||
|
}
|
||||||
|
/// <summary> 添加数值 </summary>
|
||||||
|
public void AddInstance(ValueInstance instance) {
|
||||||
|
if (dictionary.ContainsKey(instance.name)) { return; }
|
||||||
|
dictionary.Add(instance.name, instance);
|
||||||
|
}
|
||||||
|
/// <summary> 重新计算值 </summary>
|
||||||
|
public void RecalculateValue() {
|
||||||
|
foreach (var item in dictionary) { item.Value.RecalculateValue(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2cd07e4908c0bde4380bcc2be0f5e13c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数值容器 - 常量
|
||||||
|
/// </summary>
|
||||||
|
[CreateAssetMenu(menuName = "MuHua/数值模块/数值容器")]
|
||||||
|
public class ValueContainerConst : ScriptableObject {
|
||||||
|
/// <summary> 属性列表 </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public List<ValueInstanceConst> instances = new List<ValueInstanceConst>();
|
||||||
|
|
||||||
|
/// <summary> 转换数据 </summary>
|
||||||
|
public ValueContainer To() {
|
||||||
|
ValueContainer container = new ValueContainer();
|
||||||
|
instances.ForEach(obj => container.AddInstance(obj.To()));
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 11c3d0ab6f395eb41bcf0e66676f68a3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数值实例
|
||||||
|
/// </summary>
|
||||||
|
public class ValueInstance {
|
||||||
|
/// <summary> 数值类型 </summary>
|
||||||
|
public readonly ValueType type;
|
||||||
|
/// <summary> 数值名称 </summary>
|
||||||
|
public readonly string name;
|
||||||
|
|
||||||
|
/// <summary> 最小值 </summary>
|
||||||
|
public float minValue;
|
||||||
|
/// <summary> 最大值 </summary>
|
||||||
|
public float maxValue;
|
||||||
|
|
||||||
|
/// <summary> 基础值 </summary>
|
||||||
|
public float baseValue;
|
||||||
|
/// <summary> 附加值% </summary>
|
||||||
|
public float addedValue;
|
||||||
|
/// <summary> 当前值 </summary>
|
||||||
|
public float currentValue;
|
||||||
|
/// <summary> 最终数值 </summary>
|
||||||
|
public float value;
|
||||||
|
|
||||||
|
/// <summary> 修改器列表 </summary>
|
||||||
|
public List<ValueModifier> modifiers = new List<ValueModifier>();
|
||||||
|
|
||||||
|
/// <summary> 是布尔值 </summary>
|
||||||
|
public bool isBoolean => type == ValueType.Boolean && value == maxValue;
|
||||||
|
|
||||||
|
public ValueInstance(ValueType type, string name) {
|
||||||
|
this.type = type;
|
||||||
|
this.name = name;
|
||||||
|
if (type == ValueType.Float) { minValue = 0; maxValue = float.MaxValue; }
|
||||||
|
if (type == ValueType.Integer) { minValue = 0; maxValue = float.MaxValue; }
|
||||||
|
if (type == ValueType.Boolean) { minValue = 0; maxValue = 1; }
|
||||||
|
if (type == ValueType.Percentage) { minValue = 0; maxValue = 100; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> 添加修改器 </summary>
|
||||||
|
public void AddModifier(ValueModifier modifier, bool isUpdate) {
|
||||||
|
modifiers.Add(modifier);
|
||||||
|
if (isUpdate) { RecalculateValue(); }
|
||||||
|
}
|
||||||
|
/// <summary> 添加修改器 </summary>
|
||||||
|
public void AddModifier(List<ValueModifier> modifier, bool isUpdate) {
|
||||||
|
modifiers.AddRange(modifier);
|
||||||
|
if (isUpdate) { RecalculateValue(); }
|
||||||
|
}
|
||||||
|
/// <summary> 重新计算值 </summary>
|
||||||
|
public void RecalculateValue() {
|
||||||
|
addedValue = 1;
|
||||||
|
currentValue = baseValue;
|
||||||
|
modifiers.ForEach(Modify);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> 修改 </summary>
|
||||||
|
public void Modify(ValueModifier modifier) {
|
||||||
|
addedValue += modifier.AddedValue;
|
||||||
|
currentValue += modifier.FixedValue;
|
||||||
|
value = currentValue * addedValue;
|
||||||
|
value = Mathf.Clamp(currentValue, minValue, maxValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fc8206be3feda78499952ab2635f5e3c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数值实例 - 常量
|
||||||
|
/// </summary>
|
||||||
|
// [CreateAssetMenu(menuName = "MuHua/数值模块/数值实例")]
|
||||||
|
public class ValueInstanceConst : ScriptableObject {
|
||||||
|
/// <summary> 数值类型 </summary>
|
||||||
|
public ValueType type;
|
||||||
|
|
||||||
|
/// <summary> 最小值 </summary>
|
||||||
|
public float minValue;
|
||||||
|
/// <summary> 最大值 </summary>
|
||||||
|
public float maxValue = 9999;
|
||||||
|
|
||||||
|
/// <summary> 基础值 </summary>
|
||||||
|
public float baseValue;
|
||||||
|
|
||||||
|
/// <summary> 数值容器 </summary>
|
||||||
|
[HideInInspector]
|
||||||
|
public ValueContainerConst container;
|
||||||
|
|
||||||
|
public void InitialFloat() {
|
||||||
|
type = ValueType.Float;
|
||||||
|
minValue = 0;
|
||||||
|
maxValue = 9999;
|
||||||
|
baseValue = 0;
|
||||||
|
}
|
||||||
|
public void InitialInteger() {
|
||||||
|
type = ValueType.Integer;
|
||||||
|
minValue = 0;
|
||||||
|
maxValue = 9999;
|
||||||
|
baseValue = 0;
|
||||||
|
}
|
||||||
|
public void InitialBoolean() {
|
||||||
|
type = ValueType.Boolean;
|
||||||
|
minValue = 0;
|
||||||
|
maxValue = 1;
|
||||||
|
baseValue = 0;
|
||||||
|
}
|
||||||
|
public void InitialPercentage() {
|
||||||
|
type = ValueType.Percentage;
|
||||||
|
minValue = 0;
|
||||||
|
maxValue = 100;
|
||||||
|
baseValue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary> 转换数据 </summary>
|
||||||
|
public ValueInstance To() {
|
||||||
|
ValueInstance instance = new ValueInstance(type, name);
|
||||||
|
instance.minValue = minValue;
|
||||||
|
instance.maxValue = maxValue;
|
||||||
|
instance.baseValue = baseValue;
|
||||||
|
instance.RecalculateValue();
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e49882beb2bb280438028a6a8a591abf
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数值修改器
|
||||||
|
/// </summary>
|
||||||
|
public class ValueModifier {
|
||||||
|
/// <summary> 固定值 </summary>
|
||||||
|
public float Fixed;
|
||||||
|
/// <summary> 附加值 </summary>
|
||||||
|
public float Added;
|
||||||
|
|
||||||
|
/// <summary> 固定值 </summary>
|
||||||
|
public virtual float FixedValue => Fixed;
|
||||||
|
/// <summary> 附加值% </summary>
|
||||||
|
public virtual float AddedValue => Added;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cdb2930b691f3b64aa6e28c7df2ea724
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 数值类型
|
||||||
|
/// </summary>
|
||||||
|
public enum ValueType {
|
||||||
|
/// <summary> 浮点数值 </summary>
|
||||||
|
Float,
|
||||||
|
/// <summary> 整数值 </summary>
|
||||||
|
Integer,
|
||||||
|
/// <summary> 布尔值 </summary>
|
||||||
|
Boolean,
|
||||||
|
/// <summary> 百分比值 </summary>
|
||||||
|
Percentage
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a8d90ca942106514a85e67acff5554fb
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bcf9cf309997ead4ea86a7617626bc49
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d560b7218fed79044ae7cff9ef0bc1d8
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
.value-preview {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value-hide {
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 41806459e36ec82419ba1fabd9b53230
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
disableValidation: 0
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
|
||||||
|
<ui:Template name="ValueTemplate" src="project://database/Assets/ModuleCore/ModuleValue/UI%20Toolkit/ValueContainerConst/ValueTemplate.uxml?fileID=9197481963319205126&guid=d53f6d483079a3048aa12c1433cd3748&type=3#ValueTemplate" />
|
||||||
|
<Style src="project://database/Assets/ModuleCore/ModuleValue/UI%20Toolkit/ValueContainerConst/ValueContainerConst.uss?fileID=7433441132597879392&guid=41806459e36ec82419ba1fabd9b53230&type=3#ValueContainerConst" />
|
||||||
|
<ui:VisualElement name="ValueList" style="flex-grow: 0;">
|
||||||
|
<ui:Instance template="ValueTemplate" name="ValueTemplate" />
|
||||||
|
<ui:Instance template="ValueTemplate" name="ValueTemplate" />
|
||||||
|
<ui:Instance template="ValueTemplate" name="ValueTemplate" />
|
||||||
|
</ui:VisualElement>
|
||||||
|
<ui:VisualElement name="ButtonGroup" style="flex-direction: row; justify-content: space-between;">
|
||||||
|
<ui:Button text="创建属性" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button1" />
|
||||||
|
<ui:Button text="删除全部属性" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button2" />
|
||||||
|
</ui:VisualElement>
|
||||||
|
</ui:UXML>
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e4dff0385b7d2cd46b08821071a517c7
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
|
||||||
|
<ui:VisualElement style="flex-direction: row; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0; background-color: rgb(51, 51, 51); margin-top: 1px; margin-right: 1px; margin-bottom: 1px; margin-left: 1px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px;">
|
||||||
|
<ui:TextField picking-mode="Ignore" value="filler text" keyboard-type="Default" name="Name" style="margin-top: 2px; margin-right: 2px; margin-bottom: 2px; margin-left: 2px; width: 100px;" />
|
||||||
|
<ui:EnumField type="UnityEngine.TextAlignment, UnityEngine.TextRenderingModule" value="Center" name="Type" style="margin-top: 2px; margin-right: 2px; margin-bottom: 2px; margin-left: 2px; width: 100px;" />
|
||||||
|
<ui:FloatField value="42.2" name="Base" style="flex-grow: 1; margin-top: 2px; margin-right: 2px; margin-bottom: 2px; margin-left: 2px;" />
|
||||||
|
<ui:Toggle name="Boolean" style="flex-grow: 1;" />
|
||||||
|
<ui:Label tabindex="-1" text="0-9999" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Range" style="width: 100px; -unity-text-align: middle-center; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;" />
|
||||||
|
</ui:VisualElement>
|
||||||
|
</ui:UXML>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d53f6d483079a3048aa12c1433cd3748
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7af2fa106b9ab74469c46d0f671b1ae9
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 4bc02877fa0b64145a2b6ec73a5e8670
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
|
disableValidation: 0
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
|
||||||
|
<Style src="project://database/Assets/ModuleCore/ModuleValue/UI%20Toolkit/ValueInstanceConst/ValueInstanceConst.uss?fileID=7433441132597879392&guid=4bc02877fa0b64145a2b6ec73a5e8670&type=3#ValueInstanceConst" />
|
||||||
|
<ui:TextField picking-mode="Ignore" label="数值名称" value="filler text" name="Name" />
|
||||||
|
<ui:EnumField label="数值类型" type="UnityEngine.TextAlignment, UnityEngine.TextRenderingModule" value="Center" name="Type" />
|
||||||
|
<ui:FloatField label="最小值" value="42.2" name="Min" />
|
||||||
|
<ui:FloatField label="最大值" value="42.2" name="Max" />
|
||||||
|
<ui:FloatField label="基础值" value="42.2" name="Base" />
|
||||||
|
<ui:Toggle name="Boolean" label="基础值" />
|
||||||
|
<ui:Button text="删除" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Delete" style="padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0;" />
|
||||||
|
</ui:UXML>
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 303114e9196fa664c9f9cabda3fb5a37
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user