This commit is contained in:
2025-10-09 22:10:53 +08:00
40 changed files with 2360 additions and 502 deletions

View File

@@ -19,14 +19,14 @@ namespace NBF
[MenuItem("构建/配置表/导表")]
public static void BuildExcel()
{
ExcelToJsonWindow.GenConfig(false);
// ExcelToJsonWindow.GenConfig(false);
AssetDatabase.Refresh();
}
[MenuItem("构建/配置表/导多语言")]
public static void BuildLanguage()
{
ExcelToJsonWindow.GenLanguage();
// ExcelToJsonWindow.GenLanguage();
AssetDatabase.Refresh();
}

View File

@@ -8,7 +8,7 @@ namespace NBF
{
public override void Run(BuildContext context)
{
ExcelToJsonWindow.GenConfig(false);
// ExcelToJsonWindow.GenConfig(false);
}
}
}

View File

@@ -1,487 +1,487 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using ExcelDataReader;
using NBC;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
namespace NBF
{
public static class ExcelToJsonWindow
{
#region
public static void GenConfig(bool showMessageBox = true)
{
CfgEditorUtil.GenConfigScripts();
GenConfig(Application.dataPath + "/../Config", showMessageBox);
}
public static void GenConfig(string path, bool showMessageBox = false)
{
List<string> list = new List<string>();
GetFiles(path, fileList: ref list);
AllJsonData.Clear();
Stopwatch s = Stopwatch.StartNew();
ReadExcel(list.ToArray());
BuildAsset();
s.Stop();
if (showMessageBox)
{
EditorUtility.DisplayDialog("成功", $"导表完成,耗时{(s.ElapsedMilliseconds / 1000f):.00}秒", "知道了");
EditorUtility.ClearProgressBar();
}
else
{
Debug.Log($"导表完成,耗时{(s.ElapsedMilliseconds / 1000f):.00}秒");
}
AssetDatabase.Refresh();
}
private static void BuildAsset()
{
var json = JsonConvert.SerializeObject(AllJsonData, Formatting.Indented, new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
});
var jsonObj = JObject.Parse(json);
Dictionary<string, JToken> tokens = new Dictionary<string, JToken>(StringComparer.OrdinalIgnoreCase);
foreach (var item in jsonObj)
{
try
{
var name = item.Key;
var value = item.Value;
if (value != null)
{
tokens[name] = value;
}
}
catch (Exception e)
{
Log.Error($"读表异常请检查name={item.Key} ex={e}");
}
}
var relativePath = ConfigAssets.SavePath;
var asset = EditorUtils.GetOrCreateAsset<ConfigAssets>(relativePath);
var types = Reflection.GetAllNonAbstractDerivedTypes<ConfigBase>();
foreach (var type in types)
{
var tableNameAttribute = type.GetCustomAttribute<TableNameAttribute>();
if (tableNameAttribute == null) continue;
if (!tokens.TryGetValue(tableNameAttribute.Name, out var token))
{
Log.Warning($"{tableNameAttribute.Name} 解析失败tableName不一致");
continue;
}
if (token is not JArray jArray) return;
asset.Parse(jArray.ToArray(), type);
}
EditorUtility.SetDirty(asset);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
#endregion
#region
public static void GenLanguage()
{
var path = Application.dataPath + "/../Config/language";
List<string> list = new List<string>();
GetFiles(path, fileList: ref list);
AllJsonData.Clear();
Stopwatch s = Stopwatch.StartNew();
ReadExcel(list.ToArray());
var savePath = Path.Combine(Application.dataPath, "Resources/config/language.json");
BuildJson(savePath);
s.Stop();
Debug.Log($"导多语言完成,耗时{(s.ElapsedMilliseconds / 1000f):.00}秒");
AssetDatabase.Refresh();
}
private static void BuildJson(string savaPath)
{
var json = JsonConvert.SerializeObject(AllJsonData, Formatting.Indented, new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
});
SaveJson(savaPath, json);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}
#endregion
#region
private static void GetFiles(string path, ref List<string> fileList)
{
var files = Directory.GetFiles(path);
if (files.Length > 0)
{
foreach (var file in files)
{
var fileName = Path.GetFileName(file);
if ((fileName.EndsWith(".xls", true, CultureInfo.CurrentCulture) ||
fileName.EndsWith(".xlsx", true, CultureInfo.CurrentCulture)) && !fileName.StartsWith(".") &&
!fileName.StartsWith("~"))
{
fileList.Add(file.Replace('\\', '/'));
}
}
}
}
private static void SaveJson(string jsonPath, string json)
{
try
{
if (File.Exists(jsonPath))
{
File.Delete(jsonPath);
}
File.WriteAllBytes(jsonPath, Encoding.UTF8.GetBytes(json));
}
catch (Exception e)
{
// Console.WriteLine(e);
// throw;
}
}
#endregion
#region Excel读取
private static readonly Dictionary<string, object> AllJsonData = new Dictionary<string, object>();
private static bool _buildIng = false;
private static int _buildTotal = 0;
private static int _buildDoneCount = 0;
private static void ReadExcel(IReadOnlyCollection<string> paths)
{
_buildTotal = paths.Count;
_buildDoneCount = 0;
_buildIng = true;
foreach (var t in paths)
{
ReadSingleExcel(t);
}
_buildIng = false;
}
private static void ReadSingleExcelFunc(string xlsxPath, bool isThrow = false)
{
try
{
using FileStream stream = File.Open(xlsxPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
DataSet result = excelReader.AsDataSet();
// 读取第一张工资表
DataTableCollection tc = result.Tables;
if (tc.Count >= 1)
{
foreach (DataTable table in tc)
{
if (!table.TableName.StartsWith("!") && !table.TableName.StartsWith("Sheet"))
{
ReadSingleSheet(table, isThrow);
}
}
}
else
{
Debug.LogError("表名为空,请检查表");
}
}
catch (Exception e)
{
Log.Error(e);
}
}
public static void ReadSingleExcel(string xlsxPath, bool isThrow = false)
{
Stopwatch s = Stopwatch.StartNew();
string xlsxName = Path.GetFileName(xlsxPath);
if (!File.Exists(xlsxPath))
{
Debug.LogError("不存在该Excel");
return;
}
try
{
ReadSingleExcelFunc(xlsxPath, isThrow);
Debug.Log(xlsxName + ".xlsx" + "转换Json成功");
s.Stop();
Debug.Log($"导表{xlsxName},花费时间={s.ElapsedMilliseconds}毫秒");
_buildDoneCount++;
}
catch (Exception e)
{
Debug.LogError(e);
}
}
/// <summary>
/// 读取一个工作表的数据
/// </summary>
/// <param name="dataTable">读取的工作表数据</param>
/// <param name="isThrow">是否抛出异常</param>
private static void ReadSingleSheet(DataTable dataTable, bool isThrow = false)
{
int rows = dataTable.Rows.Count;
int columns = dataTable.Columns.Count;
if (rows < 1 || columns < 1)
{
return;
}
// 工作表的行数据
DataRowCollection collect = dataTable.Rows;
// xlsx对应的数据字段规定是第二行
string[] jsonFields = new string[columns];
string[] jsonFieldsType = new string[columns];
// 要保存成Json的obj
List<object> objsToSave = new List<object>();
for (int i = 0; i < columns; i++)
{
//字段
jsonFields[i] = collect[1][i].ToString();
//字段类型
jsonFieldsType[i] = collect[2][i].ToString();
}
// _lastTableName = dataTable.TableName;
// 从第三行开始
for (int i = 3; i < rows; i++)
{
Dictionary<string, object> jObject = new Dictionary<string, object>();
// _lastX = i;
for (int j = 0; j < columns; j++)
{
var objectValue = collect[i][j].ToString();
// _lastY = j;
var lastValue = $"{collect[1][j]}---{objectValue}";
try
{
if (isThrow)
{
Debug.Log($"{i}/{j}/{objectValue}");
}
Type type = GetTypeByString(jsonFieldsType[j]);
// 获取字段
string field = jsonFields[j];
//过滤掉字段为空的值
if (!string.IsNullOrEmpty(field))
{
object value = null;
if (!string.IsNullOrEmpty(objectValue))
{
//需要先判断下是否为数组
if (type != typeof(Array))
{
//需要判断一下是否为bool值 bool 直接返回int 0 或者 1
if (type == typeof(bool))
{
value = int.Parse(objectValue);
}
else if (type == typeof(Vector2))
{
value = objectValue.ToVector2();
}
else if (type == typeof(Vector3))
{
value = objectValue.ToVector3();
}
else
{
value = Convert.ChangeType(objectValue, type);
}
}
else
{
//这里在做二维数组的处理
//一般到这都是Int数组当然还可以更细致的处理不同类型的数组
string[] strs = objectValue.Split(',');
string arrayType = jsonFieldsType[j];
object[] ints = new object[strs.Length];
for (int k = 0; k < strs.Length; k++)
{
switch (arrayType)
{
case "[int]":
{
int.TryParse(strs[k], out var v);
ints[k] = v;
break;
}
case "[float]":
{
float.TryParse(strs[k], out var v);
ints[k] = v;
break;
}
case "[string]":
ints[k] = strs[k];
break;
default:
ints[k] = strs[k];
break;
}
}
value = ints;
}
}
else
{
// Log.I($"{dataTable.TableName} 字段{field}有空值存在 第{j + 1}列数据 请检查表格!!!");
//如果值为空会出现导表失败 这里需要做一下处理
value = GetDataType(type);
}
jObject[field] = value;
}
}
catch (Exception)
{
Debug.LogError($"解析表错误table={dataTable.TableName} y={i} x={j} value={lastValue}");
}
}
objsToSave.Add(jObject);
}
AllJsonData[dataTable.TableName] = objsToSave;
}
/// <summary>
/// 判断一下数据类型
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static object GetDataType(Type type)
{
object value = null;
if (type == typeof(int) || type == typeof(float))
{
value = 0;
}
else if (type == typeof(string))
{
value = "";
}
else if (type == typeof(bool))
{
//如果boo值类型为空 默认显示
value = 0;
}
else if (type == typeof(Array))
{
value = new List<object>().ToArray();
}
else
{
value = "";
}
return value;
}
/// <summary>
/// 获取字段类型
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public static Type GetTypeByString(string type)
{
switch (type.ToLower())
{
case "bool":
return typeof(bool);
case "array":
return typeof(Array);
case "double":
return typeof(double);
case "float":
return typeof(float);
case "int":
return typeof(int);
case "long":
return typeof(long);
case "object":
return typeof(object);
case "string":
return typeof(string);
case "[float]":
return typeof(Array);
case "[int]":
return typeof(Array);
case "[string]":
return typeof(Array);
case "v2":
return typeof(Vector2);
case "v3":
return typeof(Vector3);
default:
return typeof(string);
}
}
#endregion
}
}
// using System;
// using System.Collections.Generic;
// using System.Data;
// using System.Diagnostics;
// using System.Globalization;
// using System.IO;
// using System.Linq;
// using System.Reflection;
// using System.Text;
// using ExcelDataReader;
// using NBC;
// using Newtonsoft.Json;
// using Newtonsoft.Json.Linq;
// using UnityEditor;
// using UnityEngine;
// using Debug = UnityEngine.Debug;
//
// namespace NBF
// {
// public static class ExcelToJsonWindow
// {
// #region 生成配置
//
// public static void GenConfig(bool showMessageBox = true)
// {
// CfgEditorUtil.GenConfigScripts();
// GenConfig(Application.dataPath + "/../Config", showMessageBox);
// }
//
//
// public static void GenConfig(string path, bool showMessageBox = false)
// {
// List<string> list = new List<string>();
//
// GetFiles(path, fileList: ref list);
//
// AllJsonData.Clear();
// Stopwatch s = Stopwatch.StartNew();
//
// ReadExcel(list.ToArray());
//
// BuildAsset();
//
// s.Stop();
// if (showMessageBox)
// {
// EditorUtility.DisplayDialog("成功", $"导表完成,耗时{(s.ElapsedMilliseconds / 1000f):.00}秒", "知道了");
// EditorUtility.ClearProgressBar();
// }
// else
// {
// Debug.Log($"导表完成,耗时{(s.ElapsedMilliseconds / 1000f):.00}秒");
// }
//
// AssetDatabase.Refresh();
// }
//
//
// private static void BuildAsset()
// {
// var json = JsonConvert.SerializeObject(AllJsonData, Formatting.Indented, new JsonSerializerSettings
// {
// ReferenceLoopHandling = ReferenceLoopHandling.Ignore
// });
// var jsonObj = JObject.Parse(json);
//
// Dictionary<string, JToken> tokens = new Dictionary<string, JToken>(StringComparer.OrdinalIgnoreCase);
//
// foreach (var item in jsonObj)
// {
// try
// {
// var name = item.Key;
// var value = item.Value;
// if (value != null)
// {
// tokens[name] = value;
// }
// }
// catch (Exception e)
// {
// Log.Error($"读表异常请检查name={item.Key} ex={e}");
// }
// }
//
// var relativePath = ConfigAssets.SavePath;
//
// var asset = EditorUtils.GetOrCreateAsset<ConfigAssets>(relativePath);
//
// var types = Reflection.GetAllNonAbstractDerivedTypes<ConfigBase>();
// foreach (var type in types)
// {
// var tableNameAttribute = type.GetCustomAttribute<TableNameAttribute>();
// if (tableNameAttribute == null) continue;
// if (!tokens.TryGetValue(tableNameAttribute.Name, out var token))
// {
// Log.Warning($"{tableNameAttribute.Name} 解析失败tableName不一致");
// continue;
// }
//
// if (token is not JArray jArray) return;
// asset.Parse(jArray.ToArray(), type);
// }
//
// EditorUtility.SetDirty(asset);
// AssetDatabase.SaveAssets();
// AssetDatabase.Refresh();
// }
//
// #endregion
//
// #region 生成多语
//
// public static void GenLanguage()
// {
// var path = Application.dataPath + "/../Config/language";
//
// List<string> list = new List<string>();
//
// GetFiles(path, fileList: ref list);
//
// AllJsonData.Clear();
// Stopwatch s = Stopwatch.StartNew();
//
// ReadExcel(list.ToArray());
//
// var savePath = Path.Combine(Application.dataPath, "Resources/config/language.json");
//
// BuildJson(savePath);
//
// s.Stop();
//
// Debug.Log($"导多语言完成,耗时{(s.ElapsedMilliseconds / 1000f):.00}秒");
//
// AssetDatabase.Refresh();
// }
//
// private static void BuildJson(string savaPath)
// {
// var json = JsonConvert.SerializeObject(AllJsonData, Formatting.Indented, new JsonSerializerSettings
// {
// ReferenceLoopHandling = ReferenceLoopHandling.Ignore
// });
// SaveJson(savaPath, json);
//
// AssetDatabase.SaveAssets();
// AssetDatabase.Refresh();
// }
//
// #endregion
//
// #region 文件读
//
// private static void GetFiles(string path, ref List<string> fileList)
// {
// var files = Directory.GetFiles(path);
// if (files.Length > 0)
// {
// foreach (var file in files)
// {
// var fileName = Path.GetFileName(file);
//
// if ((fileName.EndsWith(".xls", true, CultureInfo.CurrentCulture) ||
// fileName.EndsWith(".xlsx", true, CultureInfo.CurrentCulture)) && !fileName.StartsWith(".") &&
// !fileName.StartsWith("~"))
// {
// fileList.Add(file.Replace('\\', '/'));
// }
// }
// }
// }
//
// private static void SaveJson(string jsonPath, string json)
// {
// try
// {
// if (File.Exists(jsonPath))
// {
// File.Delete(jsonPath);
// }
//
// File.WriteAllBytes(jsonPath, Encoding.UTF8.GetBytes(json));
// }
// catch (Exception e)
// {
// // Console.WriteLine(e);
// // throw;
// }
// }
//
// #endregion
//
// #region Excel读取
//
// private static readonly Dictionary<string, object> AllJsonData = new Dictionary<string, object>();
// private static bool _buildIng = false;
// private static int _buildTotal = 0;
//
// private static int _buildDoneCount = 0;
//
// private static void ReadExcel(IReadOnlyCollection<string> paths)
// {
// _buildTotal = paths.Count;
// _buildDoneCount = 0;
// _buildIng = true;
//
// foreach (var t in paths)
// {
// ReadSingleExcel(t);
// }
//
// _buildIng = false;
// }
//
// private static void ReadSingleExcelFunc(string xlsxPath, bool isThrow = false)
// {
// try
// {
// using FileStream stream = File.Open(xlsxPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
// IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
// DataSet result = excelReader.AsDataSet();
// // 读取第一张工资表
// DataTableCollection tc = result.Tables;
//
// if (tc.Count >= 1)
// {
// foreach (DataTable table in tc)
// {
// if (!table.TableName.StartsWith("!") && !table.TableName.StartsWith("Sheet"))
// {
// ReadSingleSheet(table, isThrow);
// }
// }
// }
// else
// {
// Debug.LogError("表名为空,请检查表");
// }
// }
// catch (Exception e)
// {
// Log.Error(e);
// }
// }
//
//
// public static void ReadSingleExcel(string xlsxPath, bool isThrow = false)
// {
// Stopwatch s = Stopwatch.StartNew();
// string xlsxName = Path.GetFileName(xlsxPath);
//
// if (!File.Exists(xlsxPath))
// {
// Debug.LogError("不存在该Excel");
// return;
// }
//
// try
// {
// ReadSingleExcelFunc(xlsxPath, isThrow);
//
// Debug.Log(xlsxName + ".xlsx" + "转换Json成功");
//
// s.Stop();
// Debug.Log($"导表{xlsxName},花费时间={s.ElapsedMilliseconds}毫秒");
// _buildDoneCount++;
// }
// catch (Exception e)
// {
// Debug.LogError(e);
// }
// }
//
// /// <summary>
// /// 读取一个工作表的数据
// /// </summary>
// /// <param name="dataTable">读取的工作表数据</param>
// /// <param name="isThrow">是否抛出异常</param>
// private static void ReadSingleSheet(DataTable dataTable, bool isThrow = false)
// {
// int rows = dataTable.Rows.Count;
// int columns = dataTable.Columns.Count;
// if (rows < 1 || columns < 1)
// {
// return;
// }
//
// // 工作表的行数据
// DataRowCollection collect = dataTable.Rows;
// // xlsx对应的数据字段规定是第二行
// string[] jsonFields = new string[columns];
// string[] jsonFieldsType = new string[columns];
// // 要保存成Json的obj
// List<object> objsToSave = new List<object>();
// for (int i = 0; i < columns; i++)
// {
// //字段
// jsonFields[i] = collect[1][i].ToString();
// //字段类型
// jsonFieldsType[i] = collect[2][i].ToString();
// }
//
// // _lastTableName = dataTable.TableName;
// // 从第三行开始
// for (int i = 3; i < rows; i++)
// {
// Dictionary<string, object> jObject = new Dictionary<string, object>();
//
// // _lastX = i;
// for (int j = 0; j < columns; j++)
// {
// var objectValue = collect[i][j].ToString();
// // _lastY = j;
// var lastValue = $"{collect[1][j]}---{objectValue}";
// try
// {
// if (isThrow)
// {
// Debug.Log($"{i}/{j}/{objectValue}");
// }
//
// Type type = GetTypeByString(jsonFieldsType[j]);
// // 获取字段
// string field = jsonFields[j];
// //过滤掉字段为空的值
// if (!string.IsNullOrEmpty(field))
// {
// object value = null;
// if (!string.IsNullOrEmpty(objectValue))
// {
// //需要先判断下是否为数组
// if (type != typeof(Array))
// {
// //需要判断一下是否为bool值 bool 直接返回int 0 或者 1
// if (type == typeof(bool))
// {
// value = int.Parse(objectValue);
// }
// else if (type == typeof(Vector2))
// {
// value = objectValue.ToVector2();
// }
// else if (type == typeof(Vector3))
// {
// value = objectValue.ToVector3();
// }
// else
// {
// value = Convert.ChangeType(objectValue, type);
// }
// }
// else
// {
// //这里在做二维数组的处理
// //一般到这都是Int数组当然还可以更细致的处理不同类型的数组
// string[] strs = objectValue.Split(',');
// string arrayType = jsonFieldsType[j];
//
// object[] ints = new object[strs.Length];
//
// for (int k = 0; k < strs.Length; k++)
// {
// switch (arrayType)
// {
// case "[int]":
// {
// int.TryParse(strs[k], out var v);
// ints[k] = v;
// break;
// }
// case "[float]":
// {
// float.TryParse(strs[k], out var v);
// ints[k] = v;
// break;
// }
// case "[string]":
// ints[k] = strs[k];
// break;
// default:
// ints[k] = strs[k];
// break;
// }
// }
//
// value = ints;
// }
// }
// else
// {
// // Log.I($"{dataTable.TableName} 字段{field}有空值存在 第{j + 1}列数据 请检查表格!!!");
// //如果值为空会出现导表失败 这里需要做一下处理
// value = GetDataType(type);
// }
//
// jObject[field] = value;
// }
// }
// catch (Exception)
// {
// Debug.LogError($"解析表错误table={dataTable.TableName} y={i} x={j} value={lastValue}");
// }
// }
//
// objsToSave.Add(jObject);
// }
//
// AllJsonData[dataTable.TableName] = objsToSave;
// }
//
//
// /// <summary>
// /// 判断一下数据类型
// /// </summary>
// /// <param name="type"></param>
// /// <returns></returns>
// public static object GetDataType(Type type)
// {
// object value = null;
// if (type == typeof(int) || type == typeof(float))
// {
// value = 0;
// }
// else if (type == typeof(string))
// {
// value = "";
// }
// else if (type == typeof(bool))
// {
// //如果boo值类型为空 默认显示
// value = 0;
// }
// else if (type == typeof(Array))
// {
// value = new List<object>().ToArray();
// }
// else
// {
// value = "";
// }
//
// return value;
// }
//
// /// <summary>
// /// 获取字段类型
// /// </summary>
// /// <param name="type"></param>
// /// <returns></returns>
// public static Type GetTypeByString(string type)
// {
// switch (type.ToLower())
// {
// case "bool":
// return typeof(bool);
// case "array":
// return typeof(Array);
// case "double":
// return typeof(double);
// case "float":
// return typeof(float);
// case "int":
// return typeof(int);
// case "long":
// return typeof(long);
// case "object":
// return typeof(object);
// case "string":
// return typeof(string);
// case "[float]":
// return typeof(Array);
// case "[int]":
// return typeof(Array);
// case "[string]":
// return typeof(Array);
// case "v2":
// return typeof(Vector2);
// case "v3":
// return typeof(Vector3);
// default:
// return typeof(string);
// }
// }
//
// #endregion
// }
// }

