Наследование: Terraria.UI.UIElement
Пример #1
0
 public UIModItem(TmodFile mod)
 {
     this.mod = mod.Name;
     this.BorderColor = new Color(89, 116, 213) * 0.7f;
     this.dividerTexture = TextureManager.Load("Images/UI/Divider");
     this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
     this.Height.Set(90f, 0f);
     this.Width.Set(0f, 1f);
     base.SetPadding(6f);
     base.OnClick += new UIElement.MouseEvent(this.ToggleEnabled);
     BuildProperties properties = ModLoader.LoadBuildProperties(mod);
     string text = properties.displayName.Length > 0 ? properties.displayName : Path.GetFileNameWithoutExtension(mod.Name);
     if (properties.version.Length > 0)
     {
         text += " " + properties.version;
     }
     if (properties.author.Length > 0)
     {
         text += " - by " + properties.author;
     }
     this.modName = new UIText(text, 1f, false);
     this.modName.Left.Set(10f, 0f);
     this.modName.Top.Set(5f, 0f);
     base.Append(this.modName);
     this.enabled = ModLoader.IsEnabled(mod.Name);
 }
Пример #2
0
 public UIModSourceItem(string mod)
 {
     this.mod = mod;
     this.BorderColor = new Color(89, 116, 213) * 0.7f;
     this.dividerTexture = TextureManager.Load("Images/UI/Divider");
     this.Height.Set(90f, 0f);
     this.Width.Set(0f, 1f);
     base.SetPadding(6f);
     this.modName = new UIText(Path.GetFileName(mod), 1f, false);
     this.modName.Left.Set(10f, 0f);
     this.modName.Top.Set(5f, 0f);
     base.Append(this.modName);
     UITextPanel button = new UITextPanel("Build", 1f, false);
     button.Width.Set(100f, 0f);
     button.Height.Set(30f, 0f);
     button.Left.Set(10f, 0f);
     button.Top.Set(40f, 0f);
     button.PaddingTop -= 2f;
     button.PaddingBottom -= 2f;
     button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
     button.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
     button.OnClick += new UIElement.MouseEvent(this.BuildMod);
     base.Append(button);
     UITextPanel button2 = new UITextPanel("Build + Reload", 1f, false);
     button2.CopyStyle(button);
     button2.Width.Set(200f, 0f);
     button2.Left.Set(150f, 0f);
     button2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
     button2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
     button2.OnClick += new UIElement.MouseEvent(this.BuildAndReload);
     base.Append(button2);
     base.OnDoubleClick += new UIElement.MouseEvent(this.BuildAndReload);
 }
Пример #3
0
 public UIModManageItem(string displayname, string name, string version, string author, string downloads, string downloadsversion, string modloaderversion)
 {
     this.displayname = displayname;
     this.version = version;
     this.author = author;
     this.name = name;
     this.BorderColor = new Color(89, 116, 213) * 0.7f;
     this.dividerTexture = TextureManager.Load("Images/UI/Divider");
     this.Height.Set(90f, 0f);
     this.Width.Set(0f, 1f);
     base.SetPadding(6f);
     string text = displayname + " " + version + " - by " + author + " - " + modloaderversion;
     this.modName = new UIText(text, 1f, false);
     this.modName.Left.Set(10f, 0f);
     this.modName.Top.Set(5f, 0f);
     base.Append(this.modName);
     UITextPanel<string> button = new UITextPanel<string>(downloads + " downloads (" + downloadsversion + " latest version)", 1f, false);
     button.Width.Set(260f, 0f);
     button.Height.Set(30f, 0f);
     button.Left.Set(10f, 0f);
     button.Top.Set(40f, 0f);
     button.PaddingTop -= 2f;
     button.PaddingBottom -= 2f;
     //	button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
     //	button.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
     base.Append(button);
     button2 = new UITextPanel<string>("Unpublish", 1f, false);
     button2.CopyStyle(button);
     button2.Width.Set(150f, 0f);
     button2.Left.Set(360f, 0f);
     button2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
     button2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
     button2.OnClick += new UIElement.MouseEvent(this.Unpublish);
     base.Append(button2);
 }
Пример #4
0
		public UILoadProgress()
		{
			text = new UIText("", 0.75f, true);
			text.Top.Set(20f, 0f);
			text.HAlign = 0.5f;
			base.Append(text);
			progress = 0f;
		}
Пример #5
0
 public UICharacterListItem(PlayerFileData data)
 {
     BorderColor = new Color(89, 116, 213) * 0.7f;
     _dividerTexture = TextureManager.Load("Images/UI/Divider");
     _innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
     _buttonCloudActiveTexture = TextureManager.Load("Images/UI/ButtonCloudActive");
     _buttonCloudInactiveTexture = TextureManager.Load("Images/UI/ButtonCloudInactive");
     _buttonFavoriteActiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteActive");
     _buttonFavoriteInactiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteInactive");
     _buttonPlayTexture = TextureManager.Load("Images/UI/ButtonPlay");
     _buttonDeleteTexture = TextureManager.Load("Images/UI/ButtonDelete");
     Height.Set(96f, 0.0f);
     Width.Set(0.0f, 1f);
     SetPadding(6f);
     playerFileData = data;
     _playerPanel = new UICharacter(data.Player);
     _playerPanel.Left.Set(4f, 0.0f);
     _playerPanel.OnDoubleClick += new UIElement.MouseEvent(PlayGame);
     OnDoubleClick += new UIElement.MouseEvent(PlayGame);
     Append(_playerPanel);
     UIImageButton uiImageButton1 = new UIImageButton(_buttonPlayTexture);
     uiImageButton1.VAlign = 1f;
     uiImageButton1.Left.Set(4f, 0.0f);
     uiImageButton1.OnClick += new UIElement.MouseEvent(PlayGame);
     uiImageButton1.OnMouseOver += new UIElement.MouseEvent(PlayMouseOver);
     uiImageButton1.OnMouseOut += new UIElement.MouseEvent(ButtonMouseOut);
     Append(uiImageButton1);
     UIImageButton uiImageButton2 = new UIImageButton(playerFileData.IsFavorite ? _buttonFavoriteActiveTexture : _buttonFavoriteInactiveTexture);
     uiImageButton2.VAlign = 1f;
     uiImageButton2.Left.Set(28f, 0.0f);
     uiImageButton2.OnClick += new UIElement.MouseEvent(FavoriteButtonClick);
     uiImageButton2.OnMouseOver += new UIElement.MouseEvent(FavoriteMouseOver);
     uiImageButton2.OnMouseOut += new UIElement.MouseEvent(ButtonMouseOut);
     uiImageButton2.SetVisibility(1f, playerFileData.IsFavorite ? 0.8f : 0.4f);
     Append(uiImageButton2);
     UIImageButton uiImageButton4 = new UIImageButton(_buttonDeleteTexture);
     uiImageButton4.VAlign = 1f;
     uiImageButton4.HAlign = 1f;
     uiImageButton4.OnClick += new UIElement.MouseEvent(DeleteButtonClick);
     uiImageButton4.OnMouseOver += new UIElement.MouseEvent(DeleteMouseOver);
     uiImageButton4.OnMouseOut += new UIElement.MouseEvent(DeleteMouseOut);
     _deleteButton = uiImageButton4;
     if (!playerFileData.IsFavorite)
         Append(uiImageButton4);
     _buttonLabel = new UIText("", 1f, false);
     _buttonLabel.VAlign = 1f;
     _buttonLabel.Left.Set(80f, 0.0f);
     _buttonLabel.Top.Set(-3f, 0.0f);
     Append(_buttonLabel);
     _deleteButtonLabel = new UIText("", 1f, false);
     _deleteButtonLabel.VAlign = 1f;
     _deleteButtonLabel.HAlign = 1f;
     _deleteButtonLabel.Left.Set(-30f, 0.0f);
     _deleteButtonLabel.Top.Set(-3f, 0.0f);
     Append(_deleteButtonLabel);
 }
Пример #6
0
		public UIModItem(TmodFile mod)
		{
			this.mod = mod.Name;
			this.BorderColor = new Color(89, 116, 213) * 0.7f;
			this.dividerTexture = TextureManager.Load("Images/UI/Divider");
			this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
			this.Height.Set(90f, 0f);
			this.Width.Set(0f, 1f);
			base.SetPadding(6f);
			//base.OnClick += new UIElement.MouseEvent(this.ToggleEnabled);
			properties = BuildProperties.ReadModFile(mod);
			string text = properties.displayName.Length > 0 ? properties.displayName : Path.GetFileNameWithoutExtension(mod.Name);
			if (properties.version.Length > 0)
			{
				text += " " + properties.version;
			}
			if (properties.author.Length > 0)
			{
				text += " - by " + properties.author;
			}
			this.modName = new UIText(text, 1f, false);
			this.modName.Left.Set(10f, 0f);
			this.modName.Top.Set(5f, 0f);
			base.Append(this.modName);
			this.enabled = ModLoader.IsEnabled(mod.Name);
			UITextPanel button = new UITextPanel("More info", 1f, false);
			button.Width.Set(100f, 0f);
			button.Height.Set(30f, 0f);
			button.Left.Set(430f, 0f);
			button.Top.Set(40f, 0f);
			button.PaddingTop -= 2f;
			button.PaddingBottom -= 2f;
			button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button.OnClick += new UIElement.MouseEvent(this.Moreinfo);
			base.Append(button);
			button2 = new UITextPanel(this.enabled ? "Click to Disable" : "Click to Enable", 1f, false);
			button2.Width.Set(100f, 0f);
			button2.Height.Set(30f, 0f);
			button2.Left.Set(275f, 0f);
			button2.Top.Set(40f, 0f);
			button2.PaddingTop -= 2f;
			button2.PaddingBottom -= 2f;
			button2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button2.OnClick += new UIElement.MouseEvent(this.ToggleEnabled);
			base.Append(button2);
		}
