public void Update(int cardId)
    {
        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardId);

        if (null == heroInfo)
        {
            return;
        }

        m_name.text = heroInfo.StrName;

        m_cardNumber.text = heroInfo.CardId + "";

        IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(heroInfo.ImageId);

        m_card.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
        OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);

        iconInfo = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);
        m_occ.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);


        RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity);

        iconInfo = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
        m_rarity.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
    }
Exemple #2
0
    void OnButtonFireSkill(object sender, EventArgs e)
    {
        if (BattleArena.Singleton.SwordSoul.Percent != 1.0f)
        {
            return;
        }
        MainPlayer currentActor = ActorManager.Singleton.MainActor;
        int        skillID      = currentActor.CurrentTableInfo.SwordSoulSkillID;

        if (skillID == 0)
        {
            OccupationInfo info = GameTable.OccupationInfoAsset.LookUp(currentActor.CurrentTableInfo.Occupation);
            if (info == null)
            {
                Debug.LogError("current occupation is null,occupation:" + currentActor.CurrentTableInfo.Occupation);
                return;
            }
            if (info.m_swordSoulList.Count == 0 || info.m_swordSoulList[0] == 0)
            {
                Debug.LogError("current occupation is not have sword soul skill,occupation:" + currentActor.CurrentTableInfo.Occupation);
                return;
            }
            skillID = info.m_swordSoulList[0];
        }
        if (skillID == 0)
        {
            Debug.LogError("sword soul skill is null");
            return;
        }
        if (currentActor.OnFireSkill(skillID))
        {
            BattleArena.Singleton.SwordSoul.Clear();
        }
    }
Exemple #3
0
    // 更新战友模型相关信息
    void UpdateHelperModel()
    {
        Helper helper = User.Singleton.HelperList.LookupHelper(StageMenu.Singleton.m_curHelperGuid);

        if (null != helper)
        {
            AddHelperModel(helper.m_cardId);

            HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(helper.m_cardId);
            if (null != heroInfo)
            {
                m_helperCardName.text  = heroInfo.StrName;
                m_helperCardLevel.text = Localization.Get("CardLevel") + helper.m_cardLevel;
                RaceInfo raceInfo = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type);
                m_helperCardRace.text = raceInfo.m_name;
                OccupationInfo occInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);
                m_helperCardOcc.text = occInfo.m_name;

                AttrRatioInfo rarityInfo = GameTable.attrRatioTableAsset.LookUp(heroInfo.Occupation, heroInfo.Rarity);
                // 计算生命值
                int hp = (int)((heroInfo.FHPMax + rarityInfo.m_hPMaxAdd * (helper.m_cardLevel - 1)) * rarityInfo.m_hpMutiply);

                m_helperHP.text = hp.ToString();


                // 计算物理攻击力
                int attack = BattleFormula.GetPhyAttack(helper.m_cardId, 1);
                m_helperPhyAttack.text = attack.ToString();

                // 魔法攻击力
                attack = BattleFormula.GetMagAttack(helper.m_cardId, 1);
                m_helperMagAttack.text = attack.ToString();
            }
        }
    }
Exemple #4
0
    public OccupationInfo LookUp(int id)
    {
        OccupationInfo info = null;

        if (m_map.TryGetValue(id, out info))
        {
            return(info);
        }

        return(null);
    }
Exemple #5
0
    // 添加 队伍索引按钮
    void AddTeamIndexItem()
    {
        for (int i = 0; i < m_teamIndexList.Count; i++)
        {
            m_teamIndexList[i].SetActive(false);
        }

        GameObject obj = null;

        for (int i = 0; i < Team.Singleton.TeamNum; i++)
        {
            // 如果不存在 则创建
            if (false == m_teamIndexList.ContainsKey(i))
            {
                obj = GameObject.Instantiate(m_teamIndexItem.gameObject) as GameObject;

                obj.transform.parent        = m_teamIndexItem.transform.parent;
                obj.transform.localScale    = m_teamIndexItem.transform.localScale;
                obj.transform.localRotation = m_teamIndexItem.transform.localRotation;
                obj.transform.localPosition = m_teamIndexItem.transform.localPosition;

                obj.name = obj.name + i;
                AddChildMouseClickEvent(obj.name, OnChangTeam);
                m_teamIndexList.Add(i, obj);
            }

            obj = m_teamIndexList[i].gameObject;
            Parma parma = obj.GetComponent <Parma>();
            parma.m_id = i;
            obj.SetActive(true);
            obj.GetComponent <UIToggle>().value = Team.Singleton.m_curTeamIndex == i;

            // 设置职业图标
            CSItem card = Team.Singleton.GetCard(i, Team.EDITTYPE.enMain);
            if (null != card)
            {
                HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);
                if (null != info)
                {
                    OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                    IconInfomation iconInfo       = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);
                    obj.transform.Find("OccPic").GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
                }
            }
            else
            {
                obj.transform.Find("OccPic").GetComponent <UITexture>().mainTexture = null;
            }
        }
    }
Exemple #6
0
    public void Load(byte[] bytes)
    {
        m_map = new Dictionary <int, OccupationInfo>();
        BinaryHelper helper = new BinaryHelper(bytes);

        int sceneCount = helper.ReadInt();

        for (int index = 0; index < sceneCount; ++index)
        {
            OccupationInfo info = new OccupationInfo();

            info.Load(helper);

            m_map.Add(info.m_id, info);
        }
    }
Exemple #7
0
    void InitAttribute(HeroInfo info)
    {
        Attribute.BaseSpeed = AppConst.BaseSpeed;
        Attribute.Speed     = Attribute.BaseSpeed;
        //Attribute.RebornTime = AppConst.RebornTime;
        Attribute.Basedis      = AppConst.Basedis;
        Attribute.Atkdis       = Attribute.Basedis;
        Attribute.MaxPhy       = AppConst.MaxPhy;
        Attribute.CurPhy       = Attribute.MaxPhy;
        Attribute.CostPhySpeed = AppConst.CostPhySpeed;
        Attribute.MaxHp        = AppConst.MaxHp;
        Attribute.Hp           = Attribute.MaxHp;

        OccupationInfo occpInfo = InfoMgr <OccupationInfo> .Instance.GetInfo(info.occupationId);

        Attribute.Skills = occpInfo.skillId;
        //Attribute.Score = 0;
        //Attribute.Level = 0;
    }
