Beispiel #1
0
    public void RefreshUI(HeroData hd)
    {
        this.hd            = hd;
        soulItem           = playerData.GetInstance().GetItemDatatByID(hd.node.soul_gem);
        HeroImg.spriteName = hd.node.icon_name;
        icon.spriteName    = GoodsDataOperation.GetInstance().GetSmallHeroGrameByHeroGrade(hd.grade);
        if (null == soulItem)
        {
            currentSoul = 0;
        }
        else
        {
            currentSoul = soulItem.Count;
        }
        for (int i = 0; i < StarList.Length; i++)
        {
            StarList[i].spriteName = i < hd.star ? "xing" : "xing-hui";
        }
        if (hd.star < 5)
        {
            int star = hd.star;
            RisingStarBtn.gameObject.SetActive(true);
            Gold.gameObject.SetActive(true);
            starUpHero = FSDataNodeTable <StarUpGradeNode> .GetSingleton().FindDataByType(++star);

            //更换英雄魂石图标 Gold 魂石条

            Gold.text = "" + starUpHero.evolve_cost;

            //魂石条赋值
            jingyancao.value = currentSoul / (float)starUpHero.evolve_stone_num;
            jingyancao.transform.Find("Label").GetComponent <UILabel>().text = currentSoul + "/" + starUpHero.evolve_stone_num;
        }
        else
        {
            Gold.text        = "";
            jingyancao.value = 1 / 1;
            //jingyancao.transform.Find("Label").GetComponent<UILabel>().text = currentSoul + " 英雄星级已达到满级";
            jingyancao.transform.Find("Label").GetComponent <UILabel>().text = " 英雄星级已达到满级";
            RisingStarBtn.gameObject.SetActive(false);
            Gold.gameObject.SetActive(false);
        }
        if (shengXingEffect != null)
        {
            if (shengXingEffect.gameObject.activeSelf)
            {
                shengXingEffect.gameObject.SetActive(false);
            }
        }
        for (int i = 0; i < xingxingEffect.Length; i++)
        {
            xingxingEffect[i].gameObject.SetActive(false);
        }
    }
Beispiel #2
0
    private void OnRisingStarBtnClick()
    {
        if (hd.star >= 5)
        {
            starUpHero = FSDataNodeTable <StarUpGradeNode> .GetSingleton().FindDataByType(hd.star);

            Gold.text = "" + starUpHero.evolve_cost;

            //获取物品
            //soulItem = playerData.GetInstance().GetItemDatatByID(Globe.selectHero.soul_gem);

            if (null == soulItem)
            {
                currentSoul = 0;
            }
            else
            {
                currentSoul = soulItem.Count;
            }

            jingyancao.value = 1;
            jingyancao.transform.Find("Label").GetComponent <UILabel>().text = currentSoul + "/" + starUpHero.evolve_stone_num;

            return;
        }

        //金币
        if (playerData.GetInstance().baginfo.gold < starUpHero.evolve_cost)
        {
            Control.ShowGUI(UIPanleID.UIGoldHand, EnumOpenUIType.DefaultUIOrSecond);
            return;
        }

        if (currentSoul >= starUpHero.evolve_stone_num)
        {
            soul_gem = starUpHero.evolve_stone_num;
            userGlod = starUpHero.evolve_cost;

            int star = hd.star;
            HeroAndEquipNodeData.HD = hd;
            ClientSendDataMgr.GetSingle().GetHeroSend().SendUpgradeHeroStar(Globe.selectHero.hero_id, star + 1, Globe.selectHero.soul_gem, starUpHero.evolve_stone_num);
        }
        else
        {
            //UIGoodsGetWayPanel.Instance.SetID(hd.node.soul_gem);
            //if (UILevel.instance.GetLevelData())
            //{
            //    Control.ShowGUI(GameLibrary.UIGoodsGetWayPanel);
            //}
            Control.ShowGUI(UIPanleID.UIGoodsGetWayPanel, EnumOpenUIType.DefaultUIOrSecond, false, (long)hd.node.soul_gem);
            return;
        }
    }
