Skip to content

Commit

Permalink
新增 unity asset 数据源支持
Browse files Browse the repository at this point in the history
  • Loading branch information
pirunxi committed Dec 18, 2021
1 parent a639309 commit 8dd04d6
Show file tree
Hide file tree
Showing 21 changed files with 299 additions and 0 deletions.
21 changes: 21 additions & 0 deletions DesignerConfigs/Datas/test/unity_scriptable_objects/1.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1cbff1bfa4708914aaa381b1dd914663, type: 3}
m_Name: 1
m_EditorClassIdentifier:
id: 1
desc: aaaa
rate: 0.45
num: 12131
v2: {x: 1, y: 1}
v3: {x: 2, y: 2, z: 2}
v4: {x: 3, y: 3, z: 4, w: 4}
21 changes: 21 additions & 0 deletions DesignerConfigs/Datas/test/unity_scriptable_objects/2.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1cbff1bfa4708914aaa381b1dd914663, type: 3}
m_Name: 2
m_EditorClassIdentifier:
id: 2
desc: bbbbb
rate: 0.8
num: 1111
v2: {x: 1, y: 2}
v3: {x: 1, y: 2, z: 3}
v4: {x: 1, y: 2, z: 3, w: 4}
11 changes: 11 additions & 0 deletions DesignerConfigs/Defines/test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,17 @@
<table name="TbTestSep" value="TestSep" define_from_file="1" input="test/test_sep.xlsx"/>


<bean name="TestScriptableObject">
<var name="id" type="int"/>
<var name="desc" type="string"/>
<var name="rate" type="float"/>
<var name="num" type="int"/>
<var name="v2" type="vector2"/>
<var name="v3" type="vector3"/>
<var name="v4" type="vector4"/>
</bean>
<table name="TbTestScriptableObject" value="TestScriptableObject" input="test/unity_scriptable_objects"/>


<enum name="AudioType" externaltype="unity_audio_type">
<var name="UNKNOWN" value="0"/>
Expand Down
5 changes: 5 additions & 0 deletions Projects/Csharp_DotNet5_json/Gen/Tables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public sealed class Tables
public test.TbMultiIndexList TbMultiIndexList {get; }
public test.TbDataFromMisc TbDataFromMisc {get; }
public test.TbMultiRowRecord TbMultiRowRecord {get; }
public test.TbTestMultiColumn TbTestMultiColumn {get; }
public test.TbMultiRowTitle TbMultiRowTitle {get; }
public test.TbTestNull TbTestNull {get; }
public test.TbDemoPrimitive TbDemoPrimitive {get; }
Expand Down Expand Up @@ -123,6 +124,8 @@ public Tables(System.Func<string, JsonElement> loader)
tables.Add("test.TbDataFromMisc", TbDataFromMisc);
TbMultiRowRecord = new test.TbMultiRowRecord(loader("test_tbmultirowrecord"));
tables.Add("test.TbMultiRowRecord", TbMultiRowRecord);
TbTestMultiColumn = new test.TbTestMultiColumn(loader("test_tbtestmulticolumn"));
tables.Add("test.TbTestMultiColumn", TbTestMultiColumn);
TbMultiRowTitle = new test.TbMultiRowTitle(loader("test_tbmultirowtitle"));
tables.Add("test.TbMultiRowTitle", TbMultiRowTitle);
TbTestNull = new test.TbTestNull(loader("test_tbtestnull"));
Expand Down Expand Up @@ -208,6 +211,7 @@ public Tables(System.Func<string, JsonElement> loader)
TbMultiIndexList.Resolve(tables);
TbDataFromMisc.Resolve(tables);
TbMultiRowRecord.Resolve(tables);
TbTestMultiColumn.Resolve(tables);
TbMultiRowTitle.Resolve(tables);
TbTestNull.Resolve(tables);
TbDemoPrimitive.Resolve(tables);
Expand Down Expand Up @@ -266,6 +270,7 @@ public void TranslateText(System.Func<string, string, string> translator)
TbMultiIndexList.TranslateText(translator);
TbDataFromMisc.TranslateText(translator);
TbMultiRowRecord.TranslateText(translator);
TbTestMultiColumn.TranslateText(translator);
TbMultiRowTitle.TranslateText(translator);
TbTestNull.TranslateText(translator);
TbDemoPrimitive.TranslateText(translator);
Expand Down
63 changes: 63 additions & 0 deletions Projects/Csharp_DotNet5_json/Gen/test/Foo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

//------------------------------------------------------------------------------
// <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 System.Text.Json;