View File

@@ -66,15 +66,15 @@ namespace NBF.Fishing2
}
}
public UnitConfig Config()
{
return UnitConfig.Get(ConfigId);
}
public UnitType UnitType()
{
return Config().Type;
}
// public UnitConfig Config()
// {
// return UnitConfig.Get(ConfigId);
// }
//
// public UnitType UnitType()
// {
// return Config().Type;
// }
#region View

View File

@@ -19,13 +19,13 @@ namespace NBF
/// <summary>
/// 摄像机配置
/// </summary>
public static CameraScriptObject CameraConfig { get; private set; }
// public static CameraScriptObject CameraConfig { get; private set; }
public static long SelfId;
private void Awake()
{
Instance = this;
CameraConfig = Resources.Load<CameraScriptObject>(nameof(CameraConfig));
// CameraConfig = Resources.Load<CameraScriptObject>(nameof(CameraConfig));
}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 797250a29ac28db458a11e40145a9e6c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,110 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class BaitConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<BaitConfig> List { get; set; } = new List<BaitConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, BaitConfig> _configs = new ConcurrentDictionary<uint, BaitConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, BaitConfig> _configs = new Dictionary<uint, BaitConfig>();
#endif
private static BaitConfigData _instance = null;
public static BaitConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<BaitConfigData>(); }
private set => _instance = value;
}
public BaitConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"BaitConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out BaitConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class BaitConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Model { get; set; } // 模型
[ProtoMember(3)]
public uint EfficacyBase { get; set; } // 吸引力
[ProtoMember(4)]
public uint Length { get; set; } // 长度(毫米)
[ProtoMember(5)]
public uint Weight { get; set; } // 重量(克)
[ProtoMember(6)]
public uint[] Arr { get; set; } = Array.Empty<uint>(); // 重量(克)
[ProtoMember(7)]
public string[] ArrStr { get; set; } = Array.Empty<string>(); // 重量(克)
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6362bd09bd57c6647b87ac7abcde3a6c

