コード例 #1
0
        public static IVariableStore DrawTable(IVariableStore store, bool allowAddRemove)
        {
            var            names         = store.GetVariableNames();
            IVariableStore selectedStore = null;

            foreach (var name in names)
            {
                var value = store.GetVariable(name);

                using (var changes = new EditorGUI.ChangeCheckScope())
                {
                    switch (value.Type)
                    {
                    case VariableType.Empty: DrawEmpty(name, ref value); break;

                    case VariableType.Boolean: DrawBoolean(name, ref value); break;

                    case VariableType.Integer: DrawInteger(name, ref value); break;

                    case VariableType.Number: DrawNumber(name, ref value); break;

                    case VariableType.String: DrawString(name, ref value); break;

                    case VariableType.Null: DrawNull(name, ref value); break;

                    default:
                    {
                        if (DrawLink(name, value.RawObject))                                 // TODO: show object picker
                        {
                            selectedStore = value.Store;
                        }

                        break;
                    }
                    }

                    if (changes.changed)
                    {
                        store.SetVariable(name, value);
                    }
                }
            }

            return(selectedStore);
        }
コード例 #2
0
 public virtual SetVariableResult SetVariable(string name, VariableValue value) => name == ValueName ? SetVariableResult.ReadOnly : _parent.SetVariable(name, value);