Exemple #8
0
    void InitAttribute(HeroInfo info)
    {
        if (isInitAttr)
        {
            return;
        }
        isInitAttr             = true;
        Attribute.BaseSpeed    = AppConst.BaseSpeed;
        Attribute.Speed        = Attribute.BaseSpeed;
        Attribute.Basedis      = AppConst.Basedis;
        Attribute.Atkdis       = Attribute.Basedis;
        Attribute.MaxPhy       = AppConst.MaxPhy;
        Attribute.CurPhy       = Attribute.MaxPhy;
        Attribute.CostPhySpeed = AppConst.CostPhySpeed;
        Attribute.MaxHp        = AppConst.MaxHp;
        Attribute.Hp           = Attribute.MaxHp;
        OccupationInfo occpInfo = InfoMgr <OccupationInfo> .Instance.GetInfo(info.occupationId);

        Attribute.Skills = occpInfo.skillId;
    }
    //添加非指定素材
    void AddUnAppoint(UISprite sprite, FormulaParam param)
    {
        Transform      texure     = sprite.transform.Find("Sprite");
        Transform      starTexure = sprite.transform.Find("Texture");
        WorldParamInfo worldInfo  = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enCardDivisionUnAppointIcon);
        IconInfomation imageInfo  = GameTable.IconInfoTableAsset.Lookup(worldInfo.IntTypeValue);

        texure.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName);
        Transform      label    = sprite.transform.Find("MateriaLabel");
        int            level    = param.paramLevel;
        int            occ      = param.paramOccu;
        int            star     = param.paramRarity;
        OccupationInfo occTable = GameTable.OccupationInfoAsset.LookUp(occ);

        if (null == occTable)
        {
            return;
        }
        label.GetComponent <UILabel>().text  = string.Format(Localization.Get("Occupation"), occTable.m_name, level);
        label.GetComponent <UILabel>().color = Color.red;
        label.gameObject.SetActive(true);
        //设置星级图标
        RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(star);

        if (null == rarityInfo)
        {
            Debug.Log("RarityRelativeInfo rarityInfo == null info.RarityId:" + star);
            return;
        }
        IconInfomation rarityIcon = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);

        if (null == rarityIcon)
        {
            Debug.Log("IconInfomation rarityIcon == null rarityInfo.m_iconId:" + rarityInfo.m_iconId);
            return;
        }
        starTexure.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(rarityIcon.dirName);
        starTexure.gameObject.SetActive(true);
    }
    void ShowRepresentativeCardInfo(CSItemGuid guid)
    {
        m_RCOption.SetActive(true);

        CSItem card = CardBag.Singleton.GetCardByGuid(guid);

        HeroInfo hero = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

        if (null == hero)
        {
            Debug.LogWarning("null == hero card.IDInTable:" + card.IDInTable);
            return;
        }

        IconInfomation icon = GameTable.IconInfoTableAsset.Lookup(hero.ImageId);

        RaceInfo race = GameTable.RaceInfoTableAsset.LookUp(hero.Type);

        OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(hero.Occupation);

        // 图片
        FindChildComponent <UITexture>("CardPic", m_RCOption).mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
        GameObject info = FindChild("Info", m_RCOption);

        FindChildComponent <UILabel>("InfoName", info).text      = hero.StrName;
        FindChildComponent <UILabel>("InfoLevel", info).text     = Localization.Get("CardLevel") + card.Level;
        FindChildComponent <UILabel>("InfoOp", info).text        = occupationInfo.m_name;
        FindChildComponent <UILabel>("InfoHp", info).text        = card.GetHp().ToString();
        FindChildComponent <UILabel>("InfoMagAttack", info).text = card.GetMagAttack().ToString();
        FindChildComponent <UILabel>("InfoPhyAttack", info).text = card.GetPhyAttack().ToString();
        FindChildComponent <UILabel>("InfoRace", info).text      = race.m_name;


        RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(hero.Rarity);

        icon = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
        FindChildComponent <UITexture>("InfoRank", info).mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
    }
Exemple #11
0
    public void InitEntityAttribute(HeroInfo info)
    {
        ConstInfo speedConstInfo = InfoMgr <ConstInfo> .Instance.GetInfo((int)ConstType.CONST_SPEED);

        Attribute.BaseSpeed = float.Parse(speedConstInfo.data) / AppConst.factor;
        Attribute.Speed     = Attribute.BaseSpeed;
        ConstInfo rebornconstInfo = InfoMgr <ConstInfo> .Instance.GetInfo((int)ConstType.CONST_REBORN);

        Attribute.RebornTime = uint.Parse(rebornconstInfo.data) / AppConst.factor;
        ConstInfo atkDisconstInfo = InfoMgr <ConstInfo> .Instance.GetInfo((int)ConstType.CONST_ATK_RADIO);

        Attribute.Atkdis = uint.Parse(atkDisconstInfo.data) / AppConst.factor;
        ConstInfo maxPhyconstInfo = InfoMgr <ConstInfo> .Instance.GetInfo((int)ConstType.CONST_MAX_PHY);

        Attribute.MaxPhy = uint.Parse(maxPhyconstInfo.data) / AppConst.factor;
        Attribute.CurPhy = Attribute.MaxPhy;
        ConstInfo perPhyconstInfo = InfoMgr <ConstInfo> .Instance.GetInfo((int)ConstType.CONST_COST_PHY_SPEED);

        Attribute.CostPhySpeed = uint.Parse(perPhyconstInfo.data) / AppConst.factor;

        OccupationInfo occpInfo = InfoMgr <OccupationInfo> .Instance.GetInfo(info.occupationId);

        Attribute.Skills = occpInfo.skillId;
    }