View File

@@ -0,0 +1,108 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class BobberConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<BobberConfig> List { get; set; } = new List<BobberConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, BobberConfig> _configs = new ConcurrentDictionary<uint, BobberConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, BobberConfig> _configs = new Dictionary<uint, BobberConfig>();
#endif
private static BobberConfigData _instance = null;
public static BobberConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<BobberConfigData>(); }
private set => _instance = value;
}
public BobberConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"BobberConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out BobberConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class BobberConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Model { get; set; } // 模型
[ProtoMember(3)]
public uint Type { get; set; } // 类型
[ProtoMember(4)]
public uint Weight { get; set; } // 重量(克)
[ProtoMember(5)]
public uint Displacement { get; set; } // 位移
[ProtoMember(6)]
public uint NightLight { get; set; } // 是否夜光
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4c4ce5c38c2619a4f95a1bd26089cca7

View File

@@ -0,0 +1,106 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class FeederConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<FeederConfig> List { get; set; } = new List<FeederConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, FeederConfig> _configs = new ConcurrentDictionary<uint, FeederConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, FeederConfig> _configs = new Dictionary<uint, FeederConfig>();
#endif
private static FeederConfigData _instance = null;
public static FeederConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<FeederConfigData>(); }
private set => _instance = value;
}
public FeederConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"FeederConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out FeederConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class FeederConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Model { get; set; } // 模型
[ProtoMember(3)]
public uint Type { get; set; } // 类型
[ProtoMember(4)]
public uint Capacity { get; set; } // 能力
[ProtoMember(5)]
public uint Weight { get; set; } // 重量(克)
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: da3d806c80cc74148a23c2af19ecbe4d

