Skip to content

Commit a669c56

Browse files
author
wanderer
committed
email
1 parent bedc9aa commit a669c56

Some content is hidden

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

66 files changed

+1749
-1741
lines changed

Base/GameMode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Copyright (c) 2018 Zhang Yang. All rights reserved.
44
// </copyright>
55
// <describe> #游戏的管理类# </describe>
6-
// <email> yeozhang@qq.com </email>
6+
// <email> dutifulwanderer@gmail.com </email>
77
// <time> #2018年6月25日 12点06分# </time>
88
//-----------------------------------------------------------------------
99

Editor/GameMode/GameModeEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Copyright (c) 2018 Zhang Yang. All rights reserved.
44
// </copyright>
55
// <describe> #GameMode的编辑器类# </describe>
6-
// <email> yeozhang@qq.com </email>
6+
// <email> dutifulwanderer@gmail.com </email>
77
// <time> #2018年6月25日 12点23分# </time>
88
//-----------------------------------------------------------------------
99

Editor/GameMode/Module/ResourceModuleEditor.cs

Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Copyright (c) 2018 Zhang Yang. All rights reserved.
44
// </copyright>
55
// <describe> #资源模块编辑器# </describe>
6-
// <email> yeozhang@qq.com </email>
6+
// <email> dutifulwanderer@gmail.com </email>
77
// <time> #2018年12月15日 17点24分# </time>
88
//-----------------------------------------------------------------------
99