Exemple #12
0
    // 更新队伍界面相关信息
    public void UpdateInfo()
    {
        // 队伍索引
        int index = Team.Singleton.m_curTeamIndex;

        UpdateTeamIndexItem();

        Debug.Log("当前队伍索引index:" + index);

        HideAllModel();

        // 允许 最大队伍数量
        PlayerAttrInfo playerInfo = GameTable.playerAttrTableAsset.LookUp(User.Singleton.GetLevel());

//         if (null != playerInfo && index+1 > playerInfo.m_teamNum)
//         {
//             // 显示 要达到的等级 并且重置界面
//             m_main.SetActive(false);
//             m_deputy.SetActive(false);
//             m_support.SetActive(false);
//
//             m_teamTips.gameObject.SetActive(true);
//
//            m_teamTipsText.text = string.Format(Localization.Get("TeamUnLockLevel"), playerInfo.m_unlockTeamLevel);
//            return;
//      }

        m_left.gameObject.SetActive(true);
        m_right.gameObject.SetActive(true);

        if (index == 0)
        {
            m_left.gameObject.SetActive(false);
        }
        else if (index == Team.Singleton.m_teamList.Count - 1)
        {
            m_right.gameObject.SetActive(false);
        }
        m_teamNum.GetComponent <UILabel>().text      = playerInfo.m_teamNum.ToString();
        m_curTeamIndex.GetComponent <UILabel>().text = (index + 1) + "";

        m_teamTips.gameObject.SetActive(false);

        // 实际领导力消耗
        int realCost = 0;

        // 主角色
        CSItem card = Team.Singleton.GetCard(index, Team.EDITTYPE.enMain);

        if (null != card)
        {
            // 姓名
            HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

            if (null == info)
            {
                Debug.LogWarning("null == hero card.IDInTable:" + card.IDInTable);
            }
            else
            {
                m_main.SetActive(true);
                m_mainLv.GetComponent <UILabel>().text = Localization.Get("CardLevel") + card.Level;

                AddModel(card, m_mainModel);

                // 星级
                RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity);
                IconInfomation     icon       = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
                m_mainRank.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
                realCost = realCost + info.Cost;

                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                icon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);
                m_mainOcc.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

                m_mainName.GetComponent <UILabel>().text = info.StrName;
            }
        }
        else
        {
            m_main.SetActive(false);
        }

        // 副角色
        card = Team.Singleton.GetCard(index, Team.EDITTYPE.enDeputy);
        if (null != card)
        {
            // 姓名
            HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);
            if (null == info)
            {
                Debug.LogWarning("null == hero card.IDInTable:" + card.IDInTable);
            }
            else
            {
                m_deputy.SetActive(true);
                m_deputyLv.GetComponent <UILabel>().text = Localization.Get("CardLevel") + card.Level;

                AddModel(card, m_deputyModel);

                // 星级

                RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity);
                IconInfomation     icon       = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
                m_deputyRank.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

                realCost = realCost + info.Cost;


                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                icon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);
                m_deputyOcc.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

                m_deputyName.GetComponent <UILabel>().text = info.StrName;
            }
        }
        else
        {
            m_deputy.SetActive(false);
        }

        // 支持角色
        card = Team.Singleton.GetCard(index, Team.EDITTYPE.enSupport);
        if (null != card)
        {
            // 姓名
            HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);
            if (info != null)
            {
                m_support.SetActive(true);
                m_supportLv.GetComponent <UILabel>().text = Localization.Get("CardLevel") + card.Level;
                // 星级
                RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity);
                IconInfomation     icon       = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
                m_supportRank.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

                realCost = realCost + info.Cost;

                AddModel(card, m_supportModel);


                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                icon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);
                m_supportOcc.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

                m_supportName.GetComponent <UILabel>().text = info.StrName;
            }
            else
            {
                Debug.Log("The info is null: " + card.IDInTable);
            }
        }
        else
        {
            m_support.SetActive(false);
        }

        // 玩家的领导力
        int playerLeadship = User.Singleton.GetLeadership();

        // 超过玩家的领导力显示红色
        if (realCost > playerLeadship)
        {
            m_costText.color = Color.red;
        }
        else
        {
            m_costText.color = Color.white;
        }
        // 领导力
        m_costText.text = realCost + "/" + playerLeadship;
    }
Exemple #13
0
    //更新荣誉戒指商店界面
    void UpDateRingOfHonorShopUI()
    {
        int ring = User.Singleton.UserProps.GetProperty_Int32(UserProperty.ring);

        int index = 1;

        foreach (RingOfHonorInfo item in ShopProp.Singleton.m_ringOfHonorList)
        {
            UIDragScrollView copy = GameObject.Instantiate(m_ringItem) as UIDragScrollView;
            copy.GetComponent <Parma>().m_id   = item.m_infoId;
            copy.GetComponent <Parma>().m_type = item.m_cardId;
            copy.transform.Find("Exchange").GetComponent <UIButton>().transform.Find("RingNum").GetComponent <UILabel>().text = item.m_price.ToString();
            //如果戒指数量不足 按钮为灰色
            if (ring < item.m_price)
            {
                copy.transform.Find("Exchange").GetComponent <UIButton>().enabled = false;
            }


            //设置卡牌显示 兑换时间
            RingExchangeTableInfo info = GameTable.RingExchangeTableAsset.Lookup(item.m_infoId);
            UISlider timeSlider        = copy.transform.Find("CardDetail").GetComponent <UISlider>().transform.Find("ExchangeTime").GetComponent <UISlider>();
            timeSlider.transform.Find("StartTime").GetComponent <UILabel>().text = info.startDate + "~";
            timeSlider.transform.Find("EndTime").GetComponent <UILabel>().text   = info.endDate;

            //获得卡牌信息
            HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(item.m_cardId);
            //设置卡牌名字
            copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("Name").GetComponent <UILabel>().text = heroInfo.StrName;
            copy.transform.Find("CardDetail").GetComponent <UISlider>().transform.Find("CardNamePanel").transform.Find("Name").GetComponent <UILabel>().text = heroInfo.StrName;
            //设置种族职业
            UISlider typeSlider = copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("TypePanel").GetComponent <UISlider>();
            typeSlider.transform.Find("Type").GetComponent <UILabel>().text = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type).m_name;
            UISlider occupationSlider = copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("OccupationPanel").GetComponent <UISlider>();
            occupationSlider.transform.Find("Occupation").GetComponent <UILabel>().text = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation).m_name;
            UITexture occupationSprite = occupationSlider.transform.Find("Texture").GetComponent <UITexture>();
            //设置职业图标
            OccupationInfo occInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);
            IconInfomation occicon = GameTable.IconInfoTableAsset.Lookup(occInfo.m_iconId);
            occupationSprite.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(occicon.dirName);
            //设置星级
            UISlider raritySlider = copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("RarityPanel").GetComponent <UISlider>();

            RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity);
            IconInfomation     icon       = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
            raritySlider.transform.Find("Rarity").GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

            icon = GameTable.IconInfoTableAsset.Lookup(heroInfo.ImageId);
            //设置卡牌图片
            copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("Card").GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);


            //设置魔法攻击力
            UISlider magicSlider = copy.transform.Find("CardDetail").GetComponent <UISlider>().transform.Find("CardNamePanel").transform.Find("MaxMagAttackPanel").GetComponent <UISlider>();
