Skip to content

Commit c692cab

Browse files
committed
更新
1 parent 8817ad3 commit c692cab

File tree

533 files changed

+29335
-885
lines changed

Some content is hidden

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

533 files changed

+29335
-885
lines changed

Assets/Script/Core/Application/ApplicationManager.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections;
33
using System;
44
using System.Collections.Generic;
5+
using FrameWork.SDKManager;
56

67
public class ApplicationManager : MonoBehaviour
78
{
@@ -111,8 +112,11 @@ public void Awake()
111112
public void AppLaunch()
112113
{
113114
DontDestroyOnLoad(gameObject);
115+
Application.runInBackground = true;
116+
Screen.sleepTimeout = SleepTimeout.NeverSleep;
117+
114118
SetResourceLoadType(); //设置资源加载类型
115-
//ResourcesConfigManager.Initialize(); //资源路径管理器启动
119+
116120
AudioPlayManager.Init();
117121
MemoryManager.Init(); //内存管理初始化
118122
Timer.Init(); //计时器启动
@@ -127,6 +131,8 @@ public void AppLaunch()
127131
ApplicationStatusManager.Init(); //游戏流程状态机初始化
128132
GlobalLogicManager.Init(); //初始化全局逻辑
129133

134+
SDKManager.Init(); //初始化SDKManger
135+
130136
if (AppMode != AppMode.Release)
131137
{
132138
GUIConsole.Init(); //运行时Console
@@ -167,6 +173,8 @@ public void AppLaunch()
167173

168174
void OnApplicationQuit()
169175
{
176+
Debug.Log("ApplicationManager OnApplicationQuit ");
177+
170178
if (s_OnApplicationQuit != null)
171179
{
172180
try

Assets/Script/Core/Application/ApplicationStatusManager.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ private static void EnterStatusLogic(string statusName,bool isFade = true)
7474
try
7575
{
7676
s_currentAppStatus.OnExitStatus();
77+
MemoryManager.FreeMemory();
7778
}
7879
catch (Exception e)
7980
{
@@ -119,6 +120,9 @@ private static void EnterStatusLogic(string statusName,bool isFade = true)
119120
UIManager.SetEventSystemEnable(true);
120121
s_currentAppStatus.CloseAllUI(false);
121122
s_currentAppStatus.OnExitStatus();
123+
124+
MemoryManager.FreeMemory();
125+
122126
s_currentAppStatusName = statusName;
123127
ApplicationManager.Instance.currentStatus = statusName;
124128

Assets/Script/Core/Application/IApplicationStatus.cs

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,52 @@ public int GetUIListCount()
1818
return m_uiList.Count;
1919
}
2020

21-
public List<UIWindowBase> GetUIList()
21+
public List<UIWindowBase> GetUIList(bool isSort = false)
2222
{
23-
return m_uiList;
23+
List < UIWindowBase > list= new List<UIWindowBase>( m_uiList);
24+
if(isSort)
25+
list.Sort(SortUIWindow);
26+
return list;
27+
}
28+
/// <summary>
29+
/// 根据window放的位置来排序UIType,以及同一Type,用界面上先后排序
30+
/// </summary>
31+
/// <param name="w"></param>
32+
/// <param name="b"></param>
33+
/// <returns></returns>
34+
private int SortUIWindow(UIWindowBase w, UIWindowBase b)
35+
{
36+
if (w.m_UIType - b.m_UIType > 0)
37+
return 1;
38+
else if (w.m_UIType - b.m_UIType < 0)
39+
{
40+
return -1;
41+
}
42+
else
43+
{
44+
int childCount = w.transform.parent.childCount;
45+
int index0 = -1;
46+
int index1 = -1;
47+
for (int i = 0; i < childCount; i++)
48+
{
49+
Transform tra = w.transform.parent.GetChild(i);
50+
if (tra == w.transform)
51+
{
52+
index0 = i;
53+
}
54+
else if (tra == b.transform)
55+
{
56+
index1 = i;
57+
}
58+
}
59+
if (index0 > index1)
60+
{
61+
return 1;
62+
}
63+
else
64+
return -1;
65+
}
2466
}
25-
2667
/// <summary>
2768
/// 获取status打开的window的最上层Window
2869
/// </summary>

Assets/Script/Core/Audio/AudioManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public static AudioClip GetAudioClip(string soundName)
257257
{
258258
AudioClip clipTmp = null;
259259

260-
clipTmp = ResourceManager.Load<AudioClip>(soundName);
260+
clipTmp = AssetsPoolManager.Load<AudioClip>(soundName);
261261

262262
if (clipTmp == null)
263263
{

Assets/Script/Core/AudioManager/AudioGroupSystem/AudioGroupSystem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private static void Init()
108108
GameObject obj = new GameObject("[AudioGroupSystem]");
109109
instance = obj.AddComponent<AudioGroupSystem>();
110110

111-
TextAsset asset = ResourceManager.Load<TextAsset>(ConfigName);
111+
TextAsset asset = AssetsPoolManager.Load<TextAsset>(ConfigName);
112112

113113
List<AudioGroupData> datas = JsonUtils.FromJson<List<AudioGroupData>>(asset.text);
114114
audioGroupDataDic.Clear();
@@ -163,7 +163,7 @@ private void Update()
163163
MusicPlayData musicPlayData = item.Excute();
164164
if (musicPlayData != null)
165165
{
166-
Debug.Log("currentAudioGroupData: " + currentAudioGroupData.keyName+ " Play MusicPlayData: " + musicPlayData.name);
166+
//Debug.Log("currentAudioGroupData: " + currentAudioGroupData.keyName+ " Play MusicPlayData: " + musicPlayData.name);
167167
PlayMusicData(musicPlayData,item.flag);
168168
}
169169
}

Assets/Script/Core/AudioManager/AudioGroupSystem/RandomLoopMusicData.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private void OnMusicPlayComplete(string name, int channal, string flag)
2323
{
2424
if (this.flag == flag)
2525
{
26-
Debug.Log("OnMusicStopCallBack :" + name + " flag:" + flag);
26+
//Debug.Log("OnMusicStopCallBack :" + name + " flag:" + flag);
2727
foreach (var item in configData.musicDatas)
2828
{
2929
if (item.name == name)
@@ -55,7 +55,7 @@ public MusicPlayData Excute()
5555
return null;
5656

5757
isPlaying = true;
58-
Debug.Log("currentPlayIndex:" + currentPlayIndex + " flag :"+flag);
58+
//Debug.Log("currentPlayIndex:" + currentPlayIndex + " flag :"+flag);
5959
if (configData.isRandom)
6060
{
6161
List<MusicPlayData> musicDatas = new List<MusicPlayData>();

Assets/Script/Core/AudioManager/AudioPlayManager.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
public class AudioPlayManager : MonoBehaviour
77
{
8-
#region 属性,字段
8+
#region 属性
9+
910
public static Audio2DPlayer a2DPlayer;
1011
public static Audio3DPlayer a3DPlayer;
1112
/// <summary>
@@ -17,7 +18,11 @@ public class AudioPlayManager : MonoBehaviour
1718
/// SFX播放完成 回调(参数 :资源名,flag(标识:用于在多个相同音频名称时分辨))
1819
/// </summary>
1920
public static CallBack<string, string> OnSFXStopCallBack;
21+
2022
#endregion
23+
24+
#region 外部调用
25+
2126
public static void Init()
2227
{
2328
GameObject obj = new GameObject("[AudioManager]");
@@ -30,7 +35,9 @@ public static void Init()
3035
MusicVolume = RecordManager.GetFloatRecord("GameSettingData", "MusicVolume", 1f);
3136
SFXVolume = RecordManager.GetFloatRecord("GameSettingData", "SFXVolume", 1f);
3237
}
38+
3339
#region Volume
40+
3441
private static float totleVolume = 1f;
3542
public static float TotleVolume
3643
{
@@ -95,6 +102,7 @@ public static void SaveVolume()
95102
}
96103
#endregion
97104

105+
#region 播放接口
98106

99107
public static void PlayMusic2D(string name, int channel, float volumeScale = 1, bool isLoop = true, float fadeTime = 0.5f, float delay = 0f, string flag = "")
100108
{
@@ -187,6 +195,9 @@ public static void ReleaseSFXAll3D()
187195
a3DPlayer.ReleaseSFXAll();
188196
}
189197

198+
#endregion
199+
200+
#endregion
190201

191202
void Update()
192203
{

Assets/Script/Core/AudioManager/AudioPlayerBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ public void UnloadClip(AudioAsset asset)
9898

9999
protected void PlayClip(AudioAsset au, string audioName, bool isLoop = true, float volumeScale = 1, float delay = 0f,float pitch =1)
100100
{
101+
if (!ResourcesConfigManager.GetIsExitRes(audioName))
102+
{
103+
Debug.LogError("不存在音频:" + audioName);
104+
return;
105+
}
101106
//if (au.PlayState == AudioPlayState.Playing)
102107
// au.Stop();
103108
UnloadClip(au);

Assets/Script/Core/Config/ConfigManager.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public static Dictionary<string, SingleField> GetData(string ConfigName)
3232

3333
string dataJson = "";
3434

35-
#if UNITY_EDITOR
3635
if (!Application.isPlaying)
3736
{
3837
dataJson = ResourceIOTool.ReadStringByResource(
@@ -42,11 +41,9 @@ public static Dictionary<string, SingleField> GetData(string ConfigName)
4241
}
4342
else
4443
{
45-
dataJson = ResourceManager.ReadTextFile(ConfigName);
44+
dataJson = AssetsPoolManager.ReadTextFile(ConfigName);
4645
}
47-
#else
48-
dataJson = ResourceManager.ReadTextFile(ConfigName);
49-
#endif
46+
5047

5148
if (dataJson == "")
5249
{
@@ -61,6 +58,11 @@ public static Dictionary<string, SingleField> GetData(string ConfigName)
6158
}
6259
}
6360

61+
public static SingleField GetData(string ConfigName,string key)
62+
{
63+
return GetData(ConfigName)[key];
64+
}
65+
6466
public static void CleanCache()
6567
{
6668
s_configCache.Clear();

Assets/Script/Core/Data/DataManager.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ public static DataTable GetData(string DataName)
3434
DataTable data = null;
3535
string dataJson = "";
3636

37-
#if UNITY_EDITOR
38-
3937
if (Application.isPlaying)
4038
{
41-
dataJson = ResourceManager.ReadTextFile(DataName);
39+
dataJson = AssetsPoolManager.ReadTextFile(DataName);
4240
}
4341
else
4442
{
@@ -47,9 +45,6 @@ public static DataTable GetData(string DataName)
4745
DataName,
4846
c_expandName));
4947
}
50-
#else
51-
dataJson = ResourceManager.ReadTextFile(DataName);
52-
#endif
5348

5449
if (dataJson == "")
5550
{

0 commit comments

Comments
 (0)