コード例 #1
0
ファイル: VariableStore.cs プロジェクト: larsolm/Archives
 public void Copy(VariableStore from)
 {
     foreach (var variable in from._variables)
     {
         Copy(variable.Name, variable);
     }
 }
コード例 #2
0
ファイル: VariableSchema.cs プロジェクト: larsolm/Archives
        public void Apply(VariableStore store, bool removeMissing)
        {
            if (removeMissing)
            {
                for (var i = 0; i < store.Variables.Count; i++)
                {
                    if (!Contains(store.Variables[i].Name))
                    {
                        store.Remove(i--);
                    }
                }
            }

            foreach (var definition in Definitions)
            {
                var variable = store.GetVariable(definition.Name);

                if (variable == null)
                {
                    store.Add(VariableValue.Create(definition.Name, definition.Type));
                }
                else if (variable.Type != definition.Type)
                {
                    variable.ChangeType(definition.Type);
                }
            }
        }
コード例 #3
0
        public VariableStoreControl(VariableStore store, string name, string tooltip, bool allowAdd, bool allowRemove, UnityAction <Rect, int> customDraw = null)
        {
            _store = store;

            var list = _list.Setup(_store.Variables, name, tooltip, false, false, false, allowAdd, allowRemove, customDraw ?? DrawStoreEntry, RemoveStoreEntry);

            list.onAddDropdownCallback += CustomAdd;
        }
コード例 #4
0
        public override void Setup(SerializedProperty property, FieldInfo fieldInfo)
        {
            _store = GetObject <VariableStore>(property);

            var access = fieldInfo.GetCustomAttributes(typeof(VariableAccessAttribute), true).FirstOrDefault() as VariableAccessAttribute;
            var list   = _list.Setup(_store.Variables, property.name, property.tooltip, false, false, false, access == null ? true : access.AllowAdd, access == null ? true : access.AllowRemove, DrawStoreEntry, RemoveStoreEntry);

            list.onAddDropdownCallback += CustomAdd;
        }
コード例 #5
0
ファイル: VariableStore.cs プロジェクト: larsolm/Archives
        public VariableStore Clone()
        {
            var clone = new VariableStore();

            foreach (var variable in _variables)
            {
                clone._variables.Add(variable.Clone());
            }

            return(clone);
        }
コード例 #6
0
        private void Awake()
        {
            _context = new WorldInstructionContext(gameObject, Variable.Name + " Responder", null);
            _store   = _context.GetStore(Variable);

            if (_store != null)
            {
                var variable = _store.GetVariable(Variable.Name);
                _store.Subscribe(this, null);
                Trigger(variable);
            }
        }
コード例 #7
0
        public void LoadWorld(GameManager.WorldData data)
        {
            PersistentState = data.WorldState ?? new VariableStore();

            foreach (var zone in World.Zones)
            {
                if (zone.Scene.Index < 0)
                {
                    Debug.LogFormat("zone {0} does not have a valid scene assigned", zone.name);
                }
                else
                {
                    Zones[zone.Scene.Index].PersistentState = (zone.Scene.Index < data.ZoneStates.Length ? data.ZoneStates[zone.Scene.Index] : null) ?? new VariableStore();
                }
            }
        }
コード例 #8
0
 public AddToStorePopup(VariableStore store)
 {
     _store = store;
 }
コード例 #9
0
 public BattleInstructionContext(UnityObject owner, string name, VariableStore variables) : base(owner, name, variables)
 {
 }
コード例 #10
0
 public InstructionContext(Object owner, string name, VariableStore variables)
 {
     Owner     = owner;
     Name      = name;
     Variables = variables ?? new VariableStore();
 }
コード例 #11
0
 public WorldInstructionContext(Object owner, string name, VariableStore variables) : base(owner, name, variables)
 {
 }
コード例 #12
0
 public EcosystemInstructionContext(Object Owner, string name, VariableStore variables) : base(Owner, name, variables)
 {
 }