Phase2.1 添加武器tag配置和数据表定义
This commit is contained in:
@@ -24,7 +24,7 @@ namespace SepCore.Entity
|
||||
|
||||
public DamageType DamageType => Config.DamageType;
|
||||
|
||||
public string Title => Config.WeaponType.ToString();
|
||||
public string Title => Config.WeaponName;
|
||||
|
||||
public string Sprite => Config.Sprite;
|
||||
|
||||
|
||||
@@ -18,9 +18,7 @@ public sealed partial class GoodsConfig : Luban.BeanBase
|
||||
{
|
||||
Id = _buf.ReadInt();
|
||||
GoodsType = (GoodsType)_buf.ReadInt();
|
||||
PropId = _buf.ReadInt();
|
||||
PropId_Ref = null;
|
||||
WeaponType = (WeaponType)_buf.ReadInt();
|
||||
RefId = _buf.ReadInt();
|
||||
}
|
||||
|
||||
public static GoodsConfig DeserializeGoodsConfig(ByteBuf _buf)
|
||||
@@ -37,14 +35,9 @@ public sealed partial class GoodsConfig : Luban.BeanBase
|
||||
/// </summary>
|
||||
public readonly GoodsType GoodsType;
|
||||
/// <summary>
|
||||
/// 道具商品Id
|
||||
/// 引用Id
|
||||
/// </summary>
|
||||
public readonly int PropId;
|
||||
public PropConfig PropId_Ref;
|
||||
/// <summary>
|
||||
/// 武器商品类型
|
||||
/// </summary>
|
||||
public readonly WeaponType WeaponType;
|
||||
public readonly int RefId;
|
||||
|
||||
public const int __ID__ = 1358452248;
|
||||
public override int GetTypeId() => __ID__;
|
||||
@@ -53,7 +46,6 @@ public sealed partial class GoodsConfig : Luban.BeanBase
|
||||
{
|
||||
|
||||
|
||||
PropId_Ref = tables.TbPropConfig.GetOrDefault(PropId);
|
||||
|
||||
}
|
||||
|
||||
@@ -62,8 +54,7 @@ public sealed partial class GoodsConfig : Luban.BeanBase
|
||||
return "{ "
|
||||
+ "id:" + Id + ","
|
||||
+ "goodsType:" + GoodsType + ","
|
||||
+ "propId:" + PropId + ","
|
||||
+ "weaponType:" + WeaponType + ","
|
||||
+ "refId:" + RefId + ","
|
||||
+ "}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ public sealed partial class LevelDropConfig : Luban.BeanBase
|
||||
{
|
||||
Id = _buf.ReadInt();
|
||||
WhiteWeight = _buf.ReadFloat();
|
||||
GreenWeight = _buf.ReadFloat();
|
||||
BlueWeight = _buf.ReadFloat();
|
||||
PurpleWeight = _buf.ReadFloat();
|
||||
RedWeight = _buf.ReadFloat();
|
||||
@@ -38,10 +37,6 @@ public sealed partial class LevelDropConfig : Luban.BeanBase
|
||||
/// </summary>
|
||||
public readonly float WhiteWeight;
|
||||
/// <summary>
|
||||
/// 绿色掉落率
|
||||
/// </summary>
|
||||
public readonly float GreenWeight;
|
||||
/// <summary>
|
||||
/// 蓝色掉落率
|
||||
/// </summary>
|
||||
public readonly float BlueWeight;
|
||||
@@ -64,7 +59,6 @@ public sealed partial class LevelDropConfig : Luban.BeanBase
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@@ -72,7 +66,6 @@ public sealed partial class LevelDropConfig : Luban.BeanBase
|
||||
return "{ "
|
||||
+ "Id:" + Id + ","
|
||||
+ "WhiteWeight:" + WhiteWeight + ","
|
||||
+ "GreenWeight:" + GreenWeight + ","
|
||||
+ "BlueWeight:" + BlueWeight + ","
|
||||
+ "PurpleWeight:" + PurpleWeight + ","
|
||||
+ "RedWeight:" + RedWeight + ","
|
||||
|
||||
@@ -25,21 +25,17 @@ namespace SepCore.Definition
|
||||
/// </summary>
|
||||
White = 1,
|
||||
/// <summary>
|
||||
/// 绿
|
||||
/// </summary>
|
||||
Green = 2,
|
||||
/// <summary>
|
||||
/// 蓝
|
||||
/// </summary>
|
||||
Blue = 3,
|
||||
Blue = 2,
|
||||
/// <summary>
|
||||
/// 紫
|
||||
/// </summary>
|
||||
Purple = 4,
|
||||
Purple = 3,
|
||||
/// <summary>
|
||||
/// 红
|
||||
/// </summary>
|
||||
Red = 5,
|
||||
Red = 4,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ public partial class Tables
|
||||
/// 角色属性配置
|
||||
/// </summary>
|
||||
public TbStatConfig TbStatConfig {get; }
|
||||
public TbWeaponTagConfig TbWeaponTagConfig {get; }
|
||||
|
||||
public Tables(System.Func<string, ByteBuf> loader)
|
||||
{
|
||||
@@ -87,6 +88,7 @@ public partial class Tables
|
||||
TbUISoundConfig = new TbUISoundConfig(loader("tbuisoundconfig"));
|
||||
TbWeaponConfig = new TbWeaponConfig(loader("tbweaponconfig"));
|
||||
TbStatConfig = new TbStatConfig(loader("tbstatconfig"));
|
||||
TbWeaponTagConfig = new TbWeaponTagConfig(loader("tbweapontagconfig"));
|
||||
ResolveRef();
|
||||
}
|
||||
|
||||
@@ -111,6 +113,7 @@ public partial class Tables
|
||||
TbUISoundConfig.ResolveRef(this);
|
||||
TbWeaponConfig.ResolveRef(this);
|
||||
TbStatConfig.ResolveRef(this);
|
||||
TbWeaponTagConfig.ResolveRef(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ namespace SepCore.Definition
|
||||
/// </summary>
|
||||
public partial class TbWeaponConfig
|
||||
{
|
||||
private readonly System.Collections.Generic.Dictionary<WeaponType, WeaponConfig> _dataMap;
|
||||
private readonly System.Collections.Generic.Dictionary<int, WeaponConfig> _dataMap;
|
||||
private readonly System.Collections.Generic.List<WeaponConfig> _dataList;
|
||||
|
||||
public TbWeaponConfig(ByteBuf _buf)
|
||||
{
|
||||
_dataMap = new System.Collections.Generic.Dictionary<WeaponType, WeaponConfig>();
|
||||
_dataMap = new System.Collections.Generic.Dictionary<int, WeaponConfig>();
|
||||
_dataList = new System.Collections.Generic.List<WeaponConfig>();
|
||||
|
||||
for(int n = _buf.ReadSize() ; n > 0 ; --n)
|
||||
@@ -30,16 +30,16 @@ public partial class TbWeaponConfig
|
||||
WeaponConfig _v;
|
||||
_v = WeaponConfig.DeserializeWeaponConfig(_buf);
|
||||
_dataList.Add(_v);
|
||||
_dataMap.Add(_v.WeaponType, _v);
|
||||
_dataMap.Add(_v.Id, _v);
|
||||
}
|
||||
}
|
||||
|
||||
public System.Collections.Generic.Dictionary<WeaponType, WeaponConfig> DataMap => _dataMap;
|
||||
public System.Collections.Generic.Dictionary<int, WeaponConfig> DataMap => _dataMap;
|
||||
public System.Collections.Generic.List<WeaponConfig> DataList => _dataList;
|
||||
|
||||
public WeaponConfig GetOrDefault(WeaponType key) => _dataMap.TryGetValue(key, out var v) ? v : null;
|
||||
public WeaponConfig Get(WeaponType key) => _dataMap[key];
|
||||
public WeaponConfig this[WeaponType key] => _dataMap[key];
|
||||
public WeaponConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
|
||||
public WeaponConfig Get(int key) => _dataMap[key];
|
||||
public WeaponConfig this[int key] => _dataMap[key];
|
||||
|
||||
public void ResolveRef(Tables tables)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using Luban;
|
||||
|
||||
|
||||
namespace SepCore.Definition
|
||||
{
|
||||
public partial class TbWeaponTagConfig
|
||||
{
|
||||
private readonly System.Collections.Generic.Dictionary<int, WeaponTagConfig> _dataMap;
|
||||
private readonly System.Collections.Generic.List<WeaponTagConfig> _dataList;
|
||||
|
||||
public TbWeaponTagConfig(ByteBuf _buf)
|
||||
{
|
||||
_dataMap = new System.Collections.Generic.Dictionary<int, WeaponTagConfig>();
|
||||
_dataList = new System.Collections.Generic.List<WeaponTagConfig>();
|
||||
|
||||
for(int n = _buf.ReadSize() ; n > 0 ; --n)
|
||||
{
|
||||
WeaponTagConfig _v;
|
||||
_v = WeaponTagConfig.DeserializeWeaponTagConfig(_buf);
|
||||
_dataList.Add(_v);
|
||||
_dataMap.Add(_v.Id, _v);
|
||||
}
|
||||
}
|
||||
|
||||
public System.Collections.Generic.Dictionary<int, WeaponTagConfig> DataMap => _dataMap;
|
||||
public System.Collections.Generic.List<WeaponTagConfig> DataList => _dataList;
|
||||
|
||||
public WeaponTagConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
|
||||
public WeaponTagConfig Get(int key) => _dataMap[key];
|
||||
public WeaponTagConfig this[int key] => _dataMap[key];
|
||||
|
||||
public void ResolveRef(Tables tables)
|
||||
{
|
||||
foreach(var _v in _dataList)
|
||||
{
|
||||
_v.ResolveRef(tables);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2628c2be656a6c348a98ca6e01db6dde
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -16,8 +16,13 @@ public sealed partial class WeaponConfig : Luban.BeanBase
|
||||
{
|
||||
public WeaponConfig(ByteBuf _buf)
|
||||
{
|
||||
Id = _buf.ReadInt();
|
||||
WeaponType = (WeaponType)_buf.ReadInt();
|
||||
WeaponName = _buf.ReadString();
|
||||
{int n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);Tags = new System.Collections.Generic.List<WeaponTag>(n0);for(var i0 = 0 ; i0 < n0 ; i0++) { WeaponTag _e0; _e0 = (WeaponTag)_buf.ReadInt(); Tags.Add(_e0);}}
|
||||
LogicType = _buf.ReadString();
|
||||
ScalingStat = (StatType)_buf.ReadInt();
|
||||
ScalingRatio = _buf.ReadFloat();
|
||||
Rarity = (Rarity)_buf.ReadInt();
|
||||
Price = _buf.ReadInt();
|
||||
Attack = _buf.ReadInt();
|
||||
@@ -38,15 +43,35 @@ public sealed partial class WeaponConfig : Luban.BeanBase
|
||||
return new WeaponConfig(_buf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 武器编号
|
||||
/// </summary>
|
||||
public readonly int Id;
|
||||
/// <summary>
|
||||
/// 武器类型
|
||||
/// </summary>
|
||||
public readonly WeaponType WeaponType;
|
||||
/// <summary>
|
||||
/// 武器名
|
||||
/// </summary>
|
||||
public readonly string WeaponName;
|
||||
/// <summary>
|
||||
/// 武器标签列表
|
||||
/// </summary>
|
||||
public readonly System.Collections.Generic.List<WeaponTag> Tags;
|
||||
/// <summary>
|
||||
/// 逻辑类型
|
||||
/// </summary>
|
||||
public readonly string LogicType;
|
||||
/// <summary>
|
||||
/// 加成主属性
|
||||
/// </summary>
|
||||
public readonly StatType ScalingStat;
|
||||
/// <summary>
|
||||
/// 主属性加成系数
|
||||
/// </summary>
|
||||
public readonly float ScalingRatio;
|
||||
/// <summary>
|
||||
/// 道具品质
|
||||
/// </summary>
|
||||
public readonly Rarity Rarity;
|
||||
@@ -105,6 +130,11 @@ public sealed partial class WeaponConfig : Luban.BeanBase
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (var _e in StatModifierConfigs) { _e?.ResolveRef(tables); }
|
||||
Prefab_Ref = tables.TbEntityConfig.GetOrDefault(Prefab);
|
||||
Sprite_Ref = tables.TbSpriteConfig.GetOrDefault(Sprite);
|
||||
@@ -113,8 +143,13 @@ public sealed partial class WeaponConfig : Luban.BeanBase
|
||||
public override string ToString()
|
||||
{
|
||||
return "{ "
|
||||
+ "id:" + Id + ","
|
||||
+ "weaponType:" + WeaponType + ","
|
||||
+ "weaponName:" + WeaponName + ","
|
||||
+ "tags:" + Luban.StringUtil.CollectionToString(Tags) + ","
|
||||
+ "logicType:" + LogicType + ","
|
||||
+ "scalingStat:" + ScalingStat + ","
|
||||
+ "scalingRatio:" + ScalingRatio + ","
|
||||
+ "rarity:" + Rarity + ","
|
||||
+ "price:" + Price + ","
|
||||
+ "attack:" + Attack + ","
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
namespace SepCore.Definition
|
||||
{
|
||||
/// <summary>
|
||||
/// 武器tag
|
||||
/// </summary>
|
||||
public enum WeaponTag : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// 无
|
||||
/// </summary>
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// 刀剑
|
||||
/// </summary>
|
||||
Blade = 1,
|
||||
/// <summary>
|
||||
/// 精准
|
||||
/// </summary>
|
||||
Precise = 2,
|
||||
/// <summary>
|
||||
/// 枪械
|
||||
/// </summary>
|
||||
Gun = 3,
|
||||
/// <summary>
|
||||
/// 工程
|
||||
/// </summary>
|
||||
Engineering = 4,
|
||||
/// <summary>
|
||||
/// 钝器
|
||||
/// </summary>
|
||||
Blunt = 5,
|
||||
/// <summary>
|
||||
/// 原始
|
||||
/// </summary>
|
||||
Primitive = 6,
|
||||
/// <summary>
|
||||
/// 元素
|
||||
/// </summary>
|
||||
Elemental = 7,
|
||||
/// <summary>
|
||||
/// 徒手
|
||||
/// </summary>
|
||||
Unarmed = 8,
|
||||
/// <summary>
|
||||
/// 医疗
|
||||
/// </summary>
|
||||
Medical = 9,
|
||||
/// <summary>
|
||||
/// 重型
|
||||
/// </summary>
|
||||
Heavy = 10,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 67a3eb7a61baa114c936b306b55c6b7a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using Luban;
|
||||
|
||||
|
||||
namespace SepCore.Definition
|
||||
{
|
||||
public sealed partial class WeaponTagConfig : Luban.BeanBase
|
||||
{
|
||||
public WeaponTagConfig(ByteBuf _buf)
|
||||
{
|
||||
Id = _buf.ReadInt();
|
||||
Tag = (WeaponTag)_buf.ReadInt();
|
||||
RequiredCount = _buf.ReadInt();
|
||||
{int n0 = System.Math.Min(_buf.ReadSize(), _buf.Size);StatModifierConfigs = new System.Collections.Generic.List<StatModifierConfig>(n0);for(var i0 = 0 ; i0 < n0 ; i0++) { StatModifierConfig _e0; _e0 = StatModifierConfig.DeserializeStatModifierConfig(_buf); StatModifierConfigs.Add(_e0);}}
|
||||
}
|
||||
|
||||
public static WeaponTagConfig DeserializeWeaponTagConfig(ByteBuf _buf)
|
||||
{
|
||||
return new WeaponTagConfig(_buf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 效果编号
|
||||
/// </summary>
|
||||
public readonly int Id;
|
||||
/// <summary>
|
||||
/// 标签
|
||||
/// </summary>
|
||||
public readonly WeaponTag Tag;
|
||||
/// <summary>
|
||||
/// 触发所需条件数
|
||||
/// </summary>
|
||||
public readonly int RequiredCount;
|
||||
public readonly System.Collections.Generic.List<StatModifierConfig> StatModifierConfigs;
|
||||
|
||||
public const int __ID__ = -1372305248;
|
||||
public override int GetTypeId() => __ID__;
|
||||
|
||||
public void ResolveRef(Tables tables)
|
||||
{
|
||||
|
||||
|
||||
|
||||
foreach (var _e in StatModifierConfigs) { _e?.ResolveRef(tables); }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "{ "
|
||||
+ "id:" + Id + ","
|
||||
+ "tag:" + Tag + ","
|
||||
+ "requiredCount:" + RequiredCount + ","
|
||||
+ "statModifierConfigs:" + Luban.StringUtil.CollectionToString(StatModifierConfigs) + ","
|
||||
+ "}";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be6aa68432437fb49ac08b59f65b8c6b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -26,7 +26,6 @@ namespace SepCore.UI
|
||||
_board.color = rarity switch
|
||||
{
|
||||
Rarity.White => Color.white,
|
||||
Rarity.Green => Color.green,
|
||||
Rarity.Blue => Color.blue,
|
||||
Rarity.Purple => Color.magenta,
|
||||
Rarity.Red => Color.red,
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace SepCore.UI
|
||||
|
||||
[SerializeField] private float _fixedTopHeight = 150f;
|
||||
|
||||
[SerializeField] private float _fixedBottomHeight = 150f;
|
||||
[SerializeField] private float _fixedBottomHeight = 250;
|
||||
|
||||
[SerializeField] private float _fixedWidth = 300f;
|
||||
[SerializeField] private float _fixedWidth = 600f;
|
||||
|
||||
[SerializeField] private float _screenEdgePadding = 0f;
|
||||
[SerializeField] private float _screenEdgePadding = 64f;
|
||||
|
||||
private ItemTooltipContext _context;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace SepCore.UI
|
||||
DamageType damageType;
|
||||
if (rawData.DataRow is WeaponConfig weaponConfig)
|
||||
{
|
||||
Name = weaponConfig.WeaponType.ToString();
|
||||
Name = weaponConfig.WeaponName;
|
||||
Description = ItemDescUtility.CreateWeaponDescription(weaponConfig);
|
||||
damageType = weaponConfig.DamageType;
|
||||
}
|
||||
|
||||
@@ -84,11 +84,13 @@ namespace SepCore.UI
|
||||
{
|
||||
if (uiComponent.IsLoadingUIForm(assetName))
|
||||
{
|
||||
Log.Warning("UIComponentExtension.OpenUIForm() skipped '{0}' because it is already loading.", assetName);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (uiComponent.HasUIForm(assetName))
|
||||
{
|
||||
Log.Warning("UIComponentExtension.OpenUIForm() skipped '{0}' because it is already open.", assetName);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ namespace SepCore.CustomComponent
|
||||
"tbuiformconfig",
|
||||
"tbuisoundconfig",
|
||||
"tbweaponconfig",
|
||||
"tbstatconfig"
|
||||
"tbstatconfig",
|
||||
"tbweapontagconfig"
|
||||
};
|
||||
|
||||
private sealed class TableAccessor
|
||||
@@ -131,7 +132,7 @@ namespace SepCore.CustomComponent
|
||||
},
|
||||
{
|
||||
typeof(WeaponConfig),
|
||||
Accessor(tables => id => tables.TbWeaponConfig.GetOrDefault((WeaponType)id),
|
||||
Accessor(tables => id => tables.TbWeaponConfig.GetOrDefault(id),
|
||||
tables => tables.TbWeaponConfig.DataList)
|
||||
},
|
||||
{
|
||||
@@ -139,6 +140,11 @@ namespace SepCore.CustomComponent
|
||||
Accessor(tables => id => tables.TbStatConfig.GetOrDefault((StatType)id),
|
||||
tables => tables.TbStatConfig.DataList)
|
||||
},
|
||||
{
|
||||
typeof(WeaponTagConfig),
|
||||
Accessor(tables => id => tables.TbWeaponTagConfig.GetOrDefault(id),
|
||||
tables => tables.TbWeaponTagConfig.DataList)
|
||||
},
|
||||
};
|
||||
|
||||
private static TableAccessor Accessor<TValue>(Func<Tables, Func<int, object>> rowGetterFactory,
|
||||
|
||||
@@ -5,8 +5,7 @@ namespace SepCore.UI
|
||||
public class ShopGoodsSelection
|
||||
{
|
||||
public GoodsType GoodsType;
|
||||
public int PropId;
|
||||
public WeaponType WeaponType;
|
||||
public int RefId;
|
||||
public int Price;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace SepCore.UI
|
||||
|
||||
if (goodsConfig.GoodsType == GoodsType.Prop)
|
||||
{
|
||||
PropConfig propConfig = GameEntry.Luban.Get<PropConfig>(goodsConfig.PropId);
|
||||
PropConfig propConfig = GameEntry.Luban.Get<PropConfig>(goodsConfig.RefId);
|
||||
int basePrice = propConfig.Price;
|
||||
|
||||
price = CalculateRandomizedPrice(basePrice, priceRandomPercent);
|
||||
@@ -177,7 +177,7 @@ namespace SepCore.UI
|
||||
}
|
||||
else if (goodsConfig.GoodsType == GoodsType.Weapon)
|
||||
{
|
||||
WeaponConfig weaponConfig = GameEntry.Luban.Get<WeaponConfig>((int)goodsConfig.WeaponType);
|
||||
WeaponConfig weaponConfig = GameEntry.Luban.Get<WeaponConfig>(goodsConfig.RefId);
|
||||
int basePrice = weaponConfig.Price;
|
||||
|
||||
price = CalculateRandomizedPrice(basePrice, priceRandomPercent);
|
||||
@@ -197,8 +197,7 @@ namespace SepCore.UI
|
||||
_selections.Add(new ShopGoodsSelection
|
||||
{
|
||||
GoodsType = goodsConfig.GoodsType,
|
||||
PropId = goodsConfig.PropId,
|
||||
WeaponType = goodsConfig.WeaponType,
|
||||
RefId = goodsConfig.RefId,
|
||||
Price = price
|
||||
});
|
||||
|
||||
@@ -253,14 +252,14 @@ namespace SepCore.UI
|
||||
|
||||
if (goods.GoodsType == GoodsType.Prop)
|
||||
{
|
||||
PropConfig propConfig = GameEntry.Luban.Get<PropConfig>(goods.PropId);
|
||||
PropConfig propConfig = GameEntry.Luban.Get<PropConfig>(goods.RefId);
|
||||
rarity = propConfig.Rarity;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (goods.GoodsType == GoodsType.Weapon)
|
||||
{
|
||||
WeaponConfig weaponConfig = GameEntry.Luban.Get<WeaponConfig>((int)goods.WeaponType);
|
||||
WeaponConfig weaponConfig = GameEntry.Luban.Get<WeaponConfig>(goods.RefId);
|
||||
rarity = weaponConfig.Rarity;
|
||||
return true;
|
||||
}
|
||||
@@ -285,7 +284,7 @@ namespace SepCore.UI
|
||||
{
|
||||
if (goods.GoodsType == GoodsType.Prop)
|
||||
{
|
||||
PropConfig propConfig = GameEntry.Luban.Get<PropConfig>(goods.PropId);
|
||||
PropConfig propConfig = GameEntry.Luban.Get<PropConfig>(goods.RefId);
|
||||
_player.AddProp(new PropItem(propConfig));
|
||||
return new DisplayItemRawData
|
||||
{
|
||||
@@ -303,7 +302,7 @@ namespace SepCore.UI
|
||||
return null;
|
||||
}
|
||||
|
||||
WeaponConfig weaponConfig = GameEntry.Luban.Get<WeaponConfig>((int)goods.WeaponType);
|
||||
WeaponConfig weaponConfig = GameEntry.Luban.Get<WeaponConfig>(goods.RefId);
|
||||
int id = GameEntry.Entity.NextId();
|
||||
var weaponData = EntityDataFactory.Create(id, weaponConfig, _player.Id, CampType.Player);
|
||||
|
||||
@@ -311,7 +310,7 @@ namespace SepCore.UI
|
||||
if (weapon == null)
|
||||
{
|
||||
Log.Warning(
|
||||
$"ShopFormUseCase::ApplyGoodsPurchase: Show weapon failed, weapon type id = {goods.WeaponType}");
|
||||
$"ShopFormUseCase::ApplyGoodsPurchase: Show weapon failed, weapon type id = {goods.RefId}");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,9 +17,15 @@ namespace SepCore.CustomUtility
|
||||
return new EnemyData(entityId, GetEnemyConfig(enemyType), level);
|
||||
}
|
||||
|
||||
public static WeaponData Create(int entityId, WeaponType weaponType, int ownerId, CampType ownerCamp)
|
||||
public static WeaponData Create(int entityId, WeaponType weaponType, int ownerId, CampType ownerCamp, Rarity rarity = Rarity.White)
|
||||
{
|
||||
var config = GameEntry.Luban.Get<WeaponConfig>((int)weaponType);
|
||||
var config = WeaponUtility.GetWeaponConfig(weaponType, rarity);
|
||||
return new WeaponData(entityId, config, ownerId, ownerCamp);
|
||||
}
|
||||
|
||||
public static WeaponData Create(int entityId, int weaponId, int ownerId, CampType ownerCamp)
|
||||
{
|
||||
var config = WeaponUtility.GetWeaponConfig(weaponId);
|
||||
return new WeaponData(entityId, config, ownerId, ownerCamp);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace SepCore.CustomUtility
|
||||
|
||||
public static Rarity SelectRarity(LevelDropConfig dropConfig)
|
||||
{
|
||||
float total = dropConfig.WhiteWeight + dropConfig.GreenWeight + dropConfig.BlueWeight + dropConfig.PurpleWeight + dropConfig.RedWeight;
|
||||
float total = dropConfig.WhiteWeight + dropConfig.BlueWeight + dropConfig.PurpleWeight + dropConfig.RedWeight;
|
||||
if (total <= 0f)
|
||||
{
|
||||
Log.Error("LevelDropConfig '{0}' has invalid total weight '{1}'.", dropConfig.Id, total);
|
||||
@@ -25,8 +25,6 @@ namespace SepCore.CustomUtility
|
||||
float roll = Random.Range(0f, total);
|
||||
if (roll < dropConfig.WhiteWeight) return Rarity.White;
|
||||
roll -= dropConfig.WhiteWeight;
|
||||
if (roll < dropConfig.GreenWeight) return Rarity.Green;
|
||||
roll -= dropConfig.GreenWeight;
|
||||
if (roll < dropConfig.BlueWeight) return Rarity.Blue;
|
||||
roll -= dropConfig.BlueWeight;
|
||||
if (roll < dropConfig.PurpleWeight) return Rarity.Purple;
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
using SepCore.Definition;
|
||||
|
||||
namespace SepCore.CustomUtility
|
||||
{
|
||||
public static class WeaponUtility
|
||||
{
|
||||
public const int IdMultiplier = 1000;
|
||||
|
||||
/// <summary>
|
||||
/// 根据武器种类与品质换算武器配置编号。
|
||||
/// </summary>
|
||||
public static int GetWeaponId(WeaponType weaponType, Rarity rarity = Rarity.White)
|
||||
{
|
||||
return (int)weaponType * IdMultiplier + (int)rarity;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据武器编号反推武器种类。
|
||||
/// </summary>
|
||||
public static WeaponType GetWeaponType(int weaponId)
|
||||
{
|
||||
return (WeaponType)(weaponId / IdMultiplier);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据武器编号反推武器品质。
|
||||
/// </summary>
|
||||
public static Rarity GetRarity(int weaponId)
|
||||
{
|
||||
return (Rarity)(weaponId % IdMultiplier);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定种类与品质的武器配置。
|
||||
/// </summary>
|
||||
public static WeaponConfig GetWeaponConfig(WeaponType weaponType, Rarity rarity = Rarity.White)
|
||||
{
|
||||
return GameEntry.Luban.Get<WeaponConfig>(GetWeaponId(weaponType, rarity));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定武器编号的武器配置。
|
||||
/// </summary>
|
||||
public static WeaponConfig GetWeaponConfig(int weaponId)
|
||||
{
|
||||
return GameEntry.Luban.Get<WeaponConfig>(weaponId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取同种武器的下一阶品质配置(用于武器合成升阶)。
|
||||
/// 若已达到最高品质(Red)则返回 false。
|
||||
/// </summary>
|
||||
public static bool TryGetNextTierConfig(WeaponConfig current, out WeaponConfig nextTierConfig)
|
||||
{
|
||||
if (current.Rarity >= Rarity.Red)
|
||||
{
|
||||
nextTierConfig = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
int nextId = (int)current.WeaponType * IdMultiplier + ((int)current.Rarity + 1);
|
||||
nextTierConfig = GameEntry.Luban.Get<WeaponConfig>(nextId);
|
||||
return nextTierConfig != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算同种武器的下一阶品质武器编号。
|
||||
/// 若已达到最高品质(Red)则返回 false。
|
||||
/// </summary>
|
||||
public static bool TryGetNextTierWeaponId(int currentWeaponId, out int nextWeaponId)
|
||||
{
|
||||
Rarity rarity = GetRarity(currentWeaponId);
|
||||
if (rarity >= Rarity.Red)
|
||||
{
|
||||
nextWeaponId = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
nextWeaponId = currentWeaponId + 1;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fff1b5f2bd835a748b998750d7d03154
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user