View File

@@ -0,0 +1,110 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class FishConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<FishConfig> List { get; set; } = new List<FishConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, FishConfig> _configs = new ConcurrentDictionary<uint, FishConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, FishConfig> _configs = new Dictionary<uint, FishConfig>();
#endif
private static FishConfigData _instance = null;
public static FishConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<FishConfigData>(); }
private set => _instance = value;
}
public FishConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"FishConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out FishConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class FishConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string[] Model { get; set; } = Array.Empty<string>(); // 模型
[ProtoMember(3)]
public uint Type { get; set; } // 类型
[ProtoMember(4)]
public uint SpeciesName { get; set; } // 鱼类型Id
[ProtoMember(5)]
public uint MinWeight { get; set; } // 最小重量(克)
[ProtoMember(6)]
public uint MaxWeight { get; set; } // 最大重量(克)
[ProtoMember(7)]
public uint Accept { get; set; } // 接受饵
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 38a9a1b4cfa8ab24c8bb141ae7cba986

View File

@@ -0,0 +1,108 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class HookConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<HookConfig> List { get; set; } = new List<HookConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, HookConfig> _configs = new ConcurrentDictionary<uint, HookConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, HookConfig> _configs = new Dictionary<uint, HookConfig>();
#endif
private static HookConfigData _instance = null;
public static HookConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<HookConfigData>(); }
private set => _instance = value;
}
public HookConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"HookConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out HookConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class HookConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Model { get; set; } // 模型
[ProtoMember(3)]
public uint Type { get; set; } // 类型
[ProtoMember(4)]
public uint Zadzior { get; set; } // 长钉
[ProtoMember(5)]
public uint Length { get; set; } // 长度(毫米)
[ProtoMember(6)]
public uint Weight { get; set; } // 重量(克)
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 5a6178b7c5ee4ca45b28631c50966e28