Пример #7
0
 public UIModDownloadItem(string displayname, string name, string version, string author, string description, string homepage, string download, int downloads, string timeStamp, bool update, bool exists)
 {
     this.displayname = displayname;
     this.mod = name;
     this.version = version;
     this.author = author;
     this.description = description;
     this.homepage = homepage;
     this.download = download;
     this.downloads = downloads;
     this.timeStamp = timeStamp;
     this.update = update;
     this.exists = exists;
     this.BorderColor = new Color(89, 116, 213) * 0.7f;
     this.dividerTexture = TextureManager.Load("Images/UI/Divider");
     this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
     this.Height.Set(90f, 0f);
     this.Width.Set(0f, 1f);
     base.SetPadding(6f);
     string text = displayname + " " + version + " - by " + author;
     this.modName = new UIText(text, 1f, false);
     this.modName.Left.Set(10f, 0f);
     this.modName.Top.Set(5f, 0f);
     base.Append(this.modName);
     UITextPanel<string> button = new UITextPanel<string>("More info", 1f, false);
     button.Width.Set(100f, 0f);
     button.Height.Set(30f, 0f);
     button.Left.Set(10f, 0f);
     button.Top.Set(40f, 0f);
     button.PaddingTop -= 2f;
     button.PaddingBottom -= 2f;
     button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
     button.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
     button.OnClick += new UIElement.MouseEvent(this.Moreinfo);
     base.Append(button);
     if (update || !exists)
     {
         button2 = new UITextPanel<string>(this.update ? "Update" : "Download", 1f, false);
         button2.CopyStyle(button);
         button2.Width.Set(200f, 0f);
         button2.Left.Set(150f, 0f);
         button2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
         button2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
         button2.OnClick += new UIElement.MouseEvent(this.DownloadMod);
         base.Append(button2);
     }
     base.OnDoubleClick += new UIElement.MouseEvent(this.Moreinfo);
 }
Пример #8
0
		public UIModSourceItem(string mod)
		{
			this.mod = mod;
			this.BorderColor = new Color(89, 116, 213) * 0.7f;
			this.dividerTexture = TextureManager.Load("Images/UI/Divider");
			this.Height.Set(90f, 0f);
			this.Width.Set(0f, 1f);
			base.SetPadding(6f);
			this.modName = new UIText(Path.GetFileName(mod), 1f, false);
			this.modName.Left.Set(10f, 0f);
			this.modName.Top.Set(5f, 0f);
			base.Append(this.modName);
			UITextPanel button = new UITextPanel("Build", 1f, false);
			button.Width.Set(100f, 0f);
			button.Height.Set(30f, 0f);
			button.Left.Set(10f, 0f);
			button.Top.Set(40f, 0f);
			button.PaddingTop -= 2f;
			button.PaddingBottom -= 2f;
			button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button.OnClick += new UIElement.MouseEvent(this.BuildMod);
			base.Append(button);
			UITextPanel button2 = new UITextPanel("Build + Reload", 1f, false);
			button2.CopyStyle(button);
			button2.Width.Set(200f, 0f);
			button2.Left.Set(150f, 0f);
			button2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button2.OnClick += new UIElement.MouseEvent(this.BuildAndReload);
			base.Append(button2);
			TmodFile[] modFiles = ModLoader.FindMods();
			foreach (TmodFile file in modFiles)
			{
				if (Path.GetFileNameWithoutExtension(file.Name).Equals(Path.GetFileName(mod)))
				{
					UITextPanel button3 = new UITextPanel("Publish", 1f, false);
					button3.CopyStyle(button2);
					button3.Width.Set(100f, 0f);
					button3.Left.Set(390f, 0f);
					button3.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
					button3.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
					button3.OnClick += new UIElement.MouseEvent(this.Publish);
					base.Append(button3);
				}
			}
			base.OnDoubleClick += new UIElement.MouseEvent(this.BuildAndReload);
		}
Пример #9
0
 public UIModItem(string mod)
 {
     this.mod = mod;
     this.BorderColor = new Color(89, 116, 213) * 0.7f;
     this.dividerTexture = TextureManager.Load("Images/UI/Divider");
     this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
     this.Height.Set(90f, 0f);
     this.Width.Set(0f, 1f);
     base.SetPadding(6f);
     base.OnClick += new UIElement.MouseEvent(this.ToggleEnabled);
     this.modName = new UIText(Path.GetFileNameWithoutExtension(mod), 1f, false);
     this.modName.Left.Set(10f, 0f);
     this.modName.Top.Set(5f, 0f);
     base.Append(this.modName);
     string path = Path.GetDirectoryName(mod) + Path.DirectorySeparatorChar + "enabled.txt";
     this.enabled = !File.Exists(path) || File.ReadAllText(path) != "false";
 }
Пример #10
0
        public PUITextBox()
        {
            this._bgTexture = new NineSliceTexture(Main.inventoryBack13Texture, new RectOffset(8, 8, 8, 8));
            _bgTexture.Color *= 0.85f;

            this.Text = string.Empty;
            this.MaxCharacters = 30;
            this.Numeric = false;
            this.OverflowHidden = true;
            this.PaddingLeft = 10f;
            this.PaddingRight = 10f;
            this.Width.Set(200f, 0f);
            this.Height.Set(HEIGHT, 0f);
            this.OnClick += Clicked;

            _textElement = new UIText(Text, 1f, false);
            _textElement.VAlign = .5f;
            this.Append(_textElement);
        }
Пример #11
0
		public UISettingsItem(string name)
		{
			fileName = name;
			this.BorderColor = new Color(89, 116, 213) * 0.7f;
			this.dividerTexture = TextureManager.Load("Images/UI/Divider");
			this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
			this.Height.Set(90f, 0f);
			this.Width.Set(0f, 1f);
			base.SetPadding(6f);

			this.listName = new UIText(name, 1f, false);
			this.listName.Left.Set(10f, 0f);
			this.listName.Top.Set(5f, 0f);
			base.Append(this.listName);

			loadThisSettingButton = new UITextPanel("Enable this List", 1f, false);
			loadThisSettingButton.Width.Set(100f, 0f);
			loadThisSettingButton.Height.Set(30f, 0f);
			loadThisSettingButton.Left.Set(75f, 0f);
			loadThisSettingButton.Top.Set(40f, 0f);
			loadThisSettingButton.PaddingTop -= 2f;
			loadThisSettingButton.PaddingBottom -= 2f;
			loadThisSettingButton.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			loadThisSettingButton.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			loadThisSettingButton.OnClick += new UIElement.MouseEvent(LoadThisSetting);
			base.Append(loadThisSettingButton);

			deleteThisSettingButton = new UITextPanel("Delete this List", 1f, false);
			deleteThisSettingButton.Width.Set(100f, 0f);
			deleteThisSettingButton.Height.Set(30f, 0f);
			deleteThisSettingButton.Left.Set(275f, 0f);
			deleteThisSettingButton.Top.Set(40f, 0f);
			deleteThisSettingButton.PaddingTop -= 2f;
			deleteThisSettingButton.PaddingBottom -= 2f;
			deleteThisSettingButton.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			deleteThisSettingButton.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			deleteThisSettingButton.OnClick += new UIElement.MouseEvent(DeleteThisSetting);
			base.Append(deleteThisSettingButton);
		}
Пример #12
0
        public UIBestiaryEntryButton(BestiaryEntry entry, bool isAPrettyPortrait)
        {
            Entry = entry;
            Height.Set(72f, 0f);
            Width.Set(72f, 0f);
            SetPadding(0f);
            UIElement uIElement = new UIElement
            {
                Width  = new StyleDimension(-4f, 1f),
                Height = new StyleDimension(-4f, 1f),
                IgnoresMouseInteraction = true,
                OverflowHidden          = true,
                HAlign = 0.5f,
                VAlign = 0.5f
            };

            uIElement.SetPadding(0f);
            uIElement.Append(new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Back", (AssetRequestMode)1))
            {
                VAlign = 0.5f,
                HAlign = 0.5f
            });
            if (isAPrettyPortrait)
            {
                Asset <Texture2D> val = TryGettingBackgroundImageProvider(entry);
                if (val != null)
                {
                    uIElement.Append(new UIImage(val)
                    {
                        HAlign = 0.5f,
                        VAlign = 0.5f
                    });
                }
            }
            UIBestiaryEntryIcon uIBestiaryEntryIcon = new UIBestiaryEntryIcon(entry, isAPrettyPortrait);

            uIElement.Append(uIBestiaryEntryIcon);
            Append(uIElement);
            _icon = uIBestiaryEntryIcon;
            int?num = TryGettingDisplayIndex(entry);

            if (num.HasValue)
            {
                UIText element = new UIText(num.Value.ToString(), 0.9f)
                {
                    Top  = new StyleDimension(10f, 0f),
                    Left = new StyleDimension(10f, 0f),
                    IgnoresMouseInteraction = true
                };
                Append(element);
            }
            _bordersGlow = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Selection", (AssetRequestMode)1))
            {
                VAlign = 0.5f,
                HAlign = 0.5f,
                IgnoresMouseInteraction = true
            };
            _bordersOverlay = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Overlay", (AssetRequestMode)1))
            {
                VAlign = 0.5f,
                HAlign = 0.5f,
                IgnoresMouseInteraction = true,
                Color = Color.White * 0.6f
            };
            Append(_bordersOverlay);
            UIImage uIImage = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Front", (AssetRequestMode)1))
            {
                VAlign = 0.5f,
                HAlign = 0.5f,
                IgnoresMouseInteraction = true
            };

            Append(uIImage);
            _borders = uIImage;
            if (isAPrettyPortrait)
            {
                RemoveChild(_bordersOverlay);
            }
            if (!isAPrettyPortrait)
            {
                base.OnMouseOver += MouseOver;
                base.OnMouseOut  += MouseOut;
            }
        }
