Exemplo n.º 1
0
 /// <summary>
 ///     師団ユニットクラス定義を書き込む
 /// </summary>
 /// <param name="unit">ユニットクラスデータ</param>
 /// <param name="writer">ファイル書き込み用</param>
 private static void WriteDivisionType(UnitClass unit, StreamWriter writer)
 {
     writer.WriteLine();
     if (unit.Type < UnitType.ReserveDivision33 || unit.Type > UnitType.ReserveDivision40)
     {
         writer.WriteLine("{0} = {{", Units.Strings[(int) unit.Type]);
     }
     else
     {
         writer.WriteLine("{0} = {{\t# Reserved for use by Darkest Hour Full", Units.Strings[(int) unit.Type]);
     }
     writer.WriteLine("\t#ID\t\t\t{0}", Units.UnitNumbers[(int) unit.Type]);
     if (unit.ExistsEntity() || (unit.Models.Count > 0))
     {
         writer.WriteLine("\ttype\t\t= {0}", Units.RealStrings[(int) unit.RealType]);
         writer.WriteLine("\tname\t\t= {0}", unit.Name);
         writer.WriteLine("\tshort_name\t= {0}", unit.ShortName);
         writer.WriteLine("\tdesc\t\t= {0}", unit.Desc);
         writer.WriteLine("\tshort_desc\t= {0}", unit.ShortDesc);
         writer.WriteLine("\teyr\t\t\t= {0}", unit.Eyr);
         writer.WriteLine("\tsprite\t\t= {0}", Units.SpriteStrings[(int) unit.Sprite]);
         writer.WriteLine("\ttransmute\t= {0}", Units.Strings[(int) unit.Transmute]);
         writer.WriteLine("\tgfx_prio\t= {0}", unit.GfxPrio);
         if (unit.DefaultType)
         {
             string s = Units.RealStrings[(int) unit.RealType];
             int len = s.Length;
             if (len < 4)
             {
                 writer.WriteLine("\t{0}\t\t\t= yes", s);
             }
             else if (len < 8)
             {
                 writer.WriteLine("\t{0}\t\t= yes", s);
             }
             else if (len < 12)
             {
                 writer.WriteLine("\t{0}\t= yes", s);
             }
             else
             {
                 writer.WriteLine("\t{0} = yes", s);
             }
         }
         writer.WriteLine("\tvalue\t\t= {0}", DoubleHelper.ToString(unit.Value));
         if (unit.Productable)
         {
             writer.WriteLine("\tproduction\t= yes");
         }
     }
     writer.WriteLine("\tlist_prio\t= {0}", unit.ListPrio);
     if (unit.UiPrio != 0)
     {
         writer.WriteLine("\tui_prio\t\t= {0}", unit.UiPrio);
     }
     writer.WriteLine("}");
 }
Exemplo n.º 2
0
        /// <summary>
        ///     旅団ユニットクラス定義を書き込む
        /// </summary>
        /// <param name="unit">ユニットクラスデータ</param>
        /// <param name="writer">ファイル書き込み用</param>
        private static void WriteBrigadeType(UnitClass unit, StreamWriter writer)
        {
            writer.WriteLine();
            if (unit.Type == UnitType.None)
            {
                writer.WriteLine("{0} = {{\t#DO NOT CHANGE!!!", Units.Strings[(int) unit.Type]);
            }
            else if (unit.Type >= UnitType.ReserveBrigade36 && unit.Type <= UnitType.ReserveBrigade40)
            {
                writer.WriteLine("{0} = {{\t# Reserved for use by Darkest Hour Full", Units.Strings[(int) unit.Type]);
            }
            else
            {
                writer.WriteLine("{0} = {{", Units.Strings[(int) unit.Type]);
            }
            writer.WriteLine("\t#ID\t\t\t{0}", Units.UnitNumbers[(int) unit.Type]);
            if (unit.ExistsEntity() || (unit.Models.Count > 0))
            {
                switch (unit.Branch)
                {
                    case Branch.Army:
                        writer.WriteLine("\ttype\t\t= land");
                        break;

                    case Branch.Navy:
                        writer.WriteLine("\ttype\t\t= naval");
                        break;

                    case Branch.Airforce:
                        writer.WriteLine("\ttype\t\t= air");
                        break;
                }
                writer.WriteLine("\tname\t\t= {0}", unit.Name);
                writer.WriteLine("\tshort_name\t= {0}", unit.ShortName);
                writer.WriteLine("\tdesc\t\t= {0}", unit.Desc);
                writer.WriteLine("\tshort_desc\t= {0}", unit.ShortDesc);
                writer.WriteLine("\tvalue\t\t= {0}", DoubleHelper.ToString(unit.Value));
                if (unit.Cag)
                {
                    writer.WriteLine("\tcag\t\t\t= yes");
                }
                if (unit.Escort)
                {
                    writer.WriteLine("\tescort\t\t= yes");
                }
                if (unit.Engineer)
                {
                    writer.WriteLine("\tengineer\t= yes");
                }
            }
            if ((unit.Type != UnitType.None) || (unit.ListPrio != -1))
            {
                writer.WriteLine("\tlist_prio\t= {0}", unit.ListPrio);
            }
            writer.WriteLine("}");
        }