Ejemplo n.º 1
0
 private void __Connect()
 {
     try
     {
         m_client.Connect();
     }
     catch (ThreadAbortException)
     {
     }
 }
Ejemplo n.º 2
0
 void OnGUI()
 {
     if (!hasCreateGame)
     {
         if (GUILayout.Button("Connect"))
         {
             m_battleClient.Connect("127.0.0.1", 1234);
         }
         if (GUILayout.Button("FindMatch"))
         {
             m_battleClient.FindMatch();
         }
         if (GUILayout.Button("CancelFindMatch"))
         {
             m_battleClient.CancelFindMatch();
         }
     }
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Logging on with Starcraft; enter CD key.");
            string cdKey = Console.ReadLine().Trim();
            Console.WriteLine("Enter account name:");
            string acct = Console.ReadLine().Trim();
            Console.WriteLine("Enter account password for {0}:", acct);
            string password = Console.ReadLine().Trim();

            Settings set = new Settings() { CdKey1 = cdKey, Username = acct, Password = password, CdKeyOwner = acct };

            BattleNetClient client = new BattleNetClient(set);
            client.Connected += delegate { Console.WriteLine("--- CONNECTED"); };
            client.Error += new ErrorEventHandler(client_Error);
            client.EnteredChat += new EnteredChatEventHandler(client_EnteredChat);
            client.LoginSucceeded += new EventHandler(client_LoginSucceeded);
            client.LoginFailed += new LoginFailedEventHandler(client_LoginFailed);
            client.ServerBroadcast += new ServerChatEventHandler(client_ServerBroadcast);
            client.ServerErrorReceived += new ServerChatEventHandler(client_ServerErrorReceived);
            client.UserShown += new UserEventHandler(client_UserShown);
            client.UserJoined += new UserEventHandler(client_UserJoined);
            client.UserLeft += new UserEventHandler(client_UserLeft);
            client.UserSpoke += new ChatMessageEventHandler(client_UserSpoke);
            client.UserEmoted += new ChatMessageEventHandler(client_UserEmoted);
            client.ClientCheckPassed += delegate { Console.WriteLine("--- VERSIONING PASSED"); };
            client.ClientCheckFailed += new ClientCheckFailedEventHandler(client_ClientCheckFailed);
            client.JoinedChannel += new ServerChatEventHandler(client_JoinedChannel);
            client.WardentUnhandled += delegate { Console.WriteLine("--- WARNING: Warden requested and unhandled!!"); };
            client.MessageSent += new ChatMessageEventHandler(client_MessageSent);
            client.Disconnected += delegate { Console.WriteLine("--- DISCONNECTED"); };

            BattleNetClientResources.IncomingBufferPool.NewBufferAllocated += new EventHandler(BufferAllocated);
            BattleNetClientResources.OutgoingBufferPool.NewBufferAllocated += new EventHandler(BufferAllocated);

            Console.WriteLine("Events hooked up; press <enter> to connect.");
            Console.ReadLine();

            Console.WriteLine("Type /exit to quit.");

            client.Connect();

            string text;
            bool exit = false;
            do
            {
                text = Console.ReadLine();
                if (!text.Equals("/exit", StringComparison.Ordinal))
                {
                    client.SendMessage(text);
                }
                else
                {
                    exit = true;
                }
            } while (!exit);

            client.Close();
            Console.WriteLine("Disconnected; press <enter> to exit.");
            Console.ReadLine();

        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Logging on with Starcraft; enter CD key.");
            string cdKey = Console.ReadLine().Trim();

            Console.WriteLine("Enter account name:");
            string acct = Console.ReadLine().Trim();

            Console.WriteLine("Enter account password for {0}:", acct);
            string password = Console.ReadLine().Trim();

            Settings set = new Settings()
            {
                CdKey1 = cdKey, Username = acct, Password = password, CdKeyOwner = acct
            };

            BattleNetClient client = new BattleNetClient(set);

            client.Connected           += delegate { Console.WriteLine("--- CONNECTED"); };
            client.Error               += new ErrorEventHandler(client_Error);
            client.EnteredChat         += new EnteredChatEventHandler(client_EnteredChat);
            client.LoginSucceeded      += new EventHandler(client_LoginSucceeded);
            client.LoginFailed         += new LoginFailedEventHandler(client_LoginFailed);
            client.ServerBroadcast     += new ServerChatEventHandler(client_ServerBroadcast);
            client.ServerErrorReceived += new ServerChatEventHandler(client_ServerErrorReceived);
            client.UserShown           += new UserEventHandler(client_UserShown);
            client.UserJoined          += new UserEventHandler(client_UserJoined);
            client.UserLeft            += new UserEventHandler(client_UserLeft);
            client.UserSpoke           += new ChatMessageEventHandler(client_UserSpoke);
            client.UserEmoted          += new ChatMessageEventHandler(client_UserEmoted);
            client.ClientCheckPassed   += delegate { Console.WriteLine("--- VERSIONING PASSED"); };
            client.ClientCheckFailed   += new ClientCheckFailedEventHandler(client_ClientCheckFailed);
            client.JoinedChannel       += new ServerChatEventHandler(client_JoinedChannel);
            client.WardentUnhandled    += delegate { Console.WriteLine("--- WARNING: Warden requested and unhandled!!"); };
            client.MessageSent         += new ChatMessageEventHandler(client_MessageSent);
            client.Disconnected        += delegate { Console.WriteLine("--- DISCONNECTED"); };

            BattleNetClientResources.IncomingBufferPool.NewBufferAllocated += new EventHandler(BufferAllocated);
            BattleNetClientResources.OutgoingBufferPool.NewBufferAllocated += new EventHandler(BufferAllocated);

            Console.WriteLine("Events hooked up; press <enter> to connect.");
            Console.ReadLine();

            Console.WriteLine("Type /exit to quit.");

            client.Connect();

            string text;
            bool   exit = false;

            do
            {
                text = Console.ReadLine();
                if (!text.Equals("/exit", StringComparison.Ordinal))
                {
                    client.SendMessage(text);
                }
                else
                {
                    exit = true;
                }
            } while (!exit);

            client.Close();
            Console.WriteLine("Disconnected; press <enter> to exit.");
            Console.ReadLine();
        }