Пример #13
0
        public UIModPackItem(string name, string[] mods)
        {
            this.filename = name;
            this.mods = mods;
            this.numMods = mods.Length;
            modMissing = new bool[mods.Length];
            numModsEnabled = 0;
            numModsDisabled = 0;
            numModsMissing = 0;
            for (int i = 0; i < mods.Length; i++)
            {
                string modname = mods[i];
                bool found = false;
                foreach (var item in UIModPacks.mods)
                {
                    if (item.name == modname)
                    {
                        found = true;
                        if (ModLoader.IsEnabled(item))
                        {
                            numModsEnabled++;
                        }
                        else
                        {
                            numModsDisabled++;
                        }
                        break;
                    }
                }
                if (!found)
                {
                    modMissing[i] = true;
                    numModsMissing++;
                }
            }

            this.BorderColor = new Color(89, 116, 213) * 0.7f;
            this.dividerTexture = TextureManager.Load("Images/UI/Divider");
            this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
            this.Height.Set(90f, 0f);
            this.Width.Set(0f, 1f);
            base.SetPadding(6f);

            this.modName = new UIText(name, 1f, false);
            this.modName.Left.Set(10f, 0f);
            this.modName.Top.Set(5f, 0f);
            base.Append(this.modName);

            UITextPanel<string> viewListButton = new UITextPanel<string>("View List", 1f, false);
            viewListButton.Width.Set(100f, 0f);
            viewListButton.Height.Set(30f, 0f);
            viewListButton.Left.Set(430f, 0f);
            viewListButton.Top.Set(40f, 0f);
            viewListButton.PaddingTop -= 2f;
            viewListButton.PaddingBottom -= 2f;
            viewListButton.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            viewListButton.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
            viewListButton.OnClick += new UIElement.MouseEvent(ViewListInfo);
            base.Append(viewListButton);

            enableListButton = new UITextPanel<string>("Enable this List", 1f, false);
            enableListButton.Width.Set(100f, 0f);
            enableListButton.Height.Set(30f, 0f);
            enableListButton.Left.Set(275f, 0f);
            enableListButton.Top.Set(40f, 0f);
            enableListButton.PaddingTop -= 2f;
            enableListButton.PaddingBottom -= 2f;
            enableListButton.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            enableListButton.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
            enableListButton.OnClick += new UIElement.MouseEvent(EnableList);
            base.Append(enableListButton);

            enableListOnlyButton = new UITextPanel<string>("Enable only this List", 1f, false);
            enableListOnlyButton.Width.Set(100f, 0f);
            enableListOnlyButton.Height.Set(30f, 0f);
            enableListOnlyButton.Left.Set(75f, 0f);
            enableListOnlyButton.Top.Set(40f, 0f);
            enableListOnlyButton.PaddingTop -= 2f;
            enableListOnlyButton.PaddingBottom -= 2f;
            enableListOnlyButton.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
            enableListOnlyButton.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
            enableListOnlyButton.OnClick += new UIElement.MouseEvent(EnableListOnly);
            base.Append(enableListOnlyButton);

            deleteButton = new UIImageButton(TextureManager.Load("Images/UI/ButtonDelete"));
            deleteButton.Top.Set(40f, 0f);
            deleteButton.OnClick += new UIElement.MouseEvent(this.DeleteButtonClick);
            base.Append(deleteButton);
        }
Пример #14
0
        public EmotesGroupListItem(
            LocalizedText groupTitle,
            int groupIndex,
            int maxEmotesPerRow,
            params int[] emotes)
        {
            maxEmotesPerRow = 14;
            this.SetPadding(0.0f);
            this._groupIndex      = groupIndex;
            this._maxEmotesPerRow = maxEmotesPerRow;
            this._tempTex         = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/ButtonFavoriteInactive", (AssetRequestMode)1);
            int num1 = emotes.Length / this._maxEmotesPerRow;

            if (emotes.Length % this._maxEmotesPerRow != 0)
            {
                ++num1;
            }
            this.Height.Set((float)(30 + 36 * num1), 0.0f);
            this.Width.Set(0.0f, 1f);
            UIElement element = new UIElement()
            {
                Height = StyleDimension.FromPixels(30f),
                Width  = StyleDimension.FromPixelsAndPercent(-20f, 1f),
                HAlign = 0.5f
            };

            element.SetPadding(0.0f);
            this.Append(element);
            UIHorizontalSeparator horizontalSeparator1 = new UIHorizontalSeparator(2, true);

            horizontalSeparator1.Width  = StyleDimension.FromPixelsAndPercent(0.0f, 1f);
            horizontalSeparator1.VAlign = 1f;
            horizontalSeparator1.HAlign = 0.5f;
            horizontalSeparator1.Color  = Color.Lerp(Color.White, new Color(63, 65, 151, (int)byte.MaxValue), 0.85f) * 0.9f;
            UIHorizontalSeparator horizontalSeparator2 = horizontalSeparator1;

            element.Append((UIElement)horizontalSeparator2);
            UIText uiText1 = new UIText(groupTitle, 1f, false);

            uiText1.VAlign = 1f;
            uiText1.HAlign = 0.5f;
            uiText1.Top    = StyleDimension.FromPixels(-6f);
            UIText uiText2 = uiText1;

            element.Append((UIElement)uiText2);
            float num2 = 6f;

            for (int id = 0; id < emotes.Length; ++id)
            {
                int emote = emotes[id];
                int num3  = id / this._maxEmotesPerRow;
                int num4  = id % this._maxEmotesPerRow;
                int num5  = emotes.Length % this._maxEmotesPerRow;
                if (emotes.Length / this._maxEmotesPerRow != num3)
                {
                    num5 = this._maxEmotesPerRow;
                }
                if (num5 == 0)
                {
                    num5 = this._maxEmotesPerRow;
                }
                float       num6         = (float)(36.0 * ((double)num5 / 2.0)) - 16f;
                float       num7         = -16f;
                EmoteButton emoteButton1 = new EmoteButton(emote);
                emoteButton1.HAlign = 0.0f;
                emoteButton1.VAlign = 0.0f;
                emoteButton1.Top    = StyleDimension.FromPixels((float)(30 + num3 * 36) + num2);
                emoteButton1.Left   = StyleDimension.FromPixels((float)(36 * num4) - num7);
                EmoteButton emoteButton2 = emoteButton1;
                this.Append((UIElement)emoteButton2);
                emoteButton2.SetSnapPoint("Group " + (object)groupIndex, id, new Vector2?(), new Vector2?());
            }
        }