//            RarityRelativeInfo rarityRelative = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity);
            magicSlider.transform.Find("MagAttackNum").GetComponent <UILabel>().text = BattleFormula.GetMagAttack(item.m_cardId, 1) + "";

            UISlider phySlider = copy.transform.Find("CardDetail").GetComponent <UISlider>().transform.Find("CardNamePanel").transform.Find("MaxPhyAttackPanel").GetComponent <UISlider>();
            phySlider.transform.Find("PhyAttackNum").GetComponent <UILabel>().text = BattleFormula.GetPhyAttack(item.m_cardId, 1) + "";
            //设置生命值
            UISlider hpSlider = copy.transform.Find("CardDetail").GetComponent <UISlider>().transform.Find("CardNamePanel").transform.Find("MaxHpPanel").GetComponent <UISlider>();
            hpSlider.transform.Find("MaxHpNum").GetComponent <UILabel>().text = BattleFormula.GetHp(item.m_cardId, 1) + "";

            //设置卡牌编号
            UILabel cardNum = copy.transform.Find("Attribute").GetComponent <UISlider>().transform.Find("CardNumText").GetComponent <UILabel>();
            cardNum.text = string.Format(Localization.Get("MercenaryNum"), heroInfo.CardId);


            copy.transform.parent = FindChildComponent <UIGrid>("CardGridList").transform;
            // 设置大小
            copy.transform.localScale = m_ringItem.transform.localScale;
            copy.gameObject.SetActive(true);

            //设置主动技能
            IconInfomation iconInfo    = null;
            SkillInfo      skillInfo   = null;
            int            skillIndex  = 1;
            List <int>     skillIDList = heroInfo.GetAllSkillIDList();
            foreach (int skillId in skillIDList)
            {
                skillInfo = GameTable.SkillTableAsset.Lookup(skillId);
                if (0 == skillInfo.SkillType)
                {
                    UITexture copySkillItem = GameObject.Instantiate(m_skillItem) as UITexture;
                    copySkillItem.GetComponent <Parma>().m_id = skillId;
                    copySkillItem.transform.localScale        = m_skillItem.transform.lossyScale;
                    copySkillItem.gameObject.SetActive(true);
                    iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon);
                    copySkillItem.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
                    copySkillItem.name        = copySkillItem.name + skillIndex;

                    copySkillItem.transform.parent = copy.transform.Find("CardDetail").transform.Find("Skill").transform;
                    EventDelegate.Add(copySkillItem.GetComponent <UIEventTrigger>().onPress, OnShowTips);
                    EventDelegate.Add(copySkillItem.GetComponent <UIEventTrigger>().onClick, OnHideTips);
                    //AddChildMouseClickEvent(copySkillItem.name, OnHideTips);
                }
                skillIndex++;
            }
            m_skillGirdList.Reposition();
            //设置被动技能
            int passiveIndex = 1;
            foreach (int skillId in heroInfo.PassiveSkillIDList)
            {
                skillInfo = GameTable.SkillTableAsset.Lookup(skillId);
                if (0 == skillInfo.SkillType)
                {
                    UISprite copySkillItem = m_skillItem.gameObject.AddComponent <UISprite>();
                    copySkillItem.GetComponent <Parma>().m_id = skillId;
                    copySkillItem.transform.localScale        = m_skillItem.transform.lossyScale;
                    copySkillItem.gameObject.SetActive(true);
                    iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon);
                    copySkillItem.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
                    copySkillItem.name        = copySkillItem.name + skillIndex;

                    copySkillItem.transform.parent = copy.transform.Find("CardDetail").transform.Find("PassiveSkill").transform;
                    EventDelegate.Add(copySkillItem.GetComponent <UIEventTrigger>().onPress, OnShowTips);
                    EventDelegate.Add(copySkillItem.GetComponent <UIEventTrigger>().onClick, OnHideTips);
                    //AddChildMouseClickEvent(copySkillItem.name, OnHideTips);
                }
                passiveIndex++;
            }



            m_ringHonorGridList.Add(index, copy);
            AddMouseClickEvent(copy.transform.Find("Exchange").gameObject, OnBuyRingCardButton);
            index++;
        }
        for (; index < m_ringHonorGridList.Count; index++)
        {
            m_ringHonorGridList[index].gameObject.SetActive(false);
            m_ringHonorGridList[index].GetComponent <Parma>().m_id   = 0;
            m_ringHonorGridList[index].GetComponent <Parma>().m_type = 0;
        }
        m_cardGridList.Reposition();
    }
