Пример #1
0
        public void ProcessWorld(NetworkResponse response)
        {
            ResponseWorld args = response as ResponseWorld;

            /*
             * if (args.status == 0) {
             * GameState.world = args.world;
             *
             * SwitchToTileSelect(1);
             *
             * GameObject gObject = GameObject.Find("Global Object");
             *
             * if (gObject != null) {
             *      if (gObject.GetComponent<EcosystemScore>() == null) {
             *              gObject.AddComponent<EcosystemScore>();
             *      }
             *
             *      if (gObject.GetComponent<GameResources>() == null) {
             *              gObject.AddComponent<GameResources>();
             *      }
             *
             *      if (gObject.GetComponent<Clock>() == null) {
             *              gObject.AddComponent<Clock>();
             *      }
             *
             *      if (gObject.GetComponent<Chat>() == null) {
             *              gObject.AddComponent<Chat>();
             *      }
             * }
             * }
             */
        }
Пример #2
0
        public static NetworkResponse Parse(MemoryStream dataStream)
        {
            ResponseWorld response = new ResponseWorld();
            response.status = DataReader.ReadShort(dataStream);

            if (response.status == 0) {
            response.world_id = DataReader.ReadInt(dataStream);
            response.name = DataReader.ReadString(dataStream);
            response.type = DataReader.ReadShort(dataStream);
            response.time_rate = DataReader.ReadFloat(dataStream);
            response.day = DataReader.ReadShort(dataStream);

            World world = new World(response.world_id);
            world.name = response.name;
            world.day = response.day;

            response.world = world;
            }

            return response;
        }
Пример #3
0
        public static NetworkResponse Parse(MemoryStream dataStream)
        {
            ResponseWorld response = new ResponseWorld();

            response.status = DataReader.ReadShort(dataStream);

            if (response.status == 0)
            {
                response.world_id  = DataReader.ReadInt(dataStream);
                response.name      = DataReader.ReadString(dataStream);
                response.type      = DataReader.ReadShort(dataStream);
                response.time_rate = DataReader.ReadFloat(dataStream);
                response.day       = DataReader.ReadShort(dataStream);

                World world = new World(response.world_id);
                world.name = response.name;
                world.day  = response.day;

                response.world = world;
            }

            return(response);
        }