View File

@@ -0,0 +1,108 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class LineConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<LineConfig> List { get; set; } = new List<LineConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, LineConfig> _configs = new ConcurrentDictionary<uint, LineConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, LineConfig> _configs = new Dictionary<uint, LineConfig>();
#endif
private static LineConfigData _instance = null;
public static LineConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<LineConfigData>(); }
private set => _instance = value;
}
public LineConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"LineConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out LineConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class LineConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Model { get; set; } // 模型
[ProtoMember(3)]
public uint Type { get; set; } // 类型
[ProtoMember(4)]
public uint Length { get; set; } // 长度(毫米)
[ProtoMember(5)]
public uint Strength { get; set; } // 强度
[ProtoMember(6)]
public uint Size { get; set; } // 尺寸
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: dd32cd6701963b84988ab6c9168f0568

View File

@@ -0,0 +1,108 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class LureConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<LureConfig> List { get; set; } = new List<LureConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, LureConfig> _configs = new ConcurrentDictionary<uint, LureConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, LureConfig> _configs = new Dictionary<uint, LureConfig>();
#endif
private static LureConfigData _instance = null;
public static LureConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<LureConfigData>(); }
private set => _instance = value;
}
public LureConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"LureConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out LureConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class LureConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Model { get; set; } // 模型
[ProtoMember(3)]
public uint[] Hook { get; set; } = Array.Empty<uint>(); // 勾
[ProtoMember(4)]
public uint EfficacyBase { get; set; } // 吸引力
[ProtoMember(5)]
public uint Length { get; set; } // 长度(毫米)
[ProtoMember(6)]
public uint Weight { get; set; } // 重量(克)
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: a3789e74296554d43b1ea6274f978384