Exemple #14
0
    public void ShowCard()
    {
        if (null == m_showCard)
        {
            return;
        }
        //设置卡牌头像
        HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(m_showCard.IDInTable);

        if (null == info)
        {
            Debug.Log("UICardEvolution HeroInfo == null card.m_id:" + m_showCard.IDInTable);
            return;
        }
        IconInfomation imageInfo = GameTable.IconInfoTableAsset.Lookup(info.ImageId);

        if (null == imageInfo)
        {
            Debug.Log("UICardEvolution IconInfo == null info.ImageId:" + info.ImageId);
            return;
        }
        m_cardHeadImage.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName);
        //设置星级图标
        RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity);

        if (null == rarityInfo)
        {
            Debug.Log("RarityRelativeInfo rarityInfo == null info.RarityId:" + info.Rarity);
            return;
        }
        IconInfomation rarityIcon = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);

        if (null == rarityIcon)
        {
            Debug.Log("IconInfomation rarityIcon == null rarityInfo.m_iconId:" + rarityInfo.m_iconId);
            return;
        }
        m_cardStar.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(rarityIcon.dirName);
        //设置职业图标
        OccupationInfo occInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);

        if (null == occInfo)
        {
            Debug.Log("OccupationInfo occInfo == null info.Occupation:" + info.Occupation);
            return;
        }
        IconInfomation occIcon = GameTable.IconInfoTableAsset.Lookup(occInfo.m_iconId);

        if (null == occIcon)
        {
            Debug.Log("IconInfomation occIcon == null rarityInfo.m_iconId:" + occInfo.m_iconId);
            return;
        }
        m_cardOcc.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(occIcon.dirName);
        //是否在编队中
        bool isInTeam = Team.Singleton.IsCardInTeam(m_showCard.m_guid);

        if (isInTeam)
        {
            m_cardInfo.gameObject.SetActive(true);
            m_cardInfo.text = Localization.Get("InTheUseOf");
        }
        //是否是代表卡
        if (User.Singleton.RepresentativeCard == m_showCard.m_guid)
        {
            m_cardInfo.gameObject.SetActive(true);
            m_cardInfo.text = Localization.Get("Onbehalfof");
        }
        //是否是最爱
        if (m_showCard.Love)
        {
            m_cardLove.gameObject.SetActive(true);
        }

        // 是否是新卡
        m_new.gameObject.SetActive(m_bNew);
    }
Exemple #15
0
    // 卡牌上的详细信息更新
    void UpdateCardInfo()
    {
        // 清空
        if (CardUpdateProp.Singleton.m_curLevelGuid.Equals(CSItemGuid.Zero))
        {
            m_cost.text          = "";
            m_name.text          = "";
            m_phyAttack.text     = "";
            m_magAttack.text     = "";
            m_hp.text            = "";
            m_occuption.text     = "";
            m_type.text          = "";
            m_rarity.mainTexture = null;
            m_levelTips.text     = "";

            // 清空下
            m_cardBG.mainTexture = null;
            // 隐藏突破信息
            m_break.gameObject.SetActive(false);
            // 隐藏提示信息
            m_warning.gameObject.SetActive(false);

            // 隐藏 等级进度条
            m_levelBefore.gameObject.SetActive(false);
            // 隐藏 升级后的进度条
            m_levelAfter.gameObject.SetActive(false);

            m_attribute.gameObject.SetActive(false);
        }
        CSItem card = CardBag.Singleton.GetCardByGuid(CardUpdateProp.Singleton.m_curLevelGuid);

        if (null == card)
        {
            return;
        }

        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

        if (null == heroInfo)
        {
            return;
        }
        OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);

        RaceInfo raceInfo = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type);

        m_cost.text      = "" + heroInfo.Cost;
        m_name.text      = heroInfo.StrName;
        m_phyAttack.text = "" + card.GetPhyAttack();
        m_magAttack.text = "" + card.GetMagAttack();
        m_hp.text        = "" + card.GetHp();
        m_occuption.text = occupationInfo.m_name;
        m_type.text      = raceInfo.m_name;

        m_levelTips.text = "" + card.Level;

        RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity);
        IconInfomation     icon       = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);

        m_rarity.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
        m_attribute.gameObject.SetActive(true);
    }
Exemple #16
0
    // 更新选项界面
    void UpdateOption()
    {
        m_option.gameObject.SetActive(true);

        CSItem card = CardBag.Singleton.GetCardByGuid(CardBag.Singleton.m_curOptinGuid);

        HeroInfo hero = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

        IconInfomation icon = GameTable.IconInfoTableAsset.Lookup(hero.headImageId);

        RaceInfo race = GameTable.RaceInfoTableAsset.LookUp(hero.Type);

        OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(hero.Occupation);

        RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(hero.Rarity);

        IconInfomation rarityIconInfo = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);

        //设置角色头像图片
        m_cardInfoMain.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

        //设置星级图标
        m_rarityTexture.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(rarityIconInfo.dirName);
        //设置种族图标
        IconInfomation raceIcon = GameTable.IconInfoTableAsset.Lookup(race.m_iconId);

        m_cardInfoRace.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(raceIcon.dirName);
        //设置职业图标
        IconInfomation occIcon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);

        m_cardInfoOccupation.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(occIcon.dirName);

        m_optionName.text      = hero.StrName;
        m_optionLevel.text     = Localization.Get("CardLevel") + card.Level;
        m_opInfoOp.text        = occupationInfo.m_name;
        m_optionHp.text        = "" + card.GetHp();
        m_optionMagAttack.text = "" + card.GetMagAttack();
        m_optionPhyAttack.text = "" + card.GetPhyAttack();
        m_optionRace.text      = race.m_name;

        //根据是否为最爱 决定按钮显示 图片和头像图标显示
        if (card.Love)
        {
            //button 按钮换图片
            WorldParamInfo worldInfo = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enCancelLoveImageName);
            m_joinLoveSprite.spriteName = worldInfo.StringTypeValue;
            //显示最爱图标
            m_cardInfoLove.gameObject.SetActive(true);
        }
        else
        {
            //button 按钮换图片
            WorldParamInfo worldInfo = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enJoinLoveImageName);
            m_joinLoveSprite.spriteName = worldInfo.StringTypeValue;
            //隐藏最爱图标
            m_cardInfoLove.gameObject.SetActive(false);
        }

        // 可强化
        if (card.IsStengthen())
        {
            m_stengThen.isEnabled = true;
        }
        else
        {
            m_stengThen.isEnabled = false;
        }

        //设置素材卡牌
        GradeUpRequireInfo gradeInfo = GameTable.gradeUpRequireAsset.Lookup(card.m_id);

        if (null == gradeInfo)
        {
            return;
        }

        // 是否达到进化所需等级
        if (card.IsEvlotion() && card.BreakCounts < gradeInfo.GradeUpTime)
        {
            m_evlotion.isEnabled = true;
        }
        else
        {
            m_evlotion.isEnabled = false;
        }


        //是否是代表卡
        m_deputyLabel.gameObject.SetActive(false);
        m_chosenLable.gameObject.SetActive(false);
        if (User.Singleton.RepresentativeCard == CardBag.Singleton.m_curOptinGuid)
        {
            m_deputyLabel.gameObject.SetActive(true);
        }
        else
        {
            if (Team.Singleton.IsCardInTeam(CardBag.Singleton.m_curOptinGuid))
            {
                m_chosenLable.gameObject.SetActive(true);
            }
        }


        //判断是否可以段位升级(待设定)
    }
