Exemplo n.º 1
0
        //  [STAThread]
        public static void Main(String[] args)
        {
            data[0] = new ClientData("akka.tcp://client1@localhost:", 1111, "/user/GameActor", 1, "client1");
            data[1] = new ClientData("akka.tcp://client2@localhost:", 2222, "/user/GameActor", 2, "client2");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            clientClass = new ClientClass(data, "client1");
            clientItem  = clientClass.initializeClient(0, data.Length);

            t1 = new Test();
            t1.setNumPlayer(data.Length);


            // line = Console.ReadLine();
            line = "";
            //System.Threading.Thread.Sleep(5000);

            while (line != null)
            {
                line = Console.ReadLine();
                if (line == "start")
                {
                    clientAlcatraz = clientItem.getAlcatraz();
                    clientItem.getAlcatraz().showWindow();
                    clientAlcatraz.addMoveListener(t1);
                    clientItem.getAlcatraz().getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                    clientItem.getAlcatraz().start();
                    Application.Run();
                }
            }
        }
Exemplo n.º 2
0
        //  [STAThread]
        public static void Main(String[] args)
        {
            string actorSystemName = "client2";

            Console.Title = actorSystemName;

            var actorSystem    = ActorSystem.Create(actorSystemName);
            var localChatActor = actorSystem.ActorOf(Props.Create <GameActor>(), "GameActor");

            child = actorSystem.ActorOf(Props.Create <GameActor>(), "GameActorClient2Child");
            string remoteActorAddressClient1 = "akka.tcp://client1@localhost:1111/user/GameActor";

            remoteChatActorClient1 = actorSystem.ActorSelection(remoteActorAddressClient1);

            data    = new ClientData[1];
            data[0] = new ClientData("akka.tcp://client1@localhost:", 1111, "/user/GameActor", 1, "client1");
            other   = new Alcatraz[data.Length + 1];

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            clientClass = new ClientClass(data, "client2");
            clientItem  = clientClass.initializeClient(1, data.Length + 1, data, "client2");
            // loop here and sent to other
            if (clientItem != null)
            {
                string line = string.Empty;
                while (line != null && line != "received")
                {
                    line = Console.ReadLine();
                    remoteChatActorClient1.Tell(clientItem, child);
                }
            }
            t1 = new Test();
            t1.setNumPlayer(data.Length + 1);


            // line = Console.ReadLine();
            line = "";
            //System.Threading.Thread.Sleep(5000);

            while (line != null)
            {
                line = Console.ReadLine();
                if (line == "start")
                {
                    clientAlcatraz = clientItem.getAlcatraz();
                    clientItem.getAlcatraz().showWindow();
                    clientAlcatraz.addMoveListener(t1);
                    clientItem.getAlcatraz().getWindow().FormClosed += new FormClosedEventHandler(Test_FormClosed);
                    clientItem.getAlcatraz().start();
                    Application.Run();
                }
            }
        }