Пример #15
0
        public UIWorldListItem(WorldFileData data, int snapPointIndex)
        {
            this._data = data;
            this.LoadTextures();
            this.InitializeAppearance();
            this._worldIcon = new UIImage(this.GetIcon());
            this._worldIcon.Left.Set(4f, 0.0f);
            this._worldIcon.OnDoubleClick += new UIElement.MouseEvent(this.PlayGame);
            this.Append((UIElement)this._worldIcon);
            float         pixels1        = 4f;
            UIImageButton uiImageButton1 = new UIImageButton(this._buttonPlayTexture);

            uiImageButton1.VAlign = 1f;
            uiImageButton1.Left.Set(pixels1, 0.0f);
            uiImageButton1.OnClick     += new UIElement.MouseEvent(this.PlayGame);
            this.OnDoubleClick         += new UIElement.MouseEvent(this.PlayGame);
            uiImageButton1.OnMouseOver += new UIElement.MouseEvent(this.PlayMouseOver);
            uiImageButton1.OnMouseOut  += new UIElement.MouseEvent(this.ButtonMouseOut);
            this.Append((UIElement)uiImageButton1);
            float         pixels2        = pixels1 + 24f;
            UIImageButton uiImageButton2 = new UIImageButton(this._data.IsFavorite ? this._buttonFavoriteActiveTexture : this._buttonFavoriteInactiveTexture);

            uiImageButton2.VAlign = 1f;
            uiImageButton2.Left.Set(pixels2, 0.0f);
            uiImageButton2.OnClick     += new UIElement.MouseEvent(this.FavoriteButtonClick);
            uiImageButton2.OnMouseOver += new UIElement.MouseEvent(this.FavoriteMouseOver);
            uiImageButton2.OnMouseOut  += new UIElement.MouseEvent(this.ButtonMouseOut);
            uiImageButton2.SetVisibility(1f, this._data.IsFavorite ? 0.8f : 0.4f);
            this.Append((UIElement)uiImageButton2);
            float pixels3 = pixels2 + 24f;

            if (SocialAPI.Cloud != null)
            {
                UIImageButton uiImageButton3 = new UIImageButton(this._data.IsCloudSave ? this._buttonCloudActiveTexture : this._buttonCloudInactiveTexture);
                uiImageButton3.VAlign = 1f;
                uiImageButton3.Left.Set(pixels3, 0.0f);
                uiImageButton3.OnClick     += new UIElement.MouseEvent(this.CloudButtonClick);
                uiImageButton3.OnMouseOver += new UIElement.MouseEvent(this.CloudMouseOver);
                uiImageButton3.OnMouseOut  += new UIElement.MouseEvent(this.ButtonMouseOut);
                uiImageButton3.SetSnapPoint("Cloud", snapPointIndex, new Vector2?(), new Vector2?());
                this.Append((UIElement)uiImageButton3);
                pixels3 += 24f;
            }
            if (Main.UseSeedUI && (long)this._data.WorldGeneratorVersion != 0L)
            {
                UIImageButton uiImageButton3 = new UIImageButton(this._buttonSeedTexture);
                uiImageButton3.VAlign = 1f;
                uiImageButton3.Left.Set(pixels3, 0.0f);
                uiImageButton3.OnClick     += new UIElement.MouseEvent(this.SeedButtonClick);
                uiImageButton3.OnMouseOver += new UIElement.MouseEvent(this.SeedMouseOver);
                uiImageButton3.OnMouseOut  += new UIElement.MouseEvent(this.ButtonMouseOut);
                uiImageButton3.SetSnapPoint("Seed", snapPointIndex, new Vector2?(), new Vector2?());
                this.Append((UIElement)uiImageButton3);
                pixels3 += 24f;
            }
            UIImageButton uiImageButton4 = new UIImageButton(this._buttonDeleteTexture);

            uiImageButton4.VAlign       = 1f;
            uiImageButton4.HAlign       = 1f;
            uiImageButton4.OnClick     += new UIElement.MouseEvent(this.DeleteButtonClick);
            uiImageButton4.OnMouseOver += new UIElement.MouseEvent(this.DeleteMouseOver);
            uiImageButton4.OnMouseOut  += new UIElement.MouseEvent(this.DeleteMouseOut);
            this._deleteButton          = uiImageButton4;
            if (!this._data.IsFavorite)
            {
                this.Append((UIElement)uiImageButton4);
            }
            float pixels4 = pixels3 + 4f;

            this._buttonLabel        = new UIText("", 1f, false);
            this._buttonLabel.VAlign = 1f;
            this._buttonLabel.Left.Set(pixels4, 0.0f);
            this._buttonLabel.Top.Set(-3f, 0.0f);
            this.Append((UIElement)this._buttonLabel);
            this._deleteButtonLabel        = new UIText("", 1f, false);
            this._deleteButtonLabel.VAlign = 1f;
            this._deleteButtonLabel.HAlign = 1f;
            this._deleteButtonLabel.Left.Set(-30f, 0.0f);
            this._deleteButtonLabel.Top.Set(-3f, 0.0f);
            this.Append((UIElement)this._deleteButtonLabel);
            uiImageButton1.SetSnapPoint("Play", snapPointIndex, new Vector2?(), new Vector2?());
            uiImageButton2.SetSnapPoint("Favorite", snapPointIndex, new Vector2?(), new Vector2?());
            uiImageButton4.SetSnapPoint("Delete", snapPointIndex, new Vector2?(), new Vector2?());
        }
Пример #16
0
        public UICharacterListItem(PlayerFileData data, int snapPointIndex)
        {
            this.BorderColor                    = new Color(89, 116, 213) * 0.7f;
            this._dividerTexture                = TextureManager.Load("Images/UI/Divider");
            this._innerPanelTexture             = TextureManager.Load("Images/UI/InnerPanelBackground");
            this._buttonCloudActiveTexture      = TextureManager.Load("Images/UI/ButtonCloudActive");
            this._buttonCloudInactiveTexture    = TextureManager.Load("Images/UI/ButtonCloudInactive");
            this._buttonFavoriteActiveTexture   = TextureManager.Load("Images/UI/ButtonFavoriteActive");
            this._buttonFavoriteInactiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteInactive");
            this._buttonPlayTexture             = TextureManager.Load("Images/UI/ButtonPlay");
            this._buttonDeleteTexture           = TextureManager.Load("Images/UI/ButtonDelete");
            this.Height.Set(96f, 0.0f);
            this.Width.Set(0.0f, 1f);
            this.SetPadding(6f);
            this._data        = data;
            this._playerPanel = new UICharacter(data.Player);
            this._playerPanel.Left.Set(4f, 0.0f);
            this._playerPanel.OnDoubleClick += new UIElement.MouseEvent(this.PlayGame);
            this.OnDoubleClick += new UIElement.MouseEvent(this.PlayGame);
            this.Append((UIElement)this._playerPanel);
            UIImageButton uiImageButton1 = new UIImageButton(this._buttonPlayTexture);

            uiImageButton1.VAlign = 1f;
            uiImageButton1.Left.Set(4f, 0.0f);
            uiImageButton1.OnClick     += new UIElement.MouseEvent(this.PlayGame);
            uiImageButton1.OnMouseOver += new UIElement.MouseEvent(this.PlayMouseOver);
            uiImageButton1.OnMouseOut  += new UIElement.MouseEvent(this.ButtonMouseOut);
            this.Append((UIElement)uiImageButton1);
            UIImageButton uiImageButton2 = new UIImageButton(this._data.IsFavorite ? this._buttonFavoriteActiveTexture : this._buttonFavoriteInactiveTexture);

            uiImageButton2.VAlign = 1f;
            uiImageButton2.Left.Set(28f, 0.0f);
            uiImageButton2.OnClick     += new UIElement.MouseEvent(this.FavoriteButtonClick);
            uiImageButton2.OnMouseOver += new UIElement.MouseEvent(this.FavoriteMouseOver);
            uiImageButton2.OnMouseOut  += new UIElement.MouseEvent(this.ButtonMouseOut);
            uiImageButton2.SetVisibility(1f, this._data.IsFavorite ? 0.8f : 0.4f);
            this.Append((UIElement)uiImageButton2);
            if (SocialAPI.Cloud != null)
            {
                UIImageButton uiImageButton3 = new UIImageButton(this._data.IsCloudSave ? this._buttonCloudActiveTexture : this._buttonCloudInactiveTexture);
                uiImageButton3.VAlign = 1f;
                uiImageButton3.Left.Set(52f, 0.0f);
                uiImageButton3.OnClick     += new UIElement.MouseEvent(this.CloudButtonClick);
                uiImageButton3.OnMouseOver += new UIElement.MouseEvent(this.CloudMouseOver);
                uiImageButton3.OnMouseOut  += new UIElement.MouseEvent(this.ButtonMouseOut);
                this.Append((UIElement)uiImageButton3);
                uiImageButton3.SetSnapPoint("Cloud", snapPointIndex, new Vector2?(), new Vector2?());
            }
            UIImageButton uiImageButton4 = new UIImageButton(this._buttonDeleteTexture);

            uiImageButton4.VAlign       = 1f;
            uiImageButton4.HAlign       = 1f;
            uiImageButton4.OnClick     += new UIElement.MouseEvent(this.DeleteButtonClick);
            uiImageButton4.OnMouseOver += new UIElement.MouseEvent(this.DeleteMouseOver);
            uiImageButton4.OnMouseOut  += new UIElement.MouseEvent(this.DeleteMouseOut);
            this._deleteButton          = uiImageButton4;
            if (!this._data.IsFavorite)
            {
                this.Append((UIElement)uiImageButton4);
            }
            this._buttonLabel        = new UIText("", 1f, false);
            this._buttonLabel.VAlign = 1f;
            this._buttonLabel.Left.Set(80f, 0.0f);
            this._buttonLabel.Top.Set(-3f, 0.0f);
            this.Append((UIElement)this._buttonLabel);
            this._deleteButtonLabel        = new UIText("", 1f, false);
            this._deleteButtonLabel.VAlign = 1f;
            this._deleteButtonLabel.HAlign = 1f;
            this._deleteButtonLabel.Left.Set(-30f, 0.0f);
            this._deleteButtonLabel.Top.Set(-3f, 0.0f);
            this.Append((UIElement)this._deleteButtonLabel);
            uiImageButton1.SetSnapPoint("Play", snapPointIndex, new Vector2?(), new Vector2?());
            uiImageButton2.SetSnapPoint("Favorite", snapPointIndex, new Vector2?(), new Vector2?());
            uiImageButton4.SetSnapPoint("Delete", snapPointIndex, new Vector2?(), new Vector2?());
        }
		public UIWorldListItem(WorldFileData data)
		{
			this.BorderColor = new Color(89, 116, 213) * 0.7f;
			this._dividerTexture = TextureManager.Load("Images/UI/Divider");
			this._innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
			this._buttonCloudActiveTexture = TextureManager.Load("Images/UI/ButtonCloudActive");
			this._buttonCloudInactiveTexture = TextureManager.Load("Images/UI/ButtonCloudInactive");
			this._buttonFavoriteActiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteActive");
			this._buttonFavoriteInactiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteInactive");
			this._buttonPlayTexture = TextureManager.Load("Images/UI/ButtonPlay");
			this._buttonDeleteTexture = TextureManager.Load("Images/UI/ButtonDelete");
			this.Height.Set(96f, 0f);
			this.Width.Set(0f, 1f);
			base.SetPadding(6f);
			this._data = data;
			this._worldIcon = new UIImage(this.GetIcon());
			this._worldIcon.Left.Set(4f, 0f);
			this._worldIcon.OnDoubleClick += new UIElement.MouseEvent(this.PlayGame);
			base.Append(this._worldIcon);
			UIImageButton uIImageButton = new UIImageButton(this._buttonPlayTexture);
			uIImageButton.VAlign = 1f;
			uIImageButton.Left.Set(4f, 0f);
			uIImageButton.OnClick += new UIElement.MouseEvent(this.PlayGame);
			base.OnDoubleClick += new UIElement.MouseEvent(this.PlayGame);
			uIImageButton.OnMouseOver += new UIElement.MouseEvent(this.PlayMouseOver);
			uIImageButton.OnMouseOut += new UIElement.MouseEvent(this.ButtonMouseOut);
			base.Append(uIImageButton);
			UIImageButton uIImageButton2 = new UIImageButton(this._data.IsFavorite ? this._buttonFavoriteActiveTexture : this._buttonFavoriteInactiveTexture);
			uIImageButton2.VAlign = 1f;
			uIImageButton2.Left.Set(28f, 0f);
			uIImageButton2.OnClick += new UIElement.MouseEvent(this.FavoriteButtonClick);
			uIImageButton2.OnMouseOver += new UIElement.MouseEvent(this.FavoriteMouseOver);
			uIImageButton2.OnMouseOut += new UIElement.MouseEvent(this.ButtonMouseOut);
			uIImageButton2.SetVisibility(1f, this._data.IsFavorite ? 0.8f : 0.4f);
			base.Append(uIImageButton2);
			if (SocialAPI.Cloud != null)
			{
				UIImageButton uIImageButton3 = new UIImageButton(this._data.IsCloudSave ? this._buttonCloudActiveTexture : this._buttonCloudInactiveTexture);
				uIImageButton3.VAlign = 1f;
				uIImageButton3.Left.Set(52f, 0f);
				uIImageButton3.OnClick += new UIElement.MouseEvent(this.CloudButtonClick);
				uIImageButton3.OnMouseOver += new UIElement.MouseEvent(this.CloudMouseOver);
				uIImageButton3.OnMouseOut += new UIElement.MouseEvent(this.ButtonMouseOut);
				base.Append(uIImageButton3);
			}
			UIImageButton uIImageButton4 = new UIImageButton(this._buttonDeleteTexture);
			uIImageButton4.VAlign = 1f;
			uIImageButton4.HAlign = 1f;
			uIImageButton4.OnClick += new UIElement.MouseEvent(this.DeleteButtonClick);
			uIImageButton4.OnMouseOver += new UIElement.MouseEvent(this.DeleteMouseOver);
			uIImageButton4.OnMouseOut += new UIElement.MouseEvent(this.DeleteMouseOut);
			this._deleteButton = uIImageButton4;
			if (!this._data.IsFavorite)
			{
				base.Append(uIImageButton4);
			}
			this._buttonLabel = new UIText("", 1f, false);
			this._buttonLabel.VAlign = 1f;
			this._buttonLabel.Left.Set(80f, 0f);
			this._buttonLabel.Top.Set(-3f, 0f);
			base.Append(this._buttonLabel);
			this._deleteButtonLabel = new UIText("", 1f, false);
			this._deleteButtonLabel.VAlign = 1f;
			this._deleteButtonLabel.HAlign = 1f;
			this._deleteButtonLabel.Left.Set(-30f, 0f);
			this._deleteButtonLabel.Top.Set(-3f, 0f);
			base.Append(this._deleteButtonLabel);
		}
