Exemplo n.º 1
0
 public void playerFires(int location)
 {
     if (otherPlayerId != string.Empty)
     {
         CometWorker.SendToClient(otherPlayerId, EXTML.Method("playerShot", location));
     }
 }
Exemplo n.º 2
0
        public void gotShot(string xs, string ys)
        {
            string playerId = otherPlayerId;

            CometWorker.SendToClient(playerId,
                                     EXTML.Method("playerShot:andY:andWidth:andHeight:", xs, ys, opponentSize.Width, opponentSize.Height));
        }
Exemplo n.º 3
0
        public void ClassTest(TestClass tc, DateTime dt)
        {
            string message = "";

            if (IsDesktop)
            {
                message = EXTML.Method("TestClassReceived", tc.number, tc.items.Count, tc.text, dt.ToShortDateString());
            }
            else
            {
                message = JSON.Method("TestClassReceived", tc.number, tc.items.Count, tc.text, dt.ToShortDateString());
            }
            CometWorker.SendToClient(ClientId, message);
        }
Exemplo n.º 4
0
        public void UnSubscribe()
        {
            CometWorker.Groups.UnpinClient(ClientId);
            string message = "";

            if (IsDesktop)
            {
                message = EXTML.Method("UnSubscribed");
            }
            else
            {
                message = JSON.Method("UnSubscribed");
            }

            CometWorker.SendToClient(ClientId, message);
        }
Exemplo n.º 5
0
        public void Subscribe()
        {
            string message = "";

            if (IsDesktop)
            {
                CometWorker.Groups.PinClientID(ClientId, "ServerTime-Desktop");
                message = EXTML.Method("Subscribed");
            }
            else
            {
                CometWorker.Groups.PinClientID(ClientId, "ServerTime-Web");
                message = JSON.Method("Subscribed");
            }

            CometWorker.SendToClient(ClientId, message);
        }
Exemplo n.º 6
0
        public void leaveRoom()
        {
            lock (sessionKeys)
            {
                sessionKeys.Remove(details.ClientId);
            }

            lock (waitingRoom)
            {
                waitingRoom.Remove(details.ClientId);
            }

            if (otherPlayerId != string.Empty)
            {
                CometWorker.SendToClient(otherPlayerId, EXTML.Method("PlayerLeft"));
                otherPlayerId = "";
            }
        }
Exemplo n.º 7
0
        static ServerInstance()
        {
            //Define image resource
            ResourceManager.AddResource(CometWorker.GetApplicationPath() + "pokein_logo.gif" //resource location
                                        , "Logo"                                             //public name of the resource
                                        , ResourceType.Image                                 //Image type
                                        , string.Empty                                       //This resource is application wide
                                        );

            string message = "PokeIn Library";

            byte[] bt = CometSettings.SerializationEncoding.GetBytes(message);
            //Define text resource
            ResourceManager.AddResource(ref bt
                                        , "Message"         //public name of the resource
                                        , ResourceType.Text //Text type
                                        , "txt"             //file type
                                        , string.Empty      //This resource is application wide
                                        );

            new Thread(delegate()
            {
                while (!CometWorker.IsApplicationRecycling)
                {
                    if (CometWorker.Groups.GroupHasMembers("ServerTime-Desktop"))
                    {
                        string ext = EXTML.Method("ServerTimeUpdated", DateTime.Now);
                        CometWorker.Groups.Send("ServerTime-Desktop", ext);
                    }

                    if (CometWorker.Groups.GroupHasMembers("ServerTime-Web"))
                    {
                        string json = JSON.Method("ServerTimeUpdated", DateTime.Now);
                        CometWorker.Groups.Send("ServerTime-Web", json);
                    }

                    Thread.Sleep(800);
                }
            }).Start();
        }
Exemplo n.º 8
0
 internal void startGame(int [] nums)
 {
     CometWorker.SendToClient(details.ClientId, EXTML.Method("creatureArray:", nums));
 }