コード例 #1
0
        public void Start()
        {
            Connection = new YGOClient();
            _behavior  = new GameBehavior(this);

            Connection.Connected      += OnConnected;
            Connection.PacketReceived += OnPacketReceived;

            Connection.Connect(IPAddress.Parse(_serverHost), _serverPort);
        }
コード例 #2
0
ファイル: GameClient.cs プロジェクト: Tic-Tac-Toc/windbot
        public void Start()
        {
            Connection = new YGOClient();
            _behavior = new GameBehavior(this);

            Connection.Connected += OnConnected;
            Connection.PacketReceived += OnPacketReceived;

            Connection.Connect(IPAddress.Parse(_serverHost), _serverPort);
        }
コード例 #3
0
ファイル: GameClient.cs プロジェクト: gragonvlad/windbot
        public void Start()
        {
            Connection = new YGOClient();
            _behavior  = new GameBehavior(this);

            Connection.Connected      += OnConnected;
            Connection.PacketReceived += OnPacketReceived;
            IPAddress target_address;

            try {
                target_address = IPAddress.Parse(_serverHost);
            } catch (System.Exception e) {
                IPHostEntry _hostEntry = Dns.GetHostEntry(_serverHost);
                target_address = _hostEntry.AddressList[0];
            }
            Connection.Connect(target_address, _serverPort);
        }
コード例 #4
0
ファイル: GameClient.cs プロジェクト: Kuro59/windbot
        public void Start()
        {
            Connection = new GameConnection(IPAddress.Parse(_serverHost), _serverPort);
            _behavior  = new GameBehavior(this);

            GameClientPacket packet = new GameClientPacket(CtosMessage.PlayerInfo);

            packet.Write(Username, 20);
            Connection.Send(packet);

            byte[] junk = { 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00 };
            packet = new GameClientPacket(CtosMessage.JoinGame);
            packet.Write(Program.ProVersion);
            packet.Write(junk);
            packet.Write(_roomInfos, 30);
            Connection.Send(packet);
        }
コード例 #5
0
        public void Start()
        {
            Connection = new AIGameConnection(IPAddress.Parse(_serverHost), _serverPort);
            _behavior  = new GameBehavior(this);

            GameClientPacket packet = new GameClientPacket(CtosMessage.PlayerInfo);

            packet.Write(Username, 20);
            Connection.Send(packet);

            byte[] junk = { 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00 };
            packet = new GameClientPacket(CtosMessage.JoinGame);
            packet.Write((short)Program.ProVersion);
            packet.Write(junk);

            packet.Write(_roomInfos, 30);


            Deck deck = Deck.Load(Deck_);

            if (deck == null)
            {
                Logger.WriteLine("read deck fail.");
                Connection.Close();
                return;
            }

            packet.Write((byte)CtosMessage.UpdateDeck);

            packet.Write(deck.Cards.Count);
            packet.Write(deck.SideCards.Count);

            foreach (var k in deck.Cards)
            {
                packet.Write(k.Id);
            }

            foreach (var k in deck.SideCards)
            {
                packet.Write(k.Id);
            }

            packet.Write((byte)CtosMessage.HsReady);
            Connection.Send(packet);
            Logger.WriteLine("send deck");
        }
コード例 #6
0
ファイル: GameClient.cs プロジェクト: Zayelion/windbot
        public void Start()
        {
            Connection = new CoreClient(_serverHost, _serverPort);
            Connection.MessageReceived += OnMessageReceived;

            _behavior = new GameBehavior(this);

            GamePacketWriter packet = new GamePacketWriter(CtosMessage.PlayerInfo);
            packet.Write(Username, 20);
            Connection.Send(packet);

            byte[] junk = { 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00 };
            packet = new GamePacketWriter(CtosMessage.JoinGame);
            packet.Write(Program.ProVersion);
            packet.Write(junk);
            packet.Write(_roomInfos, 30);
            Connection.Send(packet);
        }
コード例 #7
0
ファイル: AIGameClient.cs プロジェクト: 247321453/YgoServer
		public void Start()
		{
			Connection = new AIGameConnection(IPAddress.Parse(_serverHost), _serverPort);
			_behavior = new GameBehavior(this);

			GameClientPacket packet = new GameClientPacket(CtosMessage.PlayerInfo);
			packet.Write(Username, 20);
			Connection.Send(packet);

			byte[] junk = { 0xCC, 0xCC, 0x00, 0x00, 0x00, 0x00 };
			packet = new GameClientPacket(CtosMessage.JoinGame);
			packet.Write((short)Program.ProVersion);
			packet.Write(junk);

			packet.Write(_roomInfos, 30);

			
			Deck deck = Deck.Load(Deck_);
			if(deck == null) {
				Logger.WriteLine("read deck fail.");
				Connection.Close();
				return;
			}

			packet.Write((byte)CtosMessage.UpdateDeck);

			packet.Write(deck.Cards.Count);
			packet.Write(deck.SideCards.Count);

			foreach (var k in deck.Cards) {
				packet.Write(k.Id);
			}

			foreach (var k in deck.SideCards) {
				packet.Write(k.Id);
			}

			packet.Write((byte)CtosMessage.HsReady);
			Connection.Send(packet);
			Logger.WriteLine("send deck");
		}
コード例 #8
0
        public void Start()
        {
            Connection = new YGOClient();
            _behavior  = new GameBehavior(this);

            Connection.Connected      += OnConnected;
            Connection.PacketReceived += OnPacketReceived;

            IPAddress target_address;

            try
            {
                target_address = IPAddress.Parse(_serverHost);
            }
            catch (System.Exception)
            {
                IPHostEntry _hostEntry = Dns.GetHostEntry(_serverHost);
                target_address = _hostEntry.AddressList.FirstOrDefault(findIPv4 => findIPv4.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork);
            }

            Connection.Connect(target_address, _serverPort);
        }