Exemplo n.º 1
0
        public void groupBoxToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CGroupBox groupBox = ControlFactory.BuildCGroupBox(model.currentClickedControl);

            editor = new ControlEditor();
            editor.Show(groupBox);
        }
Exemplo n.º 2
0
        public void shapeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CPanel panel = ControlFactory.BuildCPanel(model.currentClickedControl);

            editor = new ControlEditor();
            editor.Show(panel);
        }
Exemplo n.º 3
0
        public void bitmapToolSTripMenuItem_Click(object sender, EventArgs e)
        {
            CBitmap bitmap = ControlFactory.BuildCBitmap(model.currentClickedControl);

            editor = new ControlEditor();
            editor.Show(bitmap);
        }
Exemplo n.º 4
0
        public void buttonToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CButton button = ControlFactory.BuildCButton(model.currentClickedControl);

            editor = new ControlEditor();
            editor.Show(button);
        }
Exemplo n.º 5
0
        public void labelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CLabel label = ControlFactory.BuildCLabel(model.currentClickedControl);

            editor = new ControlEditor();
            editor.Show(label);
        }
Exemplo n.º 6
0
        public void tabPageToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CTabPage tabPage = ControlFactory.BuildCTabPage(model.currentClickedControl);

            tabPage.MouseDown += Control_Click;

            editor = new ControlEditor();
            editor.Show(tabPage);
        }
Exemplo n.º 7
0
 // Start is called before the first frame update
 void Start()
 {
     Instance = this;
     //controlMap = new SortedDictionary<ControlAction, ControlInfo>();
     //controlMap.Add(ControlAction.Up, new ControlInfo { Action = ControlAction.Up, KeyCode1 = 1, KeyCode2 = 2 });
     controlMap = Json.JsonToContainer <SortedDictionary <ControlAction, ControlInfo> >("controldata.json");
     CreateControlTexts();
     Json.SaveToJson <SortedDictionary <ControlAction, ControlInfo> >(controlMap, "controldata.json");
 }
Exemplo n.º 8
0
        private void compilarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Limpia Reportes
            limpiarGrid();

            //Genera codigo 3D
            ControlEditor.analizar();
            generar3D generar3D = new generar3D();

            txt3D.Text = memoria.cadena3D;

            //Limpiar Estaticas 3D
            memoria.temporal = 0;
            memoria.etiqueta = 0;
            memoria.cadena3D = "";
            memoria.lista_estructura_clase = new List <estructura_clase>();
        }
Exemplo n.º 9
0
        public void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Close editor if oppened
            ControlEditor closing = null;

            foreach (ControlEditor ed in Application.OpenForms.OfType <ControlEditor>())
            {
                if (ed.control == model.currentClickedControl)
                {
                    closing = ed;
                }
            }
            if (closing != null)
            {
                closing.Close();
            }

            // Delete control
            model.DeleteControl(model.currentClickedControl, false);
            Model.getInstance().uiChanged = true;
        }
Exemplo n.º 10
0
        public void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (model.currentClickedControl == null)
            {
                return;
            }
            editor             = new ControlEditor();
            model.lastClickedX = model.currentClickedControl.Location.X;
            model.lastClickedY = model.currentClickedControl.Location.Y;
            model.logCreator.Append("! Editing: " + model.currentClickedControl.Name);

            foreach (ControlEditor ed in Application.OpenForms.OfType <ControlEditor>())
            {
                if (ed.control == model.currentClickedControl)
                {
                    ed.Focus();
                    return;
                }
            }
            editor.Show(model.currentClickedControl);
        }
Exemplo n.º 11
0
 private void abrirToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ControlEditor.abrirTab();
 }
Exemplo n.º 12
0
 private void guardarComoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ControlEditor.guardarComoTab();
     ListDirectory();
 }
Exemplo n.º 13
0
 private void nuevoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ControlEditor.agregarNewTab();
 }
