示例#1
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);
        }
示例#2
0
 public override void SizeChanged(BaseEventArgs e)
 {
     base.SizeChanged(e);
     MainTabView.SetSize(Size.Width - MainTabView.Position.X - 1, Size.Height - MainTabView.Position.Y - 1 - 45);
 }
示例#3
0
 public override void SizeChanged(BaseEventArgs e)
 {
     base.SizeChanged(e);
     TabControl.SetSize(this.Size);
 }
        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);
            }
        }