Skip to content

Commit 34d687c

Browse files
committed
SDKManager
1 parent a42de4b commit 34d687c

147 files changed

Lines changed: 1050 additions & 26409 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Assets/Script/Core/AnimSystem/AnimData.cs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public bool AnimReplayLogic()
170170
else
171171
{
172172
m_repeatCount--;
173-
return (m_repeatCount < 0);
173+
return (m_repeatCount > 0);
174174
}
175175
}
176176

@@ -205,9 +205,6 @@ public void ExchangeAlpha()
205205

206206
public void Init()
207207
{
208-
m_currentTime = 0;
209-
m_isDone = false;
210-
211208
switch (m_animType)
212209
{
213210
case AnimType.UGUI_Color: UguiColorInit(m_isChild); break;
@@ -231,6 +228,21 @@ public void Init()
231228
}
232229
}
233230

231+
public override void OnRelease()
232+
{
233+
m_ignoreTimeScale = false;
234+
235+
m_delayTime = 0;
236+
m_isDone = false;
237+
m_currentTime = 0;
238+
m_totalTime = 0;
239+
m_repeatCount = -1;
240+
241+
m_pathType = PathType.Line;
242+
m_v3Contral = null;
243+
m_floatContral = null;
244+
}
245+
234246
#endregion
235247

236248
#region CustomMethod

Assets/Script/Core/AnimSystem/AnimSystem.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,6 @@ void Update()
969969
{
970970
for (int i = 0; i < animList.Count; i++)
971971
{
972-
//Debug.Log(animList.Count+">>>"+i);
973972
//执行Update
974973
animList[i].executeUpdate();
975974

@@ -981,13 +980,13 @@ void Update()
981980
{
982981
animList.Remove(animTmp);
983982
i--;
983+
984+
//释放
985+
animTmp.Release();
984986
}
985987

986988
//执行回调
987989
animTmp.executeCallBack();
988-
989-
//释放
990-
animTmp.Release();
991990
}
992991
}
993992
}

Assets/Script/Core/Data/DataManager.cs

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
using System.Text;
66
using System;
77
using LuaInterface;
8+
using System.IO;
89

910
/*
1011
* 数据管理器,只读,可热更新,可使用默认值
1112
* 通过ResourceManager加载
1213
* */
13-
public class DataManager
14+
public class DataManager
1415
{
1516
public const string c_directoryName = "Data";
16-
public const string c_expandName = "txt";
17+
public const string c_expandName = "txt";
1718

1819
/// <summary>
1920
/// 数据缓存
@@ -41,13 +42,17 @@ public static DataTable GetData(string DataName)
4142
{
4243
try
4344
{
45+
//编辑器下不处理缓存
46+
#if !UNITY_EDITOR
47+
4448
if (s_dataCatch.ContainsKey(DataName))
4549
{
4650
return s_dataCatch[DataName];
4751
}
4852

49-
DataTable data = null;
53+
#endif
5054

55+
DataTable data = null;
5156
string dataJson = "";
5257

5358
#if UNITY_EDITOR
@@ -58,7 +63,6 @@ public static DataTable GetData(string DataName)
5863
}
5964
else
6065
{
61-
6266
dataJson = ResourceIOTool.ReadStringByResource(
6367
PathTool.GetRelativelyPath(c_directoryName,
6468
DataName,
@@ -80,7 +84,7 @@ public static DataTable GetData(string DataName)
8084

8185
return data;
8286
}
83-
catch(Exception e)
87+
catch (Exception e)
8488
{
8589
throw new Exception("->" + DataName + "<- : " + e.ToString());
8690
}
@@ -95,7 +99,7 @@ public static void CleanCatch()
9599
}
96100

97101
//只在编辑器下能够使用
98-
#if UNITY_EDITOR
102+
#if UNITY_EDITOR
99103

100104
[NoToLuaAttribute]
101105
public static void SaveData(string ConfigName, DataTable data)
@@ -106,7 +110,7 @@ public static void SaveData(string ConfigName, DataTable data)
106110
PathTool.GetRelativelyPath(
107111
c_directoryName,
108112
ConfigName,
109-
c_expandName)),
113+
c_expandName)),
110114
DataTable.Serialize(data));
111115

