public static FSaveHandle Create(string fileName, FFilePath pathType, FOpenType ot = FOpenType.OT_ReadWrite) { FSaveHandle sh = new FSaveHandle(); sh.Open(fileName, pathType, ot); return(sh); }
public static string ConvertPath(string fileName, FFilePath pathType = FFilePath.FP_Cache) { string converPath = ""; if (pathType == FFilePath.FP_Relative) { converPath = fileName.ToLower(); if (FEConfigure.mIsNoPack) { converPath = _fbengine.GetEditorPath(converPath); } else { converPath = WRPath + ResConfig.FDESASSETBUNDLE + "/" + converPath; } } else if (pathType == FFilePath.FP_Cache) { converPath = WRPath + fileName; } else { converPath = fileName; } return(converPath); }
public void Build(string path, FFilePath type = FFilePath.FP_Abs) { Init(); FSaveHandle handle = FSaveHandle.Create(path, type, FOpenType.OT_Txt); handle.SetContext(mTool.Build()); handle.Save(); }
public bool Open(string fileName, FFilePath pathType, FOpenType ot = FOpenType.OT_ReadWrite) { mFOpenType = ot; mFilePath = FEngineManager.ConvertPath(fileName, pathType); Init(); if (!IsHaveSameType(mFOpenType, FOpenType.OT_Write)) { mIsLoad = File.Exists(mFilePath); return(mIsLoad ? ReadFile() : false); } return(false); }
public string LoadFile(string name, FFilePath pathType) { mStateTimeEvent = new StateTimeEvent(UpdateTimeState); string tempPath = "." + ResConfig.BEHAVIORTREE; if (!name.EndsWith(tempPath)) { name += tempPath; } //加载配置 FSaveHandle sd = FSaveHandle.Create(name, pathType); SaveTreeFile stFree = new SaveTreeFile(); return(stFree.typeName); }
public void SaveAs(string fileName, FFilePath pathType) { mFilePath = FEngineManager.ConvertPath(fileName, pathType); Save(); }
public string LoadFile(string name, FFilePath pathType = FFilePath.FP_Relative) { string tempPath = "." + ResConfig.ARPGEX; if (!name.EndsWith(tempPath)) { name += tempPath; } NewRoot(); //加载配置 FSaveHandle sd = FSaveHandle.Create(name, pathType); ArpgFileData afd = new ArpgFileData(); sd.FromObject(afd); mStartNodeName = afd.headHodeName; IList baseData = (IList)StringSerialize.Deserialize(afd.param, typeof(List <>).MakeGenericType(Assembly.Load("Assembly-CSharp").GetType(afd.typeName))); if (afd != null) { FArpgNode roots = GetRoots(); for (int i = 0; i < afd.data.Length; i++) { var d = afd.data[i]; FArgpBaseData farpgData = (FArgpBaseData)baseData[i]; if (d.conditionMothods != null) { farpgData.ConditionCallBack = new Func <FArpgNode, FArpgNode, bool> [d.conditionMothods.Length]; for (int c = 0; c < d.conditionMothods.Length; c++) { farpgData.ConditionCallBack[c] = (System.Func <FArpgMachine.FArpgNode, FArpgMachine.FArpgNode, bool>)System.Delegate.CreateDelegate(typeof(System.Func <FArpgMachine.FArpgNode, FArpgMachine.FArpgNode, bool>), farpgData, d.conditionMothods[c]); } } if (d.playMothods != null) { farpgData.PlayStateCallBacks = new Action <FArpgNode, float, int> [d.playMothods.Length]; for (int c = 0; c < d.playMothods.Length; c++) { farpgData.PlayStateCallBacks[c] = (System.Action <FArpgNode, float, int>)System.Delegate.CreateDelegate(typeof(System.Action <FArpgNode, float, int>), farpgData, d.playMothods[c]); } } FArpgNode node = roots.Regs(farpgData, true, null); node.mRect = d.rect.GetRect(); } for (int i = 0; i < afd.data.Length; i++) { var d = afd.data[i]; FArgpBaseData farpgData = (FArgpBaseData)baseData[i]; FArpgNode node = roots.mMainBuffs[farpgData.nodeName]; if (d.skipNode != "") { node.mSkipNode = roots.mMainBuffs[d.skipNode]; } if (d.nextData != null) { for (int j = 0; j < d.nextData.Length; j++) { var nextNode = roots.mMainBuffs[d.nextData[j]]; node.Regs(nextNode); } } } } SetStartNode(mStartNodeName); return(afd.typeName); }