Пример #18
0
        private void BuildSacrificeMenuContents(UIElement totalContainer)
        {
            UIPanel basicPanel = UICreativeInfiniteItemsDisplay.CreateBasicPanel();

            basicPanel.VAlign = 0.5f;
            basicPanel.Height = new StyleDimension(170f, 0.0f);
            basicPanel.Width  = new StyleDimension(170f, 0.0f);
            basicPanel.Top    = new StyleDimension();
            totalContainer.Append((UIElement)basicPanel);
            basicPanel.OnUpdate    += new UIElement.ElementEvent(this.Hover_OnUpdate);
            basicPanel.OnMouseOver += new UIElement.MouseEvent(this.Hover_OnMouseOver);
            basicPanel.OnMouseOut  += new UIElement.MouseEvent(this.Hover_OnMouseOut);
            this.AddCogsForSacrificeMenu((UIElement)basicPanel);
            this._pistonParticleAsset = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_Spark", (AssetRequestMode)1);
            float   pixels   = 0.0f;
            UIImage uiImage1 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_Slots", (AssetRequestMode)1));

            uiImage1.HAlign = 0.5f;
            uiImage1.VAlign = 0.5f;
            uiImage1.Top    = new StyleDimension(-20f, 0.0f);
            uiImage1.Left   = new StyleDimension(pixels, 0.0f);
            UIImage uiImage2 = uiImage1;

            basicPanel.Append((UIElement)uiImage2);
            Asset <M0>    asset          = Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_FramedPistons", (AssetRequestMode)1);
            UIImageFramed uiImageFramed1 = new UIImageFramed((Asset <Texture2D>)asset, ((Asset <Texture2D>)asset).Frame(1, 9, 0, 0, 0, 0));

            uiImageFramed1.HAlign = 0.5f;
            uiImageFramed1.VAlign = 0.5f;
            uiImageFramed1.Top    = new StyleDimension(-20f, 0.0f);
            uiImageFramed1.Left   = new StyleDimension(pixels, 0.0f);
            uiImageFramed1.IgnoresMouseInteraction = true;
            UIImageFramed uiImageFramed2 = uiImageFramed1;

            basicPanel.Append((UIElement)uiImageFramed2);
            this._sacrificePistons = uiImageFramed2;
            UIParticleLayer uiParticleLayer = new UIParticleLayer();

            uiParticleLayer.Width  = new StyleDimension(0.0f, 1f);
            uiParticleLayer.Height = new StyleDimension(0.0f, 1f);
            uiParticleLayer.AnchorPositionOffsetByPercents = Vector2.One / 2f;
            uiParticleLayer.AnchorPositionOffsetByPixels   = Vector2.Zero;
            this._pistonParticleSystem = uiParticleLayer;
            uiImageFramed2.Append((UIElement)this._pistonParticleSystem);
            UIElement element = Main.CreativeMenu.ProvideItemSlotElement(0);

            element.HAlign = 0.5f;
            element.VAlign = 0.5f;
            element.Top    = new StyleDimension(-15f, 0.0f);
            element.Left   = new StyleDimension(pixels, 0.0f);
            element.SetSnapPoint("CreativeSacrificeSlot", 0, new Vector2?(), new Vector2?());
            uiImage2.Append(element);
            UIText uiText1 = new UIText("(0/50)", 0.8f, false);

            uiText1.Top    = new StyleDimension(10f, 0.0f);
            uiText1.Left   = new StyleDimension(pixels, 0.0f);
            uiText1.HAlign = 0.5f;
            uiText1.VAlign = 0.5f;
            uiText1.IgnoresMouseInteraction = true;
            UIText uiText2 = uiText1;

            uiText2.OnUpdate += new UIElement.ElementEvent(this.descriptionText_OnUpdate);
            basicPanel.Append((UIElement)uiText2);
            UIPanel uiPanel1 = new UIPanel();

            uiPanel1.Top    = new StyleDimension(0.0f, 0.0f);
            uiPanel1.Left   = new StyleDimension(pixels, 0.0f);
            uiPanel1.HAlign = 0.5f;
            uiPanel1.VAlign = 1f;
            uiPanel1.Width  = new StyleDimension(124f, 0.0f);
            uiPanel1.Height = new StyleDimension(30f, 0.0f);
            UIPanel uiPanel2 = uiPanel1;
            UIText  uiText3  = new UIText(Language.GetText("CreativePowers.ConfirmInfiniteItemSacrifice"), 0.8f, false);

            uiText3.IgnoresMouseInteraction = true;
            uiText3.HAlign = 0.5f;
            uiText3.VAlign = 0.5f;
            UIText uiText4 = uiText3;

            uiPanel2.Append((UIElement)uiText4);
            uiPanel2.SetSnapPoint("CreativeSacrificeConfirm", 0, new Vector2?(), new Vector2?());
            uiPanel2.OnClick     += new UIElement.MouseEvent(this.sacrificeButton_OnClick);
            uiPanel2.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver);
            uiPanel2.OnMouseOut  += new UIElement.MouseEvent(this.FadedMouseOut);
            uiPanel2.OnUpdate    += new UIElement.ElementEvent(this.research_OnUpdate);
            basicPanel.Append((UIElement)uiPanel2);
            basicPanel.OnUpdate += new UIElement.ElementEvent(this.sacrificeWindow_OnUpdate);
        }
