Exemple #1
0
        private void StartLocalServer()
        {
            ServerCore sc = new ServerCore(false);

            Thread.Sleep(300);
            Thread t = new Thread(() => ClientPacketSender.Login("Player", "PassClient"));

            t.Start();
        }
Exemple #2
0
        public override bool LeftClick()
        {
            ClientNetwork net = ClientNetwork.GetClientNetwork();

            foreach (InputBox b in tBox)
            {
                b.isSelected = false;
            }
            if (isWar)
            {
                if (buttons[0].Rect.Contains(new Point((int)core.inputManager.cursor.Position.X, (int)core.inputManager.cursor.Position.Y)))
                {
                    if (tBox[0].stringInBox != null && tBox[1].stringInBox != null &&
                        tBox[0].stringInBox.Length > 0 && tBox[1].stringInBox.Length > 0)
                    {
                        if (!net.IsLogging())
                        {
                            core.SetWorld(new World(true));
                            ClientNetwork.GetClientNetwork().Start();
                            Core.console.AddDebugString("Connecting...");
                            Thread t = new Thread(() => ClientPacketSender.Login(tBox[0].stringInBox, tBox[1].stringInBox));
                            t.Start();
                            Settings.SaveLoginInfo(tBox[0].stringInBox, tBox[1].stringInBox);
                            return(true);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
                else if (buttons[1].Rect.Contains(new Point((int)core.inputManager.cursor.Position.X, (int)core.inputManager.cursor.Position.Y)))
                {
                    if (tBox[0].stringInBox != null && tBox[1].stringInBox != null &&
                        tBox[0].stringInBox.Length > 0 && tBox[1].stringInBox.Length > 0)
                    {
                        if (!net.IsLogging())
                        {
                            ClientNetwork.GetClientNetwork().Start();
                            Core.console.AddDebugString("Registering...");
                            Thread t = new Thread(() => ClientPacketSender.Register(tBox[0].stringInBox, tBox[1].stringInBox));
                            t.Start();
                            Settings.SaveLoginInfo(tBox[0].stringInBox, tBox[1].stringInBox);
                            return(true);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
                else if (buttons[2].Rect.Contains(new Point((int)core.inputManager.cursor.Position.X, (int)core.inputManager.cursor.Position.Y)))
                {
                    core.currentGui = new GuiMainMenu();
                    Settings.SaveLoginInfo(tBox[0].stringInBox, tBox[1].stringInBox);
                    return(true);
                }
                else
                {
                    foreach (InputBox b in tBox)
                    {
                        if (b.Rect.Contains(new Point((int)core.inputManager.cursor.Position.X, (int)core.inputManager.cursor.Position.Y)))
                        {
                            b.isSelected = true;
                            return(true);
                        }
                    }
                }
                return(false);
            }
            else
            {
                if (buttons[0].Rect.Contains(new Point((int)core.inputManager.cursor.Position.X, (int)core.inputManager.cursor.Position.Y)))
                {
                    if (tBox[0].stringInBox != null && tBox[1].stringInBox != null && tBox[2].stringInBox != null &&
                        tBox[0].stringInBox.Length > 0 && tBox[1].stringInBox.Length > 0 && tBox[2].stringInBox.Length > 0)
                    {
                        if (!net.IsLogging())
                        {
                            Core.console.AddDebugString("Connecting...");
                            core.SetWorld(new World(true));
                            core.currentGui = null;
                            ClientNetwork.GetClientNetwork().Start();
                            Thread t = new Thread(() => ClientPacketSender.Connect(tBox[0].stringInBox, tBox[1].stringInBox, int.Parse(tBox[2].stringInBox)));
                            t.Start();
                            Settings.SaveLoginInfo(tBox[0].stringInBox, tBox[1].stringInBox, tBox[2].stringInBox);
                            return(true);
                        }
                        else
                        {
                            return(true);
                        }
                    }
                }
                else if (buttons[1].Rect.Contains(new Point((int)core.inputManager.cursor.Position.X, (int)core.inputManager.cursor.Position.Y)))
                {
                    core.currentGui = new GuiMainMenu();
                    Settings.SaveLoginInfo(tBox[0].stringInBox, tBox[1].stringInBox, tBox[2].stringInBox);
                    return(true);
                }
                else
                {
                    foreach (InputBox b in tBox)
                    {
                        if (b.Rect.Contains(new Point((int)core.inputManager.cursor.Position.X, (int)core.inputManager.cursor.Position.Y)))
                        {
                            b.isSelected = true;
                            return(true);
                        }
                    }
                }
                return(false);
            }
        }