Skip to content

Commit a21a05c

Browse files
committed
调整
1 parent 5c662e4 commit a21a05c

File tree

14 files changed

+240
-114
lines changed

14 files changed

+240
-114
lines changed

Assets/Script/Core/Develop/DevelopReplayManager.cs

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ static void ChoseReplayMode(bool isReplay,string replayFileName = null)
8989

9090
//关闭正常输入,保证回放数据准确
9191
IInputProxyBase.IsActive = false;
92-
//InputUIEventProxy.IsActive = false;
93-
//InputOperationEventProxy.IsActive = false;
94-
//InputNetworkEventProxy.IsActive = false;
9592
}
9693
else
9794
{
@@ -218,23 +215,31 @@ static void WriteInputEvent(string EventSerializeContent)
218215

219216
public static void LoadReplayFile(string fileName)
220217
{
221-
string eventContent = ResourceIOTool.ReadStringByFile(
222-
PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
218+
string eventContent = ResourceIOTool.ReadStringByFile(GetReplayEventFilePath(fileName));
219+
string randomContent = ResourceIOTool.ReadStringByFile(GetReplayRandomFilePath(fileName));
220+
221+
LoadEventStream(eventContent.Split('\n'));
222+
LoadRandomList(randomContent.Split('\n'));
223+
}
224+
225+
public static string GetReplayEventFilePath(string fileName)
226+
{
227+
return PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
223228
PathTool.GetRelativelyPath(
224229
c_directoryName,
225230
fileName,
226-
c_eventExpandName)));
231+
c_eventExpandName));
232+
}
227233

228-
string randomContent = ResourceIOTool.ReadStringByFile(
229-
PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
234+
public static string GetReplayRandomFilePath(string fileName)
235+
{
236+
return PathTool.GetAbsolutePath(ResLoadLocation.Persistent,
230237
PathTool.GetRelativelyPath(
231238
c_directoryName,
232239
fileName,
233-
c_randomExpandName)));
234-
235-
LoadEventStream(eventContent.Split('\n'));
236-
LoadRandomList(randomContent.Split('\n'));
240+
c_randomExpandName));
237241
}
242+
238243
public static Deserializer Deserializer = new Deserializer();
239244
static void LoadEventStream(string[] content)
240245
{
@@ -341,15 +346,22 @@ static void ReplayListGUI()
341346

342347
for (int i = 0; i < FileNameList.Length; i++)
343348
{
344-
if (GUILayout.Button("上传 " + FileNameList[i]))
349+
if (!isUploadReplay)
345350
{
346-
if(!isUploadReplay)
351+
if (GUILayout.Button(FileNameList[i]))
347352
{
348353
ChoseReplayMode(true, FileNameList[i]);
349354
}
350-
else
355+
}
356+
else
357+
{
358+
if (GUILayout.Button("上传 " + FileNameList[i]))
351359
{
360+
string replayPath = GetReplayEventFilePath(FileNameList[i]);
361+
string randomPath = GetReplayRandomFilePath(FileNameList[i]);
352362

363+
HTTPTool.Upload_Request_Thread(URLManager.GetURL("ReplayFileUpLoadURL"), replayPath, UploadCallBack);
364+
HTTPTool.Upload_Request_Thread(URLManager.GetURL("ReplayFileUpLoadURL"), randomPath, UploadCallBack);
353365
}
354366
}
355367
}
@@ -366,9 +378,16 @@ static void ReplayListGUI()
366378
});
367379
}
368380

369-
if (GUILayout.Button("上传模式 : " + isUploadReplay))
381+
if (URLManager.GetURL("ReplayFileUpLoadURL") != null)
382+
{
383+
if (GUILayout.Button("上传模式 : " + isUploadReplay))
384+
{
385+
isUploadReplay = !isUploadReplay;
386+
}
387+
}
388+
else
370389
{
371-
isUploadReplay = !isUploadReplay;
390+
GUILayout.Label("上传持久数据需要在 URLConfig -> ReplayFileUpLoadURL 配置上传目录");
372391
}
373392

374393
if (GUILayout.Button("返回上层"))

Assets/Script/Core/Develop/GUIUtil.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ public static void ShowTips(string content)
8080

8181
const int tipWindowStartID = 1000;
8282

83-
const float tipWidth = 600;
84-
const float tipHeight = 500;
83+
static float tipWidth = Screen.width/2;
84+
static float tipHeight = Screen.height / 2;
8585
static void TipsGUI()
8686
{
8787
int lastID = 0;
@@ -113,11 +113,15 @@ static Vector2 GetTipPos(int i)
113113
return pos;
114114
}
115115