Пример #19
0
        public UIWorldListItem(WorldFileData data, int orderInList, bool canBePlayed)
        {
            _orderInList = orderInList;
            _data        = data;
            _canBePlayed = canBePlayed;
            LoadTextures();
            InitializeAppearance();
            _worldIcon = new UIImage(GetIcon());
            _worldIcon.Left.Set(4f, 0f);
            _worldIcon.OnDoubleClick += PlayGame;
            Append(_worldIcon);
            float         num           = 4f;
            UIImageButton uIImageButton = new UIImageButton(_buttonPlayTexture);

            uIImageButton.VAlign = 1f;
            uIImageButton.Left.Set(num, 0f);
            uIImageButton.OnClick     += PlayGame;
            base.OnDoubleClick        += PlayGame;
            uIImageButton.OnMouseOver += PlayMouseOver;
            uIImageButton.OnMouseOut  += ButtonMouseOut;
            Append(uIImageButton);
            num += 24f;
            UIImageButton uIImageButton2 = new UIImageButton(_data.IsFavorite ? _buttonFavoriteActiveTexture : _buttonFavoriteInactiveTexture);

            uIImageButton2.VAlign = 1f;
            uIImageButton2.Left.Set(num, 0f);
            uIImageButton2.OnClick     += FavoriteButtonClick;
            uIImageButton2.OnMouseOver += FavoriteMouseOver;
            uIImageButton2.OnMouseOut  += ButtonMouseOut;
            uIImageButton2.SetVisibility(1f, _data.IsFavorite ? 0.8f : 0.4f);
            Append(uIImageButton2);
            num += 24f;
            if (SocialAPI.Cloud != null)
            {
                UIImageButton uIImageButton3 = new UIImageButton(_data.IsCloudSave ? _buttonCloudActiveTexture : _buttonCloudInactiveTexture);
                uIImageButton3.VAlign = 1f;
                uIImageButton3.Left.Set(num, 0f);
                uIImageButton3.OnClick     += CloudButtonClick;
                uIImageButton3.OnMouseOver += CloudMouseOver;
                uIImageButton3.OnMouseOut  += ButtonMouseOut;
                uIImageButton3.SetSnapPoint("Cloud", orderInList);
                Append(uIImageButton3);
                num += 24f;
            }
            if (_data.WorldGeneratorVersion != 0L)
            {
                UIImageButton uIImageButton4 = new UIImageButton(_buttonSeedTexture);
                uIImageButton4.VAlign = 1f;
                uIImageButton4.Left.Set(num, 0f);
                uIImageButton4.OnClick     += SeedButtonClick;
                uIImageButton4.OnMouseOver += SeedMouseOver;
                uIImageButton4.OnMouseOut  += ButtonMouseOut;
                uIImageButton4.SetSnapPoint("Seed", orderInList);
                Append(uIImageButton4);
                num += 24f;
            }
            UIImageButton uIImageButton5 = new UIImageButton(_buttonDeleteTexture)
            {
                VAlign = 1f,
                HAlign = 1f
            };

            if (!_data.IsFavorite)
            {
                uIImageButton5.OnClick += DeleteButtonClick;
            }
            uIImageButton5.OnMouseOver += DeleteMouseOver;
            uIImageButton5.OnMouseOut  += DeleteMouseOut;
            _deleteButton = uIImageButton5;
            Append(uIImageButton5);
            num                += 4f;
            _buttonLabel        = new UIText("");
            _buttonLabel.VAlign = 1f;
            _buttonLabel.Left.Set(num, 0f);
            _buttonLabel.Top.Set(-3f, 0f);
            Append(_buttonLabel);
            _deleteButtonLabel        = new UIText("");
            _deleteButtonLabel.VAlign = 1f;
            _deleteButtonLabel.HAlign = 1f;
            _deleteButtonLabel.Left.Set(-30f, 0f);
            _deleteButtonLabel.Top.Set(-3f, 0f);
            Append(_deleteButtonLabel);
            uIImageButton.SetSnapPoint("Play", orderInList);
            uIImageButton2.SetSnapPoint("Favorite", orderInList);
            uIImageButton5.SetSnapPoint("Delete", orderInList);
        }
Пример #20
0
        public UIWorldListItem(WorldFileData data)
        {
            BorderColor                    = new Color(89, 116, 213) * 0.7f;
            _dividerTexture                = TextureManager.Load("Images/UI/Divider");
            _innerPanelTexture             = TextureManager.Load("Images/UI/InnerPanelBackground");
            _buttonCloudActiveTexture      = TextureManager.Load("Images/UI/ButtonCloudActive");
            _buttonCloudInactiveTexture    = TextureManager.Load("Images/UI/ButtonCloudInactive");
            _buttonFavoriteActiveTexture   = TextureManager.Load("Images/UI/ButtonFavoriteActive");
            _buttonFavoriteInactiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteInactive");
            _buttonPlayTexture             = TextureManager.Load("Images/UI/ButtonPlay");
            _buttonDeleteTexture           = TextureManager.Load("Images/UI/ButtonDelete");
            Height.Set(96f, 0f);
            Width.Set(0f, 1f);
            SetPadding(6f);
            _data      = data;
            _worldIcon = new UIImage(GetIcon());
            _worldIcon.Left.Set(4f, 0f);
            _worldIcon.OnDoubleClick += PlayGame;
            Append(_worldIcon);
            UIImageButton uIImageButton = new UIImageButton(_buttonPlayTexture);

            uIImageButton.VAlign = 1f;
            uIImageButton.Left.Set(4f, 0f);
            uIImageButton.OnClick     += PlayGame;
            base.OnDoubleClick        += PlayGame;
            uIImageButton.OnMouseOver += PlayMouseOver;
            uIImageButton.OnMouseOut  += ButtonMouseOut;
            Append(uIImageButton);
            UIImageButton uIImageButton2 = new UIImageButton(_data.IsFavorite ? _buttonFavoriteActiveTexture : _buttonFavoriteInactiveTexture);

            uIImageButton2.VAlign = 1f;
            uIImageButton2.Left.Set(28f, 0f);
            uIImageButton2.OnClick     += FavoriteButtonClick;
            uIImageButton2.OnMouseOver += FavoriteMouseOver;
            uIImageButton2.OnMouseOut  += ButtonMouseOut;
            uIImageButton2.SetVisibility(1f, _data.IsFavorite ? 0.8f : 0.4f);
            Append(uIImageButton2);
            if (SocialAPI.Cloud != null)
            {
                UIImageButton uIImageButton3 = new UIImageButton(_data.IsCloudSave ? _buttonCloudActiveTexture : _buttonCloudInactiveTexture);
                uIImageButton3.VAlign = 1f;
                uIImageButton3.Left.Set(52f, 0f);
                uIImageButton3.OnClick     += CloudButtonClick;
                uIImageButton3.OnMouseOver += CloudMouseOver;
                uIImageButton3.OnMouseOut  += ButtonMouseOut;
                Append(uIImageButton3);
            }
            UIImageButton uIImageButton4 = new UIImageButton(_buttonDeleteTexture);

            uIImageButton4.VAlign       = 1f;
            uIImageButton4.HAlign       = 1f;
            uIImageButton4.OnClick     += DeleteButtonClick;
            uIImageButton4.OnMouseOver += DeleteMouseOver;
            uIImageButton4.OnMouseOut  += DeleteMouseOut;
            _deleteButton = uIImageButton4;
            if (!_data.IsFavorite)
            {
                Append(uIImageButton4);
            }
            _buttonLabel        = new UIText("");
            _buttonLabel.VAlign = 1f;
            _buttonLabel.Left.Set(80f, 0f);
            _buttonLabel.Top.Set(-3f, 0f);
            Append(_buttonLabel);
            _deleteButtonLabel        = new UIText("");
            _deleteButtonLabel.VAlign = 1f;
            _deleteButtonLabel.HAlign = 1f;
            _deleteButtonLabel.Left.Set(-30f, 0f);
            _deleteButtonLabel.Top.Set(-3f, 0f);
            Append(_deleteButtonLabel);
        }
Пример #21
0
        public UIBestiaryEntryButton(BestiaryEntry entry, bool isAPrettyPortrait)
        {
            this.Entry = entry;
            this.Height.Set(72f, 0.0f);
            this.Width.Set(72f, 0.0f);
            this.SetPadding(0.0f);
            UIElement element = new UIElement()
            {
                Width  = new StyleDimension(-4f, 1f),
                Height = new StyleDimension(-4f, 1f),
                IgnoresMouseInteraction = true,
                OverflowHidden          = true,
                HAlign = 0.5f,
                VAlign = 0.5f
            };

            element.SetPadding(0.0f);
            UIImage uiImage1 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Back", (AssetRequestMode)1));

            uiImage1.VAlign = 0.5f;
            uiImage1.HAlign = 0.5f;
            element.Append((UIElement)uiImage1);
            if (isAPrettyPortrait)
            {
                Asset <Texture2D> texture = this.TryGettingBackgroundImageProvider(entry);
                if (texture != null)
                {
                    UIElement uiElement = element;
                    UIImage   uiImage2  = new UIImage(texture);
                    uiImage2.HAlign = 0.5f;
                    uiImage2.VAlign = 0.5f;
                    uiElement.Append((UIElement)uiImage2);
                }
            }
            UIBestiaryEntryIcon bestiaryEntryIcon = new UIBestiaryEntryIcon(entry, isAPrettyPortrait);

            element.Append((UIElement)bestiaryEntryIcon);
            this.Append(element);
            this._icon = bestiaryEntryIcon;
            int?nullable = this.TryGettingDisplayIndex(entry);

            if (nullable.HasValue)
            {
                UIText uiText = new UIText(nullable.Value.ToString(), 0.9f, false);
                uiText.Top  = new StyleDimension(10f, 0.0f);
                uiText.Left = new StyleDimension(10f, 0.0f);
                uiText.IgnoresMouseInteraction = true;
                this.Append((UIElement)uiText);
            }
            UIImage uiImage3 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Selection", (AssetRequestMode)1));

            uiImage3.VAlign = 0.5f;
            uiImage3.HAlign = 0.5f;
            uiImage3.IgnoresMouseInteraction = true;
            this._bordersGlow = uiImage3;
            UIImage uiImage4 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Overlay", (AssetRequestMode)1));

            uiImage4.VAlign = 0.5f;
            uiImage4.HAlign = 0.5f;
            uiImage4.IgnoresMouseInteraction = true;
            uiImage4.Color       = Color.White * 0.6f;
            this._bordersOverlay = uiImage4;
            this.Append((UIElement)this._bordersOverlay);
            UIImage uiImage5 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Slot_Front", (AssetRequestMode)1));

            uiImage5.VAlign = 0.5f;
            uiImage5.HAlign = 0.5f;
            uiImage5.IgnoresMouseInteraction = true;
            this.Append((UIElement)uiImage5);
            this._borders = uiImage5;
            if (isAPrettyPortrait)
            {
                this.RemoveChild((UIElement)this._bordersOverlay);
            }
            if (isAPrettyPortrait)
            {
                return;
            }
            this.OnMouseOver += new UIElement.MouseEvent(this.MouseOver);
            this.OnMouseOut  += new UIElement.MouseEvent(this.MouseOut);
        }
