/// <summary> /// 还原数据 /// </summary> /// <param name="overlord"></param> /// <returns>数据结构是否改变</returns> public bool RestoreData(GKToyBaseOverlord overlord) { _overlord = overlord; LoadVariable(overlord, this); nodeLst.Clear(); int i = 0; bool isEditor = GKEditor.isUnityEditor(); bool dataChanged = false; foreach (var d in nodeData) { Type t = GKToyMakerTypeManager.Instance().typeAssemblyDict[nodeTypeData[i]].GetType(nodeTypeData[i]); var n = (GKToyNode)JsonUtility.FromJson(d, t); if (n.Restore(d) && !dataChanged) { dataChanged = true; } if (isEditor && typeof(GKToyNodeGroup) == t) { ((GKToyNodeGroup)n).data = this; } nodeLst.Add(n.id, n); i++; } return(dataChanged); }
// Json转化为变量. public void LoadVariable(GKToyBaseOverlord overlord, GKToyData data) { variableLst.Clear(); int i = 0; foreach (var d in variableData) { Type t = Type.GetType(variableTypeData[i]); var v = JsonUtility.FromJson(d, t) as GKToyVariable; // 序列化后引用为堆内存, 需要重新指定. if (null != v) { v.InitializePropertyMapping(overlord, data); } if (variableLst.ContainsKey(v.PropertyMapping)) { variableLst[v.PropertyMapping].Add(v); } else { List <object> lst = new List <object>(); lst.Add(v); variableLst.Add(v.PropertyMapping, lst); } i++; } }
public override void Init(GKToyBaseOverlord ovelord) { base.Init(ovelord); _output = new GKToySharedVector3(); outputObject = _output; _transform = ovelord.gameObject.GetComponent <Transform>(); }
public OverlordBackData(string dataPath, GKToyBaseOverlord overlord) { internalData = new BackupDataItem(AssetDatabase.GetAssetPath(overlord.internalData), string.Format("{0}{1}_back.dbak", dataPath, overlord.internalData.name)); externalDatas = new Dictionary <string, BackupDataItem>(); foreach (GKToyExternalData external in overlord.externalDatas) { externalDatas.Add(external.name, new BackupDataItem(AssetDatabase.GetAssetPath(external), string.Format("{0}{1}_back.dbak", dataPath, external.name))); } isPlaying = overlord.isPlaying; }
virtual public void Init(GKToyBaseOverlord ovelord) { _overlord = ovelord; Type t = GetType(); props = t.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); var fs = t.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly); if (null == propStates) { propNames = new string[props.Length]; propStates = new int[props.Length]; ioStates = new int[props.Length]; propLock = new bool[props.Length]; for (int i = 0; i < props.Length; i++) { propNames[i] = props[i].Name; propStates[i] = -1; ioStates[i] = 0; propLock[i] = false; } } state = NodeState.Inactive; parmRect = new Dictionary <string, NodeParm>(); parmRect.Clear(); for (int i = 0; i < props.Length; i++) { // 引用变量赋值. if (-1 != propStates[i]) { var v = props[i].PropertyType; var vlst = _overlord.GetVariableListByType(v); if (vlst.Count > propStates[i]) { props[i].SetValue(this, ((GKToyVariable)vlst[propStates[i]]), null); } } NodeParm np = new NodeParm(); np.propretyInfo = props[i]; np.rect = Rect.zero; // 参数节点区域初始化. parmRect.Add(props[i].Name, np); } }
public override void Init(GKToyBaseOverlord ovelord) { base.Init(ovelord); outputObject = Target; }
override public void Init(GKToyBaseOverlord ovelord) { base.Init(ovelord); outputObject = null; }
override public void Init(GKToyBaseOverlord ovelord) { _overlord = ovelord; state = NodeState.Inactive; }
override public void Init(GKToyBaseOverlord ovelord) { _overlord = ovelord; }
public override void Init(GKToyBaseOverlord ovelord) { base.Init(ovelord); _output = new GKToySharedFloat(); outputObject = _output; }
override public void Init(GKToyBaseOverlord ovelord) { base.Init(ovelord); outputObject = KeyCode.A; }
public override void Init(GKToyBaseOverlord ovelord) { base.Init(ovelord); }
public virtual void InitializePropertyMapping(GKToyBaseOverlord overlord, GKToyData data) { PropertyMappingOwner = overlord; PropertyDataOwner = data; PropertyMapping = GetType().ToString(); }
override public void Init(GKToyBaseOverlord ovelord) { base.Init(ovelord); _renderer = ovelord.gameObject.GetComponentInChildren <Renderer>(); outputObject = Color.white; }
public void Init(GKToyBaseOverlord overlord) { _overlord = overlord; LoadVariable(overlord, this); LoadNodes(); }
override public void Init(GKToyBaseOverlord ovelord) { base.Init(ovelord); _output = new GKToySharedVector3(); outputObject = _output; }
public override void Init(GKToyBaseOverlord ovelord) { base.Init(ovelord); outputObject = Rotation; _transform = ovelord.gameObject.GetComponent <Transform>(); }