Exemplo n.º 1
0
    public void ProcessSpeciesCreate(NetworkResponse response)
    {
        ResponseSpeciesCreate args = response as ResponseSpeciesCreate;

        SpeciesData species = null;

        if (SpeciesTable.speciesList.ContainsKey(args.species_id))
        {
            species = SpeciesTable.speciesList [args.species_id];
        }

        if (species == null)
        {
            Debug.LogError("Failed to create Species #" + args.species_id);
            return;
        }

        CreateSpecies(args.group_id, args.biomass, args.name, species);
    }
    public static NetworkResponse Parse(MemoryStream dataStream)
    {
        ResponseSpeciesCreate response = new ResponseSpeciesCreate();
        response.status = DataReader.ReadShort(dataStream);

        if (response.status == 0) {
            response.eco_id = DataReader.ReadInt(dataStream);
            response.group_id = DataReader.ReadInt(dataStream);
            response.species_id = DataReader.ReadInt(dataStream);
            response.name = DataReader.ReadString(dataStream);
            response.model_id = DataReader.ReadInt(dataStream);
            response.biomass = DataReader.ReadInt(dataStream);
            response.x = DataReader.ReadFloat(dataStream);
            response.y = DataReader.ReadFloat(dataStream);
            response.z = DataReader.ReadFloat(dataStream);
            response.user_id = DataReader.ReadInt(dataStream);
        }

        return response;
    }
    public static NetworkResponse Parse(MemoryStream dataStream)
    {
        ResponseSpeciesCreate response = new ResponseSpeciesCreate();

        response.status = DataReader.ReadShort(dataStream);

        if (response.status == 0)
        {
            response.eco_id     = DataReader.ReadInt(dataStream);
            response.group_id   = DataReader.ReadInt(dataStream);
            response.species_id = DataReader.ReadInt(dataStream);
            response.name       = DataReader.ReadString(dataStream);
            response.model_id   = DataReader.ReadInt(dataStream);
            response.biomass    = DataReader.ReadInt(dataStream);
            response.x          = DataReader.ReadFloat(dataStream);
            response.y          = DataReader.ReadFloat(dataStream);
            response.z          = DataReader.ReadFloat(dataStream);
            response.user_id    = DataReader.ReadInt(dataStream);
        }

        return(response);
    }