View File

@@ -0,0 +1,108 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class ReelConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<ReelConfig> List { get; set; } = new List<ReelConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, ReelConfig> _configs = new ConcurrentDictionary<uint, ReelConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, ReelConfig> _configs = new Dictionary<uint, ReelConfig>();
#endif
private static ReelConfigData _instance = null;
public static ReelConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<ReelConfigData>(); }
private set => _instance = value;
}
public ReelConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"ReelConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out ReelConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class ReelConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Model { get; set; } // 模型
[ProtoMember(3)]
public uint Type { get; set; } // 类型
[ProtoMember(4)]
public float[] GearRatio { get; set; } = Array.Empty<float>(); // 组件比
[ProtoMember(5)]
public uint Size { get; set; } // 尺寸
[ProtoMember(6)]
public uint Strength { get; set; } // 强度
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 937f0fc7328e76f4a8f3137d0cf2bf3c

View File

@@ -0,0 +1,100 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class RingConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<RingConfig> List { get; set; } = new List<RingConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, RingConfig> _configs = new ConcurrentDictionary<uint, RingConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, RingConfig> _configs = new Dictionary<uint, RingConfig>();
#endif
private static RingConfigData _instance = null;
public static RingConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<RingConfigData>(); }
private set => _instance = value;
}
public RingConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"RingConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out RingConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class RingConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Model { get; set; } // 模型
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 011d34ec27d1f7740b439af74c883be5

View File

@@ -0,0 +1,114 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class RodConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<RodConfig> List { get; set; } = new List<RodConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, RodConfig> _configs = new ConcurrentDictionary<uint, RodConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, RodConfig> _configs = new Dictionary<uint, RodConfig>();
#endif
private static RodConfigData _instance = null;
public static RodConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<RodConfigData>(); }
private set => _instance = value;
}
public RodConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"RodConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out RodConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class RodConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Model { get; set; } // 模型
[ProtoMember(3)]
public uint Type { get; set; } // 类型
[ProtoMember(4)]
public uint Ring { get; set; } // 导线圈
[ProtoMember(5)]
public uint Length { get; set; } // 长度(毫米)
[ProtoMember(6)]
public uint Weight { get; set; } // 重量(克)
[ProtoMember(7)]
public uint Strength { get; set; } // 强度
[ProtoMember(8)]
public uint MaxRange { get; set; } // 最大范围
[ProtoMember(9)]
public uint ConstructionType { get; set; } // 结构类型
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 50e00e7722e5f804b9151354058842cc

View File

@@ -0,0 +1,102 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class Unit2ConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<Unit2Config> List { get; set; } = new List<Unit2Config>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, Unit2Config> _configs = new ConcurrentDictionary<uint, Unit2Config>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, Unit2Config> _configs = new Dictionary<uint, Unit2Config>();
#endif
private static Unit2ConfigData _instance = null;
public static Unit2ConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<Unit2ConfigData>(); }
private set => _instance = value;
}
public Unit2Config Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"Unit2Config not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out Unit2Config config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class Unit2Config : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Name { get; set; } // 名称
[ProtoMember(3)]
public string Model { get; set; } // 数据库类型
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0750f0970e8c3aa49bd98757da8cbe39

View File

@@ -0,0 +1,102 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class UnitConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<UnitConfig> List { get; set; } = new List<UnitConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, UnitConfig> _configs = new ConcurrentDictionary<uint, UnitConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, UnitConfig> _configs = new Dictionary<uint, UnitConfig>();
#endif
private static UnitConfigData _instance = null;
public static UnitConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<UnitConfigData>(); }
private set => _instance = value;
}
public UnitConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"UnitConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out UnitConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class UnitConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Name { get; set; } // 名称
[ProtoMember(3)]
public string Model { get; set; } // 数据库类型
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c4fcd00be96ef734682179e668d43ff5

