Exemple #1
0
        public void StartGameMultiplayer()
        {
            Global.UnfocusAllTextBox();
            gameMode = GameMode.Multiplayer;
            CurrentGameState = GameState.Started;
            if (hexMap == null)
            {
                string[] textures = new string[3];
                textures[0] = "Hexa";
                textures[1] = "hexa_near";
                textures[2] = "hexa_far";
                hexMap = new HexagonMap((int)(375.0f * ScreenScaleFactor.X), (int)(110.0f * ScreenScaleFactor.Y), 9, 45, 26, textures);
            }

            var username = TextBoxName.GetText();
            var roomid = TextBoxRoom.GetText();
            if (ServerReady) {
                HexagonServer.Emit("register", username +"|"+ roomid);
            }

            hexMap.StartMultiplayer();
        }
Exemple #2
0
 public void StartGameSingle()
 {
     Global.UnfocusAllTextBox();
     gameMode = GameMode.Single;
     CurrentGameState = GameState.Started;
     if (hexMap == null)
     {
         string[] textures = new string[3];
         textures[0] = "Hexa";
         textures[1] = "hexa_near";
         textures[2] = "hexa_far";
         hexMap = new HexagonMap((int)(375.0f * ScreenScaleFactor.X), (int)(110.0f * ScreenScaleFactor.Y), 9, 45, 26, textures);
     }
     hexMap.StartSingle();
 }
Exemple #3
0
        public void ResetGame()
        {
            CurrentGameState = GameState.NotStarted;
            if (gameMode == GameMode.Multiplayer)
            {
                if (connectionState == ConnectionState.Waiting || connectionState == ConnectionState.Connected)
                {
                    HexagonServer.Emit("unregister");
                }

                connectionState = ConnectionState.NotConnected;
            }

            hexMap = null;
        }