Ejemplo n.º 1
0
        public ChooseGraphic(EventGraphic graphic)
        {
            this.OldGraphic  = graphic;
            this.GraphicData = graphic.Clone();
            SetTitle("Choose Graphic");
            MinimumSize = MaximumSize = new Size(735, 421);
            SetSize(MaximumSize);
            Center();

            Label GraphicLabel = new Label(this);

            GraphicLabel.SetFont(Font.Get("Fonts/Ubuntu-B", 16));
            GraphicLabel.SetText("Current Graphic");
            GraphicLabel.SetPosition(559, 35);

            Color outline = new Color(59, 91, 124);
            Color inline  = new Color(17, 27, 38);
            Color filler  = new Color(24, 38, 53);

            Sprites["gfxbox"]        = new Sprite(this.Viewport);
            Sprites["gfxbox"].X      = 542;
            Sprites["gfxbox"].Y      = 59;
            Sprites["gfxbox"].Bitmap = new Bitmap(177, 177);
            Sprites["gfxbox"].Bitmap.Unlock();
            Sprites["gfxbox"].Bitmap.DrawRect(0, 0, 177, 177, outline);
            Sprites["gfxbox"].Bitmap.DrawRect(1, 1, 175, 175, inline);
            Sprites["gfxbox"].Bitmap.FillRect(2, 2, 173, 173, filler);
            Sprites["gfxbox"].Bitmap.FillRect(163, 163, 13, 13, outline);
            Sprites["gfxbox"].Bitmap.DrawLine(162, 1, 162, 162, inline);
            Sprites["gfxbox"].Bitmap.DrawLine(163, 1, 163, 162, outline);
            Sprites["gfxbox"].Bitmap.DrawLine(164, 1, 164, 162, inline);
            Sprites["gfxbox"].Bitmap.DrawLine(165, 162, 174, 162, inline);
            Sprites["gfxbox"].Bitmap.DrawLine(1, 162, 162, 162, inline);
            Sprites["gfxbox"].Bitmap.DrawLine(1, 163, 162, 163, outline);
            Sprites["gfxbox"].Bitmap.DrawLine(1, 164, 162, 164, inline);
            Sprites["gfxbox"].Bitmap.DrawLine(162, 165, 162, 174, inline);
            Sprites["gfxbox"].Bitmap.Lock();

            Container GraphicContainer = new Container(this);

            GraphicContainer.SetPosition(544, 61);
            GraphicContainer.SetSize(160, 160);
            GraphicContainer.HAutoScroll = true;
            GraphicContainer.VAutoScroll = true;
            VScrollBar vs = new VScrollBar(this);

            vs.SetPosition(708, 62);
            vs.SetSize(10, 158);
            GraphicContainer.SetVScrollBar(vs);
            HScrollBar hs = new HScrollBar(this);

            hs.SetPosition(545, 225);
            hs.SetSize(158, 10);
            GraphicContainer.SetHScrollBar(hs);

            Graphic = new PictureBox(GraphicContainer);

            Cursor = new CursorWidget(GraphicContainer);
            Cursor.ConsiderInAutoScrollCalculation = false;

            Font f = Font.Get("Fonts/ProductSans-M", 12);

            TypeLabel = new Label(this);
            TypeLabel.SetPosition(547, 244);
            TypeLabel.SetFont(f);
            TypeLabel.SetText("Type: File");

            Label DirectionLabel = new Label(this);

            DirectionLabel.SetFont(f);
            DirectionLabel.SetText("Direction:");
            DirectionLabel.SetPosition(547, 269);
            DirectionBox = new DropdownBox(this);
            DirectionBox.SetPosition(609, 263);
            DirectionBox.SetSize(110, 25);
            DirectionBox.SetItems(new List <ListItem>()
            {
                new ListItem("Down"),
                new ListItem("Left"),
                new ListItem("Right"),
                new ListItem("Up")
            });
            DirectionBox.SetSelectedIndex(GraphicData.Direction / 2 - 1);
            DirectionBox.OnSelectionChanged += delegate(BaseEventArgs e)
            {
                GraphicData.Direction = (DirectionBox.SelectedIndex + 1) * 2;
                if (GraphicData.NumDirections == 1)
                {
                    GraphicData.NumDirections = 4;
                    NumDirectionsBox.SetSelectedIndex(1);
                }
                RedrawGraphic();
            };

            Label NumDirectionsLabel = new Label(this);

            NumDirectionsLabel.SetFont(f);
            NumDirectionsLabel.SetText("Number of Directions:");
            NumDirectionsLabel.SetPosition(547, 308);
            NumDirectionsBox = new DropdownBox(this);
            NumDirectionsBox.SetPosition(679, 304);
            NumDirectionsBox.SetSize(40, 25);
            NumDirectionsBox.SetItems(new List <ListItem>()
            {
                new ListItem("1"),
                new ListItem("4")
            });
            NumDirectionsBox.SetSelectedIndex(GraphicData.NumDirections == 1 ? 0 : 1);
            NumDirectionsBox.OnSelectionChanged += delegate(BaseEventArgs e)
            {
                GraphicData.NumDirections = NumDirectionsBox.SelectedIndex == 0 ? 1 : 4;
                RedrawGraphic();
            };

            Label NumFramesLabel = new Label(this);

            NumFramesLabel.SetFont(f);
            NumFramesLabel.SetText("Number of Frames:");
            NumFramesLabel.SetPosition(547, 348);
            NumFramesBox = new NumericBox(this);
            NumFramesBox.SetPosition(669, 343);
            NumFramesBox.SetSize(50, 27);
            NumFramesBox.MinValue = 1;
            NumFramesBox.MaxValue = 999;
            NumFramesBox.SetValue(GraphicData.NumFrames);
            NumFramesBox.OnValueChanged += delegate(BaseEventArgs e)
            {
                GraphicData.NumFrames = NumFramesBox.Value;
                RedrawGraphic();
            };

            FileExplorer = new FileExplorer(this);
            FileExplorer.SetPosition(1, 24);
            FileExplorer.SetSize(529, 396);
            FileExplorer.SetBaseDirectory(Data.ProjectPath);
            FileExplorer.SetFileExtensions("png");
            string dir = "";

            if (GraphicData.Param != null)
            {
                List <string> dirs = ((string)GraphicData.Param).Split('/').ToList();
                for (int i = 0; i < dirs.Count - 1; i++)
                {
                    dir += dirs[i];
                    if (i != dirs.Count - 2)
                    {
                        dir += "/";
                    }
                }
            }
            else
            {
                dir = "gfx/characters";
            }
            FileExplorer.SetDirectory(dir);
            FileExplorer.OnFileSelected += delegate(BaseEventArgs e)
            {
                string param = FileExplorer.SelectedFilename.Replace(Data.ProjectPath + "/", "").Replace(".png", "");
                if (param != (string)this.GraphicData.Param)
                {
                    this.GraphicData       = new EventGraphic();
                    this.GraphicData.Type  = ":file";
                    this.GraphicData.Param = param;
                    DirectionBox.SetSelectedIndex(0);
                    NumDirectionsBox.SetSelectedIndex(1);
                    NumFramesBox.SetValue(4);
                    RedrawGraphic();
                }
            };
            FileExplorer.SetSelectedFile((string)GraphicData.Param + ".png");

            CreateButton("Cancel", Cancel);
            Buttons[0].SetPosition(Size.Width - 99, Buttons[0].Position.Y);
            CreateButton("OK", OK);
            Buttons[1].SetPosition(Size.Width - 188, Buttons[1].Position.Y);

            RedrawGraphic();
        }
