示例#1
0
文件: Skills.cs 项目: Crwth/UltimaXNA
        public Skill(SkillData data)
        {
            m_Data = data;

            m_Index = m_Data.Index;
            m_UseButton = m_Data.UseButton;
            m_Name = m_Data.Name;
            m_Category = m_Data.Category;
            m_Unknown = m_Data.Unknown;
        }
示例#2
0
文件: Skills.cs 项目: Crwth/UltimaXNA
 public void ResetFromData()
 {
     m_Index = m_Data.Index;
     m_UseButton = m_Data.UseButton;
     m_Name = m_Data.Name;
     m_Category = m_Data.Category;
     m_Unknown = m_Data.Unknown;
 }
示例#3
0
文件: Skills.cs 项目: Crwth/UltimaXNA
        private static unsafe SkillCategory[] LoadCategories()
        {
            SkillCategory[] list = new SkillCategory[0];

            string grpPath = FileManager.GetFilePath("skillgrp.mul");

            if (grpPath == null)
            { return new SkillCategory[0]; }
            else
            {
                List<SkillCategory> toAdd = new List<SkillCategory>();

                using (FileStream stream = new FileStream(grpPath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    BinaryReader bin = new BinaryReader(stream);

                    byte[] START = new byte[4]; //File Start Offset

                    bin.Read(START, 0, 4);

                    int index = 0;

                    long
                        x = stream.Length,
                        y = 0;

                    while (y < x) //Position < Length
                    {
                        string name = ParseName(stream);
                        long fileIndex = stream.Position - name.Length;

                        if (name.Length > 0)
                        {
                            toAdd.Add(new SkillCategory(new SkillCategoryData(fileIndex, index, name)));

                            y = stream.Position;

                            ++index;
                        }
                    }
                }

                if (toAdd.Count > 0)
                {
                    list = new SkillCategory[toAdd.Count];

                    for (int i = 0; i < toAdd.Count; i++)
                    {
                        list[i] = toAdd[i];
                    }

                    toAdd.Clear();
                }
            }

            return list;
        }