Exemple #17
0
    void UpdateCardInfo(int cardId)
    {
        Debug.Log("UpdateCardInfo:" + cardId);
        m_cardDetail.SetActive(true);

        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardId);

        if (null == heroInfo)
        {
            return;
        }

        Login.Singleton.m_curCardId = cardId;

        IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(heroInfo.ImageId);

        m_infoName.text = heroInfo.StrName;

        RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity);
        IconInfomation     icon       = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);

        m_star.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
        m_cardPic.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);

        OccupationInfo occInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);

        RaceInfo raceInfo = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type);

        m_infoOp.text = occInfo.m_name;

        m_ocInfo.text = occInfo.m_name;

        m_raceInfo.text = raceInfo.m_name;

        m_ocDetail.text = occInfo.m_describe;

        int        i           = 0;
        List <int> skillIDList = heroInfo.GetAllSkillIDList();

        foreach (int skillId in skillIDList)
        {
            SkillInfo skillInfo = GameTable.SkillTableAsset.Lookup(skillId);
            if (null == skillInfo || 0 != skillInfo.SkillType)
            {
                continue;
            }

            iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon);

            if (iconInfo == null)
            {
                Debug.LogWarning("iconInfo 为空 skillId:" + skillId + ",skillInfo.Icon:" + skillInfo.Icon);
                continue;
            }
            if (m_skillList.ContainsKey(skillId))
            {
                GameObject obj = m_skillList[skillId];
                obj.SetActive(true);
                obj.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
                Parma parma = obj.GetComponent <Parma>();
                parma.m_id = skillId;
            }
            else
            {
                GameObject copy = GameObject.Instantiate(m_skillItem.gameObject) as GameObject;
                copy.transform.parent     = m_skillParent.transform;
                copy.transform.localScale = m_skillItem.transform.localScale;
                copy.gameObject.SetActive(true);
                copy.transform.LocalPositionX(0 + i * 90f);
                copy.transform.LocalPositionY(-45f);
                copy.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
                copy.name = copy.name + i;
                Parma parma = copy.GetComponent <Parma>();
                parma.m_id = skillId;

                EventDelegate.Add(copy.GetComponent <UIEventTrigger>().onPress, OnShowTips);

                AddChildMouseClickEvent(copy.name, OnHideTips);

                m_skillList.Add(skillId, copy);
            }
            i++;
        }
    }