Ejemplo n.º 2
0
        public EventPageContainer(EditEvent eew, Event EventData, EventPage PageData, IContainer Parent) : base(Parent)
        {
            this.EditEventWindow = eew;
            this.EventData       = EventData;
            this.PageData        = PageData;
            Font BoldFont = Font.Get("Fonts/Ubuntu-B", 14);
            Font f        = Font.Get("Fonts/ProductSans-M", 12);

            Label CommandsLabel = new Label(this);

            CommandsLabel.SetFont(BoldFont);
            CommandsLabel.SetPosition(306, 4);
            CommandsLabel.SetText("Commands");
            CommandBox CommandBox = new CommandBox(this);

            CommandBox.SetPosition(305, 22);
            CommandBox.SetSize(438, 493);
            CommandBox.SetEventPage(EventData, PageData);

            Label PropsLabel = new Label(this);

            PropsLabel.SetPosition(8, 4);
            PropsLabel.SetFont(BoldFont);
            PropsLabel.SetText("Page Properties");
            EventGroupBox PropBox = new EventGroupBox(this);

            PropBox.SetPosition(7, 22);
            PropBox.SetSize(291, 157);
            Label NameLabel = new Label(PropBox);

            NameLabel.SetFont(f);
            NameLabel.SetText("Page Name:");
            NameLabel.SetPosition(7, 12);
            TextBox NameBox = new TextBox(PropBox);

            NameBox.SetPosition(77, 7);
            NameBox.SetSize(208, 27);
            NameBox.SetInitialText(string.IsNullOrWhiteSpace(PageData.Name) ? "Untitled" : PageData.Name);
            NameBox.OnTextChanged += delegate(BaseEventArgs e)
            {
                PageData.Name = NameBox.Text;
                EditEventWindow.UpdateNames();
                MarkChanges();
            };
            Label ConditionsLabel = new Label(PropBox);

            ConditionsLabel.SetPosition(8, 40);
            ConditionsLabel.SetFont(f);
            ConditionsLabel.SetText("Conditions:");
            ConditionBox ConditionBox = new ConditionBox(PropBox);

            ConditionBox.SetPosition(6, 61);
            ConditionBox.SetSize(279, 65);
            ConditionBox.SetConditions(PageData.Conditions);
            Button EditConditionsButton = new Button(PropBox);

            EditConditionsButton.SetText("Edit");
            EditConditionsButton.SetPosition(230, 126);
            EditConditionsButton.SetSize(59, 29);
            EditConditionsButton.OnClicked += delegate(BaseEventArgs e)
            {
                ConditionBox.Edit(delegate(BaseEventArgs e)
                {
                    PageData.Conditions = ConditionBox.Conditions;
                });
            };

            Label TriggerLabel = new Label(this);

            TriggerLabel.SetPosition(11, 366);
            TriggerLabel.SetFont(BoldFont);
            TriggerLabel.SetText("Trigger");
            EventGroupBox TriggerGroupBox = new EventGroupBox(this);

            TriggerGroupBox.SetPosition(7, 384);
            TriggerGroupBox.SetSize(121, 71);
            Label TriggerParamLabel = new Label(TriggerGroupBox);

            TriggerParamLabel.SetPosition(11, 41);
            TriggerParamLabel.SetFont(f);
            TriggerParamLabel.SetText("Sight:");
            NumericBox ParamBox = new NumericBox(TriggerGroupBox);

            ParamBox.SetPosition(62, 36);
            ParamBox.SetSize(55, 27);
            ParamBox.MinValue = 0;
            ParamBox.MaxValue = 999;
            if (PageData.TriggerParam is int || PageData.TriggerParam is long)
            {
                ParamBox.SetValue(Convert.ToInt32(PageData.TriggerParam));
            }
            ParamBox.OnValueChanged += delegate(BaseEventArgs e)
            {
                if (PageData.TriggerMode == TriggerMode.PlayerTouch || PageData.TriggerMode == TriggerMode.EventTouch)
                {
                    PageData.TriggerParam = ParamBox.Value;
                    MarkChanges();
                }
            };
            DropdownBox TriggerTypeBox = new DropdownBox(TriggerGroupBox);

            TriggerTypeBox.SetItems(new List <ListItem>()
            {
                new ListItem("Action"),
                new ListItem("Player Touch"),
                new ListItem("Event Touch"),
                new ListItem("Autorun"),
                new ListItem("Parallel Process")
            });
            TriggerTypeBox.SetSelectedIndex((int)PageData.TriggerMode);
            TriggerTypeBox.OnSelectionChanged += delegate(BaseEventArgs e)
            {
                PageData.TriggerMode = (TriggerMode)TriggerTypeBox.SelectedIndex;
                if (TriggerTypeBox.SelectedIndex != 1 && TriggerTypeBox.SelectedIndex != 2)
                {
                    TriggerParamLabel.SetEnabled(false);
                    ParamBox.SetEnabled(false);
                    PageData.TriggerParam = null;
                }
                else
                {
                    TriggerParamLabel.SetEnabled(true);
                    ParamBox.SetEnabled(true);
                    if (PageData.TriggerParam == null)
                    {
                        PageData.TriggerParam = 0;
                        ParamBox.SetValue(0);
                    }
                }
                MarkChanges();
            };
            TriggerTypeBox.OnSelectionChanged.Invoke(new BaseEventArgs());
            TriggerTypeBox.SetPosition(5, 7);
            TriggerTypeBox.SetSize(112, 25);

            Label GraphicLabel = new Label(this);

            GraphicLabel.SetFont(BoldFont);
            GraphicLabel.SetPosition(10, 183);
            GraphicLabel.SetText("Graphic");
            GraphicWidget = new GraphicWidget(this);
            GraphicWidget.SetPosition(7, 201);
            GraphicWidget.SetEvent(EventData, PageData);

            Label AutoMoveLabel = new Label(this);

            AutoMoveLabel.SetFont(BoldFont);
            AutoMoveLabel.SetPosition(140, 183);
            AutoMoveLabel.SetText("Auto-Moveroute");
            EventGroupBox AutoMoveGroupBox = new EventGroupBox(this);

            AutoMoveGroupBox.SetPosition(136, 201);
            AutoMoveGroupBox.SetSize(162, 93);
            Label AutoMoveTypeLabel = new Label(AutoMoveGroupBox);

            AutoMoveTypeLabel.SetFont(f);
            AutoMoveTypeLabel.SetPosition(15, 10);
            AutoMoveTypeLabel.SetText("Type:");
            DropdownBox AutoMoveTypeBox = new DropdownBox(AutoMoveGroupBox);

            AutoMoveTypeBox.SetPosition(49, 7);
            AutoMoveTypeBox.SetSize(110, 25);
            AutoMoveTypeBox.SetItems(new List <ListItem>()
            {
                new ListItem("WIP")
            });
            AutoMoveTypeBox.SetSelectedIndex(0);
            Button EditAutoMoveButton = new Button(AutoMoveGroupBox);

            EditAutoMoveButton.SetPosition(73, 32);
            EditAutoMoveButton.SetSize(90, 31);
            EditAutoMoveButton.SetText("Edit Route");
            EditAutoMoveButton.SetFont(BoldFont);
            EditAutoMoveButton.OnClicked += delegate(BaseEventArgs e)
            {
                new MessageBox("Error", "WIP", IconType.Error);
            };
            Label AutoMoveMoveDelayLabel = new Label(AutoMoveGroupBox);

            AutoMoveMoveDelayLabel.SetPosition(24, 68);
            AutoMoveMoveDelayLabel.SetFont(f);
            AutoMoveMoveDelayLabel.SetText("Move Delay:");
            NumericBox AutoMoveStepDelayBox = new NumericBox(AutoMoveGroupBox);

            AutoMoveStepDelayBox.SetPosition(93, 62);
            AutoMoveStepDelayBox.SetSize(66, 27);
            AutoMoveStepDelayBox.MinValue = 0;
            AutoMoveStepDelayBox.MaxValue = 999;
            AutoMoveLabel.SetEnabled(false);
            AutoMoveTypeLabel.SetEnabled(false);
            AutoMoveTypeBox.SetEnabled(false);
            EditAutoMoveButton.SetEnabled(false);
            AutoMoveMoveDelayLabel.SetEnabled(false);
            AutoMoveStepDelayBox.SetEnabled(false);

            Label SettingsLabel = new Label(this);

            SettingsLabel.SetFont(BoldFont);
            SettingsLabel.SetPosition(140, 298);
            SettingsLabel.SetText("Event Settings");
            EventGroupBox SettingsGroupBox = new EventGroupBox(this);

            SettingsGroupBox.SetPosition(136, 316);
            SettingsGroupBox.SetSize(162, 199);
            Label MoveSpeedLabel = new Label(SettingsGroupBox);

            MoveSpeedLabel.SetFont(f);
            MoveSpeedLabel.SetText("Move Speed:");
            MoveSpeedLabel.SetPosition(6, 7);
            DropdownBox MoveSpeedBox = new DropdownBox(SettingsGroupBox);

            MoveSpeedBox.SetPosition(83, 3);
            MoveSpeedBox.SetSize(76, 25);
            MoveSpeedBox.SetItems(new List <ListItem>()
            {
                new ListItem("Walking"),
                new ListItem("Running"),
                new ListItem("Cycling")
            });
            MoveSpeedBox.SetSelectedIndex(PageData.Settings.MoveSpeed == 0.25f ? 0 : PageData.Settings.MoveSpeed == 0.125f ? 1 : 2);
            MoveSpeedBox.OnSelectionChanged += delegate(BaseEventArgs e)
            {
                PageData.Settings.MoveSpeed = new float[] { 0.25f, 0.125f, 0.1f }[MoveSpeedBox.SelectedIndex];
                MarkChanges();
            };
            Label IdleSpeedLabel = new Label(SettingsGroupBox);

            IdleSpeedLabel.SetFont(f);
            IdleSpeedLabel.SetText("Idle Speed:");
            IdleSpeedLabel.SetPosition(6, 37);
            DropdownBox IdleSpeedBox = new DropdownBox(SettingsGroupBox);

            IdleSpeedBox.SetPosition(83, 33);
            IdleSpeedBox.SetSize(76, 25);
            IdleSpeedBox.SetItems(new List <ListItem>()
            {
                new ListItem("Walking"),
                new ListItem("Running"),
                new ListItem("Cycling")
            });
            IdleSpeedBox.SetSelectedIndex(PageData.Settings.IdleSpeed == 0.25f ? 0 : PageData.Settings.IdleSpeed == 0.125f ? 1 : 2);
            IdleSpeedBox.OnSelectionChanged += delegate(BaseEventArgs e)
            {
                PageData.Settings.IdleSpeed = new float[] { 0.25f, 0.125f, 0.1f }[IdleSpeedBox.SelectedIndex];
                MarkChanges();
            };
            CheckBox MoveAnimBox = new CheckBox(SettingsGroupBox);

            MoveAnimBox.SetPosition(5, 63);
            MoveAnimBox.SetText("Move Animation");
            MoveAnimBox.SetFont(f);
            MoveAnimBox.SetChecked(PageData.Settings.MoveAnimation);
            MoveAnimBox.OnCheckChanged += delegate(BaseEventArgs e)
            {
                PageData.Settings.MoveAnimation = MoveAnimBox.Checked;
                MarkChanges();
            };
            CheckBox IdleAnimBox = new CheckBox(SettingsGroupBox);

            IdleAnimBox.SetPosition(5, 83);
            IdleAnimBox.SetText("Idle Animation");
            IdleAnimBox.SetFont(f);
            IdleAnimBox.SetChecked(PageData.Settings.IdleAnimation);
            IdleAnimBox.OnCheckChanged += delegate(BaseEventArgs e)
            {
                PageData.Settings.IdleAnimation = IdleAnimBox.Checked;
                MarkChanges();
            };
            PassableBox = new CheckBox(SettingsGroupBox);
            PassableBox.SetPosition(5, 103);
            PassableBox.SetText("Passable");
            PassableBox.SetFont(f);
            PassableBox.SetChecked(PageData.Settings.Passable);
            PassableBox.OnCheckChanged += delegate(BaseEventArgs e)
            {
                PageData.Settings.Passable = PassableBox.Checked;
                MarkChanges();
            };
            CheckBox SavePositionBox = new CheckBox(SettingsGroupBox);

            SavePositionBox.SetPosition(5, 123);
            SavePositionBox.SetText("Save Position");
            SavePositionBox.SetFont(f);
            SavePositionBox.SetChecked(PageData.Settings.SavePosition);
            SavePositionBox.OnCheckChanged += delegate(BaseEventArgs e)
            {
                PageData.Settings.SavePosition = SavePositionBox.Checked;
                MarkChanges();
            };
            CheckBox DirectionLockBox = new CheckBox(SettingsGroupBox);

            DirectionLockBox.SetPosition(5, 143);
            DirectionLockBox.SetText("Direction Lock");
            DirectionLockBox.SetFont(f);
            DirectionLockBox.SetChecked(PageData.Settings.DirectionLock);
            DirectionLockBox.OnCheckChanged += delegate(BaseEventArgs e)
            {
                PageData.Settings.DirectionLock = DirectionLockBox.Checked;
                MarkChanges();
            };
            Label PriorityLabel = new Label(SettingsGroupBox);

            PriorityLabel.SetFont(f);
            PriorityLabel.SetPosition(6, 168);
            PriorityLabel.SetText("Priority:");
            DropdownBox PriorityBox = new DropdownBox(SettingsGroupBox);

            PriorityBox.SetPosition(54, 164);
            PriorityBox.SetSize(105, 25);
            PriorityBox.SetItems(new List <ListItem>()
            {
                new ListItem("WIP")
            });
            PriorityBox.SetSelectedIndex(0);
        }