Пример #1
0
 private void AddWorldDifficultyOptions(
     UIElement container,
     float accumualtedHeight,
     UIElement.MouseEvent clickEvent,
     string tagGroup,
     float usableWidthPercent)
 {
     UIWorldCreation.WorldDifficultyId[] worldDifficultyIdArray = new UIWorldCreation.WorldDifficultyId[4]
     {
         UIWorldCreation.WorldDifficultyId.Creative,
         UIWorldCreation.WorldDifficultyId.Normal,
         UIWorldCreation.WorldDifficultyId.Expert,
         UIWorldCreation.WorldDifficultyId.Master
     };
     LocalizedText[] localizedTextArray1 = new LocalizedText[4]
     {
         Language.GetText("UI.Creative"),
         Language.GetText("UI.Normal"),
         Language.GetText("UI.Expert"),
         Language.GetText("UI.Master")
     };
     LocalizedText[] localizedTextArray2 = new LocalizedText[4]
     {
         Language.GetText("UI.WorldDescriptionCreative"),
         Language.GetText("UI.WorldDescriptionNormal"),
         Language.GetText("UI.WorldDescriptionExpert"),
         Language.GetText("UI.WorldDescriptionMaster")
     };
     Color[] colorArray = new Color[4]
     {
         Main.creativeModeColor,
         Color.White,
         Main.mcColor,
         Main.hcColor
     };
     string[] strArray = new string[4]
     {
         "Images/UI/WorldCreation/IconDifficultyCreative",
         "Images/UI/WorldCreation/IconDifficultyNormal",
         "Images/UI/WorldCreation/IconDifficultyExpert",
         "Images/UI/WorldCreation/IconDifficultyMaster"
     };
     GroupOptionButton <UIWorldCreation.WorldDifficultyId>[] groupOptionButtonArray = new GroupOptionButton <UIWorldCreation.WorldDifficultyId> [worldDifficultyIdArray.Length];
     for (int id = 0; id < groupOptionButtonArray.Length; ++id)
     {
         GroupOptionButton <UIWorldCreation.WorldDifficultyId> groupOptionButton = new GroupOptionButton <UIWorldCreation.WorldDifficultyId>(worldDifficultyIdArray[id], localizedTextArray1[id], localizedTextArray2[id], colorArray[id], strArray[id], 1f, 1f, 16f);
         groupOptionButton.Width  = StyleDimension.FromPixelsAndPercent((float)(-1 * (groupOptionButtonArray.Length - 1)), 1f / (float)groupOptionButtonArray.Length * usableWidthPercent);
         groupOptionButton.Left   = StyleDimension.FromPercent(1f - usableWidthPercent);
         groupOptionButton.HAlign = (float)id / (float)(groupOptionButtonArray.Length - 1);
         groupOptionButton.Top.Set(accumualtedHeight, 0.0f);
         groupOptionButton.OnMouseDown += clickEvent;
         groupOptionButton.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription);
         groupOptionButton.OnMouseOut  += new UIElement.MouseEvent(this.ClearOptionDescription);
         groupOptionButton.SetSnapPoint(tagGroup, id, new Vector2?(), new Vector2?());
         container.Append((UIElement)groupOptionButton);
         groupOptionButtonArray[id] = groupOptionButton;
     }
     this._difficultyButtons = groupOptionButtonArray;
 }
Пример #2
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);
 }
Пример #3
0
 private void AddWorldEvilOptions(
     UIElement container,
     float accumualtedHeight,
     UIElement.MouseEvent clickEvent,
     string tagGroup,
     float usableWidthPercent)
 {
     UIWorldCreation.WorldEvilId[] worldEvilIdArray = new UIWorldCreation.WorldEvilId[3]
     {
         UIWorldCreation.WorldEvilId.Random,
         UIWorldCreation.WorldEvilId.Corruption,
         UIWorldCreation.WorldEvilId.Crimson
     };
     LocalizedText[] localizedTextArray1 = new LocalizedText[3]
     {
         Lang.misc[103],
         Lang.misc[101],
         Lang.misc[102]
     };
     LocalizedText[] localizedTextArray2 = new LocalizedText[3]
     {
         Language.GetText("UI.WorldDescriptionEvilRandom"),
         Language.GetText("UI.WorldDescriptionEvilCorrupt"),
         Language.GetText("UI.WorldDescriptionEvilCrimson")
     };
     Color[] colorArray = new Color[3]
     {
         Color.White,
         Color.MediumPurple,
         Color.IndianRed
     };
     string[] strArray = new string[3]
     {
         "Images/UI/WorldCreation/IconEvilRandom",
         "Images/UI/WorldCreation/IconEvilCorruption",
         "Images/UI/WorldCreation/IconEvilCrimson"
     };
     GroupOptionButton <UIWorldCreation.WorldEvilId>[] groupOptionButtonArray = new GroupOptionButton <UIWorldCreation.WorldEvilId> [worldEvilIdArray.Length];
     for (int id = 0; id < groupOptionButtonArray.Length; ++id)
     {
         GroupOptionButton <UIWorldCreation.WorldEvilId> groupOptionButton = new GroupOptionButton <UIWorldCreation.WorldEvilId>(worldEvilIdArray[id], localizedTextArray1[id], localizedTextArray2[id], colorArray[id], strArray[id], 1f, 1f, 16f);
         groupOptionButton.Width  = StyleDimension.FromPixelsAndPercent((float)(-4 * (groupOptionButtonArray.Length - 1)), 1f / (float)groupOptionButtonArray.Length * usableWidthPercent);
         groupOptionButton.Left   = StyleDimension.FromPercent(1f - usableWidthPercent);
         groupOptionButton.HAlign = (float)id / (float)(groupOptionButtonArray.Length - 1);
         groupOptionButton.Top.Set(accumualtedHeight, 0.0f);
         groupOptionButton.OnMouseDown += clickEvent;
         groupOptionButton.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription);
         groupOptionButton.OnMouseOut  += new UIElement.MouseEvent(this.ClearOptionDescription);
         groupOptionButton.SetSnapPoint(tagGroup, id, new Vector2?(), new Vector2?());
         container.Append((UIElement)groupOptionButton);
         groupOptionButtonArray[id] = groupOptionButton;
     }
     this._evilButtons = groupOptionButtonArray;
 }
