Beispiel #1
0
        /** Updates the character tiles to represent the current list. */
        public void Refresh()
        {
            Clear();

            if (characterList == null)
            {
                return;
            }

            int maxY = 0;
            int lp;

            for (lp = 0; lp < characterList.Count; lp++)
            {
                var slot = new GuiCharacterSlot();

                slot.CharacterPortrait = new GuiCharacterPortrait(characterList[lp]);
                positionButton(slot, lp);
                maxY = (int)slot.Bounds.yMax;
                Add(slot);
            }

            if (EnableCreateNew)
            {
                createCharacterButton = new GuiCharacterSlot();

                createCharacterButton.OnMouseClicked += delegate {
                    var createState = new CreateCharacterState();
                    createState.OnStateClose += delegate {
                        if (OnCreateNewCharacter != null)
                        {
                            OnCreateNewCharacter();
                        }
                    };
                    Engine.PushState(createState);
                };

                positionButton(createCharacterButton, lp);

                createCharacterButton.Caption = "Create\nNew";
                maxY = (int)createCharacterButton.Bounds.yMax;
                Add(createCharacterButton);
            }
            else
            {
                createCharacterButton = null;
            }

            Height = maxY + 40;
        }
Beispiel #2
0
        public EditPartyState(MDRParty party = null, bool createInsteadOfEdit = false)
            : base("Edit Party State")
        {
            var windowTitle = createInsteadOfEdit ? "Create Party" : "Edit Party";

            window = new GuiWindow(600, 520, windowTitle);

            window.Background.Sprite = ResourceManager.GetSprite("Gui/InnerWindow");
            window.Background.Color  = new Color(0.4f, 0.42f, 0.62f);

            characterSlotsPanel       = new GuiPanel(500, 110);
            characterSlotsPanel.Color = Color.clear;
            characterSlotsPanel.Align = GuiAlignment.Top;
            window.Add(characterSlotsPanel);

            characterSlot = new GuiCharacterSlot[4];

            for (int lp = 0; lp < 4; lp++)
            {
                var slot = new GuiCharacterSlot();
                slot.Tag          = lp + 1;
                characterSlot[lp] = slot;
                characterSlotsPanel.Add(slot, 0, 10);
                characterSlotsPanel.PositionComponentToColumns(slot, lp + 1, 4, 100);
                characterSlot[lp].OnDDContentChanged += delegate {
                    applyToParty(slot.Tag - 1);
                    refreshUnassignedCharacters();
                };
            }

            unassignedCharacters = new GuiCharacterGrid(true);
            unassignedCharacters.DragDropEnabled       = true;
            unassignedCharacters.OnCreateNewCharacter += delegate {
                refreshUI();
            };

            unassignedCharactersScrollArea = new GuiScrollableArea(550 + 21, 310, ScrollMode.VerticalOnly);
            unassignedCharactersScrollArea.Add(unassignedCharacters);

            var frame = GuiWindow.CreateFrame(unassignedCharactersScrollArea, "", GuiWindowStyle.ThinTransparent);

            frame.Color = new Color(0.1f, 0.1f, 0.1f);
            window.Add(frame, 0, -46, true);

            var unusedCaption = new GuiLabel("<B>Available Heroes</B>", (int)window.ContentsBounds.width + 10, 24);

            unusedCaption.EnableBackground = true;
            unusedCaption.TextAlign        = TextAnchor.MiddleCenter;
            unusedCaption.Color            = Color.Lerp(Colors.BackgroundRed, Color.black, 0.5f);
            unusedCaption.FauxEdge         = true;
            unusedCaption.FontColor        = new Color(1, 1, 1, 0.9f);
            unusedCaption.FontSize         = 18;
            window.Add(unusedCaption, 0, frame.Y - 15);

            doneButton = new GuiButton("Done");
            window.Add(doneButton, 0, -10);

            dispandButton = new GuiButton("Dispand");
            UIStyle.RedWarning(dispandButton);
            window.Add(dispandButton, 0, -10);

            window.PositionComponentToColumns(dispandButton, 1, 2, 100);
            window.PositionComponentToColumns(doneButton, 2, 2, 100);

            doneButton.OnMouseClicked += delegate {
                applyToParty();
                Engine.PopState();
            };

            dispandButton.OnMouseClicked += delegate {
                party.Dispand();
                Engine.PopState();
            };

            Party = party;

            Add(window, 0, 0);
        }