116+
static Vector2 TipsScrollPos = Vector2.zero;
117+
116118
static void TipsWindow(int windowID)
117119
{
120+
TipsScrollPos = GUILayout.BeginScrollView(TipsScrollPos);
118121
GUILayout.Label(tiplist[windowID - tipWindowStartID], GUILayout.ExpandHeight(true));
122+
GUILayout.EndScrollView();
119123

120-
if( GUILayout.Button("OK"))
124+
if ( GUILayout.Button("OK"))
121125
{
122126
tiplist.RemoveAt(windowID - tipWindowStartID);
123127
if(tiplist.Count == 0)

Assets/Script/Core/Editor/Language/LanguageDataEditorWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ void AddLanguageModelGUI()
476476
m_langeuageDataDict.Add(selectEditorModuleName, data);
477477

478478
SaveData();
479-
479+
OnEnable();
480480
});
481481

482482
}

Assets/Script/Core/Editor/Resource/PeojectAssetChangeEvent.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private static void OnMoveAssetCallBack(AssetMoveResult t, string t1, string t2)
3131
List<string> paths = new List<string>();
3232
paths.Add(t1);
3333
paths.Add(t2);
34-
UpdateAsset(paths);
34+
//UpdateAsset(paths);
3535
Debug.Log("OnMoveAssetCallBack");
3636
//GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnMoveAsset, t,t1,t2);
3737
}
@@ -40,7 +40,7 @@ private static void OnDeleteAssetCallBack(AssetDeleteResult t, string t1, Remove
4040
{
4141
List<string> paths = new List<string>();
4242
paths.Add(t1);
43-
UpdateAsset(paths);
43+
//UpdateAsset(paths);
4444
Debug.Log("OnDeleteAssetCallBack");
4545
//GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnDeleteAsset, t, t1, t2);
4646
}
@@ -49,7 +49,7 @@ private static void OnCreateAssetCallBack(string t)
4949
{
5050
List<string> paths = new List<string>();
5151
paths.Add(t);
52-
UpdateAsset(paths);
52+
//UpdateAsset(paths);
5353
Debug.Log("OnCreateAssetCallBack");
5454
//GlobalEvent.DispatchEvent(EditorGlobalEventEnum.OnCreateAsset, t);
5555
}

Assets/Script/Core/Editor/UI/componment/UIWindowBaseComponmentEditor.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Collections;
22
using System.Collections.Generic;
33
using UnityEditor;
4+
using UnityEditor.SceneManagement;
45
using UnityEngine;
56

67
[CustomEditor(typeof(UIWindowBase),true)]
@@ -12,6 +13,7 @@ public class UIWindowBaseComponmentEditor : Editor
1213

1314
public override void OnInspectorGUI()
1415
{
16+
1517
if (m_ui == null)
1618
{
1719
m_ui = (UIWindowBase)target;
@@ -21,13 +23,21 @@ public override void OnInspectorGUI()
2123
selectIndex = GetIndex(m_ui.cameraKey);
2224

2325
selectIndex = EditorGUILayout.Popup("Camera Key", selectIndex, list);
24-
m_ui.cameraKey = list[selectIndex];
26+
if (list.Length != 0)
27+
m_ui.cameraKey = list[selectIndex];
2528

2629
base.OnInspectorGUI();
30+
if (GUI.changed)
31+
{
32+
EditorUtility.SetDirty(target);
33+
EditorSceneManager.MarkAllScenesDirty();
34+
}
2735
}
2836

2937
public int GetIndex(string current)
3038
{
39+
if (string.IsNullOrEmpty(current))
40+
return 0;
3141
for (int i = 0; i < list.Length; i++)
3242
{
3343
if (current.Equals(list[i]))

Assets/Script/Core/GuideSystem/GuideSystemBase.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public abstract class GuideSystemBase
5353
DataTable m_guideData;
5454
protected SingleData m_currentGuideData;
5555
//int m_currentGuideIndex = 0;
56-
string m_currentGuideKey = "";
56+
protected string m_currentGuideKey = "";
57+
protected string m_startGuideKey = "";
5758

5859
public bool IsStart
5960
{
@@ -113,7 +114,7 @@ public void Start(string guideKey = null)
113114
&& GuideStartCondition(guideData)
114115
&& GetGuideSwitch())
115116
{
116-
StartGuide();
117+
StartGuide(guideData);
117118
}
118119
}
119120

@@ -152,10 +153,10 @@ protected virtual void GetGuideRecord()
152153
/// 保存引导记录
153154
/// 可以根据情况选择是保存在本地还是发往服务器
154155
/// </summary>
155-
protected virtual void SaveGuideRecord(SingleData data)
156+
protected virtual void SaveGuideRecord(string startKey,string currentKey)
156157
{
157-
RecordManager.SaveRecord(c_guideRecordName, data.m_SingleDataKey, true);
158-
RecordManager.SaveRecord(c_guideRecordName, c_guideCurrentKeyName, data.m_SingleDataKey);
158+
RecordManager.SaveRecord(c_guideRecordName, startKey, true);
159+
RecordManager.SaveRecord(c_guideRecordName, c_guideCurrentKeyName, currentKey);
159160
}
160161

161162
/// <summary>
@@ -403,11 +404,13 @@ protected void Init()
403404
}
404405
}
405406

406-
void StartGuide()
407+
void StartGuide(SingleData guideData)
407408
{
408409
m_isStart = true;
409410

410-
SetCurrent(LoadFirstGuide());
411+
m_startGuideKey = guideData.m_SingleDataKey;
412+
413+
SetCurrent(guideData);
411414

412415
m_guideWindowBase = OpenGuideWindow();
413416

@@ -425,7 +428,6 @@ void StartGuide()
425428

426429
ApplicationManager.s_OnApplicationUpdate += Update;
427430
}
428-
429431
}
430432

