Exemple #1
0
    private void GenFakeBaseSkills()
    {
        for (int i = 0; i < 30; i++)
        {
            BaseSkillAsset sa = new BaseSkillAsset();
            sa.SkillId   = string.Format("test_{0:00}", i + 1);
            sa.SkillName = string.Format("基础技能{0:00}", i + 1);
            sa.SkingDesp = string.Format("这是测试用的基础技能{0:00}", i + 1);
            sa.MaxLevel  = 2;
            {
                sa.LevelDesp.Add("倍率0.8");
                sa.LevelStatusAdd.Add(5);
                sa.Prices.Add(100);
                sa.StatusBonus.Add(new float[] { 0, 0, 1, 1, 1 });
            }
            {
                sa.LevelDesp.Add("倍率1.2");
                sa.LevelStatusAdd.Add(10);
                sa.Prices.Add(300);
                sa.StatusBonus.Add(new float[] { 0, 0, 1, 1, 1 });
            }



            {
                sa.BaseCardList.Add(string.Format("test_{0:00}", i + 1));
            }
            {
                sa.BaseCardList.Add(string.Format("test_{0:00}", i + 1));
            }

            {
                sa.BaseCardList.Add(string.Format("test_xue_{0:00}", i + 1));
            }
            {
                sa.BaseCardList.Add(string.Format("test_armor_{0:00}", i + 1));
            }
            {
                sa.BaseCardList.Add(string.Format("test_armor_{0:00}", i + 1));
            }
            SkillAssetDict.Add(sa.SkillId, sa);
        }
    }
    public void SetContent(string skillId)
    {
        if (skillId == null || skillId == string.Empty)
        {
            return;
        }
        SkillInfo info = pSKillMgr.GetOwnedSkill(skillId);

        if (info == null)
        {
            return;
        }
        model.skillInfo = info;
        BaseSkillAsset bsa = info.sa as BaseSkillAsset;

        if (bsa == null)
        {
            return;
        }
        List <CardInfo> gooo = pCardMgr.GetSkillCards(skillId);

        model.infos = gooo;

        for (int i = 0; i < gooo.Count; i++)
        {
            GameObject  go          = pResLoader.Instantiate("UI/CardOut", view.CardsContainer);
            CardOutView cardOutView = new CardOutView();
            cardOutView.BindView(go.transform);
            view.AllCards.Add(cardOutView);
            cardOutView.Hint.gameObject.SetActive(false);

            CardInfo cardInfo = gooo[i];

            {
                DragEventListener listener = cardOutView.CardFace.gameObject.GetComponent <DragEventListener>();
                if (listener == null)
                {
                    listener = cardOutView.CardFace.gameObject.AddComponent <DragEventListener>();
                }

                listener.ClearClickEvent();
                listener.ClearPointerEvent();
                listener.OnClickEvent += delegate {
                    ChangeEnable(cardOutView);
                };
                listener.PointerEnterEvent += delegate {
                    ShowPopupInfo(cardInfo);
                    //idx
                };
                listener.PointerExitEvent += delegate {
                    HidePopupInfo();
                };
            }

            CardAsset ca = cardInfo.ca;
            cardOutView.Name.text = ca.CardName;
            cardOutView.Desp.text = ca.CardEffectDesp;
            cardOutView.DaGou.SetActive(!cardInfo.isDisabled);
            cardOutView.Picture.sprite = ca.Picture;

            //TODO: 质壁分离
            cardOutView.NamePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardName/" + ca.CatdImageName);
            cardOutView.Cost.text          = ca.cost + "";
            switch (ca.CardType)
            {
            case eCardType.GENG:
                cardOutView.Cover.sprite       = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Geng");
                cardOutView.Bg.sprite          = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Geng");
                cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Geng");
                Color nowColor1 = Color.white;
                ColorUtility.TryParseHtmlString(CostColor[2], out nowColor1);      //color follow the type
                cardOutView.Cost.color = nowColor1;
                break;

            case eCardType.ABILITY:
                cardOutView.Cover.sprite       = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Ability");
                cardOutView.Bg.sprite          = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Ability");
                cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Ability");
                Color nowColor2 = Color.white;
                ColorUtility.TryParseHtmlString(CostColor[1], out nowColor1);      //color follow the type
                cardOutView.Cost.color = nowColor2;
                break;

            case eCardType.ITEM:
                cardOutView.Cover.sprite       = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardCover/Item");
                cardOutView.Bg.sprite          = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardBackground/Item");
                cardOutView.TypePicture.sprite = GameMain.GetInstance().GetModule <ResLoader>().LoadResource <Sprite>("CardType/Item");
                Color nowColor3 = Color.white;
                ColorUtility.TryParseHtmlString(CostColor[0], out nowColor3);      //color follow the type
                cardOutView.Cost.color = nowColor3;
                break;
            }
        }

        UpdateUsedNumver();
        view.SkillName.text = model.skillInfo.sa.SkillName;
        view.TotalOn.isOn   = model.skillInfo.isOn;
    }
