コード例 #1
0
ファイル: GameObject.cs プロジェクト: turbo3001/LynnaLab
        /// <summary>
        ///  Returns the documentation for the object with this ID (not specific to subID).
        /// </summary>
        public Documentation GetIDDocumentation()
        {
            Documentation doc = IDConstantsMapping.GetDocumentationForValue(ID);

            if (doc == null)
            {
                return(null);
            }

            var keys = new HashSet <string>(doc.Keys);

            foreach (string key in keys)
            {
                switch (key)
                {
                case "X":
                case "Y":
                    doc.Description += "\n\n" + key + ": " + doc.GetField(key);
                    doc.RemoveField(key);
                    break;

                default:
                    if (key.Length >= 6 && key.Substring(0, 6) == "subid_")
                    {
                        string subidName = key.Substring(6);
                        doc.SetField(subidName, doc.GetSubDocumentation(key).GetField("desc"));
                    }
                    doc.RemoveField(key);
                    break;
                }
            }

            return(doc);
        }
コード例 #2
0
ファイル: GameObject.cs プロジェクト: turbo3001/LynnaLab
        /// <summary>
        ///  Returns the documentation for the object with this ID and SubID combination.
        ///
        ///  (TODO: cache, and make it so that not every object stores the subid values for everything;
        ///  might need some kind of new "BaseObject" class that only has ID, not SubID.)
        /// </summary>
        public Documentation GetSubIDDocumentation()
        {
            Documentation doc = IDConstantsMapping.GetDocumentationForValue(ID);

            if (doc == null)
            {
                return(null);
            }

            foreach (string key in doc.Keys)
            {
                if (key.Length >= 6 && key.Substring(0, 6) == "subid_")
                {
                    string range = key.Substring(6);
                    if (Helper.GetIntListFromRange(range).Contains(SubID))
                    {
                        Documentation subidDoc = doc.GetSubDocumentation(key);
                        return(subidDoc);
                    }
                }
            }

            return(doc);
        }