コード例 #1
0
        public GameBoardScreen() : base("GameBoardScreen")
        {
            GNet.OnGotMessage += GNet_OnGotMessage;

            // Hail the opponent
            GNet.SendMessage(Systems.MessageType.Hail, GSettings.Name);

            MyNameLabel       = GetMenuItem <MLabel>("MyName");
            OpponentNameLabel = GetMenuItem <MLabel>("OpponentName");
        }
コード例 #2
0
 public void Connect()
 {
     if (GNet.StartClient(_IpTextBox.Text))
     {
         _ConnectButton.BorderColor = Color.Aqua;
     }
     else
     {
         _ConnectButton.BorderColor = Color.Red;
     }
 }
コード例 #3
0
        void StartServerGame()
        {
            NetOutgoingMessage _message;

            Player1          = GScene.Create <Player>();
            Player1.IsServer = true;
            _message         = GNet.CreateMessage();
            _message.Write((byte)Systems.ObjectType.Player);
            Player.CreateSpec.Serialize(Player1, _message);
            GNet.SendMessage(Systems.MessageType.CreateObject, _message);

            Player2          = GScene.Create <Player>();
            Player2.IsServer = false;
            _message         = GNet.CreateMessage();
            _message.Write((byte)Systems.ObjectType.Player);
            Player.CreateSpec.Serialize(Player2, _message);
            GNet.SendMessage(Systems.MessageType.CreateObject, _message);

            _Started = true;
        }
コード例 #4
0
        public ServerConnectScreen() : base("ServerConnectScreen")
        {
            GNet.StartServer();

            GNet.OnNewConnection += GNet_OnNewConnection;
        }