namespace cfg.test
{

public sealed class Foo : Bright.Config.BeanBase
{
public Foo(JsonElement _json)
{
Y1 = _json.GetProperty("y1").GetInt32();
Y2 = _json.GetProperty("y2").GetInt32();
Y3 = _json.GetProperty("y3").GetInt32();
}

public Foo(int y1, int y2, int y3 )
{
this.Y1 = y1;
this.Y2 = y2;
this.Y3 = y3;
}

public static Foo DeserializeFoo(JsonElement _json)
{
return new test.Foo(_json);
}

public int Y1 { get; private set; }
public int Y2 { get; private set; }
public int Y3 { get; private set; }

public const int __ID__ = -1147950774;
public override int GetTypeId() => __ID__;

public void Resolve(Dictionary<string, object> _tables)
{
}

public void TranslateText(System.Func<string, string, string> translator)
{
}

public override string ToString()
{
return "{ "
+ "Y1:" + Y1 + ","
+ "Y2:" + Y2 + ","
+ "Y3:" + Y3 + ","
+ "}";
}
}
}
61 changes: 61 additions & 0 deletions Projects/Csharp_DotNet5_json/Gen/test/TbTestMultiColumn.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

//------------------------------------------------------------------------------
// <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 System.Text.Json;



namespace cfg.test
{

public sealed class TbTestMultiColumn
{
private readonly Dictionary<int, test.TestMultiColumn> _dataMap;
private readonly List<test.TestMultiColumn> _dataList;

public TbTestMultiColumn(JsonElement _json)
{
_dataMap = new Dictionary<int, test.TestMultiColumn>();
_dataList = new List<test.TestMultiColumn>();

foreach(JsonElement _row in _json.EnumerateArray())
{
var _v = test.TestMultiColumn.DeserializeTestMultiColumn(_row);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
}

public Dictionary<int, test.TestMultiColumn> DataMap => _dataMap;
public List<test.TestMultiColumn> DataList => _dataList;

public test.TestMultiColumn GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public test.TestMultiColumn Get(int key) => _dataMap[key];
public test.TestMultiColumn this[int key] => _dataMap[key];

public void Resolve(Dictionary<string, object> _tables)
{
foreach(var v in _dataList)
{
v.Resolve(_tables);
}
}

public void TranslateText(System.Func<string, string, string> translator)
{
foreach(var v in _dataList)
{
v.TranslateText(translator);
}
}

}

}
73 changes: 73 additions & 0 deletions Projects/Csharp_DotNet5_json/Gen/test/TestMultiColumn.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

//------------------------------------------------------------------------------
// <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 System.Text.Json;



namespace cfg.test
{

public sealed class TestMultiColumn : Bright.Config.BeanBase
{
public TestMultiColumn(JsonElement _json)
{
Id = _json.GetProperty("id").GetInt32();
A = test.Foo.DeserializeFoo(_json.GetProperty("a"));
B = test.Foo.DeserializeFoo(_json.GetProperty("b"));
C = test.Foo.DeserializeFoo(_json.GetProperty("c"));
}

public TestMultiColumn(int id, test.Foo a, test.Foo b, test.Foo c )
{
this.Id = id;
this.A = a;
this.B = b;
this.C = c;
}

public static TestMultiColumn DeserializeTestMultiColumn(JsonElement _json)
{
return new test.TestMultiColumn(_json);
}

public int Id { get; private set; }
public test.Foo A { get; private set; }
public test.Foo B { get; private set; }
public test.Foo C { get; private set; }

public const int __ID__ = -294473599;
public override int GetTypeId() => __ID__;

public void Resolve(Dictionary<string, object> _tables)
{
A?.Resolve(_tables);
B?.Resolve(_tables);
C?.Resolve(_tables);
}

public void TranslateText(System.Func<string, string, string> translator)
{
A?.TranslateText(translator);
B?.TranslateText(translator);
C?.TranslateText(translator);
}

public override string ToString()
{
return "{ "
+ "Id:" + Id + ","
+ "A:" + A + ","
+ "B:" + B + ","
+ "C:" + C + ","
+ "}";
}
}
}
44 changes: 44 additions & 0 deletions Projects/GenerateDatas/json/test_tbtestscriptableobject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[
{
"id": 1,
"desc": "aaaa",
"rate": 0.45,
"num": 12131,
"v2": {
"x": 1,
"y": 1
},
"v3": {
"x": 2,
"y": 2,
"z": 2
},
"v4": {
"x": 3,
"y": 3,
"z": 4,
"w": 4
}
},
{
"id": 2,
"desc": "bbbbb",
"rate": 0.8,
"num": 1111,
"v2": {
"x": 1,
"y": 2
},
"v3": {
"x": 1,
"y": 2,
"z": 3
},
"v4": {
"x": 1,
"y": 2,
"z": 3,
"w": 4
}
}
]
Binary file modified Tools/Luban.ClientServer/Luban.Client.dll
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.Client.exe
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.ClientServer.dll
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.ClientServer.exe
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.Common.dll
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.Job.Cfg.dll
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.Job.Common.dll
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.Job.Db.dll
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.Job.Proto.dll
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.Server.Common.dll
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.Server.dll
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/Luban.Server.exe
Binary file not shown.
Binary file modified Tools/Luban.ClientServer/ref/Luban.Job.Cfg.dll
Binary file not shown.

0 comments on commit 8dd04d6

Please sign in to comment.