Exemplo n.º 14
0
 private void cerrarArchivoToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ControlEditor.borrarTab();
 }
Exemplo n.º 15
0
        internal GameObject ConstructEditorRow(GameObject parent, ControlEditor editor, ControlType type, VectorValue vectorValue)
        {
            var rowObject = UIFactory.CreateHorizontalGroup(parent, new Color(1, 1, 1, 0));
            var rowGroup  = rowObject.GetComponent <HorizontalLayoutGroup>();

            rowGroup.childForceExpandWidth  = false;
            rowGroup.childControlWidth      = true;
            rowGroup.childForceExpandHeight = false;
            rowGroup.childControlHeight     = true;
            rowGroup.spacing = 5;
            var rowLayout = rowObject.AddComponent <LayoutElement>();

            rowLayout.minHeight      = 25;
            rowLayout.flexibleHeight = 0;
            rowLayout.minWidth       = 100;

            // Value labels

            var labelObj  = UIFactory.CreateLabel(rowObject, TextAnchor.MiddleLeft);
            var labelText = labelObj.GetComponent <Text>();

            labelText.color                = Color.cyan;
            labelText.text                 = $"{vectorValue.ToString().ToUpper()}:";
            labelText.fontSize             = 14;
            labelText.resizeTextMaxSize    = 14;
            labelText.resizeTextForBestFit = true;
            var labelLayout = labelObj.AddComponent <LayoutElement>();

            labelLayout.minHeight      = 25;
            labelLayout.flexibleHeight = 0;
            labelLayout.minWidth       = 25;
            labelLayout.flexibleWidth  = 0;

            // actual value label
            var valueLabelObj = UIFactory.CreateLabel(rowObject, TextAnchor.MiddleLeft);
            var valueLabel    = valueLabelObj.GetComponent <Text>();

            editor.values[(int)vectorValue] = valueLabel;
            var valueLabelLayout = valueLabelObj.AddComponent <LayoutElement>();

            valueLabelLayout.minWidth      = 85;
            valueLabelLayout.flexibleWidth = 0;
            valueLabelLayout.minHeight     = 25;

            // input field

            var inputHolder      = UIFactory.CreateVerticalGroup(rowObject, new Color(1, 1, 1, 0));
            var inputHolderGroup = inputHolder.GetComponent <VerticalLayoutGroup>();

            inputHolderGroup.childForceExpandHeight = false;
            inputHolderGroup.childControlHeight     = true;
            inputHolderGroup.childForceExpandWidth  = false;
            inputHolderGroup.childControlWidth      = true;

            var inputObj = UIFactory.CreateInputField(inputHolder);
            var input    = inputObj.GetComponent <InputField>();

            input.characterValidation = InputField.CharacterValidation.Decimal;

            var inputLayout = inputObj.AddComponent <LayoutElement>();

            inputLayout.minHeight      = 25;
            inputLayout.flexibleHeight = 0;
            inputLayout.minWidth       = 90;
            inputLayout.flexibleWidth  = 50;

            editor.inputs[(int)vectorValue] = input;

            // apply button

            var applyBtnObj = UIFactory.CreateButton(rowObject);
            var applyBtn    = applyBtnObj.GetComponent <Button>();
            var applyText   = applyBtnObj.GetComponentInChildren <Text>();

            applyText.text     = "Apply";
            applyText.fontSize = 14;
            var applyLayout = applyBtnObj.AddComponent <LayoutElement>();

            applyLayout.minWidth  = 60;
            applyLayout.minHeight = 25;

            applyBtn.onClick.AddListener(() => { OnVectorControlInputApplied(type, vectorValue); });

            // Slider

            var sliderObj = UIFactory.CreateSlider(rowObject);

            sliderObj.transform.Find("Fill Area").gameObject.SetActive(false);
            var sliderLayout = sliderObj.AddComponent <LayoutElement>();

            sliderLayout.minHeight      = 20;
            sliderLayout.flexibleHeight = 0;
            sliderLayout.minWidth       = 200;
            sliderLayout.flexibleWidth  = 9000;
            var slider       = sliderObj.GetComponent <Slider>();
            var sliderColors = slider.colors;

            sliderColors.normalColor = new Color(0.65f, 0.65f, 0.65f);
            slider.colors            = sliderColors;
            slider.minValue          = -2;
            slider.maxValue          = 2;
            slider.value             = 0;
            slider.onValueChanged.AddListener((float val) => { OnSliderControlChanged(val, slider, type, vectorValue); });
            editor.sliders[(int)vectorValue] = slider;

            return(rowObject);
        }
