コード例 #1
0
ファイル: RoundProperty.cs プロジェクト: qipa/Timeline
    public object Clone()
    {
        RoundGoal outdata = new RoundGoal
        {
            GoalType      = GoalType,
            Target        = Target,
            GoalCondition = GoalCondition,
            Value         = Value
        };

        return(outdata);
    }
コード例 #2
0
    private static void ReadExcelRounds()
    {
        DataRowCollection collect = ExcelAccess.ReadExcel("Res/Excel/GameData.xlsx", "rounds");

        for (int i = 2; i < collect.Count; i++)
        {
            RoundProperty role = new RoundProperty
            {
                id        = int.Parse(collect[i][0].ToString()),
                maxRound  = int.Parse(collect[i][1].ToString()),
                NeedPerse = collect[i][2].ToString() == "1"?true:false,
                Des       = collect[i][3].ToString(),
                TargetDes = collect[i][4].ToString(),
                playerId  = int.Parse(collect[i][5].ToString()),
                npcId     = int.Parse(collect[i][6].ToString()),
                title     = collect[i][7].ToString(),
                title0    = collect[i][8].ToString(),
                title1    = collect[i][9].ToString(),
            };
            List <string> rules = new List <string>();
            if (!collect[i].IsNull(10))
            {
                rules.Add(collect[i][10].ToString());
            }
            if (!collect[i].IsNull(11))
            {
                rules.Add(collect[i][11].ToString());
            }
            role.Rules = rules.ToArray();
            List <RoundGoal> funcList = new List <RoundGoal>();

            int N = (collect[i].ItemArray.Length - 11) / 4;
            for (int j = 0; j < N; j++)
            {
                if (collect[i].IsNull(12 + j * 4))
                {
                    j = N;
                    break;
                }
                RoundGoal temp = new RoundGoal();

                temp.GoalType      = (RoundGoalType)int.Parse(collect[i][12 + j * 4].ToString());
                temp.Target        = (TargetType)int.Parse(collect[i][13 + j * 4].ToString());
                temp.GoalCondition = (RoundGoalCondition)int.Parse(collect[i][14 + j * 4].ToString());
                temp.Value         = int.Parse(collect[i][15 + j * 4].ToString());

                funcList.Add(temp);
            }
            role.Goals = funcList.ToArray();
            AssetDatabase.CreateAsset(role, "Assets/Res/DataAsset/round/round" + role.id + ".asset");
        }
    }