Exemple #18
0
    // 显示更新 战斗准备
    void UpdateBattlePreparation()
    {
        for (int i = 0; i < Team.Singleton.TeamNum; ++i)
        {
            if (false == m_teamList.ContainsKey(i))
            {
                UIStageMenuTeamItem item = UIStageMenuTeamItem.Create();
                item.SetParent(m_battlePreparation.transform);
                m_teamList.Add(i, item);
            }
        }

        int curTeamIndex = Team.Singleton.m_curTeamIndex;

        foreach (KeyValuePair <int, UIStageMenuTeamItem> item in m_teamList)
        {
            if (item.Key == curTeamIndex)
            {
                item.Value.ShowWindow();
            }
            else
            {
                item.Value.HideWindow();
            }
        }

        HideAllModel();

        if (!m_teamList.ContainsKey(curTeamIndex))
        {
            Team.Singleton.m_curTeamIndex = 0;
            curTeamIndex = 0;
        }

        UIStageMenuTeamItem teamItem = m_teamList[curTeamIndex];

        teamItem.ShowWindow();

        AddModel(Team.Singleton.GetCard(curTeamIndex, Team.EDITTYPE.enMain), teamItem.m_mainModelObj);
        AddModel(Team.Singleton.GetCard(curTeamIndex, Team.EDITTYPE.enDeputy), teamItem.m_deputyModelObj);
        AddModel(Team.Singleton.GetCard(curTeamIndex, Team.EDITTYPE.enSupport), teamItem.m_supportModelObj);
        AddModel(Team.Singleton.Comrade, teamItem.m_comradeModelObj);

        UILabel mainTips    = teamItem.m_mainTips;
        UILabel deputyTips  = teamItem.m_deputyTips;
        UILabel supportTips = teamItem.m_supportTips;
        UILabel comradeTips = teamItem.m_comradeTips;

        HeroInfo info   = null;
        CSItem   csItem = null;

        csItem = Team.Singleton.Chief;
        // 主角色
        if (null != csItem)
        {
            m_battleBtn.isEnabled = true;

            info = GameTable.HeroInfoTableAsset.Lookup(csItem.IDInTable);
            if (null != info)
            {
                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                if (null != occupationInfo)
                {
                    mainTips.text  = Localization.Get("CardLevel") + csItem.Level + "\n";
                    mainTips.text += Localization.Get("Occ:") + occupationInfo.m_name + "\n";
                    mainTips.text += Localization.Get("Hp:") + csItem.GetHp() + "\n";
                    mainTips.text += Localization.Get("PhyAtk:") + csItem.GetPhyAttack() + "\n";
                    mainTips.text += Localization.Get("MagAtk:") + csItem.GetMagAttack() + "\n";
                    mainTips.text += Localization.Get("Def:") + csItem.GetPhyDefend();
                }
            }

            teamItem.m_noMainTipsLab.SetActive(false);
        }
        // 没有主角色 不可以进行战斗
        else
        {
            m_battleBtn.isEnabled = false;
            teamItem.m_noMainTipsLab.SetActive(true);
        }

        csItem = Team.Singleton.Deputy;
        // 副角色
        if (null != csItem)
        {
            info = GameTable.HeroInfoTableAsset.Lookup(csItem.IDInTable);
            if (null != info)
            {
                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                if (null != occupationInfo)
                {
                    deputyTips.text  = Localization.Get("CardLevel") + csItem.Level + "\n";
                    deputyTips.text += Localization.Get("Occ:") + occupationInfo.m_name + "\n";
                    deputyTips.text += Localization.Get("Hp:") + csItem.GetHp() + "\n";
                    deputyTips.text += Localization.Get("PhyAtk:") + csItem.GetPhyAttack() + "\n";
                    deputyTips.text += Localization.Get("MagAtk:") + csItem.GetMagAttack() + "\n";
                    deputyTips.text += Localization.Get("Def:") + csItem.GetPhyDefend();
                }
            }
        }

        csItem = Team.Singleton.Support;
        // 支援角色
        if (null != csItem)
        {
            info = GameTable.HeroInfoTableAsset.Lookup(csItem.IDInTable);
            if (null != info)
            {
                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                if (null != occupationInfo)
                {
                    supportTips.text  = Localization.Get("CardLevel") + csItem.Level + "\n";
                    supportTips.text += Localization.Get("Occ:") + occupationInfo.m_name + "\n";
                    supportTips.text += Localization.Get("Hp:") + csItem.GetHp() + "\n";
                    supportTips.text += Localization.Get("PhyAtk:") + csItem.GetPhyAttack() + "\n";
                    supportTips.text += Localization.Get("MagAtk:") + csItem.GetMagAttack() + "\n";
                    supportTips.text += Localization.Get("Def:") + csItem.GetPhyDefend();
                }
            }
        }

        csItem = Team.Singleton.Comrade;
        // 战友
        if (null != csItem)
        {
            info = GameTable.HeroInfoTableAsset.Lookup(csItem.IDInTable);
            if (null != info)
            {
                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                if (null != occupationInfo)
                {
                    comradeTips.text  = Localization.Get("CardLevel") + csItem.Level + "\n";
                    comradeTips.text += Localization.Get("Occ:") + occupationInfo.m_name + "\n";
                    comradeTips.text += Localization.Get("Hp:") + csItem.GetHp() + "\n";
                    comradeTips.text += Localization.Get("PhyAtk:") + csItem.GetPhyAttack() + "\n";
                    comradeTips.text += Localization.Get("MagAtk:") + csItem.GetMagAttack() + "\n";
                    comradeTips.text += Localization.Get("Def:") + csItem.GetPhyDefend();
                }
            }
        }


        //      TweenPosition temp = m_battlePreparation.gameObject.transform.GetComponent<TweenPosition>();
//         if (null == temp)
//         {
//             return;
//         }
//
//         Vector3 posV = m_battlePreparation.gameObject.transform.localPosition;
//         posV.x = 0;
//
//         TweenPosition.Begin(m_battlePreparation.gameObject, 0.5f, posV).method = UITweener.Method.EaseIn;



//         temp = m_battleBtn.gameObject.transform.GetComponent<TweenPosition>();
//         if (null == temp)
//         {
//             return;
//         }
//
//         posV = m_battleBtn.gameObject.transform.localPosition;
//         posV.x = 330;
//
//         TweenPosition.Begin(m_battleBtn.gameObject, 0.5f, posV).method = UITweener.Method.EaseIn;

        //m_battlePreparation.gameObject.SetActive(true);
        m_battleBtn.gameObject.SetActive(true);
        m_level.gameObject.SetActive(false);

        TweenPosition temp = m_name.gameObject.transform.GetComponent <TweenPosition>();

        if (null == temp)
        {
            return;
        }

        Vector3 posV = m_name.gameObject.transform.localPosition;

        posV.x = -700;

        TweenPosition.Begin(m_name.gameObject, 0.5f, posV).method = UITweener.Method.EaseIn;

        m_curType = (int)CurType.enBattleType;
    }
Exemple #19
0
    // 更新信息
    void UpdateInfo()
    {
        CSItem card = CardBag.Singleton.m_cardForDetail;

        if (null == card)
        {
            return;
        }

        // 如果卡牌ID为0则 是用预览卡牌(不是背包里的卡牌) 此时 加到最爱 进化 强化等按钮不显示
        if (CardBag.Singleton.m_curOptinGuid.Equals(CSItemGuid.Zero))
        {
            m_levelUpBtn.gameObject.SetActive(false);

            m_evolutionBtn.gameObject.SetActive(false);

            m_breachBtn.gameObject.SetActive(false);
        }
        else
        {
            m_levelUpBtn.gameObject.SetActive(card.IsStengthen());

            m_evolutionBtn.gameObject.SetActive(card.IsEvlotion());

            m_breachBtn.gameObject.SetActive(true);
        }
        m_grid.Reposition();
        AddModel(card, m_model);
        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

        if (null == heroInfo)
        {
            Debug.LogWarning("heroInfo == NULL heroInfo cardID:" + card.IDInTable);
            return;
        }

        m_cardPanel.Update(card.IDInTable);

        IconInfomation iconInfo       = GameTable.IconInfoTableAsset.Lookup(heroInfo.ImageId);
        OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);
        RaceInfo       raceInfo       = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type);

