public static NetworkRequest Prepare(int playerID, int wonGame)
 {
     NetworkRequest request = new NetworkRequest(NetworkCode.MATCH_OVER);
     request.AddInt32(playerID);
     request.AddInt32(wonGame);
     return request;
 }
 public static NetworkRequest Prepare(int playerID, string playerName)
 {
     NetworkRequest request = new NetworkRequest(NetworkCode.MATCH_STATUS);
     request.AddInt32(playerID);
     request.AddString (playerName);
     return request;
 }
Exemplo n.º 3
0
        public static NetworkRequest Prepare(short type)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.LOGOUT);
            request.AddShort16(type);

            return request;
        }
        public static NetworkRequest Prepare(string message)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.ERROR_LOG);
            request.AddString(message);

            return request;
        }
        public static NetworkRequest Prepare(int player_id)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.PLAYER_SELECT);
            request.AddInt32(player_id);

            return request;
        }
 public static NetworkRequest Prepare(int playerID, int attackersPosition)
 {
     NetworkRequest request = new NetworkRequest(NetworkCode.TREE_ATTACK);
     request.AddInt32(playerID);
     request.AddInt32(attackersPosition);
     return request;
 }
        public static NetworkRequest Prepare(int playerID, int roomID)
        {
            NetworkRequest request = new NetworkRequest (NetworkCode.MATCH_INIT);
            request.AddInt32 (playerID);
            request.AddInt32 (roomID);

            return request;
        }
Exemplo n.º 8
0
        public static NetworkRequest Prepare(short type, string message)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.MESSAGE);
            request.AddShort16(type);
            request.AddString(message);

            return request;
        }
Exemplo n.º 9
0
        public static NetworkRequest Prepare(short type)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.SHOP);
            //		request.addShort16(0);
            request.AddShort16(type);

            return request;
        }
Exemplo n.º 10
0
 public static NetworkRequest Prepare(int playerID, int handPosition)
 {
     NetworkRequest request = new NetworkRequest(NetworkCode.DEAL_CARD);
     request.AddInt32(playerID);
     request.AddInt32(handPosition);
     Debug.Log("Deal Card , playerID: " + playerID);
     return request;
 }
Exemplo n.º 11
0
        public static NetworkRequest Prepare(int zone_id, int user_id)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.ZONE);
            request.AddInt32(zone_id);
            request.AddInt32(user_id);

            return request;
        }
Exemplo n.º 12
0
        public static NetworkRequest Prepare(int world_id, int player_id)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.ECOSYSTEM);
            request.AddInt32(world_id);
            request.AddInt32(player_id);

            return request;
        }
Exemplo n.º 13
0
        public static NetworkRequest Prepare(string version, string session_id)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.CLIENT);
            request.AddString(version);
            request.AddString(session_id);

            return request;
        }
Exemplo n.º 14
0
        public static NetworkRequest Prepare(string user_id, string password)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.LOGIN);
            request.AddString(user_id);
            request.AddString(password);

            return request;
        }
Exemplo n.º 15
0
        public static void Send(NetworkRequest packet, Callback callback)
        {
            NetworkManager.Send (packet);

            int protocol_id = packet.GetID ();
            if (!callbackList.ContainsKey (protocol_id)) {
                callbackList [protocol_id] = new Queue<Callback> ();
            }

            callbackList [protocol_id].Enqueue (callback);
        }