112116
UnityEditor.AssetDatabase.Refresh();
@@ -126,7 +130,7 @@ public static Dictionary<string, object> GetEditorData(string dataName)
126130
if (dataJson == "")
127131
{
128132
Debug.Log(dataName + " dont find!");
129-
return new Dictionary<string,object>();
133+
return new Dictionary<string, object>();
130134
}
131135
else
132136
{
@@ -148,5 +152,38 @@ public static void SaveEditorData(string ConfigName, Dictionary<string, object>
148152

149153
UnityEditor.AssetDatabase.Refresh();
150154
}
155+
156+
static void ConvertUtf8()
157+
{
158+
//ConvertFileEncoding("e:\\555.txt", null, System.Text.Encoding.UTF8);
159+
string stmp = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
160+
Console.WriteLine(stmp);
161+
162+
DirectoryInfo TheFolder = new DirectoryInfo(stmp);
163+
164+
foreach (FileInfo NextFile in TheFolder.GetFiles())
165+
{
166+
if (NextFile.Name.EndsWith("txt"))
167+
{
168+
FileTool.ConvertFileEncoding(stmp + NextFile.Name, null, System.Text.Encoding.UTF8);
169+
}
170+
}
171+
172+
foreach (DirectoryInfo NextFolder in TheFolder.GetDirectories())
173+
{
174+
string stmp_inside = stmp + NextFolder.Name + @"\";
175+
DirectoryInfo TheFolder_inside = new DirectoryInfo(stmp_inside);
176+
foreach (FileInfo NextFile2 in TheFolder_inside.GetFiles())
177+
{
178+
if (NextFile2.Name.EndsWith("txt"))
179+
{
180+
FileTool.ConvertFileEncoding(stmp_inside + NextFile2.Name, null, System.Text.Encoding.UTF8);
181+
}
182+
}
183+
}
184+
}
185+
186+
187+
151188
#endif
152189
}

