public static NetworkResponse Parse(MemoryStream dataStream)
        {
            ResponseZoneUpdate response = new ResponseZoneUpdate();
            response.status = DataReader.ReadShort(dataStream);

            if (response.status == 0) {
            response.tile_id = DataReader.ReadInt(dataStream);
            response.owner_id = DataReader.ReadInt(dataStream);
            response.status_msg = DataReader.ReadString(dataStream);
            } else {
            response.status_msg = DataReader.ReadString(dataStream);
            }

            return response;
        }
예제 #2
0
        public static NetworkResponse Parse(MemoryStream dataStream)
        {
            ResponseZoneUpdate response = new ResponseZoneUpdate();

            response.status = DataReader.ReadShort(dataStream);

            if (response.status == 0)
            {
                response.tile_id    = DataReader.ReadInt(dataStream);
                response.owner_id   = DataReader.ReadInt(dataStream);
                response.status_msg = DataReader.ReadString(dataStream);
            }
            else
            {
                response.status_msg = DataReader.ReadString(dataStream);
            }

            return(response);
        }
예제 #3
0
        public void ProcessZoneUpdate(NetworkResponse response)
        {
            ResponseZoneUpdate args = response as ResponseZoneUpdate;

            if (args.status == 0)
            {
//			Debug.Log("update tile");
//			var tile = (GameObject)zoneList[args.tile_id];
//
//			var oldOwner = tile.GetComponent<Zone>().player_id;
//			Debug.Log("Old Owner: " + oldOwner);
//			tile.GetComponent<Zone>().player_id = args.owner_id;
//			var ownerID = tile.GetComponent<Zone>().player_id;
//			Debug.Log("New Owner: " + ownerID);
//			if (oldOwner == 0 )
//			{
//				GameObject tileOwnershipGameObject = GameObject.Instantiate(owned_tile) as GameObject;
//				tileOwnershipGameObject.SetActive(true);
//				tileOwnershipGameObject.transform.position = tile.transform.position;
//				tileOwnershipGameObject.transform.parent = tile.transform;
//				tileOwnershipGameObject.renderer.material = colorMats[playerList[ownerID].color - 1];
//			}
            }
        }