@@ -20,16 +20,16 @@ public class ResourceModuleEditor : ModuleEditorBase
2020
private BuildTargetGroup _lastBuildTargetGroup;
2121
private string _lastScriptingDefineSymbols;
2222
//资源更新类型
23-
private const string RESOURCEUPDATETYPE="ResourceUpdateType";
23+
private const string RESOURCEUPDATETYPE = "ResourceUpdateType";
2424
//资源本地路径
25-
private const string PATHTYPE="PathType";
25+
private const string PATHTYPE = "PathType";
2626
//资源更新的路径
27-
private const string RESOFFICIALUPDATEPATH="ResOfficialUpdatePath";
27+
private const string RESOFFICIALUPDATEPATH = "ResOfficialUpdatePath";
2828
//测试更新的路径
2929
private const string RESTESTUPDATEPATH = "ResTestUpdatePath";
3030
//默认是否需要从StreamingAsset里面拷贝到可读文件夹中
31-
private const string DEFAULTINSTREAMINGASSET= "DefaultInStreamingAsset";
32-
31+
private const string DEFAULTINSTREAMINGASSET = "DefaultInStreamingAsset";
32+
3333
public ResourceModuleEditor(string name, Color mainColor, GameMode gameMode)
3434
: base(name, mainColor, gameMode)
3535
{
@@ -41,107 +41,107 @@ public ResourceModuleEditor(string name, Color mainColor, GameMode gameMode)
4141
public override void OnDrawGUI()
4242
{
4343
//检查配置文件
44-
if(!NoConfigError())
44+
if (!NoConfigError())
4545
{
4646

47-
GUILayout.BeginVertical("HelpBox");
47+
GUILayout.BeginVertical("HelpBox");
4848

49-
GUILayout.BeginHorizontal("HelpBox");
50-
GUILayout.Label("Define", GUILayout.Width(50));
51-
string scriptingDefineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(_lastBuildTargetGroup);
52-
_lastScriptingDefineSymbols = GUILayout.TextArea(_lastScriptingDefineSymbols);
53-
if (GUILayout.Button("OK", GUILayout.Width(40)) && !_lastScriptingDefineSymbols.Equals(scriptingDefineSymbols))
54-
{
55-
_lastBuildTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);
56-
PlayerSettings.SetScriptingDefineSymbolsForGroup(_lastBuildTargetGroup, _lastScriptingDefineSymbols);
57-
}
58-
GUILayout.EndHorizontal();
49+
GUILayout.BeginHorizontal("HelpBox");
50+
GUILayout.Label("Define", GUILayout.Width(50));
51+
string scriptingDefineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(_lastBuildTargetGroup);
52+
_lastScriptingDefineSymbols = GUILayout.TextArea(_lastScriptingDefineSymbols);
53+
if (GUILayout.Button("OK", GUILayout.Width(40)) && !_lastScriptingDefineSymbols.Equals(scriptingDefineSymbols))
54+
{
55+
_lastBuildTargetGroup = BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget);
56+
PlayerSettings.SetScriptingDefineSymbolsForGroup(_lastBuildTargetGroup, _lastScriptingDefineSymbols);
57+
}
58+
GUILayout.EndHorizontal();
5959

60-
//检查配置文件是否存在
61-
CheckConfig(RESOURCEUPDATETYPE,0);
62-
ResourceUpdateType gameModeResourceUpdateType= (ResourceUpdateType)(int)_gameMode.ConfigJsonData[RESOURCEUPDATETYPE];
63-
CheckConfig(PATHTYPE,0);
64-
PathType gameModePathType = (PathType)(int)_gameMode.ConfigJsonData[PATHTYPE];
65-
CheckConfig(RESOFFICIALUPDATEPATH,"");
66-
string gameModeResOfficialUpdatePath=(string)_gameMode.ConfigJsonData[RESOFFICIALUPDATEPATH];
67-
CheckConfig(RESTESTUPDATEPATH,"");
68-
string gameModeResTestUpdatePath = (string)_gameMode.ConfigJsonData[RESTESTUPDATEPATH];
69-
CheckConfig(DEFAULTINSTREAMINGASSET,false);
70-
bool gameModeDefaultInStreamingAsset = (bool)_gameMode.ConfigJsonData[DEFAULTINSTREAMINGASSET];
60+
//检查配置文件是否存在
61+
CheckConfig(RESOURCEUPDATETYPE, 0);
62+
ResourceUpdateType gameModeResourceUpdateType = (ResourceUpdateType)(int)_gameMode.ConfigJsonData[RESOURCEUPDATETYPE];
63+
CheckConfig(PATHTYPE, 0);
64+
PathType gameModePathType = (PathType)(int)_gameMode.ConfigJsonData[PATHTYPE];
65+
CheckConfig(RESOFFICIALUPDATEPATH, "");
66+
string gameModeResOfficialUpdatePath = (string)_gameMode.ConfigJsonData[RESOFFICIALUPDATEPATH];
67+
CheckConfig(RESTESTUPDATEPATH, "");
68+
string gameModeResTestUpdatePath = (string)_gameMode.ConfigJsonData[RESTESTUPDATEPATH];
69+
CheckConfig(DEFAULTINSTREAMINGASSET, false);
70+
bool gameModeDefaultInStreamingAsset = (bool)_gameMode.ConfigJsonData[DEFAULTINSTREAMINGASSET];
7171

72-
ResourceUpdateType resUpdateType = (ResourceUpdateType)EditorGUILayout.EnumPopup("Resource Update Type", gameModeResourceUpdateType);
73-
if (resUpdateType != gameModeResourceUpdateType)
74-
{
75-
gameModeResourceUpdateType = resUpdateType;
76-
_gameMode.ConfigJsonData[RESOURCEUPDATETYPE]=(int)resUpdateType;
77-
//保存数据
78-
SaveConfig();
79-
}
80-
PathType localPathType=gameModePathType;
81-
if (gameModeResourceUpdateType != ResourceUpdateType.Editor
82-
&&gameModeResourceUpdateType != ResourceUpdateType.None)
83-
{
84-
if (gameModeResourceUpdateType == ResourceUpdateType.Update)
72+
ResourceUpdateType resUpdateType = (ResourceUpdateType)EditorGUILayout.EnumPopup("Resource Update Type", gameModeResourceUpdateType);
73+
if (resUpdateType != gameModeResourceUpdateType)
74+
{
75+
gameModeResourceUpdateType = resUpdateType;
76+
_gameMode.ConfigJsonData[RESOURCEUPDATETYPE] = (int)resUpdateType;
77+
//保存数据
78+
SaveConfig();
79+
}
80+
PathType localPathType = gameModePathType;
81+
if (gameModeResourceUpdateType != ResourceUpdateType.Editor
82+
&& gameModeResourceUpdateType != ResourceUpdateType.None)
8583
{
86-
string officialUpdatePath = EditorGUILayout.TextField("Official Update Path",gameModeResOfficialUpdatePath);
87-
if (!officialUpdatePath.Equals(gameModeResOfficialUpdatePath))
84+
if (gameModeResourceUpdateType == ResourceUpdateType.Update)
8885
{
89-
gameModeResOfficialUpdatePath = officialUpdatePath;
90-
_gameMode.ConfigJsonData[RESOFFICIALUPDATEPATH]=officialUpdatePath;
91-
//保存数据
92-
SaveConfig();
86+
string officialUpdatePath = EditorGUILayout.TextField("Official Update Path", gameModeResOfficialUpdatePath);
87+
if (!officialUpdatePath.Equals(gameModeResOfficialUpdatePath))
88+
{
89+
gameModeResOfficialUpdatePath = officialUpdatePath;
90+
_gameMode.ConfigJsonData[RESOFFICIALUPDATEPATH] = officialUpdatePath;
91+
//保存数据
92+
SaveConfig();
93+
}
94+
string testUpdatePath = EditorGUILayout.TextField("Test Update Path", gameModeResTestUpdatePath);
95+
if (!testUpdatePath.Equals(gameModeResTestUpdatePath))
96+
{
97+
gameModeResTestUpdatePath = testUpdatePath;
98+
_gameMode.ConfigJsonData[RESTESTUPDATEPATH] = testUpdatePath;
99+
//保存数据
100+
SaveConfig();
101+
}
102+
localPathType =
103+
(PathType)EditorGUILayout.EnumPopup("Local Path Type", PathType.ReadWrite);
104+
bool value = GUILayout.Toggle(gameModeDefaultInStreamingAsset, "Default In StreamingAsset");
105+
if (value != gameModeDefaultInStreamingAsset)
106+
{
107+
gameModeDefaultInStreamingAsset = value;
108+
_gameMode.ConfigJsonData[DEFAULTINSTREAMINGASSET] = value;
109+
//保存数据
110+
SaveConfig();
111+
}
93112
}
94-
string testUpdatePath = EditorGUILayout.TextField("Test Update Path",gameModeResTestUpdatePath);
95-
if (!testUpdatePath.Equals(gameModeResTestUpdatePath))
113+
else
96114
{
97-
gameModeResTestUpdatePath = testUpdatePath;
98-
_gameMode.ConfigJsonData[RESTESTUPDATEPATH]=testUpdatePath;
99-
//保存数据
100-
SaveConfig();
115+
localPathType =
116+
(PathType)EditorGUILayout.EnumPopup("Local Path Type", gameModePathType);
101117
}
102-
localPathType =
103-
(PathType)EditorGUILayout.EnumPopup("Local Path Type", PathType.ReadWrite);
104-
bool value = GUILayout.Toggle(gameModeDefaultInStreamingAsset, "Default In StreamingAsset");
105-
if (value != gameModeDefaultInStreamingAsset)
118+
if (gameModePathType != localPathType)
106119
{
107-
gameModeDefaultInStreamingAsset = value;
108-
_gameMode.ConfigJsonData[DEFAULTINSTREAMINGASSET]=value;
109-
//保存数据
120+
gameModePathType = localPathType;
121+
_gameMode.ConfigJsonData[PATHTYPE] = (int)localPathType;
110122
SaveConfig();
111123
}
112-
}
113-
else
114-
{
115-
localPathType =
116-
(PathType)EditorGUILayout.EnumPopup("Local Path Type", gameModePathType);
117-
}
118-
if(gameModePathType != localPathType)
119-
{
120-
gameModePathType=localPathType;
121-
_gameMode.ConfigJsonData[PATHTYPE]=(int)localPathType;
122-
SaveConfig();
123-
}
124-
string path = "";
125-
switch (gameModePathType)
126-
{
127-
case PathType.DataPath:
128-
path = Application.dataPath;
129-
break;
130-
case PathType.ReadOnly:
131-
path = Application.streamingAssetsPath;
132-
break;
133-
case PathType.ReadWrite:
134-
path = Application.persistentDataPath;
135-
break;
136-
case PathType.TemporaryCache:
137-
path = Application.temporaryCachePath;
138-
break;
139-
}
124+
string path = "";
125+
switch (gameModePathType)
126+
{
127+
case PathType.DataPath:
128+
path = Application.dataPath;
129+
break;
130+
case PathType.ReadOnly:
131+
path = Application.streamingAssetsPath;
132+
break;
133+
case PathType.ReadWrite:
134+
path = Application.persistentDataPath;
135+
break;
136+
case PathType.TemporaryCache:
137+
path = Application.temporaryCachePath;
138+
break;
139+
}
140140

141-
EditorGUILayout.LabelField("Path", path);
142-
}
141+
EditorGUILayout.LabelField("Path", path);
142+
}
143143