View File

@@ -0,0 +1,104 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
#if FANTASY_NET
using Fantasy.ConfigTable;
using Fantasy.Serialize;
#else
using NBC;
using NBC.Serialize;
#endif
// ReSharper disable CollectionNeverUpdated.Global
// ReSharper disable UnusedAutoPropertyAccessor.Global
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
#pragma warning disable CS0169
#pragma warning disable CS8618
#pragma warning disable CS8625
#pragma warning disable CS8603
namespace Fantasy
{
[ProtoContract]
public sealed partial class WeightConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<WeightConfig> List { get; set; } = new List<WeightConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, WeightConfig> _configs = new ConcurrentDictionary<uint, WeightConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, WeightConfig> _configs = new Dictionary<uint, WeightConfig>();
#endif
private static WeightConfigData _instance = null;
public static WeightConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<WeightConfigData>(); }
private set => _instance = value;
}
public WeightConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"WeightConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out WeightConfig config)
{
config = null;
if (!_configs.ContainsKey(id))
{
return false;
}
config = _configs[id];
return true;
}
public override void AfterDeserialization()
{
foreach (var config in List)
{
#if FANTASY_NET
_configs.TryAdd(config.Id, config);
#else
_configs.Add(config.Id, config);
#endif
config.AfterDeserialization();
}
EndInit();
}
public override void Dispose()
{
Instance = null;
}
}
[ProtoContract]
public sealed partial class WeightConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Model { get; set; } // 模型
[ProtoMember(3)]
public uint Type { get; set; } // 类型
[ProtoMember(4)]
public uint Weight { get; set; } // 重量(克)
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 190543eb94e16a24ba18b202c8f66cd3

View File

@@ -0,0 +1,323 @@
{
"Unit2Config": [
{
"Id": 1,
"Name": "Unit01",
"Model": "Unit01"
}
],
"WeightConfig": [
{
"Id": 800001,
"Model": "Weights/Weight2_5g",
"Type": 0,
"Weight": 3
}
],
"UnitConfig": [
{
"Id": 1,
"Name": "Unit01",
"Model": "Unit01"
}
],
"RingConfig": [
{
"Id": 1100001,
"Model": "rod_rings/rumoi/rumoi_oxiline_spin"
},
{
"Id": 1100002,
"Model": "rod_rings/smt/smt_pure_ceramic_bolo"
}
],
"LureConfig": [
{
"Id": 600001,
"Model": "lures/express_fishing/crankbaits_1/775/crankbaits_775",
"Hook": [
700102
],
"EfficacyBase": 50,
"Length": 0,
"Weight": 250
},
{
"Id": 600002,
"Model": "lures/express_fishing/poppers_1/poppers_590/poppers_590",
"Hook": [
700102
],
"EfficacyBase": 50,
"Length": 0,
"Weight": 120
},
{
"Id": 600003,
"Model": "lures/express_fishing/softplastic/ef_supergrab_6/softplastic_g_1622",
"Hook": [
0
],
"EfficacyBase": 50,
"Length": 0,
"Weight": 120
},
{
"Id": 600004,
"Model": "lures/express_fishing/softplastic/ef_superminnow_6/softplastic_m_1634",
"Hook": [
0
],
"EfficacyBase": 50,
"Length": 0,
"Weight": 120
}
],
"ReelConfig": [
{
"Id": 200001,
"Model": "reels/syberia/spin_5002/spin_5002",
"Type": 0,
"GearRatio": [
"7"
],
"Size": 250,
"Strength": 40
},
{
"Id": 200002,
"Model": "reels/syberia/spin_5036/spin_5036",
"Type": 0,
"GearRatio": [
"5"
],
"Size": 120,
"Strength": 40
}
],
"LineConfig": [
{
"Id": 400001,
"Model": "Lines/UFE Mono/UFE monoClear",
"Type": 0,
"Length": 7,
"Strength": 40,
"Size": 1
},
{
"Id": 400002,
"Model": "rods/syberia/bolo_10021/bolo_10021_LB400",
"Type": 0,
"Length": 5,
"Strength": 40,
"Size": 1
}
],
"HookConfig": [
{
"Id": 700001,
"Model": "hooks/alliance/c_hook_20789_20794/c_hook_20789",
"Type": 1,
"Zadzior": 1,
"Length": 0,
"Weight": 1
},
{
"Id": 700002,
"Model": "hooks/berserk_hooks/triple_20569_20577/triple_20569",
"Type": 1,
"Zadzior": 1,
"Length": 0,
"Weight": 1
}
],
"RodConfig": [
{
"Id": 100001,
"Model": "rods/syberia/tele_10037/tele_10037_t13",
"Type": 1,
"Ring": 0,
"Length": 7,
"Weight": 250,
"Strength": 40,
"MaxRange": 67,
"ConstructionType": 0
},
{
"Id": 100002,
"Model": "rods/syberia/bolo_10021/bolo_10021_LB400",
"Type": 0,
"Ring": 1100002,
"Length": 5,
"Weight": 120,
"Strength": 40,
"MaxRange": 30,
"ConstructionType": 0
},
{
"Id": 100003,
"Model": "rods/syberia/spin_10034/spin_10034_S60H",
"Type": 0,
"Ring": 1100001,
"Length": 5,
"Weight": 120,
"Strength": 40,
"MaxRange": 30,
"ConstructionType": 0
}
],
"FishConfig": [
{
"Id": 2200001,
"Model": [
"Burbot_B"
],
"Type": 0,
"SpeciesName": 10,
"MinWeight": 1,
"MaxWeight": 34,
"Accept": 2100001
},
{
"Id": 2200002,
"Model": [
"CarpCommon_B"
],
"Type": 0,
"SpeciesName": 11,
"MinWeight": 1,
"MaxWeight": 34,
"Accept": 2100001
},
{
"Id": 2200003,
"Model": [
"CarpGrass_B"
],
"Type": 0,
"SpeciesName": 14,
"MinWeight": 1,
"MaxWeight": 34,
"Accept": 2100001
},
{
"Id": 2200004,
"Model": [
"CarpCrucian_B"
],
"Type": 0,
"SpeciesName": 16,
"MinWeight": 1,
"MaxWeight": 34,
"Accept": 2100001
}
],
"BobberConfig": [
{
"Id": 300001,
"Model": "bobbers/expressfishing/bob_25003/bob_25003",
"Type": 2,
"Weight": 1,
"Displacement": 40,
"NightLight": 0
},
{
"Id": 300002,
"Model": "bobbers/expressfishing/bob_25162_25163/bob_25162",
"Type": 0,
"Weight": 1,
"Displacement": 40,
"NightLight": 0
},
{
"Id": 300003,
"Model": "bobbers/expressfishing/bob_25166_25167/bob_25166",
"Type": 0,
"Weight": 1,
"Displacement": 40,
"NightLight": 0
},
{
"Id": 300004,
"Model": "bobbers/expressfishing/bob_25001/bob_25001",
"Type": 0,
"Weight": 1,
"Displacement": 40,
"NightLight": 0
}
],
"FeederConfig": [
{
"Id": 900001,
"Model": "Feeders/Feeder 1/FeedTrash 1",
"Type": 0,
"Capacity": 100,
"Weight": 5
}
],
"BaitConfig": [
{
"Id": 500001,
"Model": "baits/worm_01/worm_01",
"EfficacyBase": 15,
"Length": 0,
"Weight": 250,
"Arr": [
250,
1,
2,
3
],
"ArrStr": [
"d",
"a",
"bb",
"e|12"
]
},
{
"Id": 500002,
"Model": "baits/fly/fly",
"EfficacyBase": 15,
"Length": 0,
"Weight": 120,
"Arr": [
120,
4,
3
],
"ArrStr": [
"120",
"4",
"3"
]
},
{
"Id": 500003,
"Model": "baits/black_leech/black_leech",
"EfficacyBase": 15,
"Length": 0,
"Weight": 120,
"Arr": [
120
],
"ArrStr": [
"kkk"
]
},
{
"Id": 500004,
"Model": "baits/bread/bread",
"EfficacyBase": 15,
"Length": 0,
"Weight": 120,
"Arr": [
120
],
"ArrStr": [
"11|33",
"44|2"
]
}
]
}

