Ejemplo n.º 1
0
        public CommandPicker()
        {
            SetTitle("Pick Command");
            MainTabView = new TabView(this);
            MainTabView.SetPosition(1, 25);
            MainTabView.SetHeaderColor(new Color(59, 91, 124));
            MainTabView.SetXOffset(16);
            for (int i = 0; i < CommandPlugins.CommandTypes.Count; i++)
            {
                DynamicCommandType t = CommandPlugins.CommandTypes[i];
                if (string.IsNullOrEmpty(t.Name))
                {
                    continue;
                }
                string       name   = t.PickerTabName;
                int          tabidx = MainTabView.Names.IndexOf(name);
                TabContainer tc     = null;
                if (tabidx == -1)
                {
                    tc = MainTabView.CreateTab(name);
                    Container ButtonContainer = new Container(tc);
                }
                else
                {
                    tc = MainTabView.Tabs[tabidx];
                }
                int    idx = tc.Widgets[0].Widgets.Count;
                Button b   = new Button(tc.Widgets[0]);
                b.SetText(t.Name);
                b.SetPosition(9 + 153 * (idx % 2), 7 + 38 * (int)Math.Floor(idx / 2d));
                b.SetSize(153, 38);
                b.OnClicked += delegate(BaseEventArgs e)
                {
                    CreateCommand(t);
                };
            }
            int count = 0;

            foreach (TabContainer tc in MainTabView.Tabs)
            {
                if (tc.Widgets[0].Widgets.Count > count)
                {
                    count = tc.Widgets[0].Widgets.Count;
                }
            }
            MinimumSize = MaximumSize = new Size(count > 1 ? 326 : 173, 69 + 45 + 38 * count / 2);
            SetSize(MaximumSize);
            Center();

            CreateButton("Cancel", Cancel);
        }
Ejemplo n.º 2
0
        public Widget ProcessWidgetType(dynamic widget, string Type, Widget Parent)
        {
            switch (Type)
            {
            case "MultilineLabel":
                return(new MultilineDynamicLabel(Parent));

            case "Label":
                return(new DynamicLabel(Parent));

            case "MultilineTextBox":
                return(new MultilineTextBox(Parent));

            case "SwitchPicker":
                return(new GameSwitchBox(Parent));

            case "VariablePicker":
                return(new GameVariableBox(Parent));

            case "Dropdown":
                return(new DropdownBox(Parent));

            case "RadioButton":
                return(new RadioBox(Parent));

            case "TextBox":
                return(new TextBox(Parent));

            case "TabView":
                return(new TabView(Parent));

            case "Container":
                if (widget.Parent != null)
                {
                    string parentname  = widget.Parent.GetType().Name;
                    string indexstring = widget.UniqueID.Substring(widget.UniqueID.IndexOf('.') + 1);
                    if (parentname == "TabView" && Utilities.IsNumeric(indexstring))
                    {
                        TabView tab   = DynamicWindowWidgets[widget.Parent.UniqueID];
                        int     index = Convert.ToInt32(indexstring);
                        return(new Container(tab.Tabs[index]));
                    }
                }
                return(new Container(Parent));

            case "List":
                return(new ListBox(Parent));

            case "Button":
                return(new Button(Parent));

            case "CheckBox":
                return(new CheckBox(Parent));

            case "ConditionBox":
                return(new ConditionBox(Parent));

            default:
                throw new Exception($"Invalid widget type '{Type}'!");
            }
        }
