public MapControllerServer()
        {
            this.centerMercatorX = float.MinValue;
            this.centerMercatorY = float.MinValue;
            this.posX            = float.MinValue;
            this.posY            = float.MinValue;
            this.tileX           = int.MinValue;
            this.tileY           = int.MinValue;

            this.centerPosX = float.MinValue;
            this.centerPosY = float.MinValue;

            /* if using ITB proxy use this http initialization
             *
             * HttpClientHandler handler = new HttpClientHandler();
             * WebProxy proxy = new WebProxy("http://cache.itb.ac.id:8080");
             * proxy.Credentials = new NetworkCredential("", "");
             * handler.Proxy = proxy;
             * handler.UseProxy = true;
             * this.http = new HttpClient(handler);
             */

            this.http = new HttpClient();

            this.listMapData = new ListMapData();
            this.listMapData.listBuildingData = new List <BuildingData>();
            this.listMapData.listRoadData     = new List <RoadData>();
            this.mapReady = false;

            this.firstAcess = true;
        }
Beispiel #2
0
        public ListMapData AcquireMapData(dynamic data)
        {
            playerPosX = float.MinValue;
            playerPosY = float.MinValue;

            Player currentPlayer;

            bool registered = listPlayer.Exists(x => x.GetPlayerName() == (string)data.playerName);

            if (!registered)
            {
                currentPlayer = new Player(data.playerName.ToString(), (float)Convert.ToDouble(data.latitude), (float)Convert.ToDouble(data.longitude), data.petName.ToString(), (float)Convert.ToDouble(data.petPosX), (float)Convert.ToDouble(data.petPosY));
                listPlayer.Add(currentPlayer);
            }
            else
            {
                currentPlayer = listPlayer.Find(x => x.GetPlayerName() == (string)data.playerName);
                if (currentPlayer.GetIsActive() == false)
                {
                    currentPlayer.SetIsActive(true);
                }
                if (currentPlayer.GetLatitude() != (float)Convert.ToDouble(data.latitude) || currentPlayer.GetLongitude() != (float)Convert.ToDouble(data.longitude))
                {
                    currentPlayer.SetLatitude((float)Convert.ToDouble(data.latitude));
                    currentPlayer.SetLongitude((float)Convert.ToDouble(data.longitude));
                }
                if (currentPlayer.GetPet().GetPosX() != (float)Convert.ToDouble(data.petPosX) || currentPlayer.GetPet().GetPosY() != (float)Convert.ToDouble(data.petPosY))
                {
                    currentPlayer.GetPet().SetPosX((float)Convert.ToDouble(data.petPosX));
                    currentPlayer.GetPet().SetPosY((float)Convert.ToDouble(data.petPosY));
                }
                if (currentPlayer.GetPet().GetPetName() == "")
                {
                    currentPlayer.GetPet().SetPetName((string)data.petName);
                }
            }

            currentPlayer.GetMapController().SetMapReady(false);
            this.needCreateMap = currentPlayer.CheckAndCreateMap();
            while (!currentPlayer.GetMapController().GetMapReady())
            {
            }

            this.playerPosX = currentPlayer.GetMapController().GetPosX();
            this.playerPosY = currentPlayer.GetMapController().GetPosY();

            this.centerPosX = currentPlayer.GetMapController().GetCenterPosX();
            this.centerPosY = currentPlayer.GetMapController().GetCenterPosY();

            this.tileX = currentPlayer.GetMapController().GetTileX();
            this.tileY = currentPlayer.GetMapController().GetTileY();

            ListMapData mapData = currentPlayer.GetMapController().GetListMapData();

            return(mapData);
        }
Beispiel #3
0
        public MapControllerServer()
        {
            this.centerMercatorX = float.MinValue;
            this.centerMercatorY = float.MinValue;
            this.posX            = float.MinValue;
            this.posY            = float.MinValue;
            this.tileX           = int.MinValue;
            this.tileY           = int.MinValue;

            this.centerPosX = float.MinValue;
            this.centerPosY = float.MinValue;

            this.http = new HttpClient();

            this.listMapData = new ListMapData();
            this.listMapData.listBuildingData = new List <BuildingData>();
            this.listMapData.listRoadData     = new List <RoadData>();
            this.mapReady = false;

            this.firstAcess = true;
        }
 public void SetListMapData(ListMapData listMapData)
 {
     this.listMapData = listMapData;
     //this.completeMapData = completeMapData;
 }