コード例 #1
0
ファイル: TyMod.cs プロジェクト: NotSoCheezyTech/ty-1-tools
        public static bool ApplyGlobal_EqualSign(TyGlobal global, TyGlobalItem root, TyModEditItem edit)
        {
            string[] mad = new string[] { "zwrite", "type", "effect", "id" };

            // Name is always defined without an equal sign
            if (edit.Key == "name")
            {
                return(false);
            }

            // All definitions are set with the equal sign except name
            if (global.Name.EndsWith("sound"))
            {
                return(true);
            }

            // Only select definitions have equal signs
            if (global.Name.EndsWith("mad") && mad.Contains(edit.Key))
            {
                return(true);
            }

            // Harder to determine model entry
            // So we base off of the surrounding subitems
            if (global.Name.EndsWith("model"))
            {
                if (root.SubItems.Count > 0)
                {
                    return(root.SubItems[0].EqualSign);
                }
            }

            // Default to true
            return(true);
        }
コード例 #2
0
ファイル: TyMod.cs プロジェクト: NotSoCheezyTech/ty-1-tools
 public static void ApplyGlobal_Add(TyGlobal global, TyGlobalItem root, TyModEditItem edit)
 {
     for (int x = 0; x < edit.SubItems.Count; x++)
     {
         root.SubItems.Add(new TyGlobalItem(edit.SubItems[x].Key, edit.SubItems[x].Value, root.Context, root.Indents + 4, ApplyGlobal_EqualSign(global, root, edit)));
     }
 }