Ejemplo n.º 3
0
        public EditEvent(Map map, Event ev, bool NewEvent = false)
        {
            this.MapData   = map;
            this.OldEvent  = ev;
            this.EventData = ev.Clone();
            SetTitle($"{(NewEvent ? "New" : "Edit")} event (ID: {Utilities.Digits(EventData.ID, 3)})");
            MinimumSize = MaximumSize = new Size(752, 690);
            SetSize(MaximumSize);
            Center();

            EventGroupBox MainPropertyBox = new EventGroupBox(this);

            MainPropertyBox.SetPosition(8, 25);
            MainPropertyBox.SetSize(232, 72);

            Font  f         = new Font("Fonts/ProductSans-M", 12);
            Label NameLabel = new Label(MainPropertyBox);

            NameLabel.SetFont(f);
            NameLabel.SetText("Name:");
            NameLabel.SetPosition(8, 12);
            TextBox NameBox = new TextBox(MainPropertyBox);

            NameBox.SetPosition(46, 7);
            NameBox.TextArea.SetTextY(2);
            NameBox.TextArea.SetCaretY(4);
            NameBox.SetSize(180, 27);
            NameBox.SetInitialText(EventData.Name);
            NameBox.OnTextChanged += delegate(BaseEventArgs e)
            {
                EventData.Name = NameBox.Text;
                MarkChanges();
            };

            Label WidthLabel = new Label(MainPropertyBox);

            WidthLabel.SetFont(f);
            WidthLabel.SetText("Width:");
            WidthLabel.SetPosition(6, 44);
            NumericBox WidthBox = new NumericBox(MainPropertyBox);

            WidthBox.SetPosition(46, 38);
            WidthBox.SetSize(63, 27);
            WidthBox.MinValue = 1;
            WidthBox.MaxValue = 999;
            WidthBox.SetValue(EventData.Width);
            WidthBox.OnValueChanged += delegate(BaseEventArgs e)
            {
                EventData.Width = WidthBox.Value;
                TabController.Tabs.ForEach(tc => ((EventPageContainer)tc.Widgets[0]).GraphicWidget.ConfigureGrid());
                MarkChanges();
            };

            Label HeightLabel = new Label(MainPropertyBox);

            HeightLabel.SetFont(f);
            HeightLabel.SetText("Height:");
            HeightLabel.SetPosition(119, 44);
            NumericBox HeightBox = new NumericBox(MainPropertyBox);

            HeightBox.SetPosition(163, 38);
            HeightBox.SetSize(63, 27);
            HeightBox.MinValue = 1;
            HeightBox.MaxValue = 999;
            HeightBox.SetValue(EventData.Height);
            HeightBox.OnValueChanged += delegate(BaseEventArgs e)
            {
                EventData.Height = HeightBox.Value;
                MarkChanges();
            };

            Button NewPageButton = new Button(this);

            NewPageButton.SetPosition(414, 43);
            NewPageButton.SetSize(67, 59);
            NewPageButton.SetText("New\nPage");
            NewPageButton.OnClicked += delegate(BaseEventArgs e) { NewPage(); };

            Button CopyPageButton = new Button(this);

            CopyPageButton.SetPosition(481, 43);
            CopyPageButton.SetSize(67, 59);
            CopyPageButton.SetText("Copy\nPage");
            CopyPageButton.OnClicked += delegate(BaseEventArgs e) { CopyPage(); };

            Button PastePageButton = new Button(this);

            PastePageButton.SetPosition(548, 43);
            PastePageButton.SetSize(67, 59);
            PastePageButton.SetText("Paste\nPage");
            PastePageButton.OnClicked += delegate(BaseEventArgs e) { PastePage(); };

            Button ClearPageButton = new Button(this);

            ClearPageButton.SetPosition(615, 43);
            ClearPageButton.SetSize(67, 59);
            ClearPageButton.SetText("Clear\nPage");
            ClearPageButton.OnClicked += delegate(BaseEventArgs e) { ClearPage(); };

            DeletePageButton = new Button(this);
            DeletePageButton.SetPosition(682, 43);
            DeletePageButton.SetSize(67, 59);
            DeletePageButton.SetText("Delete\nPage");
            if (EventData.Pages.Count == 1)
            {
                DeletePageButton.SetEnabled(false);
            }
            DeletePageButton.OnClicked += delegate(BaseEventArgs e) { DeletePage(); };

            TabController = new TabView(this);
            TabController.SetXOffset(8);
            TabController.SetPosition(1, 106);
            TabController.SetSize(750, 544);
            TabController.SetHeaderColor(59, 91, 124);
            for (int i = 0; i < EventData.Pages.Count; i++)
            {
                TabContainer       tc  = TabController.CreateTab(string.IsNullOrWhiteSpace(EventData.Pages[i].Name) ? "Untitled" : EventData.Pages[i].Name);
                EventPageContainer epc = new EventPageContainer(this, EventData, EventData.Pages[i], tc);
                epc.SetSize(750, 515);
                EventPageContainers.Add(epc);
            }

            CreateButton("Apply", Apply);
            CreateButton("Cancel", Cancel);
            CreateButton("OK", OK);
            ApplyButton.SetEnabled(false);
        }
