Exemplo n.º 1
0
        public void GenerateTerrain()
        {
            Terrain = new VMTSOSurroundingTerrain();
            var coords = MapCoordinates.Unpack(LotPersist.location);
            var map    = Realestate.GetMap();

            for (int y = 0; y < 3; y++)
            {
                for (int x = 0; x < 3; x++)
                {
                    Terrain.BlendN[x, y] = map.GetBlend((coords.X - 1) + x, (coords.Y - 1) + y);
                }
            }

            for (int y = 0; y < 3; y++)
            {
                for (int x = 0; x < 3; x++)
                {
                    Terrain.Roads[x, y] = map.GetRoad((coords.X - 1) + x, (coords.Y - 1) + y);
                }
            }

            for (int y = 0; y < 4; y++)
            {
                for (int x = 0; x < 4; x++)
                {
                    Terrain.Height[x, y] = map.GetElevation((coords.X - 1) + x, (coords.Y - 1) + y);
                }
            }
        }
Exemplo n.º 2
0
        private void RefreshTooltip(BindingChange[] changes)
        {
            //Called if price, online or name change
            GameThread.NextUpdate((state) =>
            {
                if (CurrentHoverLot.Value != null)
                {
                    var lot      = CurrentHoverLot.Value;
                    var name     = lot.Lot_Name;
                    var occupied = IsTileOccupied((int)(lot.Id >> 16), (int)(lot.Id & 0xFFFF));
                    if (!occupied)
                    {
                        var text = GameFacade.Strings.GetString("215", "9", new string[] { lot.Lot_Price.ToString() });
                        var flat = Realestate.GetSlope((ushort)(lot.Id >> 16), (ushort)(lot.Id & 0xFFFF));
                        var map  = Realestate.GetMap();
                        var type = map.GetTerrain((ushort)(lot.Id >> 16), (ushort)(lot.Id & 0xFFFF));

                        text += "\r\n" + type.ToString() + ", " + ((flat == 0)?"Flat":"Sloped (" + flat + ")");

                        var nhood = View.NeighGeom.NhoodNearest((int)(lot.Id >> 16), (int)(lot.Id & 0xFFFF));
                        if (nhood != -1)
                        {
                            var nhoodObj = View.NeighGeom.Data[nhood];
                            text        += "\r\n" + nhoodObj.Name;
                        }
                        Parent.Screen.CityTooltip.Text = text;
                    }
                    else
                    {
                        var text = GameFacade.Strings.GetString("215", "3", new string[] { name });
                        if (lot.Lot_LeaderID == Network.MyCharacter)
                        {
                            text += "\r\n" + GameFacade.Strings.GetString("215", "5");
                        }
                        else if (!lot.Lot_IsOnline)
                        {
                            text += "\r\n" + GameFacade.Strings.GetString("215", "6");
                        }

                        if (lot.Lot_IsOnline)
                        {
                            text += "\r\n" + GameFacade.Strings.GetString("215", "4", new string[] { lot.Lot_NumOccupants.ToString() });
                        }
                        Parent.Screen.CityTooltip.Text = text;
                    }
                }
                else
                {
                    Parent.Screen.CityTooltip.Text = null;
                }
            });
        }