Ejemplo n.º 1
0
 public static NetworkRequest Prepare(int gameid, int pairParam)
 {
     NetworkRequest request = new NetworkRequest(NetworkCode.PAIR);
     request.AddInt32 (gameid);
     request.AddInt32 (pairParam);
     return request;
 }
    public static NetworkRequest Prepare(int gameid, int pairParam)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.PAIR);

        request.AddInt32(gameid);
        request.AddInt32(pairParam);
        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(int playerID, int wonGame)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.MATCH_OVER);

        request.AddInt32(playerID);
        request.AddInt32(wonGame);
        return(request);
    }
    public static NetworkRequest Prepare(int player_id, int ecosystem_id)
    {
        NetworkRequest request = new NetworkRequest (NetworkCode.CONVERGE_PRIOR_ATTEMPT_COUNT);
        request.AddInt32 (player_id);
        request.AddInt32 (ecosystem_id);

        return request;
    }
Ejemplo n.º 6
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;
    }
Ejemplo n.º 7
0
    public static NetworkRequest Prepare(int playerID, int attackersPosition)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.TREE_ATTACK);

        request.AddInt32(playerID);
        request.AddInt32(attackersPosition);
        return(request);
    }
Ejemplo n.º 8
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);
    }
    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 playerID1, int playerID2)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.MATCH_INIT);

        request.AddInt32(playerID1);
        request.AddInt32(playerID2);

        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);
    }
Ejemplo n.º 12
0
    public static NetworkRequest Prepare(int player_id, int ecosystem_id)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.CONVERGE_PRIOR_ATTEMPT_COUNT);

        request.AddInt32(player_id);
        request.AddInt32(ecosystem_id);

        return(request);
    }
    /// <summary>
    /// Generates a request with the following format:
    /// 	id of this protocol (short)
    /// 	id of player to be attacked (int)
    /// 	# of species in attack config (int)
    /// 	for each species in attack config:
    /// 		species id (int)
    /// </summary>
    /// <param name="otherPlayerID">the player to attack</param>
    /// <param name="species">list of species ids to use in attack</param>
    public static NetworkRequest Prepare(int otherPlayerID, List<int> species)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.CLASH_INITIATE_BATTLE);
        request.AddInt32(otherPlayerID);
        request.AddInt32(species.Count);
        foreach(int s in species){
            request.AddInt32(s);
        }

        return request;
    }
    public static NetworkRequest Prepare(int playerID, int roomID, short host, string userName)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.MC_MATCH_INIT);

        request.AddInt32(playerID);
        request.AddInt32(roomID);
        request.AddShort16(host);
        request.AddString(userName);

        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(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);
    }
Ejemplo n.º 17
0
    /// <summary>
    /// Generates a request with the following format:
    ///     id of this protocol (short)
    ///     id of player to be attacked (int)
    ///     # of species in attack config (int)
    ///     for each species in attack config:
    ///         species id (int)
    /// </summary>
    /// <param name="otherPlayerID">the player to attack</param>
    /// <param name="species">list of species ids to use in attack</param>
    public static NetworkRequest Prepare(int otherPlayerID, List <int> species)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.CLASH_INITIATE_BATTLE);

        request.AddInt32(otherPlayerID);
        request.AddInt32(species.Count);
        foreach (int s in species)
        {
            request.AddInt32(s);
        }

        return(request);
    }
    public static NetworkRequest Prepare(short action, Dictionary<int, int> speciesList)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.SPECIES_ACTION);
        request.AddShort16(action);
        request.AddShort16((short) speciesList.Count);

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

        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;
    }
    public static NetworkRequest Prepare(
        int playerId,
        int ecosystemId,
        int attemptId,
        int score
        )
    {
        NetworkRequest request = new NetworkRequest (NetworkCode.CONVERGE_NEW_ATTEMPT_SCORE);
        request.AddInt32 (playerId);
        request.AddInt32 (ecosystemId);
        request.AddInt32 (attemptId);
        request.AddInt32 (score);

        return request;
    }
    public static NetworkRequest Prepare(short action, Dictionary <int, int> speciesList)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.SPECIES_ACTION);

        request.AddShort16(action);
        request.AddShort16((short)speciesList.Count);

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

        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);
    }
Ejemplo n.º 23
0
    public static NetworkRequest Prepare(
        int playerId,
        int ecosystemId,
        int attemptId,
        int score
        )
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.CONVERGE_NEW_ATTEMPT_SCORE);

        request.AddInt32(playerId);
        request.AddInt32(ecosystemId);
        request.AddInt32(attemptId);
        request.AddInt32(score);

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

        return request;
    }
    /// <summary>
    /// Creates a request containing battle results
    /// </summary>
    /// <param name="res">The result</param>
    public static NetworkRequest Prepare(BattleResult res)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.CLASH_END_BATTLE);
        request.AddInt32((int)res);

        return request;
    }
 /// <summary>
 /// Creates the network request in the format
 /// 	id of this protocol (short)
 /// 	terrain name (string)
 /// 	# of species in config (int)
 /// 	for each species in config
 /// 		species id (int)
 /// 		instance count (int)
 /// 		for each instance
 /// 			x-coordinate (float)
 /// 			y-coordinate (float)
 /// </summary>
 /// <param name="terrainName">the terain name</param>
 /// <param name="config">The species in the config, with species id's as keys
 /// and Vector2's of x- & y-coordinates as values.</param>
 public static NetworkRequest Prepare(string terrainName, Dictionary<int, List<Vector2>> config)
 {
     NetworkRequest request = new NetworkRequest(NetworkCode.CLASH_DEFENSE_SETUP);
     request.AddString(terrainName);
     request.AddInt32(config.Count);
     foreach(var pair in config){
         request.AddInt32(pair.Key);
         List<Vector2> positions = pair.Value;
         request.AddInt32(positions.Count);
         foreach(Vector2 v in positions){
             request.AddFloat(v.x);
             request.AddFloat(v.y);
         }
     }
     return request;
 }
    public static NetworkRequest Prepare(int playerID)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.GET_DECK);

        request.AddInt32(playerID);
        return(request);
    }
