添加图片素材读取流程
This commit is contained in:
@@ -28,6 +28,8 @@ public sealed partial class CharacterConfig : Luban.BeanBase
|
||||
SkillActionId = _buf.ReadInt();
|
||||
WeaponItemId = _buf.ReadInt();
|
||||
ArmorItemId = _buf.ReadInt();
|
||||
Icon = _buf.ReadString();
|
||||
Icon_Ref = null;
|
||||
}
|
||||
|
||||
public static CharacterConfig DeserializeCharacterConfig(ByteBuf _buf)
|
||||
@@ -83,6 +85,11 @@ public sealed partial class CharacterConfig : Luban.BeanBase
|
||||
/// 初始防具ID,0为空
|
||||
/// </summary>
|
||||
public readonly int ArmorItemId;
|
||||
/// <summary>
|
||||
/// 图标资源配置
|
||||
/// </summary>
|
||||
public readonly string Icon;
|
||||
public SpriteConfig Icon_Ref;
|
||||
|
||||
public const int __ID__ = 676994987;
|
||||
public override int GetTypeId() => __ID__;
|
||||
@@ -101,6 +108,7 @@ public sealed partial class CharacterConfig : Luban.BeanBase
|
||||
|
||||
|
||||
|
||||
Icon_Ref = tables.TbSpriteConfig.GetOrDefault(Icon);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@@ -118,6 +126,7 @@ public sealed partial class CharacterConfig : Luban.BeanBase
|
||||
+ "skillActionId:" + SkillActionId + ","
|
||||
+ "weaponItemId:" + WeaponItemId + ","
|
||||
+ "armorItemId:" + ArmorItemId + ","
|
||||
+ "icon:" + Icon + ","
|
||||
+ "}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ public sealed partial class ItemConfig : Luban.BeanBase
|
||||
AtkBonus = _buf.ReadInt();
|
||||
MatBonus = _buf.ReadInt();
|
||||
SpeedBonus = _buf.ReadInt();
|
||||
Icon = _buf.ReadString();
|
||||
Icon_Ref = null;
|
||||
}
|
||||
|
||||
public static ItemConfig DeserializeItemConfig(ByteBuf _buf)
|
||||
@@ -78,6 +80,11 @@ public sealed partial class ItemConfig : Luban.BeanBase
|
||||
/// SPD修正
|
||||
/// </summary>
|
||||
public readonly int SpeedBonus;
|
||||
/// <summary>
|
||||
/// 图标资源配置
|
||||
/// </summary>
|
||||
public readonly string Icon;
|
||||
public SpriteConfig Icon_Ref;
|
||||
|
||||
public const int __ID__ = -764023723;
|
||||
public override int GetTypeId() => __ID__;
|
||||
@@ -95,6 +102,7 @@ public sealed partial class ItemConfig : Luban.BeanBase
|
||||
|
||||
|
||||
|
||||
Icon_Ref = tables.TbSpriteConfig.GetOrDefault(Icon);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
@@ -111,6 +119,7 @@ public sealed partial class ItemConfig : Luban.BeanBase
|
||||
+ "atkBonus:" + AtkBonus + ","
|
||||
+ "matBonus:" + MatBonus + ","
|
||||
+ "speedBonus:" + SpeedBonus + ","
|
||||
+ "icon:" + Icon + ","
|
||||
+ "}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <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 SpriteConfig : Luban.BeanBase
|
||||
{
|
||||
public SpriteConfig(ByteBuf _buf)
|
||||
{
|
||||
Key = _buf.ReadString();
|
||||
AtlasPath = _buf.ReadString();
|
||||
SpriteIndex = _buf.ReadInt();
|
||||
}
|
||||
|
||||
public static SpriteConfig DeserializeSpriteConfig(ByteBuf _buf)
|
||||
{
|
||||
return new SpriteConfig(_buf);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 资源键
|
||||
/// </summary>
|
||||
public readonly string Key;
|
||||
/// <summary>
|
||||
/// 图集路径(相对于 Assets/GameMain/Textures)
|
||||
/// </summary>
|
||||
public readonly string AtlasPath;
|
||||
/// <summary>
|
||||
/// Sprite 索引(-1 表示整张图)
|
||||
/// </summary>
|
||||
public readonly int SpriteIndex;
|
||||
|
||||
public const int __ID__ = -1527849337;
|
||||
public override int GetTypeId() => __ID__;
|
||||
|
||||
public void ResolveRef(Tables tables)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "{ "
|
||||
+ "key:" + Key + ","
|
||||
+ "atlasPath:" + AtlasPath + ","
|
||||
+ "spriteIndex:" + SpriteIndex + ","
|
||||
+ "}";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3c1026f4da3a46e4af39d3feb237024
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -82,6 +82,10 @@ public partial class Tables
|
||||
/// 界面音效配置
|
||||
/// </summary>
|
||||
public TbUISoundConfig TbUISoundConfig {get; }
|
||||
/// <summary>
|
||||
/// 图片资源配置
|
||||
/// </summary>
|
||||
public TbSpriteConfig TbSpriteConfig {get; }
|
||||
|
||||
public Tables(System.Func<string, ByteBuf> loader)
|
||||
{
|
||||
@@ -103,6 +107,7 @@ public partial class Tables
|
||||
TbSoundConfig = new TbSoundConfig(loader("tbsoundconfig"));
|
||||
TbUIFormConfig = new TbUIFormConfig(loader("tbuiformconfig"));
|
||||
TbUISoundConfig = new TbUISoundConfig(loader("tbuisoundconfig"));
|
||||
TbSpriteConfig = new TbSpriteConfig(loader("tbspriteconfig"));
|
||||
ResolveRef();
|
||||
}
|
||||
|
||||
@@ -126,6 +131,7 @@ public partial class Tables
|
||||
TbSoundConfig.ResolveRef(this);
|
||||
TbUIFormConfig.ResolveRef(this);
|
||||
TbUISoundConfig.ResolveRef(this);
|
||||
TbSpriteConfig.ResolveRef(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <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
|
||||
{
|
||||
/// <summary>
|
||||
/// 图片资源配置
|
||||
/// </summary>
|
||||
public partial class TbSpriteConfig
|
||||
{
|
||||
private readonly System.Collections.Generic.Dictionary<string, SpriteConfig> _dataMap;
|
||||
private readonly System.Collections.Generic.List<SpriteConfig> _dataList;
|
||||
|
||||
public TbSpriteConfig(ByteBuf _buf)
|
||||
{
|
||||
_dataMap = new System.Collections.Generic.Dictionary<string, SpriteConfig>();
|
||||
_dataList = new System.Collections.Generic.List<SpriteConfig>();
|
||||
|
||||
for(int n = _buf.ReadSize() ; n > 0 ; --n)
|
||||
{
|
||||
SpriteConfig _v;
|
||||
_v = SpriteConfig.DeserializeSpriteConfig(_buf);
|
||||
_dataList.Add(_v);
|
||||
_dataMap.Add(_v.Key, _v);
|
||||
}
|
||||
}
|
||||
|
||||
public System.Collections.Generic.Dictionary<string, SpriteConfig> DataMap => _dataMap;
|
||||
public System.Collections.Generic.List<SpriteConfig> DataList => _dataList;
|
||||
|
||||
public SpriteConfig GetOrDefault(string key) => _dataMap.TryGetValue(key, out var v) ? v : null;
|
||||
public SpriteConfig Get(string key) => _dataMap[key];
|
||||
public SpriteConfig this[string key] => _dataMap[key];
|
||||
|
||||
public void ResolveRef(Tables tables)
|
||||
{
|
||||
foreach(var _v in _dataList)
|
||||
{
|
||||
_v.ResolveRef(tables);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 96ef8dd7c7cf44d7b8a3b64f80723105
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user