1
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
namespace MuHuaEditor {
|
||||
/// <summary>
|
||||
/// 装备 - 编辑窗口
|
||||
/// </summary>
|
||||
public class EquipmentWindow : ModuleUIEditorWindow {
|
||||
|
||||
public VisualTreeAsset ButtonTemplate = default;
|
||||
|
||||
private EquipmentType currentEquipmentType;
|
||||
private UIEquipmentEnum<EquipmentType> equipmentType;
|
||||
private UIEquipmentEnum<WeaponType> weaponType;
|
||||
private UIEquipmentEnum<ArmorType> armorType;
|
||||
private UIEquipmentEnum<AccessoryType> accessoryType;
|
||||
private UIEquipmentList equipmentList;
|
||||
|
||||
public VisualElement VEEquipmentType => Q<VisualElement>("EquipmentType");
|
||||
public VisualElement VEEquipmentExtendType => Q<VisualElement>("EquipmentExtendType");
|
||||
public VisualElement EquipmentList => Q<VisualElement>("EquipmentList");
|
||||
|
||||
[MenuItem("Window/UI Toolkit/EquipmentWindow")]
|
||||
public static void ShowWindow() {
|
||||
EquipmentWindow wnd = GetWindow<EquipmentWindow>();
|
||||
wnd.titleContent = new GUIContent("EquipmentWindow");
|
||||
}
|
||||
|
||||
public override void Initial() {
|
||||
equipmentType = new UIEquipmentEnum<EquipmentType>(VEEquipmentType, ButtonTemplate, SettingsEquipmentType);
|
||||
weaponType = new UIEquipmentEnum<WeaponType>(VEEquipmentExtendType, ButtonTemplate, (value) => SettingsEquipmentType(value.ToString()));
|
||||
armorType = new UIEquipmentEnum<ArmorType>(VEEquipmentExtendType, ButtonTemplate, (value) => SettingsEquipmentType(value.ToString()));
|
||||
accessoryType = new UIEquipmentEnum<AccessoryType>(VEEquipmentExtendType, ButtonTemplate, (value) => SettingsEquipmentType(value.ToString()));
|
||||
equipmentList = new UIEquipmentList(EquipmentList, rootVisualElement, ButtonTemplate, (value) => Debug.Log(value));
|
||||
AddControl(equipmentList);
|
||||
|
||||
equipmentType.Initial();
|
||||
}
|
||||
public override void OnDestroy() {
|
||||
base.OnDestroy();
|
||||
equipmentType.Release();
|
||||
weaponType.Release();
|
||||
armorType.Release();
|
||||
accessoryType.Release();
|
||||
}
|
||||
|
||||
/// <summary> 设置装备类型 </summary>
|
||||
private void SettingsEquipmentType(EquipmentType type) {
|
||||
currentEquipmentType = type;
|
||||
if (type == EquipmentType.武器) { weaponType.Initial(); }
|
||||
if (type == EquipmentType.护甲) { armorType.Initial(); }
|
||||
if (type == EquipmentType.饰品) { accessoryType.Initial(); }
|
||||
}
|
||||
/// <summary> 设置装备类型 </summary>
|
||||
private void SettingsEquipmentType(string type) {
|
||||
string path = $"Assets/AssetsEquipment/ScriptableObject/{currentEquipmentType}/{type}";
|
||||
EnsureDirectoryExists(path);
|
||||
List<EquipmentConst> equipments = FindConstAssets<EquipmentConst>(path);
|
||||
equipmentList.Initial(equipments);
|
||||
}
|
||||
|
||||
#region 编辑器工具
|
||||
/// <summary> 查找指定文件夹下的所有 T 类型的 ScriptableObject 资源 </summary>
|
||||
public static List<T> FindConstAssets<T>(string folderPath) where T : ScriptableObject {
|
||||
List<T> result = new List<T>();
|
||||
string filter = $"t:{typeof(T).Name}";
|
||||
string[] guids = AssetDatabase.FindAssets(filter, new[] { folderPath });
|
||||
foreach (string guid in guids) {
|
||||
string assetPath = AssetDatabase.GUIDToAssetPath(guid);
|
||||
T asset = AssetDatabase.LoadAssetAtPath<T>(assetPath);
|
||||
if (asset != null) { result.Add(asset); }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/// <summary> 确保目录存在 </summary>
|
||||
public static void EnsureDirectoryExists(string path) {
|
||||
if (!Directory.Exists(path)) { Directory.CreateDirectory(path); }
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void CreateConstWeapon() {
|
||||
// 创建一个新的 ConstWeapon 资源
|
||||
var asset = ScriptableObject.CreateInstance<WeaponConst>();
|
||||
string path = EditorUtility.SaveFilePanelInProject(
|
||||
"保存 ConstWeapon",
|
||||
"NewConstWeapon.asset",
|
||||
"asset",
|
||||
"请选择保存 ConstWeapon 的路径"
|
||||
);
|
||||
if (!string.IsNullOrEmpty(path)) {
|
||||
AssetDatabase.CreateAsset(asset, path);
|
||||
AssetDatabase.SaveAssets();
|
||||
EditorUtility.FocusProjectWindow();
|
||||
Selection.activeObject = asset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec99af1e55d08254f8089eba7fa65bcd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- m_ViewDataDictionary: {instanceID: 0}
|
||||
- VisualTreeAsset: {fileID: 9197481963319205126, guid: 866ca35095f42154d97c957787b91a83, type: 3}
|
||||
- ButtonTemplate: {fileID: 9197481963319205126, guid: 72d39f3bc55f0a94196e83e8bfea1857, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce2626e82921eb14992661fc763dc7b5
|
||||
guid: fe6d086cc2b6beb4e8d9dfe9339270f5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
namespace MuHuaEditor {
|
||||
/// <summary>
|
||||
/// 装备枚举
|
||||
/// </summary>
|
||||
public class UIEquipmentEnum<T> : ModuleUIPanel where T : Enum {
|
||||
|
||||
public Action<T> callback;
|
||||
public ModuleUIItems<UIItem, T> items;
|
||||
|
||||
public UIEquipmentEnum(VisualElement element, VisualTreeAsset templateAsset, Action<T> callback) : base(element) {
|
||||
this.callback = callback;
|
||||
items = new ModuleUIItems<UIItem, T>(element, templateAsset,
|
||||
(data, element) => new UIItem(data, element, this));
|
||||
}
|
||||
/// <summary> 释放资源 </summary>
|
||||
public void Release() => items.Release();
|
||||
|
||||
/// <summary> 初始化 </summary>
|
||||
public void Initial() {
|
||||
items.Create(EnumToList());
|
||||
items.SelectFirst();
|
||||
}
|
||||
/// <summary> 设置值 </summary>
|
||||
public void Settings(T value) => callback?.Invoke(value);
|
||||
|
||||
private List<T> EnumToList() {
|
||||
var list = new List<T>();
|
||||
foreach (var name in Enum.GetValues(typeof(T))) { list.Add((T)name); }
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary> UI项 </summary>
|
||||
public class UIItem : ModuleUIItem<T> {
|
||||
public readonly UIEquipmentEnum<T> parent;
|
||||
|
||||
public Button Button => Q<Button>("Button");
|
||||
|
||||
public UIItem(T value, VisualElement element, UIEquipmentEnum<T> parent) : base(value, element) {
|
||||
this.parent = parent;
|
||||
Button.text = value.ToString();
|
||||
Button.clicked += Select;
|
||||
}
|
||||
public override void DefaultState() {
|
||||
Button.EnableInClassList("button-s", false);
|
||||
}
|
||||
public override void SelectState() {
|
||||
parent.Settings(value);
|
||||
Button.EnableInClassList("button-s", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bad4c66685a426345b174ec593f67f56
|
||||
guid: 1a27a9357cd2dfb46b03783e745821ff
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
namespace MuHuaEditor {
|
||||
/// <summary>
|
||||
/// 装备 - UI列表
|
||||
/// </summary>
|
||||
public class UIEquipmentList : ModuleUIPanel, UIControl {
|
||||
|
||||
public Action<EquipmentConst> callback;
|
||||
public UIScrollViewListV<UIItem, EquipmentConst> items;
|
||||
|
||||
public VisualElement ScrollView => Q<VisualElement>("ScrollView");
|
||||
|
||||
public UIEquipmentList(VisualElement element, VisualElement canvas, VisualTreeAsset templateAsset, Action<EquipmentConst> callback) : base(element) {
|
||||
this.callback = callback;
|
||||
items = new UIScrollViewListV<UIItem, EquipmentConst>(ScrollView, canvas, templateAsset,
|
||||
(data, element) => new UIItem(data, element, this));
|
||||
}
|
||||
|
||||
public void Update() => items.Update();
|
||||
|
||||
public void Dispose() => items.Dispose();
|
||||
|
||||
/// <summary> 初始化 </summary>
|
||||
public void Initial(List<EquipmentConst> equipments) {
|
||||
items.Create(equipments);
|
||||
items.SelectFirst();
|
||||
}
|
||||
|
||||
/// <summary> 设置值 </summary>
|
||||
public void Settings(EquipmentConst value) => callback?.Invoke(value);
|
||||
|
||||
/// <summary> UI项 </summary>
|
||||
public class UIItem : ModuleUIItem<EquipmentConst> {
|
||||
public readonly UIEquipmentList parent;
|
||||
|
||||
public Button Button => Q<Button>("Button");
|
||||
|
||||
public UIItem(EquipmentConst value, VisualElement element, UIEquipmentList parent) : base(value, element) {
|
||||
this.parent = parent;
|
||||
Button.text = value.name;
|
||||
Button.clicked += Select;
|
||||
}
|
||||
public override void DefaultState() {
|
||||
Button.EnableInClassList("button-s", false);
|
||||
}
|
||||
public override void SelectState() {
|
||||
parent.Settings(value);
|
||||
Button.EnableInClassList("button-s", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99dc774aaeb03bc44b6607bd012c0e6e
|
||||
guid: ea8d2198def9909448f54d619cfc65aa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEditor;
|
||||
|
||||
namespace MuHuaEditor {
|
||||
/// <summary>
|
||||
/// 武器 - 自定义编辑器
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(WeaponConst))]
|
||||
public class WeaponConstEditor : Editor {
|
||||
public VisualTreeAsset ButtonTemplate;
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// UI装备栏
|
||||
/// </summary>
|
||||
public class UIEquipmentColumn : ModuleUIPanel {
|
||||
|
||||
public EquipmentColumn equipment;
|
||||
/// <summary> 插槽字典 </summary>
|
||||
public Dictionary<string, UIEquipmentSlot> dictionary = new Dictionary<string, UIEquipmentSlot>();
|
||||
|
||||
public UIEquipmentColumn(VisualElement element) : base(element) {
|
||||
InitialSlot(1, EquipmentSlotType.主手);
|
||||
InitialSlot(2, EquipmentSlotType.副手);
|
||||
InitialSlot(3, EquipmentSlotType.上衣);
|
||||
InitialSlot(4, EquipmentSlotType.项链);
|
||||
|
||||
InitialSlot(5, EquipmentSlotType.戒指1);
|
||||
InitialSlot(6, EquipmentSlotType.戒指2);
|
||||
InitialSlot(7, EquipmentSlotType.手镯1);
|
||||
InitialSlot(8, EquipmentSlotType.手镯2);
|
||||
|
||||
InitialSlot(9, EquipmentSlotType.头盔);
|
||||
InitialSlot(10, EquipmentSlotType.手套);
|
||||
InitialSlot(11, EquipmentSlotType.腰带);
|
||||
InitialSlot(12, EquipmentSlotType.鞋子);
|
||||
}
|
||||
public void Dispose() {
|
||||
|
||||
}
|
||||
|
||||
public void Settings(EquipmentColumn equipment) {
|
||||
if (this.equipment != null) { Dispose(); }
|
||||
this.equipment = equipment;
|
||||
if (equipment == null) { return; }
|
||||
foreach (var item in dictionary) { Settings(item.Key, item.Value); }
|
||||
}
|
||||
public void Settings(string key, UIEquipmentSlot uISlot) {
|
||||
if (!equipment.ContainsKey(key)) { return; }
|
||||
EquipmentSlot slot = equipment[key];
|
||||
uISlot.Settings(slot);
|
||||
}
|
||||
|
||||
private void InitialSlot(int index, EquipmentSlotType type) {
|
||||
VisualElement element = Q<VisualElement>($"EquipmentSlot{index}");
|
||||
UIEquipmentSlot uiSlot = new UIEquipmentSlot(element);
|
||||
dictionary.Add(type.ToString(), uiSlot);
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// UI装备插槽
|
||||
/// </summary>
|
||||
public class UIEquipmentSlot : ModuleUIPanel, InventoryDrag {
|
||||
|
||||
public EquipmentSlot value;
|
||||
|
||||
public Label CountLabel => Q<Label>("Count");
|
||||
public VisualElement Image => Q<VisualElement>("Image");
|
||||
|
||||
public int Count => 1;
|
||||
public InventoryItem Item => value.item;
|
||||
public VisualElement Anchor => element;
|
||||
|
||||
public UIEquipmentSlot(VisualElement element) : base(element) {
|
||||
element.RegisterCallback<MouseDownEvent>(MouseDownEvent);
|
||||
element.RegisterCallback<MouseOverEvent>(MouseOverEvent);
|
||||
element.RegisterCallback<MouseLeaveEvent>(MouseLeaveEvent);
|
||||
element.RegisterCallback<ClickEvent>(ClickEvent);
|
||||
}
|
||||
private void MouseDownEvent(MouseDownEvent evt) {
|
||||
UIPopupManager.I.inventoryDrag.Settings(this);
|
||||
Image.EnableInClassList("equipment-image-drag", true);
|
||||
}
|
||||
private void MouseOverEvent(MouseOverEvent evt) {
|
||||
if (!Verify()) { return; }
|
||||
UIPopupManager.I.inventoryDrag.EnterContainer(this);
|
||||
}
|
||||
private void MouseLeaveEvent(MouseLeaveEvent evt) {
|
||||
UIPopupManager.I.inventoryDrag.ExitContainer(this);
|
||||
}
|
||||
private void ClickEvent(ClickEvent evt) {
|
||||
// Debug.Log("sss");
|
||||
}
|
||||
|
||||
public void Settings(EquipmentSlot value) {
|
||||
this.value = value;
|
||||
UpdatePreview();
|
||||
}
|
||||
public void Settings(InventoryItem item, int count) {
|
||||
value.Settings(item);
|
||||
UpdatePreview();
|
||||
}
|
||||
public void Cancel() {
|
||||
Image.EnableInClassList("equipment-image-drag", false);
|
||||
}
|
||||
|
||||
private void UpdatePreview() {
|
||||
Sprite sprite = value == null || value.item == null ? null : value.item.sprite;
|
||||
Image.style.backgroundImage = new StyleBackground(sprite);
|
||||
}
|
||||
private bool Verify() {
|
||||
InventoryDrag container = UIPopupManager.I.inventoryDrag.container;
|
||||
if (container == null) { return false; }
|
||||
if (container.Item is Equipment equipment) { return value.verify.Invoke(equipment); }
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
/// <summary>
|
||||
/// 装备提示
|
||||
/// </summary>
|
||||
public class UIEquipmentTip : ModuleUIPanel {
|
||||
public UIEquipmentTip(VisualElement element) : base(element) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 191c3d543ef38514a8845f693eb75de3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1eaf517ccfb649341aa59df1d7d437c2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 饰品类型
|
||||
/// </summary>
|
||||
public enum AccessoryType {
|
||||
项链 = 0,
|
||||
戒指 = 1,
|
||||
手镯 = 2
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d2e2ebf18434ab489d8a0918806f5af
|
||||
guid: 5bc9afb170700e64a902cc2b868b8b04
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 护甲类型
|
||||
/// </summary>
|
||||
public enum ArmorType {
|
||||
上衣 = 0,
|
||||
头盔 = 1,
|
||||
手套 = 2,
|
||||
腰带 = 3,
|
||||
鞋子 = 4
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3851fbd666690f247b52ab57af296c62
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 插槽类型
|
||||
/// </summary>
|
||||
public enum EquipmentSlotType {
|
||||
主手 = 0,
|
||||
副手 = 1,
|
||||
|
||||
上衣 = 10,
|
||||
头盔 = 11,
|
||||
手套 = 12,
|
||||
腰带 = 13,
|
||||
鞋子 = 14,
|
||||
|
||||
项链 = 20,
|
||||
戒指1 = 21,
|
||||
戒指2 = 22,
|
||||
手镯1 = 23,
|
||||
手镯2 = 24
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d79bc5d78a1f1124093253ca1cd314f2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 装备类型
|
||||
/// </summary>
|
||||
public enum EquipmentType {
|
||||
武器 = 0,
|
||||
护甲 = 1,
|
||||
饰品 = 2
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 505a2c6d7fed9924591dfcdccbe928c9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 武器类型
|
||||
/// </summary>
|
||||
public enum WeaponType {
|
||||
单手 = 0,
|
||||
副手 = 1,
|
||||
双手 = 2
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d1d95d68b876be4c9d6fb7d25113dee
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa01c7c9647ebd6468b17280d5065639
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1
-1
@@ -2,7 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ConstWeaponEditor : MonoBehaviour
|
||||
public class Accessory : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cfcaecd119af2f48adf5a4649d88360
|
||||
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;
|
||||
|
||||
public class Armor : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: de8ae08be418e3c48a7f938b6b842caa
|
||||
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;
|
||||
|
||||
public class Weapon : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fdef6696992dc94f977f5ca3a2cc528
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1
-7
@@ -2,17 +2,11 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 饰品类型
|
||||
/// </summary>
|
||||
public enum AccessoryType {
|
||||
戒指, 手镯, 项链
|
||||
}
|
||||
/// <summary>
|
||||
/// 饰品 - 物品常量
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "MuHua/物品系统/饰品")]
|
||||
public class ConstAccessory : ConstEquipment {
|
||||
public class AccessoryConst : EquipmentConst {
|
||||
/// <summary> 饰品类型 </summary>
|
||||
public AccessoryType type;
|
||||
|
||||
+2
-7
@@ -2,17 +2,12 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 护甲类型
|
||||
/// </summary>
|
||||
public enum ArmorType {
|
||||
上衣, 头盔, 手套, 腰带, 鞋子
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 护甲 - 物品常量
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "MuHua/物品系统/护甲")]
|
||||
public class ConstArmor : ConstEquipment {
|
||||
public class ArmorConst : EquipmentConst {
|
||||
/// <summary> 护甲类型 </summary>
|
||||
public ArmorType type;
|
||||
|
||||
+1
-1
@@ -5,6 +5,6 @@ using UnityEngine;
|
||||
/// <summary>
|
||||
/// 装备 - 物品常量
|
||||
/// </summary>
|
||||
public class ConstEquipment : ConstInventoryItem {
|
||||
public class EquipmentConst : InventoryItemConst {
|
||||
|
||||
}
|
||||
+2
-14
@@ -2,27 +2,15 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 武器类型
|
||||
/// </summary>
|
||||
public enum WeaponType {
|
||||
单手, 副手, 双手
|
||||
}
|
||||
/// <summary>
|
||||
/// 武器类别
|
||||
/// </summary>
|
||||
public enum WeaponCategory {
|
||||
剑, 刀, 枪, 弓, 法杖, 斧头, 锤子
|
||||
}
|
||||
/// <summary>
|
||||
/// 武器 - 物品常量
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "MuHua/物品系统/武器")]
|
||||
public class ConstWeapon : ConstEquipment {
|
||||
public class WeaponConst : EquipmentConst {
|
||||
/// <summary> 武器类型 </summary>
|
||||
public WeaponType type;
|
||||
/// <summary> 武器类别 </summary>
|
||||
public WeaponCategory category;
|
||||
public string category;
|
||||
|
||||
public override InventoryItem To() {
|
||||
Equipment item = new Equipment();
|
||||
-8
@@ -3,14 +3,6 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 插槽类型
|
||||
/// </summary>
|
||||
public enum EquipmentSlotType {
|
||||
主手, 副手, 上衣, 项链,
|
||||
头盔, 手套, 腰带, 鞋子,
|
||||
戒指1, 戒指2, 手镯1, 手镯2
|
||||
}
|
||||
/// <summary>
|
||||
/// 装备插槽
|
||||
/// </summary>
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36ee47234b03ee74bad8e42c24ee2c6c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bdc3f13083804594fbdda1c64d9ae51a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,4 @@
|
||||
.button-s {
|
||||
background-color: rgb(0, 164, 192);
|
||||
color: rgb(255, 255, 255);
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2543472de45605a4e8903f740d5db3af
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
@@ -0,0 +1,4 @@
|
||||
<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">
|
||||
<Style src="project://database/Assets/UI%20Toolkit/Component/Button/Button.uss?fileID=7433441132597879392&guid=2543472de45605a4e8903f740d5db3af&type=3#Button" />
|
||||
<ui:Button text="Button" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button" style="margin-top: 2px; margin-right: 2px; margin-bottom: 2px; margin-left: 2px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px;" />
|
||||
</ui:UXML>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72d39f3bc55f0a94196e83e8bfea1857
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a03ad2fda0780f0499f39870c8107b90
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,21 @@
|
||||
<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:Template name="Button1" src="project://database/Assets/UI%20Toolkit/Component/Button/Button1.uxml?fileID=9197481963319205126&guid=72d39f3bc55f0a94196e83e8bfea1857&type=3#Button1" />
|
||||
<Style src="project://database/Assets/UI%20Toolkit/EditorWindow/EquipmentWindow/EquipmentWindow.uss?fileID=7433441132597879392&guid=8bceec5d72cb41343aace6e8d7439e3b&type=3#EquipmentWindow" />
|
||||
<ui:VisualElement name="ScrollView" class="scrollview">
|
||||
<ui:VisualElement name="Viewport" class="scrollview-viewport" style="margin-right: 0; margin-bottom: 0; margin-top: 0; margin-left: 0;">
|
||||
<ui:VisualElement name="Container" class="scrollview-container" style="padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px;">
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ScrollerHorizontal" class="scroller-horizontal scrollview-horizontal-scroller" style="display: none;">
|
||||
<ui:VisualElement name="Dragger" class="scroller-horizontal-dragger scrollview-horizontal-scroller-dragger" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="ScrollerVertical" class="scroller-vertical scrollview-vertical-scroller" style="display: none;">
|
||||
<ui:VisualElement name="Dragger" class="scroller-vertical-dragger scrollview-vertical-scroller-dragger" />
|
||||
</ui:VisualElement>
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 723d660a1c7f9a148829ed36eacad3df
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
@@ -0,0 +1,3 @@
|
||||
<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:Button text="Button" parse-escape-sequences="true" display-tooltip-when-elided="true" style="padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; margin-top: 2px; margin-right: 2px; margin-bottom: 2px; margin-left: 2px;" />
|
||||
</ui:UXML>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40971501a755d8b4eab02d9deaf63499
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bceec5d72cb41343aace6e8d7439e3b
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
@@ -0,0 +1,32 @@
|
||||
<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:Template name="Button1" src="project://database/Assets/ModuleCore/ModuleEquipment/UI%20Toolkit/Button/ButtonTemplate.uxml?fileID=9197481963319205126&guid=72d39f3bc55f0a94196e83e8bfea1857&type=3#ButtonTemplate" />
|
||||
<ui:Template name="EquipmentList" src="project://database/Assets/ModuleCore/ModuleEquipment/UI%20Toolkit/EquipmentWindow/EquipmentList.uxml?fileID=9197481963319205126&guid=723d660a1c7f9a148829ed36eacad3df&type=3#EquipmentList" />
|
||||
<Style src="project://database/Assets/ModuleCore/ModuleEquipment/UI%20Toolkit/EquipmentWindow/EquipmentWindow.uss?fileID=7433441132597879392&guid=8bceec5d72cb41343aace6e8d7439e3b&type=3#EquipmentWindow" />
|
||||
<ui:VisualElement name="EquipmentType" style="flex-direction: row; padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px;">
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement style="height: 2px; background-color: rgb(38, 38, 38);" />
|
||||
<ui:VisualElement name="EquipmentExtendType" style="flex-direction: row; padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px;">
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
<ui:Instance template="Button1" name="Button1" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement style="height: 2px; background-color: rgb(38, 38, 38);" />
|
||||
<ui:VisualElement name="FunctionPanel" style="flex-grow: 1; flex-direction: row;">
|
||||
<ui:Instance template="EquipmentList" name="EquipmentList" style="width: 100px;" />
|
||||
<ui:VisualElement style="background-color: rgb(38, 38, 38); width: 2px;" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement style="height: 2px; background-color: rgb(38, 38, 38);" />
|
||||
<ui:VisualElement name="ButtonGroup" style="flex-direction: row;">
|
||||
<ui:Button text="创建" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button1" style="margin-top: 2px; margin-right: 2px; margin-bottom: 2px; margin-left: 2px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; width: 96px;" />
|
||||
<ui:Button text="创建(随机)" parse-escape-sequences="true" display-tooltip-when-elided="true" name="Button2" style="margin-top: 2px; margin-right: 2px; margin-bottom: 2px; margin-left: 2px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; width: 96px;" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 866ca35095f42154d97c957787b91a83
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
Reference in New Issue
Block a user