Ejemplo n.º 28
0
    /* which game the client wants to play
     * 0 - Don't eat me! (no server required)
     * 1 - Cards of the Wild
     * 2 - Running Rhino
     * 3 - Clash of Species
     */

    public static NetworkRequest Prepare(int gameType)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.WAITFORGAME);

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

        request.AddInt32(playerID);
        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 pid)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.STARTGAME);

        request.AddInt32(pid);
        return(request);
    }
    /// <summary>
    /// Creates a request for the player data
    /// </summary>
    /// <param name="playerId">The id of the player requested.</param>
    public static NetworkRequest Prepare(int playerId)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.CLASH_PLAYER_VIEW);

        request.AddInt32(playerId);
        return(request);
    }
    public static NetworkRequest Prepare(int hintOffset)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.CONVERGE_HINT);

        request.AddInt32(hintOffset);

        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, string playerName)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.MATCH_STATUS);

        request.AddInt32(playerID);
        request.AddString(playerName);
        return(request);
    }
    public static NetworkRequest Prepare(short betEntered, int improveValue)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.MC_BET_UPDATE);

        request.AddShort16(betEntered);
        request.AddInt32(improveValue);

        return(request);
    }
    /// <summary>
    /// Creates a request containing battle results
    /// </summary>
    /// <param name="res">The result</param>
    public static NetworkRequest Prepare(BattleResult res)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.CLASH_END_BATTLE);

        request.AddInt32((int)res);


        return(request);
    }
    /// <summary>
    /// Creates the network request in the format
    ///     id of this protocol (short)
    ///     terrain name (string)
    ///     # of species in config (int)
    ///     for each species in config
    ///         species id (int)
    ///         instance count (int)
    ///         for each instance
    ///             x-coordinate (float)
    ///             y-coordinate (float)
    /// </summary>
    /// <param name="terrainName">the terain name</param>
    /// <param name="config">The species in the config, with species id's as keys
    /// and Vector2's of x- & y-coordinates as values.</param>

    public static NetworkRequest Prepare(string terrainName, Dictionary <int, List <Vector2> > config)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.CLASH_DEFENSE_SETUP);

        request.AddString(terrainName);
        request.AddInt32(config.Count);
        foreach (var pair in config)
        {
            request.AddInt32(pair.Key);
            List <Vector2> positions = pair.Value;
            request.AddInt32(positions.Count);
            foreach (Vector2 v in positions)
            {
                request.AddFloat(v.x);
                request.AddFloat(v.y);
            }
        }
        return(request);
    }
Ejemplo n.º 39
0
    public static NetworkRequest Prepare(short game_id, int credits)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.END_GAME);
        request.AddShort16(game_id);

        if (game_id == 1) {
            request.AddInt32(credits);
        }

        return request;
    }
Ejemplo n.º 40
0
    public static NetworkRequest Prepare(
        int playerId,
        int ecosystemId,
        int attemptId,
        bool allowHints,
        int hintId,
        int timesteps,
        string config
        )
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.CONVERGE_NEW_ATTEMPT);

        request.AddInt32(playerId);
        request.AddInt32(ecosystemId);
        request.AddInt32(attemptId);
        request.AddBool(allowHints);
        request.AddInt32(hintId);
        request.AddInt32(timesteps);
        request.AddString(config);

        return(request);
    }
Ejemplo n.º 41
0
    public static NetworkRequest Prepare(short game_id, int credits)
    {
        NetworkRequest request = new NetworkRequest(NetworkCode.END_GAME);

        request.AddShort16(game_id);

        if (game_id == 1)
        {
            request.AddInt32(credits);
        }

        return(request);
    }
Ejemplo n.º 42
0
    // 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);
    }
Ejemplo n.º 43
0
 public static NetworkRequest Prepare(int pid)
 {
     NetworkRequest request = new NetworkRequest(NetworkCode.STARTGAME);
     request.AddInt32(pid);
     return request;
 }
 /* which game the client wants list for
  * 0 - Don't eat me! (no server required)
  * 1 - Cards of the Wild
  * 2 - Running Rhino
  * 3 - Clash of Species
  */
 public static NetworkRequest Prepare(int gameType)
 {
     NetworkRequest request = new NetworkRequest(NetworkCode.WAITLIST);
     request.AddInt32(gameType);
     return request;
 }
 /// <summary>
 /// Creates a request for the player data
 /// </summary>
 /// <param name="playerId">The id of the player requested.</param>
 public static NetworkRequest Prepare(int playerId)
 {
     NetworkRequest request = new NetworkRequest(NetworkCode.CLASH_PLAYER_VIEW);
     request.AddInt32(playerId);
     return request;
 }