Esempio n. 1
0
        public ColorPicker()
        {
            colorRect  = new UIRect();
            hue        = new UIColorSlider();
            saturation = new UISlider();
            luminosity = new UISlider();

            colorRect.Width  = hue.Width;
            colorRect.Height = 30;
            colorRect.X      = Spacing;
            colorRect.Y      = Spacing;

            hue.X        = Spacing;
            hue.Y        = colorRect.Y + colorRect.Height + Spacing;
            saturation.X = hue.X;
            saturation.Y = hue.Y + hue.Height + Spacing;
            luminosity.X = hue.X;
            luminosity.Y = saturation.Y + saturation.Height + Spacing;

            this.Width  = hue.Width + Spacing * 2;
            this.Height = luminosity.Y + luminosity.Height + Spacing;

            AddChild(colorRect);
            AddChild(hue);
            AddChild(saturation);
            AddChild(luminosity);
        }
Esempio n. 2
0
        public RegionWindow()
        {
            SelectedRegion = null;
            this.CanMove   = true;
            this.Width     = 600;
            this.Anchor    = AnchorPosition.Center;
            bCreateRegion  = new UIButton(HEROsMod.HeroText("CreateRegion"));
            lTitle         = new UILabel(HEROsMod.HeroText("Regions"));
            scrollView     = new UIScrollView();
            bDeleteRegion  = new UIButton(HEROsMod.HeroText("DeleteRegion"));
            bAddGroup      = new UIButton(HEROsMod.HeroText("AddGroup"));
            bAddPlayer     = new UIButton(HEROsMod.HeroText("AddPlayer"));
            bBack          = new UIButton(Language.GetTextValue("UI.Back"));
            UIButton bToggleRegions = new UIButton(HEROsMod.HeroText("ToggleRegionsVisible"));

            bProtectChests = new UICheckbox(HEROsMod.HeroText("ProtectChests"));
            colorSlider    = new UIColorSlider();
            bSaveColor     = new UIButton(HEROsMod.HeroText("SaveColor"));
            UIImage bClose = new UIImage(closeTexture);

            lTitle.X              = Spacing;
            lTitle.Y              = Spacing;
            lTitle.Scale          = .6f;
            lTitle.OverridesMouse = false;

            bClose.X            = Width - bClose.Width - Spacing;
            bClose.Y            = Spacing;
            bClose.onLeftClick += bClose_onLeftClick;

            bCreateRegion.AutoSize = false;
            bDeleteRegion.AutoSize = false;
            bAddGroup.AutoSize     = false;
            bAddPlayer.AutoSize    = false;
            bSaveColor.AutoSize    = false;
            bBack.AutoSize         = false;
            bCreateRegion.Width    = colorSlider.Width;
            bAddGroup.Width        = 100;
            bAddPlayer.Width       = bAddGroup.Width;
            bDeleteRegion.Width    = colorSlider.Width;
            bSaveColor.Width       = 100;
            bBack.Width            = bSaveColor.Width;

            bCreateRegion.X = lTitle.X;
            bCreateRegion.Y = lTitle.Y + lTitle.Height;
            bDeleteRegion.X = bCreateRegion.X;
            bDeleteRegion.Y = bCreateRegion.Y;
            bBack.X         = bDeleteRegion.X + bDeleteRegion.Width + Spacing;
            bBack.Y         = bDeleteRegion.Y;

            colorSlider.Anchor = AnchorPosition.Left;
            colorSlider.X      = Spacing;
            bSaveColor.Y       = bBack.Y + bBack.Height + Spacing;
            bSaveColor.X       = colorSlider.X + colorSlider.Width + Spacing;
            colorSlider.Y      = bSaveColor.Y + bSaveColor.Height / 2;

            bProtectChests.X = colorSlider.X + colorSlider.Width + bSaveColor.Width + Spacing * 2;
            bProtectChests.Y = bBack.Y + bBack.Height + Spacing;

            bAddGroup.X  = Width - bAddGroup.Width - Spacing;
            bAddGroup.Y  = bDeleteRegion.Y;
            bAddPlayer.X = bAddGroup.X;
            bAddPlayer.Y = bAddGroup.Y + bAddPlayer.Height + Spacing;

            scrollView.X      = Spacing;
            scrollView.Y      = bSaveColor.Y + bSaveColor.Height + Spacing;
            scrollView.Width  = Width - Spacing * 2;
            scrollView.Height = 150;

            bToggleRegions.X = scrollView.X;
            bToggleRegions.Y = scrollView.Y + scrollView.Height + Spacing;

            bBack.onLeftClick          += bBack_onLeftClick;
            bDeleteRegion.onLeftClick  += bDeleteRegion_onLeftClick;
            bToggleRegions.onLeftClick += bToggleRegions_onLeftClick;
            bProtectChests.onLeftClick += bProtectChests_onLeftClick;
            colorSlider.valueChanged   += colorSlider_valueChanged;
            bSaveColor.onLeftClick     += bSaveColor_onLeftClick;

            bDeleteRegion.Visible  = false;
            bAddPlayer.Visible     = false;
            bAddGroup.Visible      = false;
            bBack.Visible          = false;
            colorSlider.Visible    = false;
            bSaveColor.Visible     = false;
            bProtectChests.Visible = false;

            this.Height = bToggleRegions.Y + bToggleRegions.Height + Spacing;

            AddChild(lTitle);
            AddChild(bClose);
            AddChild(scrollView);
            AddChild(bCreateRegion);
            AddChild(bDeleteRegion);
            AddChild(bAddPlayer);
            AddChild(bAddGroup);
            AddChild(bBack);
            AddChild(bToggleRegions);
            AddChild(bProtectChests);
            AddChild(colorSlider);
            AddChild(bSaveColor);

            this.CenterToParent();

            PopulateRegionsList();
        }