添加山东菏泽郓城各福里场景
This commit is contained in:
@@ -31,6 +31,7 @@ public enum Place
|
||||
Nanjing_Qixia_Yaohuamen_Jindiguangchang_nei = -17,
|
||||
Anhui_Suzhou_Yuashan_Guchengshangyejie=18,
|
||||
Gansu_Longnan_Shicheng_Dongsheng = 19,
|
||||
Shandong_Heze_Yuncheng_Gefuli = 20,
|
||||
}
|
||||
|
||||
public class GameLocal : MonoBehaviour
|
||||
|
||||
@@ -102,7 +102,7 @@ public class GameManager : NetworkBehaviour
|
||||
[SyncVar]
|
||||
public long vistEnd = 0;
|
||||
// 总游玩时长
|
||||
private int vistAllTime = (int)(60 * 8f);
|
||||
private int vistAllTime = (int)(60 * 10f);
|
||||
[SyncVar]
|
||||
public string settleData = "";
|
||||
|
||||
@@ -239,7 +239,7 @@ public class GameManager : NetworkBehaviour
|
||||
CoroutineTaskManager.Instance.WaitSecondTodo(() =>
|
||||
{
|
||||
GameOver(GameState.Settle);
|
||||
}, 60f * 10f);
|
||||
}, 60 * 10f);
|
||||
}
|
||||
|
||||
[ClientRpc]
|
||||
@@ -280,7 +280,7 @@ public class GameManager : NetworkBehaviour
|
||||
// string jsonStr = JsonMapper.ToJson(SettleInfos);
|
||||
// settleData = jsonStr;
|
||||
// //结算页面
|
||||
// RpcShow();
|
||||
//RpcShow();
|
||||
if (blueScore >= redScore)
|
||||
{
|
||||
RpcShowWin(true);
|
||||
@@ -679,12 +679,23 @@ public class GameManager : NetworkBehaviour
|
||||
|
||||
public int GetLessTimeSeconds()
|
||||
{
|
||||
return (int)(vistEnd - DateTime.Now.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
|
||||
if (isServer)
|
||||
{
|
||||
return (int)(vistEnd - NetworkTime.time);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int)(vistEnd - NetworkClient.connection.remoteTimeStamp);
|
||||
}
|
||||
//return (int)(vistEnd - DateTime.Now.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
|
||||
}
|
||||
|
||||
// 时分秒
|
||||
public string FormatTime(int totalSeconds)
|
||||
{
|
||||
//确保时间不为负
|
||||
totalSeconds = Mathf.Max(0, totalSeconds);
|
||||
|
||||
int hours = totalSeconds / 3600;
|
||||
// string hh = hours < 10 ? "0" + hours : hours.ToString();
|
||||
int minutes = (totalSeconds - hours * 3600) / 60;
|
||||
@@ -707,5 +718,17 @@ public class GameManager : NetworkBehaviour
|
||||
MasterAudio.PlaySound(JointIn);
|
||||
GameLocal.Ins.BGMState.StateChange(2);
|
||||
}
|
||||
|
||||
[SyncVar]
|
||||
private int syncRemainingTime;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (isServer)
|
||||
{
|
||||
//服务器计算剩余时间并同步
|
||||
syncRemainingTime = GetLessTimeSeconds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,20 +80,44 @@ public class HUDPanel : MonoBehaviour
|
||||
|
||||
ScoreText.text = playerDictionary[GameLocal.Ins.self.index].Score.ToString();
|
||||
}
|
||||
if (GameManager.Ins.GetLessTimeSeconds() <= 60)
|
||||
|
||||
//修改
|
||||
//获取剩余时间并处理倒计时
|
||||
float remainingTime = GameManager.Ins.GetLessTimeSeconds();
|
||||
if (remainingTime <= 0)
|
||||
{
|
||||
//时间警告提示出现
|
||||
TimingWarning.SetActive(true);
|
||||
}
|
||||
if (GameManager.Ins.GetLessTimeSeconds() <= 0)
|
||||
{
|
||||
GameManager.Ins.GameOver(GameState.Failur);
|
||||
LessTimeText.text = "00:00";
|
||||
//确保游戏结束逻辑只触发一次
|
||||
if (GameManager.Ins.gameState == GameState.Playing)
|
||||
{
|
||||
GameManager.Ins.GameOver(GameState.Failur);
|
||||
}
|
||||
LessTimeText.text = "00:00";//强制设置为00:00
|
||||
}
|
||||
else
|
||||
{
|
||||
//正常更新时间显示
|
||||
LessTimeText.text = GameManager.Ins.GetLessTimeStr();
|
||||
//警告提示
|
||||
if (remainingTime <= 60)
|
||||
{
|
||||
TimingWarning.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
//if (GameManager.Ins.GetLessTimeSeconds() <= 60)
|
||||
//{
|
||||
// //时间警告提示出现
|
||||
// TimingWarning.SetActive(true);
|
||||
//}
|
||||
//if (GameManager.Ins.GetLessTimeSeconds() <= 0)
|
||||
//{
|
||||
// GameManager.Ins.GameOver(GameState.Failur);
|
||||
// LessTimeText.text = "00:00";
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// LessTimeText.text = GameManager.Ins.GetLessTimeStr();
|
||||
//}
|
||||
}
|
||||
}
|
||||
public void NewWaveStart(int wave)
|
||||
|
||||
Reference in New Issue
Block a user