//        LevelUpInfo levelupInfo         = GameTable.LevelUpTableAsset.LookUp(card.Level);
        m_cost.text       = "" + heroInfo.Cost;
        m_phyAttack.text  = "" + (int)card.GetPhyAttack();
        m_magAttack.text  = "" + (int)card.GetMagAttack();
        m_hp.text         = "" + (int)card.GetHp();
        m_occupation.text = occupationInfo.m_name;
        m_type.text       = raceInfo.m_name;
        m_curLevel.text   = "" + card.Level;
        m_maxLevel.GetComponent <UILabel>().text = card.GetMaxLevel().ToString();

        IconInfomation icon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);

        m_occTexture.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
        icon = GameTable.IconInfoTableAsset.Lookup(raceInfo.m_iconId);
        m_raceTexture.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

        // 段位升级
        UpdateDanData(card.BreakCounts);

        foreach (UICardDetailSkillItem item in m_skillList)
        {
            if (null != item)
            {
                item.HideWindow();
            }
        }

        foreach (UICardDetailSkillItem item in m_passvieSkillList)
        {
            if (null != item)
            {
                item.HideWindow();
            }
        }

        int        i           = 0;
        List <int> skillIDList = heroInfo.GetAllSkillIDList();

        foreach (int skillId in skillIDList)
        {
            if (0 != heroInfo.NormalSkillIDList.Find(item => item == skillId))
            {
                continue;
            }
            SkillInfo skillInfo = GameTable.SkillTableAsset.Lookup(skillId);
            if (null == skillInfo)
            {
                continue;
            }

            // 普通技能才被列入
            if (skillInfo.SkillType != 0)
            {
                continue;
            }
            iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon);

            if (null == iconInfo)
            {
                continue;
            }
            if (i < m_skillList.Length)
            {
                UICardDetailSkillItem item = m_skillList[i];
                if (null == item)
                {
                    item           = UICardDetailSkillItem.Create();
                    m_skillList[i] = item;
                    item.SetParent(m_skillParent.transform);
                    item.SetPressCallbacked(OnShowTips);
                    item.SetClickCallbacked(OnHideTips);
                }

                item.ShowWindow();
                item.Update(skillId);
                i++;
            }
        }

        m_skillParent.GetComponent <UIGrid>().Reposition();

        i = 0;
        bool bNone = true;

        foreach (int skillId in heroInfo.PassiveSkillIDList)
        {
            SkillInfo skillInfo = GameTable.SkillTableAsset.Lookup(skillId);
            if (null == skillInfo)
            {
                continue;
            }
            iconInfo = GameTable.IconInfoTableAsset.Lookup(skillInfo.Icon);
            if (null == iconInfo)
            {
                continue;
            }
            if (i >= m_passvieSkillList.Length)
            {
                continue;
            }

            bNone = false;

            UICardDetailSkillItem item = m_passvieSkillList[i];
            if (null == item)
            {
                item = UICardDetailSkillItem.Create();
                m_passvieSkillList[i] = item;
                item.SetParent(m_passiveSkillParent.transform);

                item.SetPressCallbacked(OnShowTips);
                item.SetClickCallbacked(OnHideTips);
            }

            item.ShowWindow();
            item.Update(skillId);
            i++;
        }

        m_passiveSkillParent.GetComponent <UIGrid>().Reposition();
        m_skillNoneLabel.gameObject.SetActive(bNone);
    }
Exemple #20
0
    public void Update(CSItem card, ENSortType sortType, int index = 0)
    {
        if (null == card)
        {
            return;
        }

        ShowWindow();

        m_index = index;     // 表示 用显示卡牌详情
        int cardID = card.IDInTable;

        m_bg.gameObject.SetActive(true);

        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(cardID);

        if (heroInfo != null)
        {
            // 道具ID
            m_param.m_guid = card.Guid;

            // 头像
            IconInfomation iconInfo = GameTable.IconInfoTableAsset.Lookup(heroInfo.headImageId);
            if (null != iconInfo)
            {
                m_headImage.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
            }

            // 等级
            m_level.gameObject.SetActive(true);

            // 排序后的 应显示的 属性
            switch (sortType)
            {
            case ENSortType.enByRarity:
            {
                m_level.text = heroInfo.Rarity.ToString();
                break;
            }

            case ENSortType.enByPhyAttack:
            {
                m_level.text = card.GetPhyAttack().ToString();
                break;
            }

            case ENSortType.enByMagAttack:
            {
                m_level.text = card.GetMagAttack().ToString();
                break;
            }

            case ENSortType.enByHp:
            {
                m_level.text = card.GetHp().ToString();
                break;
            }

            default:
                int levelMax = card.GetMaxLevel();

                if (card.Level >= levelMax)
                {
                    m_level.text = Localization.Get("MaxCardLevel");
                }
                else
                {
                    m_level.text = Localization.Get("CardLevel") + card.Level;
                }
                break;
            }
            // 文字闪现 播放一致
            m_chosen.GetComponent <TweenAlpha>().ResetToBeginning();

            // 是否在编队中
            m_chosen.SetActive(Team.Singleton.IsCardInTeam(card.Guid));

            // 是否是最爱
            m_love.gameObject.SetActive(card.Love);

            m_defaultHead.gameObject.SetActive(false);

            // 职业
            OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation);
            if (null != occupationInfo)
            {
                iconInfo = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);

                if (null != iconInfo)
                {
                    m_occ.gameObject.SetActive(true);

                    m_occ.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
                }
            }


            RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity);
            if (null != rarityInfo)
            {
                iconInfo = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);

                m_rarity.gameObject.SetActive(true);

                m_rarity.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(iconInfo.dirName);
            }
        }
    }