Exemple #1
0
        public List <UpdatedData> Dispatch(object obj, bool merge)
        {
            if (obj == null)
            {
                return(CleanUpRecursive());
            }

            List <UpdatedData> updatedList = new List <UpdatedData>();

            if (Value != null)
            {
                if (merge)
                {
                    Value.OnMerge(obj);
                }
                else
                {
                    try
                    {
                        Value.OnUpdate(obj);
                    }
                    catch (Exception e)
                    {
                        EB.Debug.LogError(e);
                        Debug.LogError(Value.ToString());
                    }
                }

                UpdatedData updated = new UpdatedData(FullPath, Value);
                updatedList.Add(updated);
            }

            if (obj is IDictionary == false)
            {
                // EB.Debug.LogError($"obj is {obj.ToString()}");
                return(updatedList);
            }

            IDictionary dict = obj as IDictionary;

            string[] keys = new string[mPathes.Count];
            mPathes.Keys.CopyTo(keys, 0);

            for (var i = 0; i < keys.Length; i++)
            {
                var key = keys[i];

                if (!dict.Contains(key))
                {
                    continue;
                }

                updatedList.AddRange(mPathes[key].Dispatch(dict[key], merge));
            }

            return(updatedList);
        }
Exemple #2
0
        public void SetDirty(string path)
        {
            UpdatedData updated = new UpdatedData();

            updated.Path = path;
            updated.Data = Find <INodeData>(path);
            if (updated.Data == null)
            {
                EB.Debug.LogError("SetDirty: can't find data in path {0}", path);
                return;
            }

            List <UpdatedData> updatedList = new List <UpdatedData>();

            updatedList.Add(updated);

            NotifyListeners(updatedList);
        }
Exemple #3
0
        public List <UpdatedData> CleanUpRecursive()
        {
            List <UpdatedData> updatedList = new List <UpdatedData>();

            string[] keys = new string[mPathes.Count];
            mPathes.Keys.CopyTo(keys, 0);

            for (var i = 0; i < keys.Length; i++)
            {
                updatedList.AddRange(mPathes[keys[i]].CleanUpRecursive());
            }

            if (Value != null)
            {
                Value.CleanUp();
                UpdatedData cleaned = new UpdatedData(FullPath, Value);
                updatedList.Add(cleaned);
            }

            return(updatedList);
        }