Assets/Script/Core/Data/DataTable.cs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,23 @@ public class DataTable : Dictionary<string, SingleData>
5454
/// <returns>表单数据</returns>
5555
public static DataTable Analysis(string stringData)
5656
{
57-
//try
58-
//{
57+
string debugContent = "";
58+
int debugLineCount = 0;
59+
int debugRowCount = 0;
60+
61+
try
62+
{
5963
int lineIndex = 0;
6064
DataTable data = new DataTable();
6165
string[] line = stringData.Split(c_newline.ToCharArray());
6266

6367
//第一行作为Key
68+
debugContent = "解析Key";
6469
data.TableKeys = new List<string>();
6570
string[] rowKeys = ConvertStringArray(line[0]);
6671
for (int i = 0; i < rowKeys.Length; i++)
6772
{
73+
debugRowCount = i;
6874
if (!rowKeys[i].Equals(""))
6975
{
7076
data.TableKeys.Add(rowKeys[i]);
@@ -76,26 +82,32 @@ public static DataTable Analysis(string stringData)
7682
{
7783
if (line[lineIndex] != "" && line[lineIndex] != null)
7884
{
85+
debugLineCount = lineIndex;
7986
LineData = ConvertStringArray(line[lineIndex]);
8087

8188
//注释
89+
8290
if (LineData[0].Equals(c_noteTableTitle))
8391
{
92+
debugContent = "解析注释";
8493
AnalysisNoteValue(data, LineData);
8594
}
8695
//默认值
8796
else if (LineData[0].Equals(c_defaultValueTableTitle))
8897
{
98+
debugContent = "解析默认值";
8999
AnalysisDefaultValue(data, LineData);
90100
}
91101
//数据类型
92102
else if (LineData[0].Equals(c_fieldTypeTableTitle))
93103
{
104+
debugContent = "解析类型";
94105
AnalysisFieldType(data, LineData);
95106
}
96107
//数据正文
97108
else
98109
{
110+
debugContent = "解析正文";
99111
break;
100112
}
101113
}
@@ -106,6 +118,7 @@ public static DataTable Analysis(string stringData)
106118
//开始解析数据
107119
for (int i = lineIndex; i < line.Length; i++)
108120
{
121+
debugLineCount = i;
109122
SingleData dataTmp = new SingleData();
110123
dataTmp.data = data;
111124

@@ -115,6 +128,7 @@ public static DataTable Analysis(string stringData)
115128

116129
for (int j = 0; j < data.TableKeys.Count; j++)
117130
{
131+
debugRowCount = j;
118132
if (!row[j].Equals(""))
119133
{
120134
dataTmp.Add(data.TableKeys[j], row[j]);
@@ -127,11 +141,11 @@ public static DataTable Analysis(string stringData)
127141
}
128142

129143
return data;
130-
//}
131-
//catch (Exception e)
132-
//{
133-
// throw new Exception("Analysis: Don't convert value to DataTable:" + "\n" + e.ToString()); // throw
134-
//}
144+
}
145+
catch (Exception e)
146+
{
147+
throw new Exception("Analysis: Don't convert value to DataTable: 错误类型:" + debugContent + " 行:" + debugLineCount + " 列:" + debugRowCount + "\n" + e.ToString()); // throw
148+
}
135149
}
136150

137151
/// <summary>

Assets/Script/Core/Editor/Application/ApplicationManagerComponentEditor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public int GetStatusIndex()
8787
return i;
8888
}
8989
}
90-
9190
return 0;
9291
}
9392
}

Assets/Script/Core/Editor/Data/DataEditorWindow.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@ public static void ShowWindow()
2525

2626
void OnEnable()
2727
{
28-
//if (!Application.isPlaying)
29-
//{
28+
ConvertUtf8();
29+
3030
m_currentSelectIndex = 0;
3131
EditorGUIStyleData.Init();
3232

3333
FindAllDataName();
34-
//}
3534
}
3635

3736
//当选择改变时
@@ -45,6 +44,8 @@ void OnProjectChange()
4544
{
4645
if (!Application.isPlaying)
4746
{
47+
ConvertUtf8();
48+
4849
FindAllDataName();
4950

5051
if (m_currentDataName != null
@@ -895,6 +896,19 @@ string OutPutFieldName(FieldType fileType, string enumType)
895896
}
896897

897898
#endregion
899+
900+
#region Utf-8转换
901+
902+
public static void ConvertUtf8()
903+
{
904+
FileTool.RecursionFileExecute(Application.dataPath + "/Resources/" + DataManager.c_directoryName, "txt", (name) =>
905+
{
906+
//Debug.Log("ConvertUtf8 path-> " + name);
907+
FileTool.ConvertFileEncoding(name, null, System.Text.Encoding.UTF8);
908+
});
909+
}
910+
911+
#endregion
898912
}
899913

900914

Assets/Script/Core/Editor/ResourceLoad/PackageConfigEditorWindow.cs

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,24 @@ void OnGUI()
114114
CheckPackage();
115115
}
116116

117-
if (GUILayout.Button("保存编辑器设置文件"))
118-
{
119-
CreatPackageFile();
120-
}
117+
//if (GUILayout.Button("重新添加资源文件并保存"))
118+
//{
119+
// AddAllResourceBundle(); //添加资源文件
120+
// ArrangeBundlesByLayer(); //整理资源路径
121121

122-
if (GUILayout.Button("生成游戏资源路径文件"))
122+
// CreatPackageFile(); //保存编辑器文件
123+
// CheckAndCreatBundelPackageConfig(); //生成资源路径文件
124+
//}
125+
126+
if (GUILayout.Button("保存游戏资源路径文件"))
123127
{
124-
CheckAndCreatBundelPackageConfig();
128+
CreatPackageFile(); //保存编辑器文件
129+
CheckAndCreatBundelPackageConfig(); //生成资源路径文件
125130
}
126131

127132
if(!isPacking)
128133
{
129-
if (GUILayout.Button("打包 并生成MD5文件"))
134+
if (GUILayout.Button("打包"))
130135
{
131136
CheckAndPackage();
132137
}
@@ -139,10 +144,10 @@ void OnGUI()
139144
}
140145
}
141146

142-
if (GUILayout.Button("生成MD5"))
143-
{
144-
CheckAndCreatBundelPackageConfig();
145-
}
147+
//if (GUILayout.Button("生成MD5"))
148+
//{
149+
// CheckAndCreatBundelPackageConfig();
150+
//}
146151

147152
GUILayout.BeginHorizontal();
148153

@@ -343,6 +348,15 @@ void BundlesView()
343348
ArrangeBundlesByLayer();
344349
}
345350

351+
if (GUILayout.Button("自动添加 Resource 目录下的资源并保存"))
352+
{
353+
AddAllResourceBundle(); //添加资源文件
354+
ArrangeBundlesByLayer(); //整理资源路径
355+
356+
CreatPackageFile(); //保存编辑器文件
357+
CheckAndCreatBundelPackageConfig(); //生成资源路径文件
358+
}
359+
346360
if (GUILayout.Button("增加选中资源"))
347361
{
348362
//获取选中的资源

0 commit comments

Comments
 (0)