protected bool ChangeChild(ISerializableObject item) { if (item.Parent != this || (item.Idx == -1 && string.IsNullOrEmpty(item.Key)))//可能已经删除了 { Debuger.LogError("逻辑错误"); return(false); } if (!OnChangeChild(item)) { return(false); } ChangeCxt cxt = new ChangeCxt(); cxt.type = enSerializeChangeType.change; if (item._idx != -1) { cxt.idx = item._idx; } else { cxt.key = item._key; } cxt.obj = item; _changes.Add(cxt); item._valueChange = true; Change(); return(true); }
protected bool ClearChild() { if (!OnClearChild()) { return(false); } ChangeCxt cxt = new ChangeCxt(); cxt.type = enSerializeChangeType.clear; _changes.Add(cxt); Change(); return(true); }
protected bool RemoveChild(string key) { if (!OnRemoveChild(key)) { return(false); } ChangeCxt cxt = new ChangeCxt(); cxt.type = enSerializeChangeType.remove; cxt.key = key; _changes.Add(cxt); Change(); return(true); }
protected bool RemoveChild(int idx) { if (!OnRemoveChild(idx)) { return(false); } ChangeCxt cxt = new ChangeCxt(); cxt.type = enSerializeChangeType.remove; cxt.idx = idx; _changes.Add(cxt); Change(); return(true); }
protected bool AddChild(string key, ISerializableObject item) { if (item.Parent != null) { Debuger.LogError("不能重新设置序列化对象的parent"); return(false); } if (!OnAddChild(key, item)) { return(false); } ChangeCxt cxt = new ChangeCxt(); cxt.type = enSerializeChangeType.add; cxt.key = key; cxt.obj = item; _changes.Add(cxt); item._valueChange = true; Change(); return(true); }