Merge branch 'main' of http://10.27.17.121:3000/kawagiri/TH1 into main
This commit is contained in:
commit
53df03a955
@ -57,7 +57,16 @@ namespace TH1_Logic.Steam
|
|||||||
if (message.MapData == null) return;
|
if (message.MapData == null) return;
|
||||||
if (LobbyManager.Instance.Lobby.IsLobbyOwner()) return;
|
if (LobbyManager.Instance.Lobby.IsLobbyOwner()) return;
|
||||||
LogSystem.LogWarning($"OnReceivedGameStart : {NetData.GetMapDataHash(message.MapData)}");
|
LogSystem.LogWarning($"OnReceivedGameStart : {NetData.GetMapDataHash(message.MapData)}");
|
||||||
Main.Instance.NetStartGame(message.MapData);
|
|
||||||
|
|
||||||
|
//客户端开启游戏
|
||||||
|
//如果loading失败 直接开始游戏并关闭当前页面
|
||||||
|
if (!UIManager.Instance.ShowLoading())
|
||||||
|
Main.Instance.NetStartGame(message.MapData);
|
||||||
|
else
|
||||||
|
Timer.Instance.TimerRegister(this, ()=> { Main.Instance.NetStartGame(message.MapData); },0.5f,"Multi_ShowLoading");
|
||||||
|
|
||||||
|
|
||||||
EventManager.Publish(new HideUIOutsideMultiplay(){});
|
EventManager.Publish(new HideUIOutsideMultiplay(){});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -90,5 +90,11 @@ namespace TH1_UI.Controller.Interaction
|
|||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Close()
|
||||||
|
{
|
||||||
|
WindowScript?.OnCloseView();
|
||||||
|
return base.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +62,10 @@ namespace TH1_UI.View.Outside
|
|||||||
public List<Button> DifficultyButtonList;
|
public List<Button> DifficultyButtonList;
|
||||||
|
|
||||||
private SteamLobbyManager _lobby;
|
private SteamLobbyManager _lobby;
|
||||||
|
//关闭时执行的委托
|
||||||
public ViDelegateAssisstant.Dele OnBtnCloseClick;
|
public ViDelegateAssisstant.Dele OnBtnCloseClick;
|
||||||
|
|
||||||
|
//开始游戏时执行的委托(目前委托内容就是执行controller的Close())
|
||||||
public ViDelegateAssisstant.Dele OnStartGame;
|
public ViDelegateAssisstant.Dele OnStartGame;
|
||||||
|
|
||||||
private bool _noRoom = false;
|
private bool _noRoom = false;
|
||||||
@ -73,7 +76,6 @@ namespace TH1_UI.View.Outside
|
|||||||
CloseButton.onClick.AddListener(() =>
|
CloseButton.onClick.AddListener(() =>
|
||||||
{
|
{
|
||||||
LeaveRoom();
|
LeaveRoom();
|
||||||
OnCloseView();
|
|
||||||
OnBtnCloseClick.Invoke();
|
OnBtnCloseClick.Invoke();
|
||||||
UIManager.Instance.GameUI.MainUI.NeedShow = true;
|
UIManager.Instance.GameUI.MainUI.NeedShow = true;
|
||||||
|
|
||||||
@ -399,8 +401,9 @@ namespace TH1_UI.View.Outside
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowLoadingAndStartGame();
|
if(Main.Instance.HasMultiArchive() && ResumeToggle.isOn)
|
||||||
OnCloseView();
|
ShowLoadingAndStartGame(true);
|
||||||
|
else ShowLoadingAndStartGame(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowLoadingAndStartGame(bool resume = false)
|
public void ShowLoadingAndStartGame(bool resume = false)
|
||||||
@ -413,14 +416,14 @@ namespace TH1_UI.View.Outside
|
|||||||
Main.Instance.MainMemberStartGame();
|
Main.Instance.MainMemberStartGame();
|
||||||
else
|
else
|
||||||
Main.Instance.MainMemberContinueGame();
|
Main.Instance.MainMemberContinueGame();
|
||||||
|
//OnstartGame会自动执行controller的Close close会负责触发view的CloseView
|
||||||
|
OnStartGame?.Invoke();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer.Instance.TimerRegister(this,Main.Instance.MainMemberStartGame,0.5f,"Multi_ShowLoading");
|
//否则带有延时执行
|
||||||
Timer.Instance.TimerRegister(this, () =>
|
Timer.Instance.TimerRegister(this,resume ? Main.Instance.MainMemberContinueGame:Main.Instance.MainMemberStartGame,0.5f,"Multi_ShowLoading");
|
||||||
{
|
Timer.Instance.TimerRegister(this, ()=> { OnStartGame?.Invoke(); },0.5f,"Multi_ShowLoading");
|
||||||
OnStartGame?.Invoke();
|
|
||||||
},0.5f,"Multi_ShowLoading");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,13 +454,14 @@ namespace TH1_UI.View.Outside
|
|||||||
Main.Instance.MapConfig.AIDiff = difficult;
|
Main.Instance.MapConfig.AIDiff = difficult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCloseView()
|
|
||||||
|
//在Controller 调用Close的时候,会先调用这个closeview
|
||||||
|
public void OnCloseView()
|
||||||
{
|
{
|
||||||
_lobby.OnMembersChangedEvent -= RefreshAll;
|
_lobby.OnMembersChangedEvent -= RefreshAll;
|
||||||
_lobby.OnLobbyLeftEvent -= RefreshAll;
|
_lobby.OnLobbyLeftEvent -= RefreshAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user