/// <summary> /// Handle the picking of new zones by the players /// </summary> /// <param name="players"> An ordonated list of the players </param> /// <param name="nbOfZones"> An ordonated list (same order as the players') of the bumber of zones each player can pick</param> /// <param name="dt"></param> public void pickZonesForPLayers(List<int> players, List<int> nbOfZones, float dt) { if (_pickZoneData == null) { _pickZoneData = new PickZoneData(); _pickZoneData.currentIndex = 0; //init for first player //display dialog initPickZoneDialog(players[_pickZoneData.currentIndex], nbOfZones[_pickZoneData.currentIndex]); } commonUpdate(dt); if (pickZonesForPlayer(players[_pickZoneData.currentIndex] , nbOfZones[_pickZoneData.currentIndex], dt)) { Console.WriteLine("\nzones captured for player : " + players[_pickZoneData.currentIndex] + "\n" + " captured : " + _pickZoneData.zonePicked[players[_pickZoneData.currentIndex]].Count); //send added territories for this player ServerCom.Instance.Socket.Emit("capturedTerritories", new { gameID = players[_pickZoneData.currentIndex] , territories = _pickZoneData.zonePicked[players[_pickZoneData.currentIndex]] }); //move to next player ++_pickZoneData.currentIndex; _afterButtonTimer = 0f; //re display dialog for new player if (_pickZoneData.currentIndex < players.Count) { if (nbOfZones[_pickZoneData.currentIndex] == 0) { //TODO send empty capturedTerritories message ServerCom.Instance.Socket.Emit("capturedTerritories", new { gameID = players[_pickZoneData.currentIndex] , territories = new List<int>() }); ++_pickZoneData.currentIndex; } else { initPickZoneDialog(players[_pickZoneData.currentIndex], nbOfZones[_pickZoneData.currentIndex]); } } //all players have picked zones if (_pickZoneData.currentIndex >= players.Count) { _pickZoneData = null; //send message to server _currentDialog = null; //_updateAction = oldUpdate; //_updateAction = placeCommanderUpdate; Console.WriteLine("\nsetting update method to empty\n"); _updateAction = emptyUpdate; } } }
/// <summary> /// Handle the picking of new zones by the players /// </summary> /// <param name="players"> An ordonated list of the players </param> /// <param name="nbOfZones"> An ordonated list (same order as the players') of the bumber of zones each player can pick</param> /// <param name="dt"></param> public void pickZonesForPLayers(List <int> players, List <int> nbOfZones, float dt) { if (_pickZoneData == null) { _pickZoneData = new PickZoneData(); _pickZoneData.currentIndex = 0; //init for first player //display dialog initPickZoneDialog(players[_pickZoneData.currentIndex], nbOfZones[_pickZoneData.currentIndex]); } commonUpdate(dt); if (pickZonesForPlayer(players[_pickZoneData.currentIndex] , nbOfZones[_pickZoneData.currentIndex], dt)) { Console.WriteLine("\nzones captured for player : " + players[_pickZoneData.currentIndex] + "\n" + " captured : " + _pickZoneData.zonePicked[players[_pickZoneData.currentIndex]].Count); //send added territories for this player ServerCom.Instance.Socket.Emit("capturedTerritories", new { gameID = players[_pickZoneData.currentIndex] , territories = _pickZoneData.zonePicked[players[_pickZoneData.currentIndex]] }); //move to next player ++_pickZoneData.currentIndex; _afterButtonTimer = 0f; //re display dialog for new player if (_pickZoneData.currentIndex < players.Count) { if (nbOfZones[_pickZoneData.currentIndex] == 0) { //TODO send empty capturedTerritories message ServerCom.Instance.Socket.Emit("capturedTerritories", new { gameID = players[_pickZoneData.currentIndex] , territories = new List <int>() }); ++_pickZoneData.currentIndex; } else { initPickZoneDialog(players[_pickZoneData.currentIndex], nbOfZones[_pickZoneData.currentIndex]); } } //all players have picked zones if (_pickZoneData.currentIndex >= players.Count) { _pickZoneData = null; //send message to server _currentDialog = null; //_updateAction = oldUpdate; //_updateAction = placeCommanderUpdate; Console.WriteLine("\nsetting update method to empty\n"); _updateAction = emptyUpdate; } } }