public UIAchievementListItem(Achievement achievement) { this.BackgroundColor = new Color(26, 40, 89) * 0.8f; this.BorderColor = new Color(13, 20, 44) * 0.8f; this._achievement = achievement; this.Height.Set(82f, 0f); this.Width.Set(0f, 1f); this.PaddingTop = 8f; this.PaddingLeft = 9f; int iconIndex = Main.Achievements.GetIconIndex(achievement.Name); this._iconIndex = iconIndex; this._iconFrameUnlocked = new Rectangle(iconIndex % 8 * 66, iconIndex / 8 * 66, 64, 64); this._iconFrameLocked = this._iconFrameUnlocked; this._iconFrameLocked.X = this._iconFrameLocked.X + 528; this._iconFrame = this._iconFrameLocked; this.UpdateIconFrame(); this._achievementIcon = new UIImageFramed(TextureManager.Load("Images/UI/Achievements"), this._iconFrame); base.Append(this._achievementIcon); this._achievementIconBorders = new UIImage(TextureManager.Load("Images/UI/Achievement_Borders")); this._achievementIconBorders.Left.Set(-4f, 0f); this._achievementIconBorders.Top.Set(-4f, 0f); base.Append(this._achievementIconBorders); this._innerPanelTopTexture = TextureManager.Load("Images/UI/Achievement_InnerPanelTop"); this._innerPanelBottomTexture = TextureManager.Load("Images/UI/Achievement_InnerPanelBottom"); this._categoryTexture = TextureManager.Load("Images/UI/Achievement_Categories"); }
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); }
public UIWorldListItem(WorldFileData 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._buttonSeedTexture = TextureManager.Load("Images/UI/ButtonSeed"); 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._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 = 28f; 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?()); }
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); }
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; }
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); }