|
|
@@ -11,17 +11,18 @@ public class SocketPlayer : JC.SocketIO.SocketIOClient
|
|
|
void Awake()
|
|
|
{
|
|
|
ins = this;
|
|
|
+ GlobalEventCenter.ins.onGameSceneLoad += ResetTryAgain;
|
|
|
GlobalEventCenter.ins.onGameSceneDestroy += DestroySelf;
|
|
|
}
|
|
|
public override void OnDestroy()
|
|
|
{
|
|
|
if (ins == this) ins = null;
|
|
|
+ GlobalEventCenter.ins.onGameSceneLoad -= ResetTryAgain;
|
|
|
GlobalEventCenter.ins.onGameSceneDestroy -= DestroySelf;
|
|
|
base.OnDestroy();
|
|
|
}
|
|
|
void DestroySelf() {
|
|
|
if (willTryAgain) {
|
|
|
- willTryAgain = false;
|
|
|
return;
|
|
|
}
|
|
|
if (gameObject) Destroy(gameObject);
|
|
|
@@ -100,6 +101,7 @@ public class SocketPlayer : JC.SocketIO.SocketIOClient
|
|
|
}
|
|
|
//上传游戏数据
|
|
|
public void UploadPKGameData(string key, object data) {
|
|
|
+ if (willTryAgain) return;
|
|
|
if (!isValid) return;
|
|
|
call("UploadPKGameData", repeatID.ToString() + key, data);
|
|
|
}
|
|
|
@@ -153,4 +155,7 @@ public class SocketPlayer : JC.SocketIO.SocketIOClient
|
|
|
isGameOver = false;
|
|
|
SceneManager.LoadScene(sceneName, LoadSceneMode.Single);
|
|
|
}
|
|
|
+ void ResetTryAgain() {
|
|
|
+ willTryAgain = false;
|
|
|
+ }
|
|
|
}
|