add:添加服务器脚本

This commit is contained in:
bzx
2026-01-14 18:38:14 +08:00
parent 6f142e1960
commit 68677b9be9
8 changed files with 492 additions and 101 deletions

View File

@@ -101,7 +101,9 @@ namespace Valheim
[SyncVar]
public long vistEnd = 0;
// 总游玩时长
private int vistAllTime = (int)(60 * 15F);
public int vistAllTime = (int)(60 * 15F);
public float curGameTime = 0;
// 游戏是否结束
[NonSerialized]
[SyncVar]
@@ -282,6 +284,11 @@ namespace Valheim
battleArea.SetActive(false);
}
public int GetNowTime()
{
return Mathf.RoundToInt(curGameTime);
}
/// <summary>
/// 创建复活点
/// </summary>
@@ -1585,7 +1592,7 @@ namespace Valheim
if (GameInit.Ins.place == Place.GongSi1LouShiwai)
authInfo.shop = 999;
#endif
authInfo.gameId = 4;
authInfo.gameId = (int)GameInit.Ins.gameId;
string authJson = JsonUtility.ToJson(authInfo);
Debug.Log("发送数据 -> " + authJson);
request.RawData = System.Text.Encoding.UTF8.GetBytes(authJson);
@@ -1892,6 +1899,11 @@ namespace Valheim
}, 75f);
}
if (isPlayGame)
{
curGameTime += Time.deltaTime;
}
}
/// <summary>