Exemple #3
0
    private void GenFakeExtendSKills()
    {
        for (int i = 0; i < 30; i++)
        {
            for (int n = 0; n < 5; n++)
            {
                ExtentSkillAsset sa = new ExtentSkillAsset();

                sa.SkillId     = string.Format("test_extend_{0:00}_{1:00}", i + 1, n + 1);
                sa.BaseSkillId = string.Format("test_{0:00}", i + 1);

                sa.SkillName = string.Format("扩展技能{0:00}-{1:00}", i + 1, n + 1);
                sa.SkingDesp = string.Format("这是测试用的扩展技能{0:00}-{1:00}", i + 1, n + 1);

                sa.Prices.Add(0);

                sa.MaxLevel = 5;
                for (int j = 0; j < 5; j++)
                {
                    if (n < 2)
                    {
                        sa.LevelDesp.Add(string.Format("将一张基础攻击卡升级为test_{0:00}", i + 1 + j + 1));
                    }
                    else if (n < 4)
                    {
                        sa.LevelDesp.Add(string.Format("将一张基础防御卡升级为test_armor_{0:00}", i + 1 + j + 1));
                    }
                    else
                    {
                        sa.LevelDesp.Add(string.Format("将一张基础加血卡升级为test_xue_{0:00}", i + 1 + j + 1));
                    }
                    sa.Difficulties.Add(i * 3 + j);

                    sa.LevelStatusAdd.Add(i + j);
                }
                for (int j = 0; j < 5; j++)
                {
                    AttachCardsInfo attached = new AttachCardsInfo();
                    CardOperator    opt1     = new CardOperator();

                    BaseSkillAsset bsa = GetSkillAsset(sa.BaseSkillId) as BaseSkillAsset;

                    opt1.opt = eCardOperatorMode.Replace;


                    if (n < 2)
                    {
                        opt1.from = string.Format("test_{0:00}", i + 1);
                        opt1.to   = string.Format("test_{0:00}", i + 1 + j + 1);
                    }
                    else if (n < 4)
                    {
                        opt1.from = string.Format("test_armor_{0:00}", i + 1);
                        opt1.to   = string.Format("test_armor_{0:00}", i + 1 + j + 1);
                    }
                    else
                    {
                        opt1.from = string.Format("test_xue_{0:00}", i + 1);
                        opt1.to   = string.Format("test_xue_{0:00}", i + 1 + j + 1);
                    }

                    //opt1.from = string.Format("test_{0:00}", i + 1);
                    //opt1.to = string.Format("test_{0:00}", i + 1 + j + 1);

                    attached.operators.Add(opt1);

                    sa.AttachCardInfos.Add(attached);
                }

                SkillAssetDict.Add(sa.SkillId, sa);
            }
        }
    }
Exemple #4
0
    public void GainSkills(string skillId)
    {
        if (GetSkillAsset(skillId) == null)
        {
            return;
        }

        SkillAsset sa = GetSkillAsset(skillId);

        foreach (SkillPrerequist s in sa.PrerequistSkills)
        {
            SkillInfo preSkill = GetOwnedSkill(s.skillId);
            if (preSkill == null || preSkill.SkillLvl < s.level)
            {
                return;
            }
        }

        SkillInfo skillInfo = GetOwnedSkill(skillId);

        if (skillInfo == null)
        {
            skillInfo = new SkillInfo(skillId, sa);
            OwnedSkills.Add(skillInfo);
            skillInfo.SkillLvl = 1;

            BaseSkillAsset bsa = sa as BaseSkillAsset;
            if (bsa != null)
            {
                mCardMgr.AddSkillCards(skillId, new List <string>(bsa.BaseCardList));
            }
        }
        else
        {
            skillInfo.SkillLvl += 1;
        }


        mRoleMdl.AddAllStatus(sa.LevelStatusAdd[skillInfo.SkillLvl - 1]);
        Debug.Log("加了" + sa.LevelStatusAdd[skillInfo.SkillLvl - 1]);

        ExtentSkillAsset esa = sa as ExtentSkillAsset;

        if (esa == null)
        {
            return;
        }

        if (skillInfo.SkillLvl > 1)
        {
            AttachCardsInfo attachInfo = esa.AttachCardInfos[skillInfo.SkillLvl - 2];
            for (int i = 0; i < attachInfo.operators.Count; i++)
            {
                mCardMgr.ChangeSkillCard(esa.BaseSkillId, attachInfo.operators[i].to, attachInfo.operators[i].from);
            }
        }
        {
            AttachCardsInfo attachInfo = esa.AttachCardInfos[skillInfo.SkillLvl - 1];

            for (int i = 0; i < attachInfo.operators.Count; i++)
            {
                mCardMgr.ChangeSkillCard(esa.BaseSkillId, attachInfo.operators[i].from, attachInfo.operators[i].to);
            }
        }
    }
