Example #1
0
        public static void ConsoleMain(string[] args)
        {
            Root r = new Root(args, false);

            SpaceWar2006.GameSystem.Mod.Instance.Init();

            ServerFinder scanner = new ServerFinder(Answer, true, true);

            for (int i = 0; i < 50; ++i)
            {
                scanner.Tick(0.1f);
                Thread.Sleep(100);
            }

            System.Console.WriteLine("---------SERVERS----------");

            List <IPEndPoint> list = new List <IPEndPoint>();
            int j = 0;

            foreach (KeyValuePair <IPEndPoint, GameSystem.GameServerInfo> kv in servers)
            {
                list.Add(kv.Key);
                j++;
                System.Console.Write("[" + j.ToString() + "] " + kv.Key.ToString() + ": ");
                System.Console.WriteLine(kv.Value.ToString());
            }

            System.Console.WriteLine("--------------------------");
            System.Console.Write("select server: ");
            int select = int.Parse(System.Console.ReadLine()) - 1;

            IPEndPoint connect = list[select];

            System.Console.WriteLine("Connecting to " + connect.ToString() + "...");

            args = new string[] { "client", "-connect", connect.ToString() };
            Root.Instance.Args = args;
            r.ClientClient(args);

            Flow f = new SpaceWar2006.Flows.ClientStart();

            r.CurrentFlow = f;

            f.Start();

            r.ClientLoop();

            r.Dispose();
        }
Example #2
0
        public static void ClientMain(string[] args)
        {
            Root r = new Root(args, false);
            r.ClientClient(args);
            IUserInterface ui = r.UserInterface;

            Flow f = new SpaceWar2006.Flows.ClientStart();

            r.CurrentFlow = f;

            f.Start();

            r.ClientLoop();

            r.Dispose();
        }
Example #3
0
        public static void ClientMain(string[] args)
        {
            Root r = new Root(args, false);

            r.ClientClient(args);
            IUserInterface ui = r.UserInterface;

            Flow f = new SpaceWar2006.Flows.ClientStart();

            r.CurrentFlow = f;

            f.Start();

            r.ClientLoop();

            r.Dispose();
        }
Example #4
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            GameRunning = true;
            string[] args = new string[] { };

            Root r = Root.Instance;

            r.Authoritive = false;
            r.ClientClient(args);
            IUserInterface ui = r.UserInterface;

            //Cheetah.Root.Instance.LocalObjects.Add(new Helper());

            Cheetah.Console.ConsoleEvent += ConsoleOutput;


            Flow f = new SpaceWar2006.Flows.ClientStart();

            r.CurrentFlow = f;



            f.Start();

            r.ClientLoop();

            //Cheetah.Root.Instance.LocalObjects.Clear();

            r.Gui.windows.Clear();
            r.Gui = null;
            GC.Collect();
            r.ResourceManager.UnloadAll();
            r.UserInterface.Dispose();
            r.UserInterface = null;

            Cheetah.Console.ConsoleEvent -= ConsoleOutput;
            GameRunning = false;
        }
Example #5
0
        private void JoinButton_Click(object sender, EventArgs e)
        {
            if (IpAddress.Text.Length == 0)
            {
                MessageBox.Show(this, "Select a server first.", "<°)))><", MessageBoxButtons.OK);
                return;
            }

            if (GameRunning)
            {
                MessageBox.Show(this, "Stop the current game first.", "<°)))><", MessageBoxButtons.OK);
                return;
            }

            GameRunning = true;

            string address = IpAddress.Text;

            string[] args;
            if (string.IsNullOrEmpty(JoinPassword.Text))
            {
                args = new string[] { "-connect", address }
            }
            ;
            else
            {
                args = new string[] { "-connect", address, "-password", JoinPassword.Text }
            };

            Root r = Root.Instance;

            r.Args = args;

            r.Authoritive = false;
            r.ClientClient(args);
            IUserInterface ui = r.UserInterface;

            Flow f = new SpaceWar2006.Flows.ClientStart();

            r.CurrentFlow = f;

            f.Start();

            r.ClientLoop();

            r.ResourceManager.UnloadAll();
            r.UserInterface.Dispose();
            r.UserInterface = null;

            GameRunning = false;
        }

        Map CreateMap()
        {
            if (HostMap.SelectedItem is Type)
            {
                return((Map)Root.Instance.Factory.CreateInstance((Type)HostMap.SelectedItem));
            }
            else if (HostMap.SelectedItem is string)
            {
                return(new XmlMap((string)HostMap.SelectedItem));
            }

            throw new Exception("unknown map selected.");
        }