431433
void EndGuide()
@@ -465,7 +467,7 @@ void NextGuide()
465467

466468
//如果是结束点则保存这一步
467469
if (GuideEndCondition())
468-
SaveGuideRecord(m_currentGuideData);
470+
SaveGuideRecord(m_startGuideKey,m_currentGuideData.m_SingleDataKey);
469471

470472
SingleData nextGuideData = GetNextGuideData(m_currentGuideData);
471473

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
5+
public abstract class HeartBeatBase
6+
{
7+
#region 属性
8+
private float m_heatBeatSendSpaceTime = 15f;
9+
10+
private float m_sendHeatBeatTimer;
11+
private float m_receviceHeatBeatTimer;
12+
13+
/// <summary>
14+
/// 设置心跳包发送间隔时间
15+
/// </summary>
16+
public float HeatBeatSendSpaceTime
17+
{
18+
get
19+
{
20+
return m_heatBeatSendSpaceTime;
21+
}
22+
23+
set
24+
{
25+
m_heatBeatSendSpaceTime = Mathf.Clamp(value, 2f, 100);
26+
ResetSendTimer();
27+
}
28+
}
29+
30+
#endregion
31+
32+
#region 生命周期
33+
34+
public virtual void Init(int spaceTime)
35+
{
36+
HeatBeatSendSpaceTime = spaceTime;
37+
38+
InputManager.AddListener<InputNetworkMessageEvent>("HB",ReceviceMessage);
39+
InputManager.AddListener<InputNetworkConnectStatusEvent>(ReceviceConnectStatus);
40+
}
41+
42+
public virtual void Dispose()
43+
{
44+
InputManager.RemoveListener<InputNetworkMessageEvent>("HB",ReceviceMessage);
45+
InputManager.RemoveListener<InputNetworkConnectStatusEvent>(ReceviceConnectStatus);
46+
}
47+
48+
#endregion
49+
50+
#region 重载方法
51+
52+
protected virtual void SendHeartBeatMessage()
53+
{
54+
//Debug.Log("SendHeartBeatMessage");
55+
NetworkManager.SendMessage("HB", new Dictionary<string, object>());
56+
}
57+
58+
protected virtual void ReceviceMessage(InputNetworkMessageEvent e)
59+
{
60+
if(e.m_MessgaeType == "HB")
61+
{
62+
ResetReceviceTimer();
63+
}
64+
}
65+
66+
protected virtual void ReceviceConnectStatus(InputNetworkConnectStatusEvent e)
67+
{
68+
if(e.m_status == NetworkState.Connected)
69+
{
70+
ResetSendTimer();
71+
ResetReceviceTimer();
72+
}
73+
}
74+
75+
#endregion
76+
77+
#region Update
78+
79+
public void Update()
80+
{
81+
m_sendHeatBeatTimer -= Time.unscaledDeltaTime;
82+
m_receviceHeatBeatTimer -= Time.unscaledDeltaTime;
83+
84+
//定时发送心跳包
85+
if (m_sendHeatBeatTimer <= 0)
86+
{
87+
ResetSendTimer();
88+
SendHeartBeatMessage();
89+
}
90+
91+
//长期没收到服务器返回认为断线
92+
if (m_receviceHeatBeatTimer <= 0)
93+
{
94+
NetworkManager.DisConnect();
95+
}
96+
}
97+
98+
/// <summary>
99+
/// 重设心跳包接收Timer
100+
/// </summary>
101+
void ResetReceviceTimer()
102+
{
103+
m_receviceHeatBeatTimer = HeatBeatSendSpaceTime * 2 + 1;
104+
}
105+
106+
void ResetSendTimer()
107+
{
108+
m_sendHeatBeatTimer = HeatBeatSendSpaceTime;
109+
}
110+
111+
#endregion
112+
}

Assets/Script/Core/Network/Interface/HeartBeatBase.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)