예제 #1
0
    public static List <AttackData> m_magicData;     //魔法攻撃データ


    //物理攻撃の名前を返す
    private static string PhysicalNameString(PhysicalName physical)
    {
        switch (physical)
        {
        default:
            return("");
        }
    }
예제 #2
0
    /// <summary>
    ///     If the object passed in is equivalent, return true
    /// </summary>
    /// <param name="obj">the object to compare</param>
    /// <returns>true if this instance and obj are equivalent</returns>
    public override Boolean Equals(Object obj)
    {
        var result = this == obj;

        if (result || obj is not Destination other)
        {
            return(result);
        }
        result = GetDestinationType() == other.GetDestinationType() &&
                 PhysicalName.Equals(other.PhysicalName);
        return(result);
    }
예제 #3
0
    /// <summary>
    /// </summary>
    /// <returns>hashCode for this instance</returns>
    public override Int32 GetHashCode()
    {
        var answer = 37;

        if (PhysicalName != null)
        {
            answer = PhysicalName.GetHashCode();
        }
        if (IsTopic)
        {
            answer ^= 0xfabfab;
        }
        return(answer);
    }
예제 #4
0
 //初期化
 void Start()
 {
     m_physicalData = new List <AttackData>();
     m_magicData    = new List <AttackData>();
     for (PhysicalName i = 0; i < PhysicalName.number; i++)
     {
         m_physicalData.Add(new AttackData());
         ReadPhysicalDataCsv(i);
     }
     for (MagicName i = 0; i < MagicName.number; i++)
     {
         m_magicData.Add(new AttackData());
         ReadMagicDataCsv(i);
     }
 }
예제 #5
0
    //物理攻撃データを入力する
    void ReadPhysicalDataCsv(PhysicalName physical)
    {
        List <List <bool> > attackArea;     //攻撃範囲
        TextAsset           csv;            //テキストアセット
        StringReader        reader;         //文字列読み込みクラス
        string line;                        //読み込み文字列

        string[] values;                    //読み込み文字列の単語
        int      count;                     //凡庸カウンター

        csv    = Resources.Load("CSV/" + PhysicalNameString(physical)) as TextAsset;
        reader = new StringReader(csv.text);
        if (reader.Peek() == -1)
        {
            return;
        }
        //余分な文字列を排除する
        line = reader.ReadLine();
        //物理の攻撃範囲の情報を取得
        count      = 0;
        attackArea = new List <List <bool> >();
        while (reader.Peek() > -1)
        {
            line   = reader.ReadLine();
            values = line.Split(',');
            attackArea.Add(new List <bool>());
            for (int i = 0; i < values.Length; i++)
            {
                if (int.Parse(values[i]) == 0)
                {
                    attackArea[count].Add(false);
                }
                else
                {
                    attackArea[count].Add(true);
                }
            }
            count++;
        }
        //攻撃範囲を入力
        m_physicalData[(int)physical].m_range = new bool[attackArea.Count][];
        for (int i = 0; i < attackArea.Count; i++)
        {
            m_physicalData[(int)physical].m_range[i] = attackArea[i].ToArray();
        }
        m_physicalData[(int)physical].m_centerXRange = Mathf.FloorToInt(m_physicalData[(int)physical].m_range.Length / 2);
        m_physicalData[(int)physical].m_centerYRange = Mathf.FloorToInt(m_physicalData[(int)physical].m_range[0].Length / 2);
    }
예제 #6
0
        public string GenerateEnumScript()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.SetUsing("System.Collections.Generic");
            stringBuilder.AppendLine();
            stringBuilder.SetNameSpace("App");
            stringBuilder.Indent0().AppendLine("{");
            stringBuilder.SetSummaryComment($"This enum is generated automatically, so it can not be edited.\nTable logical name is {LogicalName}", 1);

            stringBuilder.AppendLine();
            stringBuilder.Indent1().AppendLine($"public enum {PhysicalName.SnakeToUpperCamel()}");
            stringBuilder.Indent1().AppendLine("{");

            foreach (TableDefinitionDataEntity entity in data)
            {
                stringBuilder.AppendLine(entity.GenerateEnumValueScript());
            }

            stringBuilder.Indent1().AppendLine("}");
            stringBuilder.AppendLine();

            stringBuilder.Indent1().AppendLine($"public class {PhysicalName.SnakeToUpperCamel()}Compare : IEqualityComparer<{PhysicalName.SnakeToUpperCamel()}>");
            stringBuilder.Indent1().AppendLine("{");
            stringBuilder.Indent2().AppendLine($"public bool Equals({PhysicalName.SnakeToUpperCamel()} x, {PhysicalName.SnakeToUpperCamel()} y) " + "{");
            stringBuilder.Indent3().AppendLine("return x == y;");
            stringBuilder.Indent2().AppendLine("}");
            stringBuilder.AppendLine();
            stringBuilder.Indent2().AppendLine($"public int GetHashCode({PhysicalName.SnakeToUpperCamel()} obj) " + "{");
            stringBuilder.Indent3().AppendLine("return (int)obj;");
            stringBuilder.Indent2().AppendLine("}");
            stringBuilder.Indent1().AppendLine("}");
            stringBuilder.AppendLine();

            stringBuilder.Indent1().AppendLine($"public static partial class {PhysicalName.SnakeToUpperCamel()}Extensions");
            stringBuilder.Indent1().AppendLine("{");

            foreach (TableDefinitionDataEntity entity in data)
            {
                stringBuilder.AppendLine(entity.GenerateBooleanScript(physicalName));
                stringBuilder.AppendLine();
            }

            stringBuilder.Indent1().AppendLine("}");
            stringBuilder.Indent0().AppendLine("}");

            return(stringBuilder.ToString());
        }