コード例 #1
0
        public void draw()
        {
            ge.Name = EditorGUILayout.TextField("Name", ge.Name);

            foreach (string param in ge.Params)
            {
                if (param != "synchronous")
                {
                    EditorGUILayout.BeginHorizontal();

                    ge.setParameter(param, ParamEditor.LayoutEditorFor(param, ge.getParameter(param)));
                    //ge.setParameter (param, EditorGUILayout.ObjectField (param, (Object)ge.getParameter (param), typeof(Object), true));
                    if (GUILayout.Button("X"))
                    {
                        ge.removeParameter(param);
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.BeginHorizontal();
            newParameter = EditorGUILayout.TextField("New Parameter", newParameter);
            if (GUILayout.Button("Add"))
            {
                ge.setParameter(newParameter, null);
            }
            EditorGUILayout.EndHorizontal();
        }
コード例 #2
0
        protected override void NodeContentInspectorGUI()
        {
            var isf = target as ISwitchFork;

            isf.id = EditorGUILayout.TextField("ID", isf.id);
            isf.comparationType = (ISwitchFork.ComparationType)EditorGUILayout.EnumPopup("Comparation Type", isf.comparationType);
            isf.Value           = ParamEditor.LayoutEditorFor("Value", isf.Value, false);

            isf.name = isf.id + GetComparationString(isf.comparationType) + isf.Value;
        }
コード例 #3
0
    public override void OnInspectorGUI()
    {
        isoSwitches = target as IsoSwitches;

        GUIStyle style = new GUIStyle();

        style.padding = new RectOffset(5, 5, 5, 5);

        isoSwitches = target as IsoSwitches;

        EditorGUILayout.HelpBox("List of switches that represent the state of the game.", MessageType.None);

        ISwitch[] switches = isoSwitches.getList();
        if (switches != null)
        {
            int i = 0;
            scrollposition = EditorGUILayout.BeginScrollView(scrollposition, GUILayout.ExpandHeight(true));
            foreach (ISwitch isw in switches)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("ID: ", GUILayout.Width(27));
                isw.id    = EditorGUILayout.TextField(isw.id);
                isw.State = ParamEditor.editorFor("Initial State: ", isw.State);
                GUIContent btt = new GUIContent("Remove");
                Rect       btr = GUILayoutUtility.GetRect(btt, style);
                if (GUI.Button(btr, btt))
                {
                    isoSwitches.removeSwitch(isw);
                }
                ;
                EditorGUILayout.EndHorizontal();
                i++;
            }
            EditorGUILayout.EndScrollView();
        }

        EditorGUILayout.BeginHorizontal();
        GUIContent bttext = new GUIContent("Add Switch");
        Rect       btrect = GUILayoutUtility.GetRect(bttext, style);

        if (GUI.Button(btrect, bttext))
        {
            isoSwitches.addSwitch();
        }
        ;
        EditorGUILayout.EndHorizontal();
    }
コード例 #4
0
        private void FileTree_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TabPage p = null;

            if (e.Node is ScriptNode)
            {
                TreeNode root = e.Node.Parent;
                while (root.Parent != null)
                {
                    root = root.Parent;
                }

                if (root?.Name == "nACMD")
                {
                    p = new CodeEditor(e.Node as ScriptNode, ACMD_INFO.CMD_NAMES.Values.ToArray());
                }
                else if (root?.Name == "nMSC")
                {
                    p = new CodeEditor(e.Node as ScriptNode, MSC_INFO.NAMES.Values.ToArray());
                }
                else
                {
                    p = new CodeEditor(e.Node as ScriptNode);
                }
            }
            else if (e.Node is ParamListNode)
            {
                p = new ParamEditor(e.Node as ParamListNode);
            }

            if (p != null)
            {
                p.Name = e.Node.Text + e.Node.Index;
                p.Text = e.Node.Text;
                if (Viewport.TabPages.ContainsKey(p.Name))
                {
                    Viewport.SelectTab(p.Name);
                    return;
                }
                else
                {
                    Viewport.TabPages.Insert(0, p);
                    Viewport.SelectTab(0);
                }
            }
        }
コード例 #5
0
 public void draw()
 {
     ge.setParameter("switch", EditorGUILayout.TextField("SwitchID", (string)ge.getParameter("switch")));
     ge.setParameter("value", ParamEditor.editorFor("Value", ge.getParameter("value")));
 }
コード例 #6
0
 public void draw()
 {
     isf.id = EditorGUILayout.TextField("ID", isf.id);
     isf.comparationType = (ISwitchFork.ComparationType)EditorGUILayout.EnumPopup("Comparation Type", isf.comparationType);
     isf.Value           = ParamEditor.editorFor("Value", isf.Value, false);
 }
コード例 #7
0
 public void draw()
 {
     foreach (var parameterConfig in config.ParameterConfig)
     {
         if (parameterConfig.Value == typeof(bool))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.Toggle(parameterConfig.Key, (bool)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(float))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.FloatField(parameterConfig.Key, (float)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(int))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.IntField(parameterConfig.Key, (int)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(Vector2))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.Vector2Field(parameterConfig.Key, (Vector2)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(Vector3))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.Vector3Field(parameterConfig.Key, (Vector3)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(Vector4))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.Vector4Field(parameterConfig.Key, (Vector4)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(Rect))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.RectField(parameterConfig.Key, (Rect)ge.getParameter(parameterConfig.Key)));
         }
         if (typeof(UnityEngine.Object).IsAssignableFrom(parameterConfig.Value))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.ObjectField(parameterConfig.Key, (UnityEngine.Object)ge.getParameter(parameterConfig.Key), parameterConfig.Value, true));
         }
         if (parameterConfig.Value == typeof(Color))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.ColorField(parameterConfig.Key, (Color)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(Bounds))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.BoundsField(parameterConfig.Key, (Bounds)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(AnimationCurve))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.CurveField(parameterConfig.Key, (AnimationCurve)ge.getParameter(parameterConfig.Key)));
         }
         if (typeof(Enum).IsAssignableFrom(parameterConfig.Value))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.EnumPopup(parameterConfig.Key, (Enum)Enum.ToObject(parameterConfig.Value, ge.getParameter(parameterConfig.Key))));
         }
         if (parameterConfig.Value == typeof(string))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.TextField(parameterConfig.Key, (string)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(long))
         {
             ge.setParameter(parameterConfig.Key, EditorGUILayout.LongField(parameterConfig.Key, (long)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(double))
         {
             ge.setParameter(parameterConfig.Key, (double)EditorGUILayout.FloatField(parameterConfig.Key, (float)ge.getParameter(parameterConfig.Key)));
         }
         if (parameterConfig.Value == typeof(object))
         {
             ge.setParameter(parameterConfig.Key, ParamEditor.LayoutEditorFor(parameterConfig.Key, ge.getParameter(parameterConfig.Key)));
         }
     }
 }