예제 #1
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);
        }
예제 #2
0
        /** Constructs a new character page */
        public GuiCharacterEquipPage()
        {
            // ---------------------------------

            CacheMode           = CacheMode.Solid;
            AutoRefreshInterval = 0.5f;

            GuiPanel Panel = new GuiPanel(0, 90);

            Panel.Align     = GuiAlignment.Top;
            Panel.PanelMode = GuiPanelMode.Square;
            Panel.Color     = new Color(0.15f, 0.15f, 0.35f, 0.00f);
            Add(Panel);

            CharacterInfo            = new GuiLabel(0, 0, "", 200);
            CharacterInfo.TextAlign  = TextAnchor.MiddleCenter;
            CharacterInfo.DropShadow = true;
            CharacterInfo.FontSize   = 18;
            Panel.Add(CharacterInfo, 85, 20);

            CharacterPortrait             = new GuiImage(0, 0, null);
            CharacterPortrait.Framed      = true;
            CharacterPortrait.InnerShadow = true;
            Panel.Add(CharacterPortrait, 25, 10);

            goldInfo = new GuiCoinAmount();
            Add(goldInfo, 14, 210);

            // ---------------------------------

            // basic stats
            StatNames           = new GuiLabel(10, 100, "", 80, 200);
            StatNames.FontColor = new Color(0.9f, 0.9f, 0.9f, 0.9f);
            StatNames.Caption   =
                "HP" + "\n" +
                "SP" + "\n" +
                "\n" +
                "Damage" + "\n" +
                "Armour" + "\n";

            Add(StatNames);

            StatValues           = new GuiLabel(10, 100, "", 100, 200);
            StatValues.FontColor = Color.Lerp(Color.white, Color.red, 0.25f);
            StatValues.TextAlign = TextAnchor.UpperRight;
            Add(StatValues);

            // create equiped item slots
            EquipedSlot = new GuiItemSlot[16];

            EquipedSlot[0] = CreateEquipedSlot(1, 1);
            EquipedSlot[1] = CreateEquipedSlot(2, 1);
            EquipedSlot[2] = CreateEquipedSlot(3, 1);

            EquipedSlot[3] = CreateEquipedSlot(1, 2);
            EquipedSlot[4] = CreateEquipedSlot(2, 2);
            EquipedSlot[5] = CreateEquipedSlot(3, 2);

            EquipedSlot[6] = CreateEquipedSlot(1, 3);
            EquipedSlot[7] = CreateEquipedSlot(2, 3);
            EquipedSlot[8] = CreateEquipedSlot(3, 3);

            EquipedSlot[9]  = CreateEquipedSlot(1, 4);
            EquipedSlot[10] = CreateEquipedSlot(3, 4);

            EquipedSlot[11] = CreateEquipedSlot(1, 5);
            EquipedSlot[12] = CreateEquipedSlot(2, 5);
            EquipedSlot[13] = CreateEquipedSlot(3, 5);

            var itemTrashSlot = new GuiItemTrash(0, 0);

            Add(itemTrashSlot, 10, -30);

            Sync();
        }