Пример #22
0
        public UIWorldListItem(WorldFileData data)
        {
            BorderColor                    = new Color(89, 116, 213) * 0.7f;
            _dividerTexture                = TextureManager.Load("Images/UI/Divider");
            _innerPanelTexture             = TextureManager.Load("Images/UI/InnerPanelBackground");
            _buttonCloudActiveTexture      = TextureManager.Load("Images/UI/ButtonCloudActive");
            _buttonCloudInactiveTexture    = TextureManager.Load("Images/UI/ButtonCloudInactive");
            _buttonFavoriteActiveTexture   = TextureManager.Load("Images/UI/ButtonFavoriteActive");
            _buttonFavoriteInactiveTexture = TextureManager.Load("Images/UI/ButtonFavoriteInactive");
            _buttonPlayTexture             = TextureManager.Load("Images/UI/ButtonPlay");
            _buttonDeleteTexture           = TextureManager.Load("Images/UI/ButtonDelete");
            Height.Set(96f, 0.0f);
            Width.Set(0.0f, 1f);
            SetPadding(6f);
            _data      = data;
            _worldIcon = new UIImage(GetIcon());
            _worldIcon.Left.Set(4f, 0.0f);
            _worldIcon.OnDoubleClick += new UIElement.MouseEvent(PlayGame);
            Append(_worldIcon);
            UIImageButton uiImageButton1 = new UIImageButton(_buttonPlayTexture);

            uiImageButton1.VAlign = 1f;
            uiImageButton1.Left.Set(4f, 0.0f);
            uiImageButton1.OnClick     += new UIElement.MouseEvent(PlayGame);
            OnDoubleClick              += new UIElement.MouseEvent(PlayGame);
            uiImageButton1.OnMouseOver += new UIElement.MouseEvent(PlayMouseOver);
            uiImageButton1.OnMouseOut  += new UIElement.MouseEvent(ButtonMouseOut);
            Append(uiImageButton1);
            UIImageButton uiImageButton2 = new UIImageButton(_data.IsFavorite ? _buttonFavoriteActiveTexture : _buttonFavoriteInactiveTexture);

            uiImageButton2.VAlign = 1f;
            uiImageButton2.Left.Set(28f, 0.0f);
            uiImageButton2.OnClick     += new UIElement.MouseEvent(FavoriteButtonClick);
            uiImageButton2.OnMouseOver += new UIElement.MouseEvent(FavoriteMouseOver);
            uiImageButton2.OnMouseOut  += new UIElement.MouseEvent(ButtonMouseOut);
            uiImageButton2.SetVisibility(1f, this._data.IsFavorite ? 0.8f : 0.4f);
            Append(uiImageButton2);
            UIImageButton uiImageButton4 = new UIImageButton(_buttonDeleteTexture);

            uiImageButton4.VAlign       = 1f;
            uiImageButton4.HAlign       = 1f;
            uiImageButton4.OnClick     += new UIElement.MouseEvent(DeleteButtonClick);
            uiImageButton4.OnMouseOver += new UIElement.MouseEvent(DeleteMouseOver);
            uiImageButton4.OnMouseOut  += new UIElement.MouseEvent(DeleteMouseOut);
            _deleteButton = uiImageButton4;
            if (!_data.IsFavorite)
            {
                Append(uiImageButton4);
            }
            _buttonLabel        = new UIText("", 1f, false);
            _buttonLabel.VAlign = 1f;
            _buttonLabel.Left.Set(80f, 0.0f);
            _buttonLabel.Top.Set(-3f, 0.0f);
            Append(_buttonLabel);
            _deleteButtonLabel        = new UIText("", 1f, false);
            _deleteButtonLabel.VAlign = 1f;
            _deleteButtonLabel.HAlign = 1f;
            _deleteButtonLabel.Left.Set(-30f, 0.0f);
            _deleteButtonLabel.Top.Set(-3f, 0.0f);
            Append(_deleteButtonLabel);
        }
Пример #23
0
        public EmotesGroupListItem(LocalizedText groupTitle, int groupIndex, int maxEmotesPerRow, params int[] emotes)
        {
            maxEmotesPerRow = 14;
            SetPadding(0f);
            _groupIndex      = groupIndex;
            _maxEmotesPerRow = maxEmotesPerRow;
            _tempTex         = Main.Assets.Request <Texture2D>("Images/UI/ButtonFavoriteInactive", (AssetRequestMode)1);
            int num = emotes.Length / _maxEmotesPerRow;

            if (emotes.Length % _maxEmotesPerRow != 0)
            {
                num++;
            }
            Height.Set(30 + 36 * num, 0f);
            Width.Set(0f, 1f);
            UIElement uIElement = new UIElement
            {
                Height = StyleDimension.FromPixels(30f),
                Width  = StyleDimension.FromPixelsAndPercent(-20f, 1f),
                HAlign = 0.5f
            };

            uIElement.SetPadding(0f);
            Append(uIElement);
            UIHorizontalSeparator element = new UIHorizontalSeparator
            {
                Width  = StyleDimension.FromPixelsAndPercent(0f, 1f),
                VAlign = 1f,
                HAlign = 0.5f,
                Color  = Color.Lerp(Color.White, new Color(63, 65, 151, 255), 0.85f) * 0.9f
            };

            uIElement.Append(element);
            UIText element2 = new UIText(groupTitle)
            {
                VAlign = 1f,
                HAlign = 0.5f,
                Top    = StyleDimension.FromPixels(-6f)
            };

            uIElement.Append(element2);
            float num2 = 6f;

            for (int i = 0; i < emotes.Length; i++)
            {
                int emoteIndex = emotes[i];
                int num3       = i / _maxEmotesPerRow;
                int num4       = i % _maxEmotesPerRow;
                int num5       = emotes.Length % _maxEmotesPerRow;
                if (emotes.Length / _maxEmotesPerRow != num3)
                {
                    num5 = _maxEmotesPerRow;
                }
                if (num5 == 0)
                {
                    num5 = _maxEmotesPerRow;
                }
                float num6 = 36f * ((float)num5 / 2f);
                num6 -= 16f;
                num6  = -16f;
                EmoteButton emoteButton = new EmoteButton(emoteIndex)
                {
                    HAlign = 0f,
                    VAlign = 0f,
                    Top    = StyleDimension.FromPixels((float)(30 + num3 * 36) + num2),
                    Left   = StyleDimension.FromPixels((float)(36 * num4) - num6)
                };
                Append(emoteButton);
                emoteButton.SetSnapPoint("Group " + groupIndex, i);
            }
        }
Пример #24
0
        public UICharacterListItem(PlayerFileData data, int snapPointIndex)
        {
            BorderColor                    = new Color(89, 116, 213) * 0.7f;
            _dividerTexture                = Main.Assets.Request <Texture2D>("Images/UI/Divider", Main.content, (AssetRequestMode)1);
            _innerPanelTexture             = Main.Assets.Request <Texture2D>("Images/UI/InnerPanelBackground", Main.content, (AssetRequestMode)1);
            _buttonCloudActiveTexture      = Main.Assets.Request <Texture2D>("Images/UI/ButtonCloudActive", Main.content, (AssetRequestMode)1);
            _buttonCloudInactiveTexture    = Main.Assets.Request <Texture2D>("Images/UI/ButtonCloudInactive", Main.content, (AssetRequestMode)1);
            _buttonFavoriteActiveTexture   = Main.Assets.Request <Texture2D>("Images/UI/ButtonFavoriteActive", Main.content, (AssetRequestMode)1);
            _buttonFavoriteInactiveTexture = Main.Assets.Request <Texture2D>("Images/UI/ButtonFavoriteInactive", Main.content, (AssetRequestMode)1);
            _buttonPlayTexture             = Main.Assets.Request <Texture2D>("Images/UI/ButtonPlay", Main.content, (AssetRequestMode)1);
            _buttonDeleteTexture           = Main.Assets.Request <Texture2D>("Images/UI/ButtonDelete", Main.content, (AssetRequestMode)1);
            Height.Set(96f, 0f);
            Width.Set(0f, 1f);
            SetPadding(6f);
            _data        = data;
            _playerPanel = new UICharacter(data.Player);
            _playerPanel.Left.Set(4f, 0f);
            _playerPanel.OnDoubleClick += PlayGame;
            base.OnDoubleClick         += PlayGame;
            Append(_playerPanel);
            UIImageButton uIImageButton = new UIImageButton(_buttonPlayTexture);

            uIImageButton.VAlign = 1f;
            uIImageButton.Left.Set(4f, 0f);
            uIImageButton.OnClick     += PlayGame;
            uIImageButton.OnMouseOver += PlayMouseOver;
            uIImageButton.OnMouseOut  += ButtonMouseOut;
            Append(uIImageButton);
            UIImageButton uIImageButton2 = new UIImageButton(_data.IsFavorite ? _buttonFavoriteActiveTexture : _buttonFavoriteInactiveTexture);

            uIImageButton2.VAlign = 1f;
            uIImageButton2.Left.Set(28f, 0f);
            uIImageButton2.OnClick     += FavoriteButtonClick;
            uIImageButton2.OnMouseOver += FavoriteMouseOver;
            uIImageButton2.OnMouseOut  += ButtonMouseOut;
            uIImageButton2.SetVisibility(1f, _data.IsFavorite ? 0.8f : 0.4f);
            Append(uIImageButton2);
            if (SocialAPI.Cloud != null)
            {
                UIImageButton uIImageButton3 = new UIImageButton(_data.IsCloudSave ? _buttonCloudActiveTexture : _buttonCloudInactiveTexture);
                uIImageButton3.VAlign = 1f;
                uIImageButton3.Left.Set(52f, 0f);
                uIImageButton3.OnClick     += CloudButtonClick;
                uIImageButton3.OnMouseOver += CloudMouseOver;
                uIImageButton3.OnMouseOut  += ButtonMouseOut;
                Append(uIImageButton3);
                uIImageButton3.SetSnapPoint("Cloud", snapPointIndex);
            }
            UIImageButton uIImageButton4 = new UIImageButton(_buttonDeleteTexture)
            {
                VAlign = 1f,
                HAlign = 1f
            };

            if (!_data.IsFavorite)
            {
                uIImageButton4.OnClick += DeleteButtonClick;
            }
            uIImageButton4.OnMouseOver += DeleteMouseOver;
            uIImageButton4.OnMouseOut  += DeleteMouseOut;
            _deleteButton = uIImageButton4;
            Append(uIImageButton4);
            _buttonLabel        = new UIText("");
            _buttonLabel.VAlign = 1f;
            _buttonLabel.Left.Set(80f, 0f);
            _buttonLabel.Top.Set(-3f, 0f);
            Append(_buttonLabel);
            _deleteButtonLabel        = new UIText("");
            _deleteButtonLabel.VAlign = 1f;
            _deleteButtonLabel.HAlign = 1f;
            _deleteButtonLabel.Left.Set(-30f, 0f);
            _deleteButtonLabel.Top.Set(-3f, 0f);
            Append(_deleteButtonLabel);
            uIImageButton.SetSnapPoint("Play", snapPointIndex);
            uIImageButton2.SetSnapPoint("Favorite", snapPointIndex);
            uIImageButton4.SetSnapPoint("Delete", snapPointIndex);
        }