Beispiel #3
0
    /// <summary>
    /// 升星成功
    /// </summary>
    public void RisingStarSuccess()
    {
        StarUpGradeNode starUpHero = FSDataNodeTable <StarUpGradeNode> .GetSingleton().FindDataByType(hd.star);

        //减去金币,使用的魂石
        playerData.GetInstance().MoneyHadler(MoneyType.Gold, -starUpHero.evolve_cost);
        GoodsDataOperation.GetInstance().UseGoods(hd.node.soul_gem, starUpHero.call_stone_num);

        hd.star++;

        UpGradeStar.RefreshSoulStone(hd);
        NameArea.RefreshUI(hd);
    }
Beispiel #4
0
    public void RefreshSoulStone(HeroData hd)
    {
        this.hd  = hd;
        soulItem = playerData.GetInstance().GetItemDatatByID(hd.node.soul_gem);
        if (null == soulItem)
        {
            currentSoul = 0;
        }
        else
        {
            currentSoul = soulItem.Count;
        }

        SoulStoneIcon.GetComponent <UIButton>().normalSprite = Globe.selectHero.icon_name;

        if (hd.star < 5)
        {
            int star = hd.star;
            //RisingStarBtn.gameObject.SetActive(true);
            //Gold.gameObject.SetActive(true);
            starUpHero = FSDataNodeTable <StarUpGradeNode> .GetSingleton().FindDataByType(++star);

            //更换英雄魂石图标 Gold 魂石条

            //Gold.text = "" + starUpHero.evolve_cost;

            //魂石条赋值
            SoulStoneBar.value = currentSoul / (float)starUpHero.call_stone_num;
            SoulStoneBar.transform.Find("Label").GetComponent <UILabel>().text = currentSoul + "/" + starUpHero.call_stone_num;
        }
        else
        {
            SoulStoneBar.value = 1 / 1;
            SoulStoneBar.transform.Find("Label").GetComponent <UILabel>().text = currentSoul + "";
            //RisingStarBtn.gameObject.SetActive(false);
            //Gold.gameObject.SetActive(false);
        }
        //if (playerData.GetInstance().selfData.expPool > 0)
        //{
        //    Exp.gameObject.SetActive(true);
        //}
        //else
        //{
        //    Exp.gameObject.SetActive(false);
        //}
        Explbl.text        = playerData.GetInstance().selfData.expPool.ToString();
        Upgradenumlab.text = "提升" + HeroAndEquipNodeData.Instance().GetHeroLV(hd, playerData.GetInstance().selfData.expPool).ToString() + "级";
    }
Beispiel #5
0
    /// <summary>
    /// 信息赋值
    /// </summary>
    /// <param name="obj"></param>
    public override void Info(object obj)
    {
        heroNode = (HeroNode)obj;
        hd       = playerData.GetInstance().GetHeroDataByID(heroNode.hero_id);
        if (!Globe.allHeroDic.ContainsKey(heroNode.hero_id))
        {
            Globe.allHeroDic.Add(heroNode.hero_id, heroNode);
        }
        for (int i = 0; i < playerData.GetInstance().herodataList.Count; i++)
        {
            if (heroNode.hero_id == playerData.GetInstance().herodataList[i].id)
            {
                heroNode.isHas = true;
            }
        }

        //获取背包中的魂石
        item        = playerData.GetInstance().GetItemDatatByID(heroNode.soul_gem);
        currentSoul = null == item ? 0 : item.Count;

        if (heroNode.isHas == false)
        {
            icon.GetComponent <UISprite>().color = new Color(0, 0, 0);
            //icon.enabled = false;
            suo.enabled  = true;
            mask.enabled = true;
            mask.GetComponent <BoxCollider>().enabled = false;
            mask.alpha = 0.1f;
            for (int i = 0; i < startList.Count; i++)
            {
                startList[i].spriteName = i < heroNode.init_star ? "xing" : "xing-hui";
            }
            starUpNode = FSDataNodeTable <StarUpGradeNode> .GetSingleton().FindDataByType(heroNode.init_star);

            if (currentSoul >= starUpNode.call_stone_num)
            {
                summonBtn.gameObject.SetActive(true);
            }
            souStoneL.text = "[3BE6FFFF]" + currentSoul + "[-]/" + starUpNode.call_stone_num;
        }
        else
        {
            mask.enabled = false;
            int star = hd.star + 1;
            if (star > 5)
            {
                star = 5;
            }
            starUpNode = FSDataNodeTable <StarUpGradeNode> .GetSingleton().FindDataByType(star);

            for (int i = 0; i < 5; i++)
            {
                startList[i].spriteName = i < hd.star ? "xing" : "xing-hui";
            }
            icon.GetComponent <UISprite>().color = new Color(1, 1, 1);
            icon.enabled   = true;
            souStoneL.text = "[3BE6FFFF]" + currentSoul + "[-]/" + starUpNode.evolve_stone_num;
        }
        if (hd != null)
        {
            border.spriteName = GoodsDataOperation.GetInstance().GetHeroGrameByHeroGrade(hd.grade);
        }
        else
        {
            border.spriteName = "baikuang";
        }
        levelLabel.text = !heroNode.isHas ? "" : hd.lvl + "级";
        nameLabel.text  = heroNode.name;
        icon.spriteName = heroNode.original_painting;


        ShowType(heroNode.attribute);

        Globe.isC = true;
    }
