Beispiel #1
0
    //加载数据
    public void LoadAsset(int level)
    {
        DataReady = false;

        //读取关卡规则信息
        if (level < GameData.Instance.SystemData.AllRounds.Length)
        {
            roundData = (RoundProperty)(GameData.Instance.SystemData.AllRounds[level]).Clone();
        }
        //读取关卡的回合数 步骤等信息
        if (level < GameData.Instance.SystemData.AllLevels.Length)
        {
            levelData = (LevelData)(GameData.Instance.SystemData.AllLevels[level]).Clone();
            MaxRound  = levelData.rounds.Length;
            InitData();
            DataReady = true;
            //设置UI显示数据
            UIRoundData = new object[4] {
                roundData, RemainRound, StepType.None, level
            };
            //显示UI
            UIManager.Instance.ShowUI <UIGameRound>(null, UIRoundData);
            StartCoroutine(StartBattle());
        }
    }
Beispiel #2
0
    public void UpdateDataShow()
    {
        object[]      list = (object[])data;
        RoundProperty p    = (RoundProperty)list[0];

        Label_Level.SetText(StrOpe.i + "关卡:" + p.id.ToString());
        Label_Goal.SetText(StrOpe.i + "目标:" + p.TargetDes);
        Label_RoundNum.SetText(StrOpe.i + "剩余回合数:" + (int)list[3]);
        Label_Des.SetText(p.Des);
        Label_title0.SetText(p.title);
        Label_title1.SetText(p.title0);
        Label_title2.SetText(p.title1);
        Label_title3.SetText(p.title0);
        Label_title4.SetText(p.title1);
        Label_Profit00.SetText(p.Profit[0].ToString());
        Label_Profit01.SetText(p.Profit[1].ToString());
        Label_Profit10.SetText(p.Profit[2].ToString());
        Label_Profit11.SetText(p.Profit[3].ToString());

        RoleProperty player = (RoleProperty)list[1];

        Player_Money.SetText(StrOpe.i + "金钱:" + player.Money.ToString());
        Player_Hornor.SetText(StrOpe.i + "荣誉:" + player.Honor.ToString());
        Player_Amity.SetText(StrOpe.i + "友好度:" + player.Amity.ToString());

        RoleProperty npc = (RoleProperty)list[2];

        NPC_Money.SetText(StrOpe.i + "金钱:" + npc.Money.ToString());
        NPC_Hornor.SetText(StrOpe.i + "荣誉:" + npc.Honor.ToString());
        NPC_Amity.SetText(StrOpe.i + "友好度:" + npc.Amity.ToString());
    }
Beispiel #3
0
    private static void CreateRoundData()
    {
        RoundProperty role = new RoundProperty();
        string        path = EditorUtility.SaveFilePanel("", Application.dataPath + "/", "", "asset");

        if (path.Length != 0)
        {
            path = "Assets" + path.Replace(Application.dataPath, "");
            AssetDatabase.CreateAsset(role, path);
        }
    }
Beispiel #4
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");
        }
    }
Beispiel #5
0
 //加载数据
 public void LoadAsset(int level)
 {
     DataReady = false;
     if (level < GameData.Instance.SystemData.AllRounds.Length)
     {
         roundData = (RoundProperty)(GameData.Instance.SystemData.AllRounds[level]).Clone();
         InitData();
         DataReady   = true;
         UIRoundData = new object[4] {
             RoundSystem.Instance.roundData, RoundSystem.Instance.PlayerAtt.property, RoundSystem.Instance.NPCAtt.property, RoundSystem.Instance.RemainRound
         };
         UIManager.Instance.ShowUI <UIRound>(null, UIRoundData);
         UIManager.Instance.ShowUI <UICardPad>();
         StartCoroutine(StartBattle());
     }
 }
Beispiel #6
0
    public object Clone()
    {
        RoundProperty outdata = new RoundProperty
        {
            id        = id,
            NeedPerse = NeedPerse,
            Des       = Des,
            title     = title,
            title0    = title0,
            title1    = title1,
            maxRound  = maxRound,
            TargetDes = TargetDes,
            Rules     = (string[])Rules.Clone(),
            Goals     = (RoundGoal[])Goals.Clone(),
            Profit    = (Vector2[])Profit.Clone()
        };

        return(outdata);
    }
Beispiel #7
0
    public void UpdateDataShow()
    {
        object[]      list = (object[])data;
        RoundProperty p    = (RoundProperty)list[0];

        Label_Level.SetText(StrOpe.i + "关卡:" + (int)((int)list[3] + 1));
        Label_Goal.SetText(StrOpe.i + "目标:" + p.TargetDes);
        Label_RoundNum.SetText(StrOpe.i + "剩余回合数:" + (int)list[1]);
        Label_Des.SetText(p.Des);
        Label_title0.SetText(p.title);
        Label_title1.SetText(p.title0);
        Label_title2.SetText(p.title1);
        Label_title3.SetText(p.title0);
        Label_title4.SetText(p.title1);
        Label_Profit00.SetText(p.Profit[0].ToString());
        Label_Profit01.SetText(p.Profit[1].ToString());
        Label_Profit10.SetText(p.Profit[2].ToString());
        Label_Profit11.SetText(p.Profit[3].ToString());

        label_Yourchoose.gameObject.SetActive(false);
        btn_Do.gameObject.SetActive(false);
        btn_UnDo.gameObject.SetActive(false);

        label_Result.gameObject.SetActive(false);
        label_Earn.gameObject.SetActive(false);

        label_useCard.gameObject.SetActive(false);
        btn_Card1.gameObject.SetActive(false);
        btn_Card2.gameObject.SetActive(false);

        label_friend.gameObject.SetActive(false);
        label_NPCRate.gameObject.SetActive(false);
        btn_Next.gameObject.SetActive(false);
        UIcollider.SetActive(false);

        btn_Player.enabled = false;
        btn_NPC.enabled    = false;
        chooseSide.gameObject.SetActive(false);

        StepType type = (StepType)list[2];

        switch (type)
        {
        case StepType.DoChoice:
        {
            label_Yourchoose.gameObject.SetActive(true);
            btn_Do.gameObject.SetActive(true);
            btn_UnDo.gameObject.SetActive(true);
            break;
        }

        case StepType.UseCard:
        {
            label_useCard.gameObject.SetActive(true);
            btn_Card1.gameObject.SetActive(true);
            btn_Card2.gameObject.SetActive(true);
            break;
        }

        case StepType.Think:
        {
            label_friend.gameObject.SetActive(true);
            label_NPCRate.gameObject.SetActive(true);
            btn_Next.gameObject.SetActive(true);
            break;
        }

        case StepType.Result:
        {
            label_Result.gameObject.SetActive(true);
            label_Earn.gameObject.SetActive(true);
            break;
        }

        default: break;
        }
    }