protected virtual void _SaveFile(string realPath) { if (mFileHandle == null) { mFileHandle = new FSaveHandle(); mFileHandle.Open(realPath, FFilePath.FP_Cache, GetOpenType() | FOpenType.OT_Write); } mFileHandle.PushObject(this); mFileHandle.Save(); }
public void SaveFile(string fileName, Type type) { //保存配置 FSaveHandle sd = FSaveHandle.Create(fileName, FFilePath.FP_Abs, FOpenType.OT_Write); SaveTreeFile stf = new SaveTreeFile(); stf.typeName = type.FullName; stf.headHodeName = mRootNode.mData.nodeName; stf.data = new SaveTreeFile.Data[mBuffNodes.Count]; IList paramList = Array.CreateInstance(type, mBuffNodes.Count); int index = 0; stf.param = StringSerialize.Serialize(paramList); sd.PushObject(stf); sd.Save(); }
public void SaveFile(string fileName, Type type) { //保存配置 FArpgNode roots = GetRoots(); Dictionary <string, FArpgNode> nodes = roots.mMainBuffs; FSaveHandle sd = FSaveHandle.Create(fileName, FFilePath.FP_Abs, FOpenType.OT_Write); ArpgFileData arpgFileData = new ArpgFileData(); arpgFileData.typeName = type.FullName; arpgFileData.headHodeName = mStartNodeName; ArpgFileData.Data[] datas = new ArpgFileData.Data[nodes.Count]; arpgFileData.data = datas; IList paramList = Array.CreateInstance(type, nodes.Count); int index = 0; foreach (var k in nodes) { var afd = new ArpgFileData.Data(); datas[index] = afd; afd.rect = new Unit_Rect(); afd.rect.SetRect(k.Value.mRect); //条件判断事件 var conditions = k.Value.mFArgpBaseData.ConditionCallBack; if (conditions != null && conditions.Length != 0) { afd.conditionMothods = new string[conditions.Length]; for (int i = 0; i < conditions.Length; i++) { afd.conditionMothods[i] = conditions[i].Method.Name; } } //状态执行事件 var states = k.Value.mFArgpBaseData.PlayStateCallBacks; if (states != null && states.Length != 0) { afd.playMothods = new string[states.Length]; for (int i = 0; i < states.Length; i++) { afd.playMothods[i] = states[i].Method.Name; } } if (k.Value.mSkipNode != null) { afd.skipNode = k.Value.mSkipNode.mFArgpBaseData.nodeName; } afd.nextData = new string[k.Value.mNextData.Count]; for (int i = 0; i < k.Value.mNextData.Count; i++) { afd.nextData[i] = k.Value.mNextData[i].mFArgpBaseData.nodeName; } paramList[index++] = k.Value.mFArgpBaseData; } arpgFileData.param = StringSerialize.Serialize(paramList); sd.PushObject(arpgFileData); sd.Save(); }