144-
GUILayout.EndVertical();
144+
GUILayout.EndVertical();
145145
}
146146
}
147147

Editor/GameMode/Module/SettingModuleEditor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Copyright (c) 2018 Zhang Yang. All rights reserved.
44
// </copyright>
55
// <describe> #设置模块编辑器# </describe>
6-
// <email> yeozhang@qq.com </email>
6+
// <email> dutifulwanderer@gmail.com </email>
77
// <time> #2018年12月15日 17点27分# </time>
88
//-----------------------------------------------------------------------
99

@@ -14,20 +14,20 @@
1414

1515
namespace Wanderer.GameFramework
1616
{
17-
[CustomModuleEditor("Settings Module",0.2f,0.8f,0.6f)]
17+
[CustomModuleEditor("Settings Module", 0.2f, 0.8f, 0.6f)]
1818
public class SettingModuleEditor : ModuleEditorBase
1919
{
2020
public SettingModuleEditor(string name, Color mainColor, GameMode gameMode)
2121
: base(name, mainColor, gameMode)
22-
{
23-
22+
{
23+
2424
}
2525

2626
public override void OnDrawGUI()
2727
{
2828
GUILayout.BeginVertical("HelpBox");
29-
30-
// GUI.color = _gameMode.DebugEnable ? Color.white : Color.gray;
29+
30+
// GUI.color = _gameMode.DebugEnable ? Color.white : Color.gray;
3131
// bool debugEnable = GUILayout.Toggle(GameMode.Setting.DebugEnable, "Debug Enable");
3232
// if (debugEnable != GameMode.Setting.DebugEnable)
3333
// {

Editor/GameMode/Module/StateModuleEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// // Copyright (c) 2018 Zhang Yang. All rights reserved.
44
// // </copyright>
55
// // <describe> #状态模块编辑器# </describe>
6-
// // <email> yeozhang@qq.com </email>
6+
// // <email> dutifulwanderer@gmail.com </email>
77
// // <time> #2018年12月15日 17点29分# </time>
88
// //-----------------------------------------------------------------------
99

Editor/GameMode/ModuleEditorBase.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Copyright (c) 2018 Zhang Yang. All rights reserved.
44
// </copyright>
55
// <describe> #模块编辑器的基础类# </describe>
6-
// <email> yeozhang@qq.com </email>
6+
// <email> dutifulwanderer@gmail.com </email>
77
// <time> #2018年12月15日 17点21分# </time>
88
//-----------------------------------------------------------------------
99

@@ -65,22 +65,22 @@ public virtual void OnInspectorGUI()
6565
//保存配置文件
6666
protected virtual void SaveConfig()
6767
{
68-
if(_gameMode==null||_gameMode.ConfigAsset==null)
68+
if (_gameMode == null || _gameMode.ConfigAsset == null)
6969
return;
70-
if(_gameMode.ConfigJsonData==null)
70+
if (_gameMode.ConfigJsonData == null)
7171
return;
7272
string configPath = AssetDatabase.GetAssetPath(_gameMode.ConfigAsset);
73-
File.WriteAllText(configPath,_gameMode.ConfigJsonData.ToJson());
73+
File.WriteAllText(configPath, _gameMode.ConfigJsonData.ToJson());
7474
AssetDatabase.Refresh();
7575
EditorUtility.SetDirty(_gameMode);
7676
}
7777

7878
//检测是否有对应的key
79-
protected virtual void CheckConfig(string key,object value)
79+
protected virtual void CheckConfig(string key, object value)
8080
{
81-
if(!_gameMode.ConfigJsonData.ContainsKey(key))
81+
if (!_gameMode.ConfigJsonData.ContainsKey(key))
8282
{
83-
_gameMode.ConfigJsonData[key]=new JsonData(value);
83+
_gameMode.ConfigJsonData[key] = new JsonData(value);
8484
SaveConfig();
8585
}
8686
}
@@ -89,10 +89,10 @@ protected virtual void CheckConfig(string key,object value)
8989
protected virtual bool NoConfigError()
9090
{
9191
bool result = false;
92-
if(_gameMode==null||_gameMode.ConfigJsonData==null)
92+
if (_gameMode == null || _gameMode.ConfigJsonData == null)
9393
{
94-
EditorGUILayout.HelpBox("No config file!", MessageType.Error);
95-
result=true;
94+
EditorGUILayout.HelpBox("No config file!", MessageType.Error);
95+
result = true;
9696
}
9797
return result;
9898
}

GameFramework/Editor/OpenFolder/OpenFolderEditor.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Copyright (c) 2018 Zhang Yang. All rights reserved.
44
// </copyright>
55
// <describe> #打开文件夹编辑器# </describe>
6-
// <email> yeozhang@qq.com </email>
6+
// <email> dutifulwanderer@gmail.com </email>
77
// <time> #2018年7月19日 11点12分# </time>
88
//-----------------------------------------------------------------------
99

@@ -12,7 +12,8 @@
1212
using UnityEngine;
1313
using UnityEditor;
1414

15-
public class OpenFolderEditor {
15+
public class OpenFolderEditor
16+
{
1617

1718
//打开读写文件夹
1819
[MenuItem("Tools/OpenFolder/PersistentDataPath")]

0 commit comments

Comments
 (0)