/// <summary> /// Build this instance. /// 在所有LoadJson()调用完成后调用 /// </summary> public void Build() { // build parent-children inheritance foreach (var tp in mTypeList) { if (tp.IsClass()) { GTypeClass tpClass = tp as GTypeClass; tpClass.InheritParentFields(); } } }
public bool InheritParentFields() { if (inherited) { return(true); } if (this.Parent == null) { return(true); } // check GTypeClass parentType = (GTypeClass)GTypeManager.Instance.GetType(this.Parent); if (parentType == null || !parentType.IsClass()) { GLog.LogError("'" + this.Parent + "' is not defined or is not a 'Class'"); return(false); } parentType.InheritParentFields(); // inherit category this.Category = parentType.Category; // inherit fiedls this.mInheritedFields = new GStructField[parentType.FieldCount]; for (int i = 0; i < this.mInheritedFields.Length; ++i) { // TODO: copy or ref ? // this.mInheritedFields[i] = parentType.GetField(i); } inherited = true; return(true); }