导出配表+建筑占位

main
刘涛 2024-09-09 15:30:51 +08:00
parent cfe3b6155c
commit 0c25f9cf86
11 changed files with 326 additions and 0 deletions

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 42e21286767e4b288b7a13f5e46df944
timeCreated: 1725864675

View File

@ -0,0 +1,13 @@
using Gameplay.Unit;
using Gameplay.Unit.Data;
namespace Code.Scripts.Gameplay.Building
{
public class UnitBuild : GameUnit
{
public UnitBuild(uint id,
int troopId) : base(id, troopId, EGameUnitType.Building)
{
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 47e839ec33b34ae9a97f82787160cc02
timeCreated: 1725866810

View File

@ -8,6 +8,7 @@ namespace Gameplay.Unit.Data
Vehicle,
Player,
BeProtect,
Building,
}
public static class EGameUnitTypeUtils {
@ -26,6 +27,8 @@ namespace Gameplay.Unit.Data
return "玩家对象";
case EGameUnitType.BeProtect:
return "被保护对象";
case EGameUnitType.Building:
return "建筑";
default:
return "未知类型:" + typeId;
}

View File

@ -0,0 +1,72 @@
//------------------------------------------------------------------------------
// <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 Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace cfg.FightCfg
{
public sealed partial class BuildConfig
{
private readonly Dictionary<int, FightCfg.DataBuild> _dataMap;
private readonly List<FightCfg.DataBuild> _dataList;
public BuildConfig(JSONNode _json)
{
_dataMap = new Dictionary<int, FightCfg.DataBuild>();
_dataList = new List<FightCfg.DataBuild>();
foreach(JSONNode _row in _json.Children)
{
var _v = FightCfg.DataBuild.DeserializeDataBuild(_row);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public Dictionary<int, FightCfg.DataBuild> DataMap => _dataMap;
public List<FightCfg.DataBuild> DataList => _dataList;
public FightCfg.DataBuild GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public FightCfg.DataBuild Get(int key) {
if (_dataMap.TryGetValue(key, out var v)) {
return v;
} else {
UnityEngine.Debug.LogError($"table BuildConfig key not found: {key}");
return null;
}
}
public FightCfg.DataBuild this[int key] => _dataMap[key];
public void Resolve(Dictionary<string, object> _tables)
{
foreach(var v in _dataList)
{
v.Resolve(_tables);
}
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
foreach(var v in _dataList)
{
v.TranslateText(translator);
}
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0f6f880788bd8304c802a27bd5f2d155
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,126 @@
//------------------------------------------------------------------------------
// <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 Bright.Serialization;
using System.Collections.Generic;
using SimpleJSON;
namespace cfg.FightCfg
{
public sealed partial class DataBuild : Bright.Config.BeanBase
{
public DataBuild(JSONNode _json)
{
{ if(!_json["id"].IsNumber) { throw new SerializationException(); } Id = _json["id"]; }
{ if(!_json["name"].IsString) { throw new SerializationException(); } Name = _json["name"]; }
{ if(!_json["build_type"].IsNumber) { throw new SerializationException(); } BuildType = _json["build_type"]; }
{ if(!_json["model_path"].IsString) { throw new SerializationException(); } ModelPath = _json["model_path"]; }
{ if(!_json["hp"].IsNumber) { throw new SerializationException(); } Hp = _json["hp"]; }
{ if(!_json["stand_cross_level"].IsNumber) { throw new SerializationException(); } StandCrossLevel = _json["stand_cross_level"]; }
{ if(!_json["block_attack"].IsBoolean) { throw new SerializationException(); } BlockAttack = _json["block_attack"]; }
{ if(!_json["fight_level"].IsNumber) { throw new SerializationException(); } FightLevel = _json["fight_level"]; }
{ if(!_json["fight_defense"].IsNumber) { throw new SerializationException(); } FightDefense = _json["fight_defense"]; }
{ var __json0 = _json["float_params"]; if(!__json0.IsArray) { throw new SerializationException(); } FloatParams = new System.Collections.Generic.List<float>(__json0.Count); foreach(JSONNode __e0 in __json0.Children) { float __v0; { if(!__e0.IsNumber) { throw new SerializationException(); } __v0 = __e0; } FloatParams.Add(__v0); } }
PostInit();
}
public DataBuild(int id, string name, int build_type, string model_path, int hp, int stand_cross_level, bool block_attack, int fight_level, int fight_defense, System.Collections.Generic.List<float> float_params )
{
this.Id = id;
this.Name = name;
this.BuildType = build_type;
this.ModelPath = model_path;
this.Hp = hp;
this.StandCrossLevel = stand_cross_level;
this.BlockAttack = block_attack;
this.FightLevel = fight_level;
this.FightDefense = fight_defense;
this.FloatParams = float_params;
PostInit();
}
public static DataBuild DeserializeDataBuild(JSONNode _json)
{
return new FightCfg.DataBuild(_json);
}
/// <summary>
/// 建筑ID
/// </summary>
public int Id { get; private set; }
/// <summary>
/// 名字(仅用于调试显示)
/// </summary>
public string Name { get; private set; }
/// <summary>
/// 建筑类型
/// </summary>
public int BuildType { get; private set; }
/// <summary>
/// 模型路径
/// </summary>
public string ModelPath { get; private set; }
/// <summary>
/// 血量
/// </summary>
public int Hp { get; private set; }
/// <summary>
/// 占用通行级别
/// </summary>
public int StandCrossLevel { get; private set; }
/// <summary>
/// 是否阻挡射击
/// </summary>
public bool BlockAttack { get; private set; }
/// <summary>
/// 战斗参数_level
/// </summary>
public int FightLevel { get; private set; }
/// <summary>
/// 战斗参数_防御力
/// </summary>
public int FightDefense { get; private set; }
/// <summary>
/// float参数
/// </summary>
public System.Collections.Generic.List<float> FloatParams { get; private set; }
public const int __ID__ = 459064746;
public override int GetTypeId() => __ID__;
public void Resolve(Dictionary<string, object> _tables)
{
PostResolve();
}
public void TranslateText(System.Func<string, string, string> translator)
{
}
public override string ToString()
{
return "{ "
+ "Id:" + Id + ","
+ "Name:" + Name + ","
+ "BuildType:" + BuildType + ","
+ "ModelPath:" + ModelPath + ","
+ "Hp:" + Hp + ","
+ "StandCrossLevel:" + StandCrossLevel + ","
+ "BlockAttack:" + BlockAttack + ","
+ "FightLevel:" + FightLevel + ","
+ "FightDefense:" + FightDefense + ","
+ "FloatParams:" + Bright.Common.StringUtil.CollectionToString(FloatParams) + ","
+ "}";
}
partial void PostInit();
partial void PostResolve();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fdc5b4d06ca077d438e4450b6de91ef3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -100,6 +100,7 @@ public sealed partial class Tables
public FightCfg.EnemyVehicleConfig EnemyVehicleConfig {get; }
public FightCfg.EnemyVehicleLevelUp EnemyVehicleLevelUp {get; }
public FightCfg.EnemyVehicleSkillUpgrade EnemyVehicleSkillUpgrade {get; }
public FightCfg.BuildConfig BuildConfig {get; }
public Tables(System.Func<string, JSONNode> loader)
{
@ -272,6 +273,8 @@ public sealed partial class Tables
tables.Add("FightCfg.EnemyVehicleLevelUp", EnemyVehicleLevelUp);
EnemyVehicleSkillUpgrade = new FightCfg.EnemyVehicleSkillUpgrade(loader("fightcfg_enemyvehicleskillupgrade"));
tables.Add("FightCfg.EnemyVehicleSkillUpgrade", EnemyVehicleSkillUpgrade);
BuildConfig = new FightCfg.BuildConfig(loader("fightcfg_buildconfig"));
tables.Add("FightCfg.BuildConfig", BuildConfig);
PostInit();
CharacterAttri.Resolve(tables);
@ -358,6 +361,7 @@ public sealed partial class Tables
EnemyVehicleConfig.Resolve(tables);
EnemyVehicleLevelUp.Resolve(tables);
EnemyVehicleSkillUpgrade.Resolve(tables);
BuildConfig.Resolve(tables);
PostResolve();
}
@ -446,6 +450,7 @@ public sealed partial class Tables
loader("fightcfg_enemyvehicleconfig");
loader("fightcfg_enemyvehiclelevelup");
loader("fightcfg_enemyvehicleskillupgrade");
loader("fightcfg_buildconfig");
}
public static void AfterLoaded(Action<string> loader) {
@ -533,6 +538,7 @@ public sealed partial class Tables
loader("fightcfg_enemyvehicleconfig");
loader("fightcfg_enemyvehiclelevelup");
loader("fightcfg_enemyvehicleskillupgrade");
loader("fightcfg_buildconfig");
}
public void TranslateText(System.Func<string, string, string> translator)
@ -621,6 +627,7 @@ public sealed partial class Tables
EnemyVehicleConfig.TranslateText(translator);
EnemyVehicleLevelUp.TranslateText(translator);
EnemyVehicleSkillUpgrade.TranslateText(translator);
BuildConfig.TranslateText(translator);
}
partial void PostInit();

View File

@ -0,0 +1,70 @@
[
{
"id": 1001,
"name": "暗堡",
"build_type": 1,
"model_path": "",
"hp": 10000,
"stand_cross_level": 999,
"block_attack": true,
"fight_level": 1,
"fight_defense": 0,
"float_params": [
7,
0.5,
60001
]
},
{
"id": 1002,
"name": "壁垒",
"build_type": 2,
"model_path": "",
"hp": 10000,
"stand_cross_level": 999,
"block_attack": true,
"fight_level": 1,
"fight_defense": 0,
"float_params": []
},
{
"id": 1003,
"name": "地刺陷阱",
"build_type": 3,
"model_path": "",
"hp": 0,
"stand_cross_level": 0,
"block_attack": false,
"fight_level": 1,
"fight_defense": 0,
"float_params": [
60001
]
},
{
"id": 1004,
"name": "地雷",
"build_type": 4,
"model_path": "",
"hp": 0,
"stand_cross_level": 0,
"block_attack": false,
"fight_level": 1,
"fight_defense": 0,
"float_params": [
60001
]
},
{
"id": 1005,
"name": "瞭望阵地",
"build_type": 5,
"model_path": "",
"hp": 0,
"stand_cross_level": 0,
"block_attack": false,
"fight_level": 1,
"fight_defense": 0,
"float_params": []
}
]

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7e87e2bdc4a54404995dc149ff462e94
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: