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;
 }
        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;
        }
        public static NetworkRequest Prepare(short type, string message)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.MESSAGE);
            request.AddShort16(type);
            request.AddString(message);

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

            return request;
        }
 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;
 }
示例#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;
        }
        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;
        }
        public static NetworkRequest Prepare(string version, string session_id)
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.CLIENT);
            request.AddString(version);
            request.AddString(session_id);

            return request;
        }
示例#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;
        }
        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);
        }
        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);
        }
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.PLAYERS);

            return request;
        }
示例#23
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.UPDATE_ENV_SCORE);

            return(request);
        }
        // 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() + "]");
                }
            }
        }
 public static void Send(NetworkRequest packet)
 {
     requests.Enqueue(packet);
 }
 public static void Send(NetworkRequest packet)
 {
     requests.Enqueue (packet);
 }
示例#27
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.WORLD);

            return request;
        }
        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;
        }
示例#31
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.UPDATE_RESOURCES);

            return(request);
        }
	public static NetworkRequest Prepare(int playerID) {
		NetworkRequest request = new NetworkRequest(NetworkCode.QUIT_MATCH);
		request.AddInt32(playerID);
		return request;
	}
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.HEARTBEAT);

            return request;
        }
示例#34
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.HEARTBEAT);

            return(request);
        }
示例#35
0
        public static NetworkRequest Prepare()
        {
            NetworkRequest request = new NetworkRequest(NetworkCode.SPECIES_LIST);

            return(request);
        }
        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;
        }
 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;
        }