Exemplo n.º 16
0
        public static NetworkRequest Prepare(string fname, string lname, string email, string password, string name, short color)
        {
            NetworkRequest request = new NetworkRequest (NetworkCode.REGISTER);
            request.AddString (fname);
            request.AddString (lname);
            request.AddString (email);
            request.AddString (password);
            request.AddString (name);

            return request;
        }
        public static NetworkRequest Prepare(int zone_id, int player_id, int vegetation_capacity, int natural_event)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.ZONE_UPDATE);
            request.AddInt32(zone_id);
            //		request.addInt32(Constants.USER_ID);
            request.AddInt32(player_id);
            request.AddInt32(vegetation_capacity);
            request.AddInt32(natural_event);

            return request;
        }
        public static NetworkRequest Prepare(short type, Dictionary<int, int> cartList)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.SHOP_ACTION);
            request.AddShort16(type);
            request.AddShort16((short) cartList.Count);

            foreach (KeyValuePair<int, int> entry in cartList) {
            request.AddInt32(entry.Key);
            request.AddInt32(entry.Value);
            }

            return request;
        }
        // Card Constructor
        //public void init(BattlePlayer player, int cardID, int diet,
        // int level, int attack, int health,string species_name, string type, string description
        public static NetworkRequest Prepare(int playerID, int cardID, int diet, 
            int level, int attack, int health,
            string species_name, string type,
            string description)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.SUMMON_CARD);
            request.AddInt32(playerID);
            request.AddInt32(cardID);
            request.AddInt32 (diet);
            request.AddInt32(level);
            request.AddInt32(attack);
            request.AddInt32 (health);
            request.AddString (species_name);

            // These two not used
            request.AddString (type);
            request.AddString (description);

            return request;
        }
        // Card Constructor
        //public void init(BattlePlayer player, int cardID, int diet,
        // int level, int attack, int health,string species_name, string type, string description

        public static NetworkRequest Prepare(int playerID, int cardID, int diet,
                                             int level, int attack, int health,
                                             string species_name, string type,
                                             string description)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.SUMMON_CARD);

            request.AddInt32(playerID);
            request.AddInt32(cardID);
            request.AddInt32(diet);
            request.AddInt32(level);
            request.AddInt32(attack);
            request.AddInt32(health);
            request.AddString(species_name);

            // These two not used
            request.AddString(type);
            request.AddString(description);

            return(request);
        }
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.PREDICTION);

            return(request);
        }
Exemplo n.º 22
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.PLAYERS);

            return request;
        }
Exemplo n.º 23
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.UPDATE_ENV_SCORE);

            return(request);
        }
Exemplo n.º 24
0
        // Update is called once per frame
        void Update()
        {
            if (!cManager.Connected)
            {
                return;
            }

            while (requests.Count > 0)
            {
                NetworkRequest packet = requests.Peek();

                if (cManager.Send(packet.GetBytes()))
                {
                    requests.Dequeue();

                    if (packet.GetID() != 211)
                    {
                        Debug.Log("CW: Sent Request No. " + packet.GetID() + " [" + NetworkProtocolTable.Get(packet.GetID()).ToString() + "]");
                    }
                }
            }

            counter++;
            if (counter == interval)
            {
                //Debug.Log ("checking response buffer... (+50)");
                counter = 0;
            }
            foreach (NetworkResponse args in cManager.Read())
            {
                bool status = false;

                int protocol_id = args.GetID();

                // One-Time
                if (callbackList.ContainsKey(protocol_id))
                {
                    if (callbackList [protocol_id].Count > 0)
                    {
                        callbackList [protocol_id].Dequeue() (args);

                        status = true;
                    }
                }
                // Listen
                if (listenList.ContainsKey(protocol_id))
                {
                    if (listenList [protocol_id].Count > 0)
                    {
                        foreach (Callback callback in listenList[protocol_id])
                        {
                            callback(args);
                        }

                        status = true;
                    }
                }

                if (args.GetID() != 211)
                {
                    Debug.Log((status ? "Processed" : "Ignored") + " Response No. " + args.GetID() + " [" + NetworkProtocolTable.Get(args.GetID()).ToString() + "]");
                }
            }
        }
Exemplo n.º 25
0
 public static void Send(NetworkRequest packet)
 {
     requests.Enqueue(packet);
 }
Exemplo n.º 26
0
 public static void Send(NetworkRequest packet)
 {
     requests.Enqueue (packet);
 }
Exemplo n.º 27
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.WORLD);

            return request;
        }
Exemplo n.º 28
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.PLAYERS);

            return(request);
        }
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.RETURN_LOBBY);

            return(request);
        }
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.SPECIES_CREATE);

            return request;
        }
Exemplo n.º 31
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.UPDATE_RESOURCES);

            return(request);
        }
Exemplo n.º 32
0
	public static NetworkRequest Prepare(int playerID) {
		NetworkRequest request = new NetworkRequest(NetworkCode.QUIT_MATCH);
		request.AddInt32(playerID);
		return request;
	}
Exemplo n.º 33
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.HEARTBEAT);

            return request;
        }
Exemplo n.º 34
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.HEARTBEAT);

            return(request);
        }
Exemplo n.º 35
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.SPECIES_LIST);

            return(request);
        }
Exemplo n.º 36
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.ZONE_LIST);

            return request;
        }
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.UPDATE_TIME);

            return request;
        }
Exemplo n.º 38
0
 public static NetworkRequest Prepare(int playerID)
 {
     NetworkRequest request = new NetworkRequest(NetworkCode.END_TURN);
     request.AddInt32(playerID);
     return request;
 }
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.PREDICTION);

            return request;
        }
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.RETURN_LOBBY);

            return request;
        }