void _OnFindBattlePartner(object sender, System.EventArgs args) { findBattlePartner = true; VersusScreen.Instance.StartAnimation(); M3GameCache.SetBattleType(BattleType.RandomPVP); }
public override void OnStateEnter() { base.OnStateEnter(); challengeMode = Utils.STR_RANDOM; VersusScreen.Instance.StartAnimation(); M3GameCache.SetBattleType(BattleType.RandomPVP); ConnectionController.Instance.M3OnJoinedRoom += _onJoinedRoom; ConnectionController.Instance.M3OnPhotonJoinRoomFailed += _onJoinRoomFailed; ConnectionController.Instance.M3OnPhotonPlayerConnected += _onPhotonPlayerConnected; ConnectionController.Instance.M3OnPhotonPlayerDisconnected += _onPhotonPlayerDisconnected; Events.EventManager.Instance.UpdatePhotonRoomPropertiesHandler += _onUpdateRoomProperties; // ConnectionController.Instance.M3OnDisconnectedFromPhoton += _onDisconnectedFromPhoton; DoWaitForBattlePartner(); }
public override void OnStateEnter() { base.OnStateEnter(); M3GameCache.SetBattleType(BattleType.RandomPVP); ConnectionController.Instance.M3OnDisconnectedFromPhoton += _onDisconnect; ConnectionController.Instance.M3OnConnectedToMaster += _onConnect; Events.EventManager.Instance.MainMenuLoadCompleteHandler += _onMainMenuSceneLoaded; Events.EventManager.Instance.FindBattlePartnerHandler += _onFindBattlePartner; if (_data == null) { //no data was passed. } else { Dictionary <string, object> parameters = new Dictionary <string, object>(); parameters = _data as Dictionary <string, object>; if (parameters.ContainsKey(StateWaitForChallenge.FIND_BATTLE_PARTNER)) { findBattlePartner = (bool)parameters[StateWaitForChallenge.FIND_BATTLE_PARTNER]; } } if (ConnectionController.Instance.ConnectedAndOnline) { ConnectionController.Instance.Disconnect(); //then wait for disconnect callback. } else if (PhotonNetwork.connecting) { //Wait for connect Callback } else { if (ConnectionController.Instance.offlineMode) { _onConnect(); } else { ConnectionController.Instance.SwitchToOfflineMode(); } } }
void _OnFindBattlePartner(object sender, System.EventArgs args) { findBattlePartner = true; VersusScreen.Instance.StartAnimation(); M3GameCache.SetBattleType(BattleType.RandomPVP); M3PUN.Utils.UpdatePhotonPlayerProperties(); if (ConnectionController.Instance.ConnectedAndOnline) { DoFindMatch(); } else { VersusScreen.Instance.StartAnimation(); StateMachine.Instance.MakeTransition(typeof(StateGoForAIBattle)); } }
void _onPrivateChallengeStartBattleHandler(object sender, Events.ChallengeArgs args) { M3GameCache.SetBattleType(privateChallengeArgs.BattleType); StateMachine.Instance.MakeTransition(typeof(StateGoForOnlineBattle)); }