Exemplo n.º 16
0
        internal void ConstructVector3Editor(GameObject parent, string title, ControlType type, out ControlEditor editor)
        {
            editor = new ControlEditor();

            var topBarObj = UIFactory.CreateHorizontalGroup(parent, new Color(1, 1, 1, 0));
            var topGroup  = topBarObj.GetComponent <HorizontalLayoutGroup>();

            topGroup.childForceExpandWidth  = false;
            topGroup.childControlWidth      = true;
            topGroup.childForceExpandHeight = false;
            topGroup.childControlHeight     = true;
            topGroup.spacing = 5;
            var topLayout = topBarObj.AddComponent <LayoutElement>();

            topLayout.minHeight      = 25;
            topLayout.flexibleHeight = 0;

            var titleObj  = UIFactory.CreateLabel(topBarObj, TextAnchor.MiddleLeft);
            var titleText = titleObj.GetComponent <Text>();

            titleText.text     = title;
            titleText.color    = Color.grey;
            titleText.fontSize = 14;
            var titleLayout = titleObj.AddComponent <LayoutElement>();

            titleLayout.minWidth      = 110;
            titleLayout.flexibleWidth = 0;
            titleLayout.minHeight     = 25;

            // expand button
            var expandButtonObj = UIFactory.CreateButton(topBarObj);
            var expandButton    = expandButtonObj.GetComponent <Button>();
            var expandText      = expandButtonObj.GetComponentInChildren <Text>();

            expandText.text     = "▼";
            expandText.fontSize = 12;
            var btnLayout = expandButtonObj.AddComponent <LayoutElement>();

            btnLayout.minWidth       = 35;
            btnLayout.flexibleWidth  = 0;
            btnLayout.minHeight      = 25;
            btnLayout.flexibleHeight = 0;

            // readonly value input

            var valueInputObj = UIFactory.CreateInputField(topBarObj);
            var valueInput    = valueInputObj.GetComponent <InputField>();

            valueInput.readOnly = true;
            //valueInput.richText = true;
            //valueInput.isRichTextEditingAllowed = true;
            var valueInputLayout = valueInputObj.AddComponent <LayoutElement>();

            valueInputLayout.minHeight      = 25;
            valueInputLayout.flexibleHeight = 0;
            valueInputLayout.preferredWidth = 400;
            valueInputLayout.flexibleWidth  = 9999;

            editor.fullValue = valueInput;

            editor.sliders = new Slider[3];
            editor.inputs  = new InputField[3];
            editor.values  = new Text[3];

            var xRow = ConstructEditorRow(parent, editor, type, VectorValue.x);

            xRow.SetActive(false);
            var yRow = ConstructEditorRow(parent, editor, type, VectorValue.y);

            yRow.SetActive(false);
            var zRow = ConstructEditorRow(parent, editor, type, VectorValue.z);

            zRow.SetActive(false);

            // add expand callback now that we have group reference
            expandButton.onClick.AddListener(ToggleExpand);
            void ToggleExpand()
            {
                if (xRow.activeSelf)
                {
                    xRow.SetActive(false);
                    yRow.SetActive(false);
                    zRow.SetActive(false);
                    expandText.text = "▼";
                }
                else
                {
                    xRow.SetActive(true);
                    yRow.SetActive(true);
                    zRow.SetActive(true);
                    expandText.text = "▲";
                }
            }
        }