Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        GameInfo = GameObject.Find("GameInfo");
        if (GameInfo == null)
        {
            GameInfo = new GameObject("GameInfo");
            GameInfo.AddComponent <GameInfo>();

            Invoke("Start", 0.1f);
            return;
        }
        Cheat_UI.GetComponent <Toggle> ().isOn = GameInfo.GetComponent <GameInfo> ().Cheat;

        int StageNum = GameInfo.GetComponent <GameInfo> ().StageNum;

        for (int i = 0; i < StageNum; i++)
        {
            Stage [i].GetComponent <Stage> ().StageLevel = i + 1;
            Stage [i].GetComponent <Stage> ().Init();
        }


        StageParent.SetActive(true);
        ViewCard.SetActive(true);
        ChooseSkill.SetActive(true);
        Cheat_UI.SetActive(true);

        ReadyToPlay.transform.parent.gameObject.SetActive(false);
        Close.SetActive(false);
        ReadyToUpGrade.SetActive(false);
    }
Ejemplo n.º 2
0
    //-----------------------------------------------选择技能
    public void OnClickChooseSkill()
    {
        StageParent.SetActive(false);
        ViewCard.SetActive(false);
        ChooseSkill.SetActive(false);
        Cheat_UI.SetActive(false);

        Close.SetActive(true);
        Title_UI.SetActive(true);
        Title_UI.GetComponent <Text> ().text = "选择技能\n";


        List <SkillInfo> SkillList = GameInfo.GetComponent <GameInfo> ().SkillList;
        Vector3          Position  = new Vector3(-21, 14, 0);

        SkillObjectList.Clear();
        for (int i = 1; i < SkillList.Count; i++)
        {
            GameObject tmp = Instantiate(Skill_Prefab, Position, Quaternion.identity);
            tmp.GetComponent <Skill>().SkillNum = i;
            tmp.GetComponent <Skill> ().Init();
            SkillObjectList.Add(tmp);
            Position += new Vector3(0, -5.5f, 0);
        }
    }
Ejemplo n.º 3
0
    //------------------------------------------------点击关卡
    public void OnClickStage(GameObject c)
    {
        StageLevel = c.GetComponent <Stage> ().StageLevel;
        string StageType = c.GetComponent <Stage> ().StageType;

        if (StageType == "Game")
        {
            //开始关卡
            ReadyToPlay.transform.parent.gameObject.SetActive(true);
            ReadyToPlay.GetComponent <Text> ().text = "开始关卡\"" + c.GetComponent <Stage> ().Description + "\"";
        }
        if (StageType == "UpGrade")
        {
            //升级卡牌
            StageParent.SetActive(false);
            ViewCard.SetActive(false);
            ChooseSkill.SetActive(false);
            Cheat_UI.SetActive(false);

            Close.SetActive(true);
            Title_UI.SetActive(true);
            Title_UI.GetComponent <Text>().text  = c.GetComponent <Stage> ().Description;
            Title_UI.GetComponent <Text>().text += "\n当前升级所需花费为" + (-c.GetComponent <Stage> ().GoldReword).ToString() + "金币";
            StageSelect = c;

            ShowPlayerCard("UpGrade");
            GameInfo.GetComponent <GameInfo> ().LoadStage(StageLevel);
            GameInfo.GetComponent <GameInfo> ().WinGame();
            int StageNum = GameInfo.GetComponent <GameInfo> ().StageNum;
            for (int i = 0; i < StageNum; i++)
            {
                Stage [i].GetComponent <Stage> ().Init();
            }
        }
        if (StageType == "Remove")
        {
            //移除卡牌
            StageParent.SetActive(false);
            ViewCard.SetActive(false);
            ChooseSkill.SetActive(false);
            Cheat_UI.SetActive(false);

            Close.SetActive(true);
            Title_UI.SetActive(true);
            Title_UI.GetComponent <Text>().text  = c.GetComponent <Stage> ().Description;
            Title_UI.GetComponent <Text>().text += "\n当前移除所需花费为" + (-c.GetComponent <Stage> ().GoldReword).ToString() + "金币";
            StageSelect = c;

            ShowPlayerCard("Remove");
            GameInfo.GetComponent <GameInfo> ().LoadStage(StageLevel);
            GameInfo.GetComponent <GameInfo> ().WinGame();
            int StageNum = GameInfo.GetComponent <GameInfo> ().StageNum;
            for (int i = 0; i < StageNum; i++)
            {
                Stage [i].GetComponent <Stage> ().Init();
            }
        }
    }
Ejemplo n.º 4
0
    public void OnClickViewCard()
    {
        StageParent.SetActive(false);
        ViewCard.SetActive(false);
        ChooseSkill.SetActive(false);
        Cheat_UI.SetActive(false);

        Close.SetActive(true);
        Title_UI.SetActive(true);
        Title_UI.GetComponent <Text> ().text = "查看牌组";

        ShowPlayerCard("View");
    }
Ejemplo n.º 5
0
    //-----------------------------------------返回按钮
    public void OnClickCancel()
    {
        for (int i = Player_CardObjectList.Count; i > 0; i--)
        {
            Player_CardObjectList [i - 1].GetComponent <Card> ().BeDestroied();;
        }
        Player_CardObjectList.Clear();

        StageParent.SetActive(true);
        ViewCard.SetActive(true);
        ChooseSkill.SetActive(true);
        Cheat_UI.SetActive(true);

        Close.SetActive(false);
        ReadyToUpGrade.SetActive(false);
        ReadyToRemove.SetActive(false);
        UnlockSkill.SetActive(false);
        Title_UI.SetActive(false);
        for (int i = 0; i < SkillObjectList.Count; i++)
        {
            SkillObjectList [i].GetComponent <Skill> ().Destroied();
        }
        SkillObjectList.Clear();
    }