Exemplo n.º 1
0
        //scene
        public bool Load()
        {
            DestroyScene();
            XQFileStream file = new XQFileStream();

            if (file != null)
            {
                file.Open("Data/sceneinfo");
                if (file.IsOpen())
                {
                    UInt16 usNumber = 0;
                    file.ReadUShort(ref usNumber);

                    for (UInt16 i = 0; i < usNumber; i++)
                    {
                        CSceneInfo sceneinfo = new CSceneInfo();
                        sceneinfo.Load(ref file);
                        RegistSceneInfo(sceneinfo);
                    }
                    file.Close();
                    s_SceneInfoMap.Sort();
                    return(true);
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        bool ParseFile(XQFileStream file)
        {
            if (file != null && file.IsOpen())
            {
                UInt16 usNumber = 0;
                file.ReadUShort(ref usNumber);

                for (UInt16 i = 0; i < usNumber; i++)
                {
                    CItemInfo iteminfo = new CItemInfo();
                    iteminfo.Load(ref file);
                    RegistItemInfo(iteminfo);
                }

                // 额外时尚值 客户端不使用
                List <PlaceFashionInfo> m_PlaceFashionList = new List <PlaceFashionInfo>();
                _Load <PlaceFashionInfo>(file, m_PlaceFashionList);

                // 光效石属性
                XQDataLoadHelper.LoadToDic <byte, uint>(ref m_dicEffectStoneInfo, file, XQDataLoadHelper.ReadByte, XQDataLoadHelper.ReadUInt, false);

                // skin
                usNumber = 0;
                file.ReadUShort(ref usNumber);

                for (UInt16 i = 0; i < usNumber; i++)
                {
                    CSkinInfo skinInfo = new CSkinInfo();
                    skinInfo.Load(ref file);
                    AddSkinInfo(skinInfo);
                }

                //Item animation
                file.ReadUShort(ref usNumber);
                for (UInt16 i = 0; i < usNumber; i++)
                {
                    CItemAniInfo itemAniInfo = new CItemAniInfo();
                    itemAniInfo.Load(ref file);
                    AddItemAniInfo(itemAniInfo);
                }

                file.Close();
                s_ItemInfoMap.Sort();
                s_SkinInfoMap.Sort();
                s_ItemAniInfoMap.Sort();
                return(true);
            }
            return(false);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 用于从文件中读取“键”在“值”中无引用的字典
        /// </summary>
        /// <typeparam name="TKey">键</typeparam>
        /// <typeparam name="TValue">值</typeparam>
        /// <param name="outputDic">输出字典,可以为空</param>
        /// <param name="xqFile">二进制文件</param>
        /// <param name="keyLoader">键读取方法</param>
        /// <param name="valueLoader">值读取方法</param>
        /// <param name="needClear">true 需要清除原有Dictionary的内容</param>
        /// <returns>true 读取成功</returns>
        public static bool LoadToDic <TKey, TValue>(ref Dictionary <TKey, TValue> outputDic, XQFileStream xqFile, CallbackReturn <TKey, XQFileStream> keyLoader, CallbackReturn <TValue, XQFileStream> valueLoader, bool needClear)
        {
            bool res = false;

            do
            {
                if (outputDic == null)
                {
                    outputDic = new Dictionary <TKey, TValue>();
                }
                else if (needClear)
                {
                    outputDic.Clear();
                }

                if (xqFile == null || !xqFile.IsOpen())
                {
                    break;
                }

                if (keyLoader == null || valueLoader == null)
                {
                    break;
                }

                TKey   key   = default(TKey);
                TValue value = default(TValue);
                ushort count = xqFile.ReadUShort();
                for (ushort i = 0; i < count; i++)
                {
                    key   = keyLoader(xqFile);
                    value = valueLoader(xqFile);
                    if (outputDic.ContainsKey(key))
                    {
                        continue;
                    }

                    outputDic.Add(key, value);
                }

                res = true;
            } while (false);

            return(res);
        }
Exemplo n.º 4
0
        public bool LoadStage(XQFileStream file)
        {
            DestroyStage();
            if (file != null && file.IsOpen())
            {
                UInt16 usNumber = 0;
                file.ReadUShort(ref usNumber);

                for (UInt16 i = 0; i < usNumber; i++)
                {
                    CMusicStage musicstage = new CMusicStage();
                    musicstage.Load(ref file);
                    RegistMusicStage(musicstage);
                }
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
        public bool Load(XQFileStream file)
        {
            DestroyModel();
            if (file != null && file.IsOpen())
            {
                UInt16 usNumber = 0;
                file.ReadUShort(ref usNumber);

                for (UInt16 i = 0; i < usNumber; i++)
                {
                    CModelInfo modelinfo = new CModelInfo();
                    modelinfo.Load(ref file);
                    RegistModelInfo(modelinfo);
                }
                s_ModelInfoMap.Sort();
                return(true);
            }
            return(false);
        }
Exemplo n.º 6
0
        public static void Load(byte[] bytes)
        {
            XQFileStream fs = new XQFileStream();

            fs.Open(bytes);

            if (fs.IsOpen())
            {
                int    count     = fs.ReadInt();
                string assetName = null;
                for (int i = 0; i < count; ++i)
                {
                    assetName            = fs.ReadString();
                    mDicAsset[assetName] = 0;
                }
            }

            fs.Close();
        }
Exemplo n.º 7
0
 /// <summary>
 /// 从文件中读取一个uint类型的值
 /// </summary>
 /// <param name="xqFile">二进制文件</param>
 /// <returns>值</returns>
 public static uint ReadUInt(XQFileStream xqFile)
 {
     return(xqFile == null && xqFile.IsOpen() ? uint.MinValue : xqFile.ReadUInt());
 }
Exemplo n.º 8
0
 /// <summary>
 /// 从文件中读取一个byte类型的值
 /// </summary>
 /// <param name="xqFile">二进制文件</param>
 /// <returns>值</returns>
 public static byte ReadByte(XQFileStream xqFile)
 {
     return(xqFile == null && xqFile.IsOpen() ? byte.MinValue : xqFile.ReadByte());
 }