Exemplo n.º 1
0
        public EventContentLine(int index, EventEditor parent)
        {
            this.index  = index;
            this.parent = parent;
            indexText   = new EText().Content(index.ToString()).RelativeSize(false).Width(20);
            nameField   = new ETextInputField().RelativeSize(true).OnInputUpdate((ETextInputField f, string val) => { parent.cfg.events[this.index] = val; nameText.Content(val); });
            nameText    = new EText().Content(parent.cfg.events[index]).RelativeSize(true);

            editButton       = new EButton().RelativeSize(false).Width(80).OnClicked((EButton b) => { parent.BeginEdit(index); }) + new EText().Content("edit");
            editFinishButton = new EButton().RelativeSize(false).Width(50).OnClicked((EButton b) => { parent.FinishEdit(); }) + new EText().Content("finish");
            deleteButton     = new EButton().RelativeSize(false).Width(30).OnClicked((EButton b) => { parent.RemoveEvent(index); }) + new EText().Content("x");

            children.Add(new EHorizontalLayout() + indexText + nameText + editButton);
            children.Add(new EHorizontalLayout() + indexText + nameField + editFinishButton + deleteButton);
            children.Add(new EHorizontalLayout() + indexText + nameText);
            this.OnConstruct(parent);
        }
Exemplo n.º 2
0
        public NewCompTab(ComponentEditorWindow window)
        {
            RelativeSize(true);
            this.window = window;

            aimingAngleField = new ETextInputField().OnInputUpdate((ETextInputField f, string val) =>
            {
                compAim.aimingAngle = Convert.ToSingle(val);
            }).RelativeSize(true);
            horizontalRotationSpeedField = new ETextInputField().OnInputUpdate((ETextInputField f, string val) =>
            {
                compAim.horizontalRotationSpeed = Convert.ToSingle(val);
            }).RelativeSize(true);
            verticalRotationSpeedField = new ETextInputField().OnInputUpdate((ETextInputField f, string val) =>
            {
                compAim.verticalRotationSpeed = Convert.ToSingle(val);
            }).RelativeSize(true);

            List <string> aimingTypes = new List <string>(Enum.GetNames(typeof(ComponentAimingType)));

            aimingTypes.Insert(0, "Disable aiming");

            var aimConfig = new ESwitchTab().RelativeSize(true).OnActivateTab((ESwitchTab tab, int i) => { })
                            + new EBox().Content(new GUIContent("Aiming disabled"))
                            + (new EVerticalLayout()
                               + (new EHorizontalLayout()
                                  + (new EText("Aiming angle resolution").RelativeSize(true))
                                  + aimingAngleField
                                  )
                               + (new EHorizontalLayout()
                                  + (new EText("Horizontal rotation speed").RelativeSize(true))
                                  + horizontalRotationSpeedField
                                  )
                               + (new EHorizontalLayout()
                                  + (new EText("Vertical rotation speed").RelativeSize(true))
                                  + verticalRotationSpeedField
                                  )
                               );

            children.Add(new EVerticalLayout().RelativeSize(true)
                         //Name input field

                         //Name viability status


                         + (new EHorizontalLayout()
                            //Component type
                            + (new ETextInputField().OnInputUpdate((ETextInputField f, string val) => SetName(val))).RelativeSize(true).Width(3)
                            + new EPopup().RelativeSize(true).Width(1)
                            .Content(Enum.GetNames(typeof(ComponentType)))
                            .OnSelectionChange((EPopup p, int i) => { SetType(i); })
                            )
                         + (new EText().BindContent(() => { return(CheckNameViability() ? "All good" : "!! Naming conflict !!"); }))
                         //Component aiming mechanism
                         + new EPopup()
                         .Content(aimingTypes.ToArray())
                         .OnSelectionChange((EPopup p, int i) => {
                if (i == 0)
                {
                    aimConfig.ActivateTab(0);
                }
                else
                {
                    aimConfig.ActivateTab(1);
                }
                SetAimType(i);
            })
                         + aimConfig
                         );

            children.Add(
                new EHorizontalLayout()
                + (new EButton().RelativeSize(true).OnClicked((EButton b) => CreateComponent()) + new EText("Create"))
                + (new EButton().RelativeSize(true).OnClicked((EButton b) => window.OpenDBEditTab()) + new EText("Cancel"))
                );
        }