Example #6
0
        public static void ConsoleMain(string[] args)
        {
            Root r = new Root(args, false);
            SpaceWar2006.GameSystem.Mod.Instance.Init();

            ServerFinder scanner = new ServerFinder(Answer,true,true);

            for (int i = 0; i < 50; ++i)
            {
                scanner.Tick(0.1f);
                Thread.Sleep(100);
            }

            System.Console.WriteLine("---------SERVERS----------");

            List<IPEndPoint> list = new List<IPEndPoint>();
            int j = 0;
            foreach (KeyValuePair<IPEndPoint, GameSystem.GameServerInfo> kv in servers)
            {
                list.Add(kv.Key);
                j++;
                System.Console.Write("["+ j.ToString()+"] "+kv.Key.ToString()+": ");
                System.Console.WriteLine(kv.Value.ToString());
            }

            System.Console.WriteLine("--------------------------");
            System.Console.Write("select server: ");
            int select = int.Parse(System.Console.ReadLine()) - 1;

            IPEndPoint connect = list[select];

            System.Console.WriteLine("Connecting to "+connect.ToString()+"...");

            args = new string[] { "client", "-connect", connect.ToString() };
            Root.Instance.Args = args;
            r.ClientClient(args);

            Flow f = new SpaceWar2006.Flows.ClientStart();

            r.CurrentFlow = f;

            f.Start();

            r.ClientLoop();

            r.Dispose();
        }
Example #7
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            GameRunning = true;
            string[] args = new string[] { };

            Root r = Root.Instance;
            r.Authoritive = false;
            r.ClientClient(args);
            IUserInterface ui = r.UserInterface;

            //Cheetah.Root.Instance.LocalObjects.Add(new Helper());

            Cheetah.Console.ConsoleEvent += ConsoleOutput;

            Flow f = new SpaceWar2006.Flows.ClientStart();

            r.CurrentFlow = f;

            f.Start();

            r.ClientLoop();

            //Cheetah.Root.Instance.LocalObjects.Clear();

            r.Gui.windows.Clear();
            r.Gui = null;
            GC.Collect();
            r.ResourceManager.UnloadAll();
            r.UserInterface.Dispose();
            r.UserInterface = null;

            Cheetah.Console.ConsoleEvent -= ConsoleOutput;
            GameRunning = false;
        }
Example #8
0
        private void JoinButton_Click(object sender, EventArgs e)
        {
            if (IpAddress.Text.Length == 0)
            {
                MessageBox.Show(this, "Select a server first.", "<°)))><", MessageBoxButtons.OK);
                return;
            }

            if (GameRunning)
            {
                MessageBox.Show(this, "Stop the current game first.", "<°)))><", MessageBoxButtons.OK);
                return;
            }

            GameRunning = true;

            string address = IpAddress.Text;
            string[] args;
            if(string.IsNullOrEmpty(JoinPassword.Text))
                args = new string[] { "-connect", address};
            else
                args = new string[] { "-connect", address, "-password", JoinPassword.Text };

            Root r = Root.Instance;
            r.Args = args;

            r.Authoritive = false;
            r.ClientClient(args);
            IUserInterface ui = r.UserInterface;

            Flow f = new SpaceWar2006.Flows.ClientStart();

            r.CurrentFlow = f;

            f.Start();

            r.ClientLoop();

            r.ResourceManager.UnloadAll();
            r.UserInterface.Dispose();
            r.UserInterface = null;

            GameRunning = false;
        }