View File

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

View File

@@ -111,7 +111,7 @@ namespace NBF
private void LoadData()
{
ConfigAssets.Init();
// ConfigAssets.Init();
}
private async FTask OpenUI()

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5ccc2499679c40909ac59a0a325c78c4
timeCreated: 1759160041

View File

@@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.IO;
using NBC.Serialize;
namespace NBC
{
/// <summary>
/// 配置表帮助类
/// </summary>
public static class ConfigTableHelper
{
private static string _configTableBinaryDirectory;
private static readonly object Lock = new object();
// 配置表数据缓存字典
private static readonly Dictionary<string, ASerialize> ConfigDic = new ();
/// <summary>
/// 初始化ConfigTableHelper
/// </summary>
/// <param name="configTableBinaryDirectory"></param>
public static void Initialize(string configTableBinaryDirectory)
{
_configTableBinaryDirectory = configTableBinaryDirectory;
}
/// <summary>
/// 加载配置表数据
/// </summary>
/// <typeparam name="T">配置表类型</typeparam>
/// <returns>配置表数据</returns>
public static T Load<T>() where T : ASerialize
{
lock (Lock)
{
try
{
var dataConfig = typeof(T).Name;
if (ConfigDic.TryGetValue(dataConfig, out var aProto))
{
return (T)aProto;
}
var configFile = GetConfigPath(dataConfig);
var bytes = File.ReadAllBytes(configFile);
// Log.Debug($"dataConfig:{dataConfig} {bytes.Length}");
var data = SerializerManager.GetSerializer(FantasySerializerType.ProtoBuf).Deserialize<T>(bytes);
ConfigDic[dataConfig] = data;
return data;
}
catch (Exception ex)
{
throw new Exception($"ConfigTableManage:{typeof(T).Name} 数据表加载之后反序列化时出错:{ex}");
}
}
}
/// <summary>
/// 获取配置表文件路径
/// </summary>
/// <param name="name">配置表名称</param>
/// <returns>配置表文件路径</returns>
private static string GetConfigPath(string name)
{
var configFile = Path.Combine(_configTableBinaryDirectory, $"{name}.bytes");
if (File.Exists(configFile))
{
return configFile;
}
throw new FileNotFoundException($"{name}.byte not found: {configFile}");
}
/// <summary>
/// 重新加载配置表数据
/// </summary>
public static void ReLoadConfigTable()
{
lock (Lock)
{
foreach (var (_, aProto) in ConfigDic)
{
((IDisposable) aProto).Dispose();
}
ConfigDic.Clear();
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: de53a788ec4e446eb6c07c50c65afcc2
timeCreated: 1759160093

View File

@@ -0,0 +1,7 @@
namespace NBC
{
/// <summary>
/// 表示是一个配置文件
/// </summary>
public interface IConfigTable { }
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: df4eb038440a4a498e27ccaf23a1cd9b
timeCreated: 1759160060