private void UpdateBindableData() { var AmIPresent = CurrentMembers.Where(cm => cm.PlayerName == GameClient.PlayerProfile.Username).FirstOrDefault() != null; var AmINeutralTeam = GameClient.PlayerProfile.Team == TeamColor.Neutral; var HasSpace = CurrentGym.GymLevel > CurrentMembers.Count; var IsTeamOk = CurrentGym.OwnedByTeam == TeamColor.Neutral ? true : CurrentGym.OwnedByTeam == GameClient.PlayerProfile.Team; NotLvl5Yet = GameClient.PlayerStats?.Level < 5; CanDeploy = !AmINeutralTeam && IsTeamOk && HasSpace && !AmIPresent; NotInRange = CurrentGym.FortDataStatus == Utils.Game.FortDataStatus.Closed; IsEnabled = !NotInRange && !NotLvl5Yet; if (CurrentGym.OwnedByTeam == TeamColor.Neutral) { AtckType = AttackType.None; } else if (CurrentGym.OwnedByTeam == GameClient.PlayerProfile.Team) { AtckType = AttackType.Train; } else { AtckType = AttackType.Attack; } DeployPokemon.RaiseCanExecuteChanged(); StartBattle.RaiseCanExecuteChanged(); }
// Start is called before the first frame update void Start() { state = BattleState.START; PlayerInfo = GameObject.Find("InformationStorage").GetComponent <InformationStorage>(); LoadManagement = PlayerInfo.gameObject.GetComponent <StartBattle>(); StartCoroutine(SetUpBattle()); magicUI.gameObject.SetActive(false); }
public void StartBattle(GameMsg msg) { audioSvc.PlayAudioInUI(audioSvc.uiAudio); StartBattle startBattle = msg.startBattle; //传递玩家数据 PECommon.Log("跳转场景,进入战斗。"); resSvc.AsyncLoadScene(Constants.SceneBattle, () => { BattleSys.Instance.EnterBattle(startBattle.battlePropDic); }); //TODO多人再做。 }
private static void Postfix(StartBattle __instance) { if (!Main.on) { return; } Refers component = __instance.GetComponent <Refers>(); if (component != null) { var startButton = component.CGet <Button>("StartButton"); Utils.ButtonConfirm(startButton); } }
// Use this for initialization void Start() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); SceneManager.sceneLoaded += OnSceneLoaded; this.gameObject.SetActive(true); }
// Start is called before the first frame update private void Awake() { if (current != null) { Debug.Log("Destory success"); Destroy(this.gameObject); } else { current = this; DontDestroyOnLoad(this.gameObject); SceneManager.sceneLoaded += OnSceneLoaded; Debug.Log(this.name + " scene's loading event add successs"); } }
private void EndDialog() { Animator.SetBool("IsOpen", false); _isStarted = false; // if event exists, invoke if (Type == "START") { StartBattle?.Invoke(); } else if (Type == "END") { EndBattle?.Invoke(); } else if (Type == "STARTCUTSCENE") { EndStartingCutscene?.Invoke(); } else if (Type == "PLAYERSTARTCUTSCENE") { PlayerEndStartingCutscene?.Invoke(); } else if (Type == "HEALTHPICKUP") { HealthPickup?.Invoke(); } else if (Type == "ENDING") { FinalScene?.Invoke(); } AudioSource source = FindObjectOfType <GameStateManager>().gameObject.GetComponent <AudioSource>(); if (source) { source.mute = false; } }
public static void OnPacket(Client client, object pack) { Room room = RoomPool.me.GetOneReadyRoom(); RoomInfo roomInfo = new RoomInfo(); roomInfo.RoomId = room.roomId; client.Send(roomInfo); if (room.clientA == null) { room.clientA = client; client.roomid = room.roomId; } else { room.clientB = client; client.roomid = room.roomId; //RoomInfo roomInfo = new RoomInfo(); //roomInfo.RoomId = room.roomId; //client.Send(roomInfo); //{ // UserEnterRoom userEnterRoom = new UserEnterRoom(); // userEnterRoom.UserId = room.clientA.userid; // userEnterRoom.RoomId = room.roomId; // client.Send(userEnterRoom); //} //{ // UserEnterRoom userEnterRoom = new UserEnterRoom(); // userEnterRoom.UserId = room.clientB.userid; // userEnterRoom.RoomId = room.roomId; // client.Send(userEnterRoom); //} StartBattle startBattle = new StartBattle(); startBattle.RoomId = room.roomId; room.clientA.Send(startBattle); room.clientB.Send(startBattle); CreateObject createObjectA = new CreateObject(); createObjectA.UserId = room.clientA.userid; createObjectA.RoomId = room.roomId; createObjectA.ObjectId = ++room.objIdCounter; createObjectA.ObjectType = 1; createObjectA.X = 0; createObjectA.Y = 0; CreateObject createObjectB = new CreateObject(); createObjectB.UserId = room.clientB.userid; createObjectB.RoomId = room.roomId; createObjectB.ObjectId = ++room.objIdCounter; createObjectB.ObjectType = 1; createObjectB.X = 0; createObjectB.Y = 0; room.clientA.Send(createObjectA); room.clientA.Send(createObjectB); room.clientB.Send(createObjectA); room.clientB.Send(createObjectB); } }
void Awake() { S = this; }