Ejemplo n.º 4
0
 public Sidebar(IContainer Parent) : base(Parent)
 {
     SetBackgroundColor(10, 23, 37);
     TabControl = new TabView(this);
 }
Ejemplo n.º 5
0
        public EditConditionsWindow(List <BasicCondition> Conditions)
        {
            this.Conditions    = Conditions;
            this.OldConditions = new List <BasicCondition>();
            this.Conditions.ForEach(c => this.OldConditions.Add(c.Clone()));
            SetTitle("Edit Conditions");
            MinimumSize = MaximumSize = new Size(610, 469);
            SetSize(MaximumSize);
            Center();

            ConditionList = new ConditionBox(this);
            ConditionList.SetPosition(6, 23);
            ConditionList.SetSize(279, Size.Height - 67);
            ConditionList.SetConditions(this.Conditions);
            ConditionList.SetSelectable(true);
            ConditionList.OnSelectionChanged += delegate(BaseEventArgs e) { ConditionChanged(); };
            if (this.Conditions.Count > 0)
            {
                ConditionList.SetSelectedIndex(0);
            }

            TypeTabs = new TabView(this);
            TypeTabs.SetPosition(285, 23);
            TypeTabs.SetSize(324, Size.Height - 67);
            TypeTabs.SetXOffset(8);
            TypeTabs.SetHeaderColor(59, 91, 124);
            ConditionParser.Headers.ForEach(header =>
            {
                TabContainer tc = TypeTabs.CreateTab(header.Name);
                int h           = 0;
                for (int i = 0; i < header.Types.Count; i++)
                {
                    string typeid      = header.Types[i];
                    ConditionType type = ConditionParser.Types.Find(t => t.Identifier == typeid);
                    if (type.UI.Count == 0)
                    {
                        continue;
                    }
                    ConditionHandlerWidget chw = new ConditionHandlerWidget(type, tc);
                    chw.SetPosition(11, 11 + h);
                    chw.SetSize(Convert.ToInt32(type.UI["width"]), Convert.ToInt32(type.UI["height"]));
                    h += Convert.ToInt32(type.UI["height"]);
                }
            });

            NewConditionButton = new Button(this);
            NewConditionButton.SetText("New");
            NewConditionButton.SetPosition(14, Size.Height - 38);
            NewConditionButton.SetSize(122, 31);
            NewConditionButton.OnClicked += delegate(BaseEventArgs e) { NewCondition(); };

            RemoveConditionButton = new Button(this);
            RemoveConditionButton.SetText("Remove");
            RemoveConditionButton.SetPosition(155, Size.Height - 38);
            RemoveConditionButton.SetSize(122, 31);
            RemoveConditionButton.OnClicked += delegate(BaseEventArgs e) { RemoveCondition(); };
            if (this.Conditions.Count == 0)
            {
                RemoveConditionButton.SetEnabled(false);
            }

            CreateButton("Apply", Apply);
            CreateButton("Cancel", Cancel);
            CreateButton("OK", OK);

            ApplyButton.SetEnabled(false);

            ConditionChanged();
            if (this.Conditions.Count == 0)
            {
                SetAllEnabled(false);
            }
        }