예제 #1
0
        protected override void Setup()
        {
            // Main panel
            mainPanel.HorizontalAlignment = HorizontalAlignment.Center;
            mainPanel.VerticalAlignment   = VerticalAlignment.Middle;
            mainPanel.Size            = mainPanelSize;
            mainPanel.Outline.Enabled = true;
            if (TextureReplacement.CustomTextureExist("mainPanelBackgroundColor"))
            {
                mainPanel.BackgroundTexture = TextureReplacement.LoadCustomTexture("mainPanelBackgroundColor");
            }
            else
            {
                mainPanel.BackgroundColor = mainPanelBackgroundColor;
            }
            NativePanel.Components.Add(mainPanel);

            // Prompt
            promptLabel.ShadowPosition = Vector2.zero;
            promptLabel.Position       = new Vector2(4, 4);
            mainPanel.Components.Add(promptLabel);

            // Name panel
            Panel namePanel = new Panel();

            namePanel.Position        = new Vector2(4, 12);
            namePanel.Size            = new Vector2(272, 9);
            namePanel.Outline.Enabled = true;
            if (TextureReplacement.CustomTextureExist("namePanelBackgroundColor"))
            {
                namePanel.BackgroundTexture = TextureReplacement.LoadCustomTexture("namePanelBackgroundColor");
            }
            else
            {
                namePanel.BackgroundColor = namePanelBackgroundColor;
            }
            mainPanel.Components.Add(namePanel);

            // Name input
            saveNameTextBox.Position      = new Vector2(2, 2);
            saveNameTextBox.MaxCharacters = 26;
            saveNameTextBox.OnType       += SaveNameTextBox_OnType;
            namePanel.Components.Add(saveNameTextBox);

            // Save panel
            Panel savesPanel = new Panel();

            savesPanel.Position        = new Vector2(4, 25);
            savesPanel.Size            = new Vector2(100, 141);
            savesPanel.Outline.Enabled = true;
            mainPanel.Components.Add(savesPanel);

            // Save list
            savesList.Position  = new Vector2(2, 2);
            savesList.Size      = new Vector2(91, 129);
            savesList.TextColor = savesListTextColor;
            if (TextureReplacement.CustomTextureExist("savesListBackgroundColor"))
            {
                savesList.BackgroundTexture = TextureReplacement.LoadCustomTexture("savesListBackgroundColor");
            }
            else
            {
                savesList.BackgroundColor = savesListBackgroundColor;
            }
            savesList.ShadowPosition      = Vector2.zero;
            savesList.RowsDisplayed       = 16;
            savesList.OnScroll           += SavesList_OnScroll;
            savesList.OnSelectItem       += SavesList_OnSelectItem;
            savesList.OnMouseDoubleClick += SaveLoadEventHandler;
            savesPanel.Components.Add(savesList);

            // Save scroller
            savesScroller.Position     = new Vector2(94, 2);
            savesScroller.Size         = new Vector2(5, 129);
            savesScroller.DisplayUnits = 16;
            savesScroller.OnScroll    += SavesScroller_OnScroll;
            savesPanel.Components.Add(savesScroller);

            // Save/Load button
            goButton.Position          = new Vector2(108, 150);
            goButton.Size              = new Vector2(40, 16);
            goButton.Label.ShadowColor = Color.black;
            if (TextureReplacement.CustomTextureExist("saveButtonBackgroundColor"))
            {
                TextureReplacement.SetCustomButton(ref goButton, "saveButtonBackgroundColor");
            }
            else
            {
                goButton.BackgroundColor = saveButtonBackgroundColor;
            }
            goButton.Outline.Enabled = true;
            goButton.OnMouseClick   += SaveLoadEventHandler;
            mainPanel.Components.Add(goButton);

            // Switch to classic save window button
            switchClassicButton.Position   = new Vector2(172, 150);
            switchClassicButton.Size       = new Vector2(40, 16);
            switchClassicButton.Label.Text = "Classic";
            //switchClassicButton.Label.TextColor = new Color(0.6f, 0.3f, 0.6f);
            switchClassicButton.Label.ShadowColor = Color.black;
            if (TextureReplacement.CustomTextureExist("switchClassicButtonBackgroundColor"))
            {
                TextureReplacement.SetCustomButton(ref switchClassicButton, "switchClassicButtonBackgroundColor");
            }
            else
            {
                switchClassicButton.BackgroundColor = new Color(0.2f, 0.2f, 0);
            }
            switchClassicButton.Outline.Enabled = true;
            switchClassicButton.OnMouseClick   += SwitchClassicButton_OnMouseClick;
            mainPanel.Components.Add(switchClassicButton);

            // Cancel button
            Button cancelButton = new Button();

            cancelButton.Position          = new Vector2(236, 150);
            cancelButton.Size              = new Vector2(40, 16);
            cancelButton.Label.Text        = "Cancel";
            cancelButton.Label.ShadowColor = Color.black;
            if (TextureReplacement.CustomTextureExist("cancelButtonBackgroundColor"))
            {
                TextureReplacement.SetCustomButton(ref cancelButton, "cancelButtonBackgroundColor");
            }
            else
            {
                cancelButton.BackgroundColor = cancelButtonBackgroundColor;
            }
            cancelButton.Outline.Enabled = true;
            cancelButton.OnMouseClick   += CancelButton_OnMouseClick;
            mainPanel.Components.Add(cancelButton);

            // Screenshot panel
            screenshotPanel.Position = new Vector2(108, 25);
            screenshotPanel.Size     = new Vector2(168, 95);
            screenshotPanel.BackgroundTextureLayout = BackgroundLayout.ScaleToFit;
            if (TextureReplacement.CustomTextureExist("screenshotPanelBackgroundColor"))
            {
                screenshotPanel.BackgroundTexture = TextureReplacement.LoadCustomTexture("screenshotPanelBackgroundColor");
            }
            else
            {
                screenshotPanel.BackgroundColor = savesListBackgroundColor;
            }
            screenshotPanel.Outline.Enabled = true;
            mainPanel.Components.Add(screenshotPanel);

            // Info panel
            Panel infoPanel = new Panel();

            infoPanel.Position = new Vector2(108, 122);
            infoPanel.Size     = new Vector2(168, 26);
            mainPanel.Components.Add(infoPanel);

            // Save version
            saveVersionLabel.ShadowColor = Color.black;
            saveVersionLabel.Position    = new Vector2(1, 1);
            saveVersionLabel.TextColor   = saveFolderColor;
            screenshotPanel.Components.Add(saveVersionLabel);

            // Save folder
            saveFolderLabel.ShadowColor         = Color.black;
            saveFolderLabel.HorizontalAlignment = HorizontalAlignment.Right;
            saveFolderLabel.Position            = new Vector2(0, 1);
            saveFolderLabel.TextColor           = saveFolderColor;
            screenshotPanel.Components.Add(saveFolderLabel);

            // Time labels
            saveTimeLabel.ShadowPosition      = Vector2.zero;
            saveTimeLabel.HorizontalAlignment = HorizontalAlignment.Center;
            saveTimeLabel.Position            = new Vector2(0, 0);
            infoPanel.Components.Add(saveTimeLabel);
            gameTimeLabel.ShadowPosition      = Vector2.zero;
            gameTimeLabel.HorizontalAlignment = HorizontalAlignment.Center;
            gameTimeLabel.Position            = new Vector2(0, 9);
            infoPanel.Components.Add(gameTimeLabel);

            // Delete save button
            deleteSaveButton.Position            = new Vector2(0, 132);
            deleteSaveButton.Size                = new Vector2(98, 8);
            deleteSaveButton.HorizontalAlignment = HorizontalAlignment.Center;
            deleteSaveButton.Label.Text          = "Delete Save";
            deleteSaveButton.Label.ShadowColor   = Color.black;
            if (TextureReplacement.CustomTextureExist("deleteSaveButtonBackgroundColor"))
            {
                TextureReplacement.SetCustomButton(ref deleteSaveButton, "deleteSaveButtonBackgroundColor");
            }
            else
            {
                deleteSaveButton.BackgroundColor = namePanelBackgroundColor;
            }
            deleteSaveButton.Outline.Enabled = false;
            deleteSaveButton.OnMouseClick   += DeleteSaveButton_OnMouseClick;
            savesPanel.Components.Add(deleteSaveButton);

            // Switch character button
            switchCharButton.Position          = new Vector2(216, 2);
            switchCharButton.Size              = new Vector2(60, 8);
            switchCharButton.Label.Text        = "Switch Char";
            switchCharButton.Label.ShadowColor = Color.black;
            if (TextureReplacement.CustomTextureExist("switchCharButtonBackgroundColor"))
            {
                TextureReplacement.SetCustomButton(ref switchCharButton, "switchCharButtonBackgroundColor");
            }
            else
            {
                switchCharButton.BackgroundColor = saveButtonBackgroundColor;
            }
            switchCharButton.OnMouseClick += SwitchCharButton_OnMouseClick;
            mainPanel.Components.Add(switchCharButton);
        }