Пример #25
0
		public UIModItem(TmodFile mod)
		{
			this.mod = mod;
			this.BorderColor = new Color(89, 116, 213) * 0.7f;
			this.dividerTexture = TextureManager.Load("Images/UI/Divider");
			this.innerPanelTexture = TextureManager.Load("Images/UI/InnerPanelBackground");
			this.Height.Set(90f, 0f);
			this.Width.Set(0f, 1f);
			base.SetPadding(6f);
			//base.OnClick += new UIElement.MouseEvent(this.ToggleEnabled);
			properties = BuildProperties.ReadModFile(mod);
			string text = properties.displayName.Length > 0 ? properties.displayName : mod.name;
			text += " v" + mod.version;
			if (properties.author.Length > 0)
			{
				text += " - by " + properties.author;
			}
			this.modName = new UIText(text, 1f, false);
			this.modName.Left.Set(10f, 0f);
			this.modName.Top.Set(5f, 0f);
			base.Append(this.modName);
			this.enabled = ModLoader.IsEnabled(mod);
			UITextPanel button = new UITextPanel("More info", 1f, false);
			button.Width.Set(100f, 0f);
			button.Height.Set(30f, 0f);
			button.Left.Set(430f, 0f);
			button.Top.Set(40f, 0f);
			button.PaddingTop -= 2f;
			button.PaddingBottom -= 2f;
			button.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button.OnClick += new UIElement.MouseEvent(this.Moreinfo);
			base.Append(button);
			button2 = new UITextPanel(this.enabled ? "Click to Disable" : "Click to Enable", 1f, false);
			button2.Width.Set(100f, 0f);
			button2.Height.Set(30f, 0f);
			button2.Left.Set(275f, 0f);
			button2.Top.Set(40f, 0f);
			button2.PaddingTop -= 2f;
			button2.PaddingBottom -= 2f;
			button2.OnMouseOver += new UIElement.MouseEvent(FadedMouseOver);
			button2.OnMouseOut += new UIElement.MouseEvent(FadedMouseOut);
			button2.OnClick += new UIElement.MouseEvent(this.ToggleEnabled);
			base.Append(button2);
			if (mod.ValidModBrowserSignature)
			{
				keyImage = new UIHoverImage(Main.itemTexture[ID.ItemID.GoldenKey], "This mod originated from the Mod Browser");
				keyImage.Left.Set(-20, 1f);
				base.Append(keyImage);
			}
			if (ModLoader.ModLoaded(mod.name))
			{
				Mod loadedMod = ModLoader.GetMod(mod.name);
				int[] values = { loadedMod.items.Count, loadedMod.npcs.Count, loadedMod.tiles.Count, loadedMod.walls.Count, loadedMod.buffs.Count, loadedMod.mountDatas.Count	};
				string[] strings = { " items", " NPCs", " tiles", " walls", " buffs", " mounts"};
				int xOffset = -40;
				for (int i = 0; i < values.Length; i++)
				{
					if(values[i] > 0)
					{
						Texture2D iconTexture = ModLoader.GetTexture("Terraria/UI" + Path.DirectorySeparatorChar + "InfoIcon_" + i);
						keyImage = new UIHoverImage(iconTexture, values[i] + strings[i]);
						keyImage.Left.Set(xOffset, 1f);
						base.Append(keyImage);
						xOffset -= 18;
					}
				}
			}
		}
Пример #26
0
        private void BuildSacrificeMenuContents(UIElement totalContainer)
        {
            UIPanel uIPanel = CreateBasicPanel();

            uIPanel.VAlign = 0.5f;
            uIPanel.Height = new StyleDimension(170f, 0f);
            uIPanel.Width  = new StyleDimension(170f, 0f);
            uIPanel.Top    = default(StyleDimension);
            totalContainer.Append(uIPanel);
            uIPanel.OnUpdate    += Hover_OnUpdate;
            uIPanel.OnMouseOver += Hover_OnMouseOver;
            uIPanel.OnMouseOut  += Hover_OnMouseOut;
            AddCogsForSacrificeMenu(uIPanel);
            _pistonParticleAsset = Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_Spark", Main.content, (AssetRequestMode)1);
            float   pixels  = 0f;
            UIImage uIImage = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_Slots", Main.content, (AssetRequestMode)1))
            {
                HAlign = 0.5f,
                VAlign = 0.5f,
                Top    = new StyleDimension(-20f, 0f),
                Left   = new StyleDimension(pixels, 0f)
            };

            uIPanel.Append(uIImage);
            Asset <Texture2D> obj           = Main.Assets.Request <Texture2D>("Images/UI/Creative/Research_FramedPistons", Main.content, (AssetRequestMode)1);
            UIImageFramed     uIImageFramed = new UIImageFramed(obj, obj.Frame(1, 9))
            {
                HAlign = 0.5f,
                VAlign = 0.5f,
                Top    = new StyleDimension(-20f, 0f),
                Left   = new StyleDimension(pixels, 0f),
                IgnoresMouseInteraction = true
            };

            uIPanel.Append(uIImageFramed);
            _sacrificePistons = uIImageFramed;
            UIParticleLayer uIParticleLayer = (_pistonParticleSystem = new UIParticleLayer
            {
                Width = new StyleDimension(0f, 1f),
                Height = new StyleDimension(0f, 1f),
                AnchorPositionOffsetByPercents = Vector2.One / 2f,
                AnchorPositionOffsetByPixels = Vector2.Zero
            });

            uIImageFramed.Append(_pistonParticleSystem);
            UIElement uIElement = Main.CreativeMenu.ProvideItemSlotElement(0);

            uIElement.HAlign = 0.5f;
            uIElement.VAlign = 0.5f;
            uIElement.Top    = new StyleDimension(-15f, 0f);
            uIElement.Left   = new StyleDimension(pixels, 0f);
            uIElement.SetSnapPoint("CreativeSacrificeSlot", 0);
            uIImage.Append(uIElement);
            UIText uIText = new UIText("(0/50)", 0.8f)
            {
                Top    = new StyleDimension(10f, 0f),
                Left   = new StyleDimension(pixels, 0f),
                HAlign = 0.5f,
                VAlign = 0.5f,
                IgnoresMouseInteraction = true
            };

            uIText.OnUpdate += descriptionText_OnUpdate;
            uIPanel.Append(uIText);
            UIPanel uIPanel2 = new UIPanel
            {
                Top    = new StyleDimension(0f, 0f),
                Left   = new StyleDimension(pixels, 0f),
                HAlign = 0.5f,
                VAlign = 1f,
                Width  = new StyleDimension(124f, 0f),
                Height = new StyleDimension(30f, 0f)
            };
            UIText element = new UIText(Language.GetText("CreativePowers.ConfirmInfiniteItemSacrifice"), 0.8f)
            {
                IgnoresMouseInteraction = true,
                HAlign = 0.5f,
                VAlign = 0.5f
            };

            uIPanel2.Append(element);
            uIPanel2.SetSnapPoint("CreativeSacrificeConfirm", 0);
            uIPanel2.OnClick     += sacrificeButton_OnClick;
            uIPanel2.OnMouseOver += FadedMouseOver;
            uIPanel2.OnMouseOut  += FadedMouseOut;
            uIPanel2.OnUpdate    += research_OnUpdate;
            uIPanel.Append(uIPanel2);
            uIPanel.OnUpdate += sacrificeWindow_OnUpdate;
        }