Beispiel #6
0
    /// <summary>
    /// 读取英雄数据
    /// </summary>
    public void InitListData()
    {
        //全部英雄的字典
        heroList = new Dictionary <long, object>();

        //所有英雄的键值
        List <long> count = new List <long>();

        //排序后已英雄
        if (obj.Length <= 0)
        {
            return;
        }
        object[] objs = new object[obj.Length];

        List <object> notown = new List <object>();

        int index = 0;

        HeroNode heroNode;

        //卡牌排序可召唤英雄,拥有卡牌,未拥有卡牌
        if (playerData.GetInstance().herodataList.Count > 0)
        {
            //存储所有英雄
            for (int i = 0; i < obj.Length; i++)
            {
                heroNode = (HeroNode)obj[i];

                heroList.Add(heroNode.hero_id, obj[i]);

                count.Add(heroNode.hero_id);
            }

            //通过从背包中寻找魂石判断可召唤的英雄
            HeroNode hn;
            ItemData items;
            for (int i = 0; i < obj.Length; i++)
            {
                hn = (HeroNode)obj[i];

                if (playerData.GetInstance().GetHeroDataByID(hn.hero_id) != null)
                {
                    continue;
                }

                items = playerData.GetInstance().GetItemDatatByID(hn.soul_gem);

                StarUpGradeNode starUpNode = FSDataNodeTable <StarUpGradeNode> .GetSingleton().FindDataByType(hn.init_star);

                if (null != items)
                {
                    if (items.Count >= starUpNode.call_stone_num)
                    {
                        if (!summonList.Contains(hn.hero_id))
                        {
                            summonList.Add(hn.hero_id);
                        }
                    }
                }
            }

            object obje = null;

            //可召唤的英雄在前
            if (summonList.Count > 0)
            {
                //可召唤英雄大于1时进行排序
                if (summonList.Count > 1)
                {
                    NotownSort(summonList);
                }

                for (int i = 0; i < summonList.Count; i++)
                {
                    if (heroList.TryGetValue(summonList[i], out obje))
                    {
                        objs[index] = obje;
                        count.Remove(summonList[i]);
                        index++;
                        heroList.Remove(summonList[i]);
                    }
                }
            }

            //拥有英雄个数大于1进行排序
            if (playerData.GetInstance().herodataList.Count > 1)
            {
                HeroSort();
                //playerData.GetInstance().herodataList.Sort(new HeroDataComparer());
            }

            //已经拥有的英雄
            for (int i = 0; i < playerData.GetInstance().herodataList.Count; i++)
            {
                if (heroList.TryGetValue(playerData.GetInstance().herodataList[i].id, out obje))
                {
                    objs[index] = obje;
                    count.Remove(playerData.GetInstance().herodataList[i].id);
                    index++;
                    heroList.Remove(playerData.GetInstance().herodataList[i].id);
                }
            }

            //剩余未拥有英雄
            for (int i = 0; i < heroList.Count; i++)
            {
                if (heroList.TryGetValue(count[i], out obje))
                {
                    notown.Add(obje);
                }
            }

            //未拥有的英雄
            if (notown.Count > 0)
            {
                for (int i = 0; i < notown.Count; i++)
                {
                    objs[index] = notown[i];
                    index++;
                }
            }

            //进行显示
            InitHeroList(objs);
        }
        else//玩家未拥有卡牌
        {
            //进行显示
            InitHeroList(obj);
        }
    }