示例#1
0
文件: Game1.cs 项目: bikrone/hexagon
        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();
        }
示例#2
0
文件: Game1.cs 项目: bikrone/hexagon
 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();
 }
示例#3
0
文件: Game1.cs 项目: bikrone/hexagon
        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;
        }