Пример #4
0
 private void AddWorldSizeOptions(
     UIElement container,
     float accumualtedHeight,
     UIElement.MouseEvent clickEvent,
     string tagGroup,
     float usableWidthPercent)
 {
     UIWorldCreation.WorldSizeId[] worldSizeIdArray = new UIWorldCreation.WorldSizeId[3]
     {
         UIWorldCreation.WorldSizeId.Small,
         UIWorldCreation.WorldSizeId.Medium,
         UIWorldCreation.WorldSizeId.Large
     };
     LocalizedText[] localizedTextArray1 = new LocalizedText[3]
     {
         Lang.menu[92],
         Lang.menu[93],
         Lang.menu[94]
     };
     LocalizedText[] localizedTextArray2 = new LocalizedText[3]
     {
         Language.GetText("UI.WorldDescriptionSizeSmall"),
         Language.GetText("UI.WorldDescriptionSizeMedium"),
         Language.GetText("UI.WorldDescriptionSizeLarge")
     };
     Color[] colorArray = new Color[3]
     {
         Color.Cyan,
         Color.Lerp(Color.Cyan, Color.LimeGreen, 0.5f),
         Color.LimeGreen
     };
     string[] strArray = new string[3]
     {
         "Images/UI/WorldCreation/IconSizeSmall",
         "Images/UI/WorldCreation/IconSizeMedium",
         "Images/UI/WorldCreation/IconSizeLarge"
     };
     GroupOptionButton <UIWorldCreation.WorldSizeId>[] groupOptionButtonArray = new GroupOptionButton <UIWorldCreation.WorldSizeId> [worldSizeIdArray.Length];
     for (int id = 0; id < groupOptionButtonArray.Length; ++id)
     {
         GroupOptionButton <UIWorldCreation.WorldSizeId> groupOptionButton = new GroupOptionButton <UIWorldCreation.WorldSizeId>(worldSizeIdArray[id], localizedTextArray1[id], localizedTextArray2[id], colorArray[id], strArray[id], 1f, 1f, 16f);
         groupOptionButton.Width  = StyleDimension.FromPixelsAndPercent((float)(-4 * (groupOptionButtonArray.Length - 1)), 1f / (float)groupOptionButtonArray.Length * usableWidthPercent);
         groupOptionButton.Left   = StyleDimension.FromPercent(1f - usableWidthPercent);
         groupOptionButton.HAlign = (float)id / (float)(groupOptionButtonArray.Length - 1);
         groupOptionButton.Top.Set(accumualtedHeight, 0.0f);
         groupOptionButton.OnMouseDown += clickEvent;
         groupOptionButton.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription);
         groupOptionButton.OnMouseOut  += new UIElement.MouseEvent(this.ClearOptionDescription);
         groupOptionButton.SetSnapPoint(tagGroup, id, new Vector2?(), new Vector2?());
         container.Append((UIElement)groupOptionButton);
         groupOptionButtonArray[id] = groupOptionButton;
     }
     this._sizeButtons = groupOptionButtonArray;
 }
Пример #5
0
 public UIBestiaryEntryGrid(
     List <BestiaryEntry> workingSet,
     UIElement.MouseEvent clickOnEntryEvent)
 {
     this.Width              = new StyleDimension(0.0f, 1f);
     this.Height             = new StyleDimension(0.0f, 1f);
     this._workingSetEntries = workingSet;
     this._clickOnEntryEvent = clickOnEntryEvent;
     this.SetPadding(0.0f);
     this.UpdateEntries();
     this.FillBestiarySpaceWithEntries();
 }
Пример #6
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);
        }