コード例 #1
0
ファイル: EditorHandler.cs プロジェクト: BrunoS3D/FastPlay
 public static ConstantTypes GetConstantTypesCurrentInstance()
 {
     instanceConstantTypes = AssetDatabase.LoadAssetAtPath <ConstantTypes>("Assets/FastPlay/FP-Runtime/ConstantTypes.asset");
     if (instanceConstantTypes)
     {
         return(instanceConstantTypes);
     }
     instanceConstantTypes = ScriptableObject.CreateInstance <ConstantTypes>();
     AssetDatabase.CreateAsset(instanceConstantTypes, "Assets/FastPlay/FP-Runtime/ConstantTypes.asset");
     return(instanceConstantTypes);
 }
コード例 #2
0
        private void CreateTypeList()
        {
            ConstantTypes types = (ConstantTypes)target;

            list = new ReorderableList(types.current_types, typeof(Type), true, true, true, true);

            list.drawHeaderCallback = rect => {
                EditorGUI.LabelField(rect, "Current Types");
            };

            list.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => {
                //rect.y += 2;
                Type last_value = GUIDraw.AnyField(rect, types.current_types[index]);
                if (last_value != types.current_types[index])
                {
                    UndoManager.RecordObject(target, "Type Change");
                    types.current_types[index] = last_value;
                }
                //GUI.Label(rect, types.current_types[index].GetTypeName(true));
            };

            list.onRemoveCallback = (ReorderableList list) => {
                UndoManager.RecordObject(target, "Remove type");
                types.current_types.RemoveAt(list.index);
                list.index = list.count - 1;
            };

            list.onAddDropdownCallback = (Rect buttonRect, ReorderableList list) => {
                if (generic_menu == null)
                {
                    generic_menu = new GenericMenu();
                    foreach (Type type in ReflectionUtils.GetFullTypes())
                    {
                        if (type == null)
                        {
                            continue;
                        }

                        string type_path = type.GetTypePath(true);

                        generic_menu.AddItem(new GUIContent(type_path), false, () => {
                            UndoManager.RecordObject(target, "Add new type");
                            types.current_types.Add(type);
                            CreateTypeList();
                        });
                    }
                }
                generic_menu.ShowAsContext();
            };
        }
コード例 #3
0
        public override void OnInspectorGUI()
        {
            ConstantTypes types = (ConstantTypes)target;

            if (GUILayout.Button("Reset to defaults"))
            {
                UndoManager.RecordObject(target, "Reset to defaults");
                types.current_types = ConstantTypes.default_types;
                CreateTypeList();
            }

            list.DoLayoutList();

            if (GUI.changed)
            {
                UndoManager.SetDirty(target);
                GUI.changed = true;
            }
        }
コード例 #4
0
ファイル: Constants.cs プロジェクト: QuantumCores/Mathema
 public static Constant Get(ConstantTypes type)
 {
     return(All[type.ToString().ToLower()]);
 }
コード例 #5
0
 public Constant(string symbol, decimal value, ConstantTypes type)
 {
     this.Symbol = symbol;
     this.Value  = value;
     this.Type   = type;
 }
コード例 #6
0
ファイル: Predicate.cs プロジェクト: jgshort/SqlDom
 public Like(ConstantTypes.String left, ConstantTypes.String right)
     : base(left, right)
 {
     //
 }