fix:调整静态数据存储gamelocal

This commit is contained in:
bzx
2026-01-15 13:55:34 +08:00
parent accdca2ff4
commit 275619f2f4
7 changed files with 48 additions and 19 deletions

View File

@@ -6708,7 +6708,7 @@ MonoBehaviour:
IncludeChildColliders: 0
RuntimeFollower: {fileID: 0}
colliderMaxDistance: 100
lastTimeMaxDistanceCalced: 639040145455162885
lastTimeMaxDistanceCalced: 639040214663384235
--- !u!1 &679496949
GameObject:
m_ObjectHideFlags: 0
@@ -8689,6 +8689,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 929547486}
- component: {fileID: 929547487}
m_Layer: 0
m_Name: HttpServer
m_TagString: Untagged
@@ -8711,6 +8712,18 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &929547487
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 929547485}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8a0de683bcf8bae408b2ed43e059e04d, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &959961076
GameObject:
m_ObjectHideFlags: 0
@@ -12561,6 +12574,9 @@ MonoBehaviour:
BGMState: {fileID: 541392504}
Version: 1.0.0
place: 0
curGameTime: 0
gameId: 0
vistAllTime: 900
enemyStartPos:
- {fileID: 1304609849}
- {fileID: 793457653}

View File

@@ -107,17 +107,25 @@ public class GameLocal : MonoBehaviour
public Transform MRRightControl;
//public PXR_Manager PXRManager;
public State BGMState;
// 验证信息
private AuthInfo authInfo = new AuthInfo();
[NonSerialized]
public Player self;
[Header("版本号")]
public string Version = "1.0.1";
[Header("场地")]
public Place place = Place.Company1Floor;
public float curGameTime = 0;
public GameKey gameId;
// 总游玩时长
public int vistAllTime = 60 * 15;
[NonSerialized]
public int GameMode = 0;
@@ -155,6 +163,11 @@ public class GameLocal : MonoBehaviour
}
public int GetNowTime()
{
return Mathf.RoundToInt(GameLocal.Ins.curGameTime);
}
/// <summary>
/// 鉴权
/// </summary>

View File

@@ -116,10 +116,9 @@ public class GameManager : NetworkBehaviour
[NonSerialized]
[SyncVar]
public long vistEnd = 0;
// 总游玩时长
public int vistAllTime = (int)(60 * 15);
public float curGameTime = 0;
[SyncVar]
public string settleData = "";
@@ -166,15 +165,10 @@ public class GameManager : NetworkBehaviour
UpdateGuideArrowPosition();
if (gameState == GameState.Playing)
{
curGameTime+=Time.deltaTime;
GameLocal.Ins.curGameTime+=Time.deltaTime;
}
}
public int GetNowTime()
{
return Mathf.RoundToInt(curGameTime);
}
/// <summary>
/// 创建门
/// </summary>
@@ -222,7 +216,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;
isStart = true;
ChangeBgmRpc(1);
// CreateTowers();
@@ -237,7 +231,7 @@ public class GameManager : NetworkBehaviour
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
{
GameOver(GameState.Settle);
}, vistAllTime);
}, GameLocal.Ins.vistAllTime);
}
[ClientRpc]

View File

@@ -262,12 +262,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();
}

View File

@@ -13,6 +13,7 @@
"com.unity.ide.visualstudio": "2.0.22",
"com.unity.ide.vscode": "1.2.5",
"com.unity.learn.iet-framework": "3.1.3",
"com.unity.mobile.android-logcat": "1.4.6",
"com.unity.purchasing": "4.11.0",
"com.unity.recorder": "4.0.3",
"com.unity.render-pipelines.universal": "14.0.11",

View File

@@ -218,6 +218,13 @@
"dependencies": {},
"url": "https://packages.unity.cn"
},
"com.unity.mobile.android-logcat": {
"version": "1.4.6",
"depth": 0,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.cn"
},
"com.unity.nuget.mono-cecil": {
"version": "1.11.4",
"depth": 2,

View File

@@ -142,9 +142,7 @@ PlayerSettings:
visionOSBundleVersion: 1.0
tvOSBundleVersion: 1.0
bundleVersion: 1.0.2
preloadedAssets:
- {fileID: 1814176829808956018, guid: 58f40b12bbc864f3c96c6505a9a1e1e3, type: 2}
- {fileID: 11400000, guid: d0f8149c48842b4488cf6fb974cff9a2, type: 2}
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1