diff --git a/Assets/_KOF/Scripts/GameLocal.cs b/Assets/_KOF/Scripts/GameLocal.cs index c9e2ab6e..7c2e32de 100644 --- a/Assets/_KOF/Scripts/GameLocal.cs +++ b/Assets/_KOF/Scripts/GameLocal.cs @@ -125,6 +125,11 @@ public class GameLocal : MonoBehaviour public Place place = Place.Company1Floor; public GameKey gameId; + + // 总游玩时长 + public int vistAllTime = (int)(60 * 10f); + + public float curGameTime = 0; public GameObject Scene; public GameObject Settle; @@ -242,6 +247,11 @@ public class GameLocal : MonoBehaviour { return (long)DateTime.Now.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; } + + public int GetNowTime() + { + return Mathf.RoundToInt(curGameTime); + } public string ConvertTimestampToDateTime(long timestamp) { diff --git a/Assets/_KOF/Scripts/GameManager.cs b/Assets/_KOF/Scripts/GameManager.cs index fb096d58..8e04487b 100644 --- a/Assets/_KOF/Scripts/GameManager.cs +++ b/Assets/_KOF/Scripts/GameManager.cs @@ -101,10 +101,7 @@ public class GameManager : NetworkBehaviour [NonSerialized] [SyncVar] public long vistEnd = 0; - // 总游玩时长 - public int vistAllTime = (int)(60 * 10f); - public float curGameTime = 0; [SyncVar] public string settleData = ""; @@ -226,7 +223,7 @@ public class GameManager : NetworkBehaviour public void GameStart() { gameState = GameState.Playing; - vistEnd = (long)(DateTime.Now.Subtract(new DateTime(1970, 1, 1))).TotalSeconds + vistAllTime; + vistEnd = (long)(DateTime.Now.Subtract(new DateTime(1970, 1, 1))).TotalSeconds + GameLocal.Ins.vistAllTime; ChangeBgmRpc(1); // CreateTowers(); AstarPath.active.Scan(); @@ -736,13 +733,10 @@ public class GameManager : NetworkBehaviour { //服务器计算剩余时间并同步 syncRemainingTime = GetLessTimeSeconds(); - curGameTime+=Time.deltaTime; + GameLocal.Ins.curGameTime+=Time.deltaTime; } } - public int GetNowTime() - { - return Mathf.RoundToInt(curGameTime); - } + } diff --git a/Assets/_KOF/Scripts/HttpServer.cs b/Assets/_KOF/Scripts/HttpServer.cs index 592f2fa6..f7266d00 100644 --- a/Assets/_KOF/Scripts/HttpServer.cs +++ b/Assets/_KOF/Scripts/HttpServer.cs @@ -261,12 +261,12 @@ public class HttpServer : MonoBehaviour private int GetGameTotalTime() { - return Mathf.FloorToInt(GameManager.Ins.vistAllTime); // 举例:1 小时(秒) + return Mathf.FloorToInt(GameLocal.Ins.vistAllTime); // 举例:1 小时(秒) } private int GetCurrentPlayTime() { - return GameManager.Ins.GetNowTime(); + return GameLocal.Ins.GetNowTime(); } diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 524508b9..79b3efaf 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -5,7 +5,7 @@ EditorBuildSettings: m_ObjectHideFlags: 0 serializedVersion: 2 m_Scenes: - - enabled: 0 + - enabled: 1 path: Assets/_KOF/Scenes/Company1Floor.unity guid: 386a8fdea01af8a4e8d4a9835407ddec - enabled: 0 @@ -203,7 +203,7 @@ EditorBuildSettings: - enabled: 0 path: Assets/_KOF/Scenes/Shandong_Weifang_Linqu_WandaGuangchang.unity guid: 292b5f7fc61bdb0419b29f4c2c84a84a - - enabled: 1 + - enabled: 0 path: Assets/_KOF/Scenes/Jilin_Changchun_Chaoyang_OuyaMaichang.unity guid: 52d26ac3b92c1cc489f7036255cb62e2 - enabled: 0 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 12fe48ca..8510af3f 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -141,7 +141,9 @@ PlayerSettings: visionOSBundleVersion: 1.0 tvOSBundleVersion: 1.0 bundleVersion: 1.0.1 - preloadedAssets: [] + preloadedAssets: + - {fileID: 1814176829808956018, guid: 58f40b12bbc864f3c96c6505a9a1e1e3, type: 2} + - {fileID: 11400000, guid: d0f8149c48842b4488cf6fb974cff9a2, type: 2} metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1 @@ -162,7 +164,7 @@ PlayerSettings: androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 applicationIdentifier: - Android: com.pineappletech.kof.jilinchangchunchaoyangouyamaichang + Android: com.pineappletech.kof.gongsi1lou Standalone: com.DefaultCompany.com.unity.template.ar buildNumber: Standalone: 0