Esempio n. 1
0
        void CollectPortalNames()
        {
            PortalVariable myTarget = (PortalVariable)target;

            // ... iterate through the portals, to get the names, and the current index.
            int           index    = -1;
            List <string> nameList = new List <string>();

            for (int cnt = 0; cnt < _inputPortals.Count; cnt++)
            {
                var portal = _inputPortals[cnt];
                if (portal == myTarget)
                {
                    continue;
                }

                nameList.Add(portal.PortalName);

                if (myTarget.PortalName == portal.PortalName)
                {
                    index = cnt;
                }
            }

            _portalNames = new SmartPopup(nameList.ToArray(), index);
        }
Esempio n. 2
0
        public override void OnInspectorGUI()
        {
            Node myTarget = (Node)target;

            EditorGUI.BeginChangeCheck();

            if (myTarget is INodeCollection || NameEditable)
            {
                EditorGUIExtension.SimpleBox("", 5, "", delegate()
                {
                    myTarget.Name = EditorGUILayout.TextField("Name", myTarget.Name);
                });
            }
            else if (myTarget is ITypedNode)
            {
                ITypedNode t = (ITypedNode)myTarget;
                EditorGUIExtension.SimpleBox("", 5, "", delegate()
                {
                    if (_typePopup == null)
                    {
                        int index           = 0;
                        List <string> names = new List <string>();
                        for (int cnt = 0; cnt < t.AllowedTypes.Count; cnt++)
                        {
                            if (t.Type == t.AllowedTypes[cnt])
                            {
                                index = cnt;
                            }
                            names.Add(TypeUtils.GetPrettyName(t.AllowedTypes[cnt]));
                        }
                        _typePopup = new SmartPopup(names, index);
                    }

                    if (_typePopup.Draw("Value Type"))
                    {
                        t.Type = t.AllowedTypes[_typePopup.Index];
                    }
                });
            }

            EditorGUILayout.Space();

            onGUI();

            if (EditorGUI.EndChangeCheck())
            {
                myTarget.HasChanges = true;
            }
        }
Esempio n. 3
0
 protected void ResetTypePopup()
 {
     _typePopup = null;
 }