예제 #1
0
파일: GuiListBox.cs 프로젝트: bsimser/CoM
        public ScrollableListBox(int width = 200, int height = 200)
            : base(width, height)
        {
            ScrollArea            = new GuiScrollableArea(Width, Height);
            ScrollArea.Align      = GuiAlignment.Full;
            ScrollArea.ScrollMode = ScrollMode.VerticalOnly;

            ListBox          = new GuiListBox <T>(0, 0, width - (int)GUI.skin.verticalScrollbar.fixedWidth);
            ListBox.AutoSize = true;

            Add(ScrollArea);
            ScrollArea.Add(ListBox);
        }
예제 #2
0
 /** Creates a new message box */
 public GuiMessageBox(int width = 400, int height = 100, bool disableScrolling = false) : base(width, height)
 {
     this.scrollBox = new GuiScrollableArea((int)ContentsBounds.width, (int)ContentsBounds.height, disableScrolling ? ScrollMode.None : ScrollMode.VerticalOnly);
     Add(scrollBox);
     this.Label           = new GuiLabel(0, 0, "", (int)scrollBox.ContentsScrollRect.width);
     this.Label.FontColor = new Color(0.9f, 0.9f, 0.9f);
     this.Label.WordWrap  = true;
     this.scrollBox.Add(Label);
     this.Label.FontSize = 14;
     this.HideStyle      = MessageBoxHideStyle.FadingMouse;
     this.Messages       = new List <MessageEntry>();
     fitScrollBox();
 }
예제 #3
0
        /** Creates a new item inventory and slots */
        public GuiItemInventory(int width = 300, int height = 185) : base(width, height)
        {
            const int inlay = 4;

            inventoryScrollArea = new GuiScrollableArea((int)ContentsBounds.width - inlay * 2, (int)ContentsBounds.height - inlay * 2, ScrollMode.VerticalOnly)
            {
                X = inlay,
                Y = inlay
            };
            Add(inventoryScrollArea);
            CacheMode           = CacheMode.Enabled;
            AutoRefreshInterval = 0.5f;
            Sync();
        }
예제 #4
0
파일: GuiListBox.cs 프로젝트: bsimser/CoM
        public FramedListBox(int width = 200, int height = 200, string title = "")
            : base(width, height)
        {
            this.WindowStyle = title == "" ? GuiWindowStyle.Normal : GuiWindowStyle.Titled;
            Title            = title;

            var scrollArea = new GuiScrollableArea(Width, Height);

            scrollArea.Align      = GuiAlignment.Full;
            scrollArea.ScrollMode = ScrollMode.None;

            ListBox       = new GuiListBox <T>(0, 0);
            ListBox.Align = GuiAlignment.Full;

            Add(scrollArea);
            scrollArea.Add(ListBox);
        }
예제 #5
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);
        }