app center;增加發送ping的秒

This commit is contained in:
Caiyanpeng committed 2021-11-12 16:21:13 +08:00
1 parent 1bd1ffdb5a
commit d754ff3b15
719 files changed
+34172 -2875

No files matched your search

+1 -1
View File
@@ -26,7 +26,7 @@ namespace Assets.Scripts.Scenes
while (true)
{
ping = new Ping("47.97.84.8");
yield return new WaitForSeconds(1);
yield return new WaitForSeconds(5);
}
}
+29 -2
View File
@@ -15,6 +15,7 @@ using Newtonsoft.Json.Linq;
using System;
using Assets.Scenes.Ride.Scripts;
using UnityEngine.SceneManagement;
using System.Threading;
public class UIManager : MonoBehaviour
{
@@ -53,7 +54,21 @@ public class UIManager : MonoBehaviour
return this.GetPanelInstance("HomePanel", ref this.mHomePanel);
}
}
public static void RunOnUnityThread(Action action)
{
// is this right?
if (unityThread == Thread.CurrentThread.ManagedThreadId)
{
action();
}
else
{
lock (runInUpdate)
{
runInUpdate.Enqueue(action);
}
}
}
private UserInfoController mUserInfoPanel;
public UserInfoController UserInfoPanel
{
@@ -362,9 +377,12 @@ public class UIManager : MonoBehaviour
stack.Clear();
stack.Push(UIManager.Instance.HomePanel);
}
public static int unityThread;
static public Queue<Action> runInUpdate = new Queue<Action>();
private void Awake()
{
UIManager.Instance = this;
unityThread = Thread.CurrentThread.ManagedThreadId;
stack = new Stack<PFUIPanel>();
loginRegOptions = new LoginRegOptions();
var userInfosJson = PlayerPrefs.GetString("UserInfos");
@@ -422,7 +440,16 @@ public class UIManager : MonoBehaviour
// Update is called once per frame
void Update()
{
while (runInUpdate.Count > 0)
{
Action action = null;
lock (runInUpdate)
{
if (runInUpdate.Count > 0)
action = runInUpdate.Dequeue();
}
action?.Invoke();
}
}
//重新查询已经参赛列表
public static void UpdateJoinCompetition()