Tibialyzer.House.GetImage C# (CSharp) Method

GetImage() public method

public GetImage ( ) : Image
return Image
        public override Image GetImage()
        {
            if (sqm < 20) {
                return StyleManager.GetImage("smallhouse.png");
            } else if (sqm < 60) {
                return StyleManager.GetImage("mediumhouse.png");
            } else {
                return StyleManager.GetImage("bighouse.png");
            }
        }

Usage Example

示例#1
0
        public override void LoadForm()
        {
            if (house == null)
            {
                return;
            }

            this.SuspendForm();
            NotificationInitialize();
            houseName.Text = house.GetName().ToTitle();
            Font f = StyleManager.FontList[0];

            for (int i = 0; i < StyleManager.FontList.Count; i++)
            {
                Font font = StyleManager.FontList[i];
                Size size = TextRenderer.MeasureText(this.houseName.Text, font);
                if (size.Width < houseName.MaximumSize.Width && size.Height < houseName.MaximumSize.Height)
                {
                    f = font;
                }
                else
                {
                    break;
                }
            }
            this.houseName.Font = f;

            cityLabel.Text = house.city.ToString();
            sizeLabel.Text = String.Format("{0} sqm", house.sqm);
            bedLabel.Text  = house.beds.ToString();
            if (house.world != null)
            {
                statusLabel.Text = house.occupied ? "rented" : (house.hoursleft <= 0 ? "free" : "auctioned");
                if (house.occupied || house.hoursleft < 0)
                {
                    timeLeftLabel.Visible  = false;
                    timeLeftHeader.Visible = false;
                }
                else
                {
                    timeLeftLabel.Text = String.Format("{0}{1}", house.hoursleft > 24 ? house.hoursleft / 24 : house.hoursleft, house.hoursleft > 24 ? "D" : "h");
                }
            }
            else
            {
                timeLeftHeader.Visible = false;
                statusHeader.Visible   = false;
                timeLeftLabel.Visible  = false;
                statusLabel.Visible    = false;
            }

            Map m = StorageManager.getMap(house.pos.z);

            mapBox.map      = m;
            mapBox.mapImage = null;

            Target t = new Target();

            t.coordinate = new Coordinate(house.pos);
            t.image      = house.GetImage();
            t.size       = 20;

            mapBox.targets.Add(t);
            mapBox.sourceWidth   = mapBox.Width;
            mapBox.mapCoordinate = new Coordinate(house.pos);
            mapBox.zCoordinate   = house.pos.z;
            mapBox.UpdateMap();

            UnregisterControl(mapBox);

            this.mapUpLevel.Image = StyleManager.GetImage("mapup.png");
            this.UnregisterControl(mapUpLevel);
            this.mapUpLevel.Click  += mapUpLevel_Click;
            this.mapDownLevel.Image = StyleManager.GetImage("mapdown.png");
            this.UnregisterControl(mapDownLevel);
            this.mapDownLevel.Click += mapDownLevel_Click;

            base.NotificationFinalize();
            this.ResumeForm();
        }