Example #1
0
 public GameController(GameConnection cn, GameInterface g)
 {
     gameInterface = g;
     cn.setGame(this);
     game = new GameState();
     gameInterface.setObservers(game.hero, game.villain, game.stack);
     setupEventHandlers();
     stackxd = new Stack<StackWrapper>();
 }
 public static void newGame(GameConnection c)
 {
     Thread t = new Thread(newGameT);
     t.Start(c);
 }
Example #3
0
        public void receiveMessage(SMessage m)
        {
            //Console.WriteLine(m.ToString());

            switch (m.header)
            {
                case "game":
                {
                    Network.receiveGameMessage(m.from, m.message);
                } break;

                case "tell":
                {
                        GUI.showTell(m.from, m.message);
                } break;

                case "startgame":
                {
                    var ss = m.message.Split(',');
                    GameConnection c = new GameConnection(ss[0], ss[1] == "home");
                    Network.addGameConnection(ss[0], c);
                    CentralShitterModule.newGame(c);

                } break;

                case "error":
                {
                    Console.WriteLine("Error: {0}", m.message);
                } break;

                default:
                {
                    System.Console.WriteLine("borked message: " + m.ToString());
                } break;
            }
        }
Example #4
0
 /// <summary>
 /// Adds a game connection to the given user
 /// </summary>
 /// <param name="s">The user to set up the game connection with</param>
 /// <param name="c">The game connection</param>
 public static void addGameConnection(string s, GameConnection c)
 {
     gameConnections.Add(s, c);
 }