Пример #1
0
 protected virtual bool _ReadFile(string realPath)
 {
     mFileHandle = new FSaveHandle();
     mFileHandle.Open(realPath, FFilePath.FP_Cache, GetOpenType() & (~FOpenType.OT_Write));
     if (mFileHandle.IsLoad)
     {
         mFileHandle.FromObject(this);
         return(true);
     }
     return(false);
 }
Пример #2
0
        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);
        }