重做物品系统
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 材料 - 物品常量
|
||||
/// </summary>
|
||||
[CreateAssetMenu(menuName = "MuHua/物品系统/材料")]
|
||||
public class ConstMaterial : InventoryItemConst {
|
||||
/// <summary> 最大堆叠数 </summary>
|
||||
public int maxStack = 99;
|
||||
|
||||
public override InventoryItem To() {
|
||||
DataMaterial item = new DataMaterial();
|
||||
item.name = name;
|
||||
item.sprite = sprite;
|
||||
item.maxStack = maxStack;
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,5 @@ public class EquipmentAffix {
|
||||
/// <summary> 最小值 </summary>
|
||||
public float maxValue = float.MaxValue;
|
||||
/// <summary> 属性类型 </summary>
|
||||
public AttributeType attributeType;
|
||||
public ValueType attributeType;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
/// <summary>
|
||||
/// 装备栏
|
||||
/// </summary>
|
||||
public class EquipmentColumn {
|
||||
/// <summary> 插槽字典 </summary>
|
||||
public Dictionary<string, EquipmentSlot> dictionary = new Dictionary<string, EquipmentSlot>();
|
||||
|
||||
/// <summary> 索引器 </summary>
|
||||
public EquipmentSlot this[string key] => dictionary[key];
|
||||
|
||||
public EquipmentColumn() {
|
||||
// AddSlot(WeaponSlot());
|
||||
// AddSlot(DeputySlot());
|
||||
|
||||
// AddSlot(ArmorSlot(EquipmentSlotType.上衣, ArmorType.上衣));
|
||||
// AddSlot(ArmorSlot(EquipmentSlotType.头盔, ArmorType.头盔));
|
||||
// AddSlot(ArmorSlot(EquipmentSlotType.手套, ArmorType.手套));
|
||||
// AddSlot(ArmorSlot(EquipmentSlotType.腰带, ArmorType.腰带));
|
||||
// AddSlot(ArmorSlot(EquipmentSlotType.鞋子, ArmorType.鞋子));
|
||||
|
||||
// AddSlot(AccessorySlot(EquipmentSlotType.项链, AccessoryType.项链));
|
||||
// AddSlot(AccessorySlot(EquipmentSlotType.戒指1, AccessoryType.戒指));
|
||||
// AddSlot(AccessorySlot(EquipmentSlotType.戒指2, AccessoryType.戒指));
|
||||
// AddSlot(AccessorySlot(EquipmentSlotType.手镯1, AccessoryType.手镯));
|
||||
// AddSlot(AccessorySlot(EquipmentSlotType.手镯2, AccessoryType.手镯));
|
||||
}
|
||||
|
||||
public bool ContainsKey(string key) => dictionary.ContainsKey(key);
|
||||
/// <summary> 添加插槽 </summary>
|
||||
public void AddSlot(EquipmentSlot slot) => dictionary.Add(slot.name, slot);
|
||||
|
||||
// /// <summary> 武器插槽 </summary>
|
||||
// public EquipmentSlot WeaponSlot() {
|
||||
// return new EquipmentSlot(EquipmentSlotType.主手, VerifyWeapon);
|
||||
// }
|
||||
// /// <summary> 副手插槽 </summary>
|
||||
// public EquipmentSlot DeputySlot() {
|
||||
// return new EquipmentSlot(EquipmentSlotType.副手, VerifyDeputy);
|
||||
// }
|
||||
// /// <summary> 护甲插槽 </summary>
|
||||
// public EquipmentSlot ArmorSlot(EquipmentSlotType type, ArmorType armor) {
|
||||
// return new EquipmentSlot(type, (equipment) => VerifyCommon(equipment, armor.ToString()));
|
||||
// }
|
||||
// /// <summary> 饰品插槽 </summary>
|
||||
// public EquipmentSlot AccessorySlot(EquipmentSlotType type, AccessoryType accessory) {
|
||||
// return new EquipmentSlot(type, (equipment) => VerifyCommon(equipment, accessory.ToString()));
|
||||
// }
|
||||
|
||||
/// <summary> 通用校验 </summary>
|
||||
// public static bool VerifyCommon(Equipment equipment, string type) {
|
||||
// string[] types = equipment.type.Split("/");
|
||||
// if (types[0] == type) { return true; }
|
||||
// return false;
|
||||
// }
|
||||
/// <summary> 主手校验 </summary>
|
||||
// public static bool VerifyWeapon(Equipment equipment) {
|
||||
// string[] type = equipment.type.Split("/");
|
||||
// if (type[0] == WeaponType.单手.ToString()) { return true; }
|
||||
// if (type[0] == WeaponType.双手.ToString()) { return true; }
|
||||
// return false;
|
||||
// }
|
||||
/// <summary> 副手校验 </summary>
|
||||
// public static bool VerifyDeputy(Equipment equipment) {
|
||||
// string[] type = equipment.type.Split("/");
|
||||
// if (type[0] == WeaponType.副手.ToString()) { return true; }
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5592cd11563474d42a1f6805b66f7a1f
|
||||
guid: 13afb37aea13dc94b97e8e85af77b5b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -10,11 +10,11 @@ public class AccessoryConst : EquipmentConst {
|
||||
/// <summary> 饰品类型 </summary>
|
||||
public AccessoryType type;
|
||||
|
||||
public override InventoryItem To() {
|
||||
Equipment item = new Equipment();
|
||||
item.name = name;
|
||||
item.sprite = sprite;
|
||||
item.type = type.ToString();
|
||||
return item;
|
||||
}
|
||||
// public override InventoryItem To() {
|
||||
// Equipment item = new Equipment();
|
||||
// item.name = name;
|
||||
// item.sprite = sprite;
|
||||
// item.type = type.ToString();
|
||||
// return item;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@ public class ArmorConst : EquipmentConst {
|
||||
/// <summary> 护甲类型 </summary>
|
||||
public ArmorType type;
|
||||
|
||||
public override InventoryItem To() {
|
||||
Equipment item = new Equipment();
|
||||
item.name = name;
|
||||
item.sprite = sprite;
|
||||
item.type = type.ToString();
|
||||
return item;
|
||||
}
|
||||
// public override InventoryItem To() {
|
||||
// Equipment item = new Equipment();
|
||||
// item.name = name;
|
||||
// item.sprite = sprite;
|
||||
// item.type = type.ToString();
|
||||
// return item;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -12,11 +12,11 @@ public class WeaponConst : EquipmentConst {
|
||||
/// <summary> 武器类型 </summary>
|
||||
public WeaponCategory category;
|
||||
|
||||
public override InventoryItem To() {
|
||||
Equipment item = new Equipment();
|
||||
item.name = name;
|
||||
item.sprite = sprite;
|
||||
item.type = $"{type}/{category}";
|
||||
return item;
|
||||
}
|
||||
// public override InventoryItem To() {
|
||||
// Equipment item = new Equipment();
|
||||
// item.name = name;
|
||||
// item.sprite = sprite;
|
||||
// item.type = $"{type}/{category}";
|
||||
// return item;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
font-size: 14px;
|
||||
-unity-font-style: bold;
|
||||
-unity-font: url("project://database/Assets/UI%20Toolkit/FontLibrary/Fonts/SourceHanSansCN-Medium.otf?fileID=12800000&guid=3ceb88ff2ced01a439c5b2d1b63c86a5&type=3#SourceHanSansCN-Medium");
|
||||
-unity-font-definition: url("project://database/Assets/UI%20Toolkit/FontLibrary/Fonts/SourceHanSansCN-Medium%20SDF.asset?fileID=11400000&guid=0239ab36009b94e479c9c67877764f1e&type=2#SourceHanSansCN-Medium SDF");
|
||||
-unity-font-definition: url('project://database/Assets/UI%20Toolkit/FontLibrary/Fonts/SourceHanSansCN-Medium%20SDF.asset?fileID=11400000&guid=0239ab36009b94e479c9c67877764f1e&type=2#SourceHanSansCN-Medium SDF');
|
||||
}
|
||||
|
||||
.ep-separate-label {
|
||||
@@ -24,6 +24,7 @@
|
||||
padding-left: 2px;
|
||||
font-size: 12px;
|
||||
-unity-font: url("project://database/Assets/UI%20Toolkit/FontLibrary/Fonts/SourceHanSansCN-Medium.otf?fileID=12800000&guid=3ceb88ff2ced01a439c5b2d1b63c86a5&type=3#SourceHanSansCN-Medium");
|
||||
-unity-font-definition: url("project://database/Assets/UI%20Toolkit/FontLibrary/Fonts/SourceHanSansCN-Medium%20SDF.asset?fileID=11400000&guid=0239ab36009b94e479c9c67877764f1e&type=2#SourceHanSansCN-Medium SDF");
|
||||
-unity-font-definition: url('project://database/Assets/UI%20Toolkit/FontLibrary/Fonts/SourceHanSansCN-Medium%20SDF.asset?fileID=11400000&guid=0239ab36009b94e479c9c67877764f1e&type=2#SourceHanSansCN-Medium SDF');
|
||||
-unity-font-style: normal;
|
||||
-unity-background-image-tint-color: rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user