Exemplo n.º 1
0
        public override void Awake()
        {
            try {
                base.Awake();
                AddDrag("Save Prop Template");
                {
                    UIPanel panel = AddLeftPanel();
                    {
                        SavesListBox        = panel.AddUIComponent <SaveListBoxProp>();
                        SavesListBox.width  = panel.width;
                        SavesListBox.height = 628;
                        SavesListBox.AddScrollBar();
                        SavesListBox.eventSelectedIndexChanged += (_, val) =>
                                                                  OnSelectedSaveChanged(val);
                    }
                    {
                        NameField                   = panel.AddUIComponent <MenuTextField>();
                        NameField.text              = "New Template";
                        NameField.width             = panel.width;
                        NameField.eventTextChanged += (_, __) => OnNameChanged();
                    }
                }
                {
                    UIPanel panel = AddRightPanel();
                    {
                        SummaryBox        = panel.AddUIComponent <SummaryLabel>();
                        SummaryBox.width  = panel.width;
                        SummaryBox.height = 400;
                    }
                    {
                        DescriptionField           = panel.AddUIComponent <MenuTextField>();
                        DescriptionField.multiline = true;
                        DescriptionField.text      = "Description";
                        DescriptionField.width     = panel.width;
                        DescriptionField.height    = 162;
                    }
                }

                FitChildrenVertically(10);
                {
                    var BottomPanel = AddBottomPanel(this);
                    SaveButton             = BottomPanel.AddUIComponent <MenuButton>();
                    SaveButton.text        = "Save";
                    SaveButton.eventClick += (_, __) => OnSave();
                    //pos.x += -SaveButton.size.x - 20;
                    //SaveButton.relativePosition = pos;

                    var cancel = BottomPanel.AddUIComponent <MenuButton>();
                    cancel.text        = "Cancel";
                    cancel.eventClick += (_, __) => Destroy(gameObject);
                    //var pos = size - cancel.size - new Vector2(20, 10);
                    //cancel.relativePosition = pos;
                }
            } catch (Exception ex) {
                Log.Exception(ex);
            }
        }
Exemplo n.º 2
0
        public override void Awake()
        {
            base.Awake();
            AddDrag("Load Road XML");
            {
                UIPanel panel = AddLeftPanel();
                {
                    SavesListBox        = panel.AddUIComponent <SavesListBoxT <RoadAssetInfo> >();
                    SavesListBox.width  = panel.width;
                    SavesListBox.height = 470;
                    SavesListBox.AddScrollBar();
                    SavesListBox.eventSelectedIndexChanged += (_, val) =>
                                                              OnSelectedSaveChanged(val);
                    SavesListBox.eventDoubleClick += (_, __) => OnLoad();
                }
            }
            {
                UIPanel panel = AddRightPanel();
                {
                    SummaryBox        = panel.AddUIComponent <SummaryLabel>();
                    SummaryBox.width  = panel.width;
                    SummaryBox.height = 400;
                }
            }

            FitChildrenVertically(10);
            {
                var BottomPanel = AddBottomPanel(this);
                LoadButton             = BottomPanel.AddUIComponent <MenuButton>();
                LoadButton.text        = "Load";
                LoadButton.eventClick += (_, __) => OnLoad();
                //pos.x += -LoadButton.size.x - 20;
                //LoadButton.relativePosition = pos;

                var cancel = BottomPanel.AddUIComponent <MenuButton>();
                cancel.text        = "Cancel";
                cancel.eventClick += (_, __) => Destroy(gameObject);
                //var pos = size - cancel.size - new Vector2(20, 10);
                //cancel.relativePosition = pos;
            }
        }
Exemplo n.º 3
0
        public override void Awake()
        {
            base.Awake();
            AddDrag("Load Prop Template");
            {
                UIPanel panel = AddLeftPanel();
                {
                    SavesListBox        = panel.AddUIComponent <SaveListBoxProp>();
                    SavesListBox.width  = panel.width;
                    SavesListBox.height = 628;
                    SavesListBox.AddScrollBar();
                    SavesListBox.eventSelectedIndexChanged += (_, val) =>
                                                              OnSelectedSaveChanged(val);
                    SavesListBox.eventDoubleClick += (_, __) => OnLoad();
                }
            }
            {
                UIPanel panel = AddRightPanel();
                {
                    SummaryBox        = panel.AddUIComponent <SummaryLabel>();
                    SummaryBox.width  = panel.width;
                    SummaryBox.height = 400;
                }
                {
                    SwitchDir        = panel.AddUIComponent <MenuCheckbox>();
                    SwitchDir.Label  = "Switch Forward/Backward";
                    SwitchSide       = panel.AddUIComponent <MenuCheckbox>();
                    SwitchSide.Label = "Switch RHT/LHT";
                }
                {
                    //Displacement = panel.AddUIComponent<TextFieldInt>();
                    //Displacement.width = panel.width;

                    UIPanel panel2 = panel.AddUIComponent <UIPanel>();
                    panel2.autoLayout          = true;
                    panel2.autoLayoutDirection = LayoutDirection.Horizontal;
                    panel2.autoLayoutPadding   = new RectOffset(0, 5, 0, 0);
                    var lbl = panel2.AddUIComponent <UILabel>();
                    lbl.text              = "Displacement:";
                    Displacement          = panel2.AddUIComponent <MenuTextFieldFloat>();
                    Displacement.width    = panel.width - Displacement.relativePosition.x;
                    Displacement.tooltip  = "put a posetive number to move props sideways.";
                    lbl.height            = Displacement.height;
                    lbl.verticalAlignment = UIVerticalAlignment.Middle;
                    panel2.FitChildren();
                }
            }

            FitChildrenVertically(10);

            {
                var BottomPanel = AddBottomPanel(this);
                LoadButton             = BottomPanel.AddUIComponent <MenuButton>();
                LoadButton.text        = "Load";
                LoadButton.eventClick += (_, __) => OnLoad();
                //pos.x += -LoadButton.size.x - 20;
                //LoadButton.relativePosition = pos;

                var cancel = BottomPanel.AddUIComponent <MenuButton>();
                cancel.text        = "Cancel";
                cancel.eventClick += (_, __) => Destroy(gameObject);
                //var pos = size - cancel.size - new Vector2(20, 10);
                //cancel.relativePosition = pos;
            }
        }