Exemple #5
0
    public void ShowDetail(string skillId)
    {
        SkillAsset sa = pSkillMgr.GetSkillAsset(skillId);

        if (sa == null)
        {
            HideDetail();
            return;
        }

        view.DetailName.text = sa.SkillName;
        view.DetailDesp.text = sa.SkingDesp;
        SkillInfo info = pSkillMgr.GetOwnedSkill(skillId);

        if (info == null)
        {
            //未学习技能
            view.PracticeePanel.gameObject.SetActive(false);
            view.LearnPanel.gameObject.SetActive(true);

            view.LearnBtn.gameObject.SetActive(true);
            {
                view.MoneyCost.gameObject.SetActive(true);
                view.MoneyCost.text         = sa.Prices[0] + "";
                view.LearningNextLevel.text = "(0->1)";
            }
            view.PracticeBtn.gameObject.SetActive(false);

            view.CurLevelComp.gameObject.SetActive(false);
            view.NextLevelComp.gameObject.SetActive(true);


            string s = "";
            for (int i = 0; i < sa.PrerequistSkills.Count; i++)
            {
                s += sa.PrerequistSkills[i].skillId;
                s += sa.PrerequistSkills[i].level;
                s += "\n";
            }

            view.NextLevelCards.text = sa.LevelDesp[0];
            view.NextLevelAward.text = "属性+" + sa.LevelStatusAdd[0];

            view.Prerequist.text = s;

            //ExtentSkillAsset esa = sa as ExtentSkillAsset;
            //if(esa != null && esa.AttachCardInfos.Count!=0)
            //{
            //    AttachCardsInfo attach = esa.AttachCardInfos[0];
            //    view.CurLevelCards.text = "";
            //    for (int i = 0; i < attach.operators.Count; i++)
            //    {

            //    }
            //}
        }
        else
        {
            BaseSkillAsset bsa = info.sa as BaseSkillAsset;
            if (bsa == null)
            {
                //普通技能
                view.PracticeePanel.gameObject.SetActive(true);
                view.LearnPanel.gameObject.SetActive(false);
                view.Difficulty.text = "300";

                if (info.SkillLvl == info.sa.MaxLevel)
                {
                    view.PracticeBtn.gameObject.SetActive(false);
                }
                else
                {
                    view.PracticeBtn.gameObject.SetActive(true);
                }


                view.LearnBtn.gameObject.SetActive(false);
            }
            else
            {
                //base技能
                view.PracticeePanel.gameObject.SetActive(false);
                view.LearnPanel.gameObject.SetActive(true);

                if (info.SkillLvl == info.sa.MaxLevel)
                {
                    view.LearnBtn.gameObject.SetActive(false);
                    view.MoneyCost.gameObject.SetActive(false);
                    view.LearningNextLevel.text = "(已满级)";
                }
                else
                {
                    view.LearnBtn.gameObject.SetActive(true);
                    view.MoneyCost.text = sa.Prices[info.SkillLvl] + "";
                    view.MoneyCost.gameObject.SetActive(true);
                    view.LearningNextLevel.text = "(" + (info.SkillLvl) + "->" + (info.SkillLvl + 1) + ")";
                }

                view.PracticeBtn.gameObject.SetActive(false);
            }



            view.CurLevelComp.gameObject.SetActive(true);

            UpdateExp(info);



            view.CurLevelCards.text = sa.LevelDesp[info.SkillLvl - 1];
            view.CurLevelAward.text = "属性+" + sa.LevelStatusAdd[info.SkillLvl - 1];

            if (info.SkillLvl == sa.MaxLevel)
            {
                view.NextLevelComp.gameObject.SetActive(false);
            }
            else
            {
                view.NextLevelComp.gameObject.SetActive(true);
                view.NextLevelCards.text = sa.LevelDesp[info.SkillLvl];
                view.NextLevelAward.text = "属性+" + sa.LevelStatusAdd[info.SkillLvl];
            }

            //ExtentSkillAsset esa = sa as ExtentSkillAsset;
            //if (esa != null && esa.AttachCardInfos.Count != 0)
            //{
            //    AttachCardsInfo attach = esa.AttachCardInfos[0];
            //    view.CurLevelCards.text = "";
            //    for (int i = 0; i < attach.operators.Count; i++)
            //    {

            //    }
            //}
        }

        //view.DetailMask.gameObject.SetActive(false);
        view.Detail.gameObject.SetActive(true);
    }