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);
    }
示例#2
0
    void ShowBattleHelper(int userGUID)
    {
        Helper helper = User.Singleton.HelperList.LookupHelper(userGUID);

        if (helper == null)
        {
            Debug.Log("No this helper, id = " + userGUID.ToString());
            ShowSelf();
            return;
        }
        m_btnTeamLeaderModel.SetActive(false);
        m_btnCancelTeamLeaderMode.SetActive(false);
        m_btnSelectThis.SetActive(true);
        m_btnChangeCard.SetActive(false);
        //userinfo
        m_userName.text  = helper.m_userName;
        m_userLevel.text = Localization.Get("CardLevel") + helper.m_userLevel.ToString();
        m_labelGUID.text = "ID:" + helper.m_userGuid.ToString();

        CSItem card = new CSItem();

        card.Guid        = helper.m_cardGuid;
        card.m_id        = (short)helper.m_cardId;
        card.Level       = helper.m_cardLevel;
        card.BreakCounts = helper.m_cardBreakCounts;
        card.m_segment.m_heroCard.m_skill = helper.m_cardSkill;

        //代表卡info
//      CSItemGuid cardGuid = User.Singleton.RepresentativeCard;
//      CSItem card = CardBag.Singleton.GetCardByGuid(cardGuid);
        if (card != null)
        {
            Debug.Log("RefreshInfo");
            HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);
            if (info == null)
            {
                return;
            }
            int            headImageID = info.headImageId;
            IconInfomation icon        = GameTable.IconInfoTableAsset.Lookup(headImageID);
            m_cardPortrait.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

            m_cardName.text  = info.StrName;
            m_cardLevel.text = card.Level.ToString();
            RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity);
            icon = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
            m_raritySprite.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
            int    occ      = info.Occupation;
            int    race     = info.Type;
            string occName  = GameTable.OccupationInfoAsset.LookUp(occ).m_name;
            string raceName = GameTable.RaceInfoTableAsset.LookUp(race).m_name;
            m_occAndRace.text        = occName + " " + raceName;
            m_phyAttack.text         = ((int)card.GetPhyAttack()).ToString();
            m_magAttack.text         = ((int)card.GetMagAttack()).ToString();
            m_hp.text                = ((int)card.GetHp()).ToString();
            m_breakthroughTimes.text = card.BreakCounts.ToString();
        }
    }
示例#3
0
    // 更新卡牌界面相关信息
    public void UpdateInfo(CSItemGuid guid)
    {
        CSItem cardInfo = CardBag.Singleton.itemBag.GetItemByGuid(guid);

        if (cardInfo == null)
        {
            return;
        }
        // 卡牌ID
        int id = cardInfo.IDInTable;

        HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(id);

        if (null == info)
        {
            Debug.Log("UICard UpdateInfo HeroInfo 表数据没有 ID 为:" + id);
            return;
        }

        // 星级
        SetRarity(info.Rarity);

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

        if (null == rarityInfo)
        {
            Debug.Log("UICard UpdateInfo RarityRelativeInfo 表数据没有 ID 为:" + id);
            return;
        }

        IconInfomation imageInfo = GameTable.IconInfoTableAsset.Lookup(info.ImageId);

        if (null == imageInfo)
        {
            return;
        }

        // 消耗
        m_cardCost.text = info.Cost.ToString();

        m_cardName.text = info.StrName.ToString();

        m_card.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName);


        // 计算生命值
        float hp = cardInfo.GetHp();

        m_cardHp.text = hp.ToString();

        // 计算物理攻击力
        float attack = cardInfo.GetPhyAttack();

        m_cardAttack.text = attack.ToString();

        Debug.Log("UICard UpdateInfo:" + info.StrName);
    }
示例#4
0
    static public int GetPhyAttack(int id, int level, int yellowPoint = 1)
    {
        HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(id);

        if (null == info)
        {
            return(0);
        }

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

        if (rarityInfo == null)
        {
            return(0);
        }

        QualityInfo qualityInfo = GameTable.qualityRelativeAsset.LookUp(info.Quality);

        if (qualityInfo == null)
        {
            return(0);
        }

        CardTypeInfo cardTypeInfo = GameTable.cardTypeVariationAsset.LookUp((int)info.AttrTypeID);

        if (cardTypeInfo == null)
        {
            return(0);
        }

        LevelUpInfo levelUpInfo = GameTable.LevelUpTableAsset.LookUp(level);

        if (levelUpInfo == null)
        {
            return(0);
        }
        CardLevelInfo cardLevelInfo = GameTable.cardLevelVariationAsset.LookUp((int)info.levelTypeID);

        if (cardLevelInfo == null)
        {
            return(0);
        }

        YellowPointInfo yellowPointInfo = GameTable.yellowPointParamAsset.LookUp(yellowPoint);

        if (yellowPointInfo == null)
        {
            return(0);
        }

        //Debug.Log("(" + info.FPhyAttack + "+" + cardTypeInfo.m_phyAtt + ") * (1 +" + cardLevelInfo.m_phyAttParam + "*" + level + "+" + yellowPointInfo.m_phyAttParam + ")*(" + rarityInfo.m_mainAttrMutiply +"+"+ qualityInfo.m_mainAttrMutiply+")");
        // 计算物理攻击力
        float attack = (info.FPhyAttack + cardTypeInfo.m_phyAtt) * (1 + cardLevelInfo.m_phyAttParam * level + yellowPointInfo.m_phyAttParam) * (rarityInfo.m_mainAttrMutiply + qualityInfo.m_mainAttrMutiply);

        return((int)attack);
    }
示例#5
0
    // 获得当前物理防御力
    static public int GetPhyDefend(int id, int level, int yellowPoint = 1)
    {
        HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(id);

        if (null == info)
        {
            return(0);
        }

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

        if (rarityInfo == null)
        {
            return(0);
        }

        QualityInfo qualityInfo = GameTable.qualityRelativeAsset.LookUp(info.Quality);

        if (qualityInfo == null)
        {
            return(0);
        }

        CardTypeInfo cardTypeInfo = GameTable.cardTypeVariationAsset.LookUp((int)info.AttrTypeID);

        if (cardTypeInfo == null)
        {
            return(0);
        }

        LevelUpInfo levelUpInfo = GameTable.LevelUpTableAsset.LookUp(level);

        if (levelUpInfo == null)
        {
            return(0);
        }

        CardLevelInfo cardLevelInfo = GameTable.cardLevelVariationAsset.LookUp((int)info.levelTypeID);

        if (cardLevelInfo == null)
        {
            return(0);
        }

        YellowPointInfo yellowPointInfo = GameTable.yellowPointParamAsset.LookUp(yellowPoint);

        if (yellowPointInfo == null)
        {
            return(0);
        }

        // 获得当前魔法 防御力
        float attack = (info.FPhyDefend + cardTypeInfo.m_phyDef) * (1 + cardLevelInfo.m_phyDefParam * level + yellowPointInfo.m_phyDefParam) * (rarityInfo.m_mainAttrMutiply + qualityInfo.m_mainAttrMutiply);

        return((int)attack);
    }
    public RarityRelativeInfo LookUp(int id)
    {
        RarityRelativeInfo info = null;

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

        return(null);
    }
示例#7
0
    static public int GetHp(int id, int level, int yellowPoint = 1)
    {
        HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(id);

        if (null == info)
        {
            return(0);
        }

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

        if (rarityInfo == null)
        {
            return(0);
        }

        QualityInfo qualityInfo = GameTable.qualityRelativeAsset.LookUp(info.Quality);

        if (qualityInfo == null)
        {
            return(0);
        }

        CardTypeInfo cardTypeInfo = GameTable.cardTypeVariationAsset.LookUp((int)info.AttrTypeID);

        if (cardTypeInfo == null)
        {
            return(0);
        }

        CardLevelInfo cardLevelInfo = GameTable.cardLevelVariationAsset.LookUp((int)info.levelTypeID);

        if (cardLevelInfo == null)
        {
            return(0);
        }

        YellowPointInfo yellowPointInfo = GameTable.yellowPointParamAsset.LookUp(yellowPoint);

        if (yellowPointInfo == null)
        {
            return(0);
        }

        float maxLevelAttrParam = GameTable.WorldParamTableAsset.Lookup((int)ENWorldParamIndex.enMaxLevelAttrParam).FloatTypeValue;

        float hp = (info.FHPMax + cardTypeInfo.m_hp) * (1 + cardLevelInfo.m_hpParam * level + yellowPointInfo.m_hpParam) * (rarityInfo.m_mainAttrMutiply + qualityInfo.m_mainAttrMutiply);

        return((int)hp);
    }
示例#8
0
    // 更新卡牌界面相关信息 
    public void UpdateInfo(CSItemGuid guid)
    {
        CSItem card = CardBag.Singleton.GetCardByGuid(guid);
        if (null == card)
        {
            return;
        }
        
        m_name.text         = "";

        HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);
        if (null == info)
        {
            Debug.Log("UICard UpdateInfo HeroInfo 表数据没有 ID 为:" + card.IDInTable);
            return;
        }

        IconInfomation imageInfo  = GameTable.IconInfoTableAsset.Lookup(info.ImageId);

        if (null == imageInfo)
        {
            return;
        }

        m_card.mainTexture = PoolManager.Singleton.LoadIcon<Texture>(imageInfo.dirName);

        m_name.text             = info.StrName;
        m_attirbutename.name    = info.StrName;

        // 星级

        RarityRelativeInfo rarityInfo   = GameTable.RarityRelativeAsset.LookUp(info.Rarity);
        if (null == rarityInfo)
        {
            return;
        }
        IconInfomation icon             = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
        m_cardRarity.GetComponent<UITexture>().mainTexture = PoolManager.Singleton.LoadIcon<Texture>(icon.dirName);

        // 消耗
        m_cardCost.text     = info.Cost.ToString();

        // 生命值
        m_cardHp.text       = card.GetHp().ToString();

        m_magAttack.text    = card.GetMagAttack().ToString();

        m_cardAttack.text   = card.GetPhyAttack().ToString();
    }
    public void Load(byte[] bytes)
    {
        m_rarityRelativeMap = new Dictionary <int, RarityRelativeInfo>();
        BinaryHelper helper = new BinaryHelper(bytes);

        int sceneCount = helper.ReadInt();

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

            info.Load(helper);

            m_rarityRelativeMap.Add(info.m_rarity, info);
        }
    }
示例#10
0
    void ShowSelf()
    {
        m_btnTeamLeaderModel.SetActive(User.Singleton.IsTeamLeaderModel);
        m_btnCancelTeamLeaderMode.SetActive(!User.Singleton.IsTeamLeaderModel);
        m_btnSelectThis.SetActive(false);
        m_btnChangeCard.SetActive(true);

        //userinfo
        m_userName.text  = User.Singleton.UserProps.GetProperty_String(UserProperty.name);
        m_userLevel.text = Localization.Get("CardLevel") + User.Singleton.UserProps.GetProperty_Int32(UserProperty.level).ToString();
        m_labelGUID.text = "ID:" + User.Singleton.Guid.ToString();

        //代表卡info
        CSItemGuid cardGuid = User.Singleton.RepresentativeCard;
        CSItem     card     = CardBag.Singleton.GetCardByGuid(cardGuid);

        if (card != null)
        {
            Debug.Log("RefreshInfo");
            HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);
            if (info == null)
            {
                return;
            }
            int            headImageID = info.headImageId;
            IconInfomation icon        = GameTable.IconInfoTableAsset.Lookup(headImageID);
            m_cardPortrait.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
            m_cardName.text            = info.StrName;
            m_cardLevel.text           = card.Level.ToString();

            RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity);
            icon = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
            m_raritySprite.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
            int    occ      = info.Occupation;
            int    race     = info.Type;
            string occName  = GameTable.OccupationInfoAsset.LookUp(occ).m_name;
            string raceName = GameTable.RaceInfoTableAsset.LookUp(race).m_name;
            m_occAndRace.text        = occName + " " + raceName;
            m_phyAttack.text         = ((int)card.GetPhyAttack()).ToString();
            m_magAttack.text         = ((int)card.GetMagAttack()).ToString();
            m_hp.text                = ((int)card.GetHp()).ToString();
            m_breakthroughTimes.text = card.BreakCounts.ToString();
        }
    }
示例#11
0
    // 等级上限
    public int GetMaxLevel()
    {
        HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(IDInTable);

        int levelMax = heroInfo.MaxLevel;

        if (levelMax == 0)
        {
            RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity);

            levelMax = rarityInfo.m_levelMax + BreakCounts * heroInfo.BreakThroughLevel;
        }
        else
        {
            levelMax = levelMax + BreakCounts * heroInfo.BreakThroughLevel;
        }

        return(levelMax);
    }
示例#12
0
    public void ShowFriendPlayerInfo(FriendItem friendItem)
    {
        m_btnTeamLeaderModel.SetActive(false);
        m_btnCancelTeamLeaderMode.SetActive(false);

        FindChild("FriendBtnList").SetActive(true);
        FindChild("RepresentativeBtnList").SetActive(false);
        m_frienditem     = friendItem;
        m_userName.text  = friendItem.m_actorName;
        m_userLevel.text = Localization.Get("CardLevel") + friendItem.m_level;
        m_labelGUID.text = "ID:" + "000000";
        CSItem card = friendItem.GetItem();

        if (card != null)
        {
            Debug.Log("RefreshInfo");
            HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);
            if (info == null)
            {
                return;
            }
            int            headImageID = info.headImageId;
            IconInfomation icon        = GameTable.IconInfoTableAsset.Lookup(headImageID);
            m_cardPortrait.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
            m_cardName.text            = info.StrName;
            m_cardLevel.text           = card.Level.ToString();

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

            int    occ      = info.Occupation;
            int    race     = info.Type;
            string occName  = GameTable.OccupationInfoAsset.LookUp(occ).m_name;
            string raceName = GameTable.RaceInfoTableAsset.LookUp(race).m_name;
            m_occAndRace.text        = occName + " " + raceName;
            m_phyAttack.text         = ((int)card.GetPhyAttack()).ToString();
            m_magAttack.text         = ((int)card.GetMagAttack()).ToString();
            m_hp.text                = ((int)card.GetHp()).ToString();
            m_breakthroughTimes.text = card.BreakCounts.ToString();
        }
        ShowWindow();
    }
示例#13
0
    //添加非指定素材
    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);
    }
示例#15
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();
    }
示例#16
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);
    }
示例#17
0
    void UpdateInfo()
    {
        UpdateCardInfo();

        // 如果 升级卡牌  无效则 清空相关UI
        if (CardUpdateProp.Singleton.m_curLevelGuid.Equals(CSItemGuid.Zero))
        {
            // 隐藏材料 列表
            for (int i = 0; i < m_listMax; i++)
            {
                Parma parma = FindChildComponent <Parma>("" + i);
                if (null == parma)
                {
                    continue;
                }
                parma.m_guid = CSItemGuid.Zero;
                parma.gameObject.SetActive(false);
            }
        }

        // 选择数
        m_chosen.text = string.Format(Localization.Get("ChooeseNum"), OperateCardList.Singleton.LevelUpList.Count);
        // 持有数
        m_hold.text = CardBag.Singleton.itemList.Count + "/" + CardBag.Singleton.GetBagCapcity();
        // 升级的 基本卡牌
        CSItem card = CardBag.Singleton.GetCardByGuid(CardUpdateProp.Singleton.m_curLevelGuid);

        if (null == card)
        {
            return;
        }
        HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

        if (null == info)
        {
            return;
        }

        IconInfomation imageInfo = GameTable.IconInfoTableAsset.Lookup(info.ImageId);

        if (null == imageInfo)
        {
            return;
        }

        LevelUpInfo levInfo = GameTable.LevelUpTableAsset.LookUp(card.Level);

        if (null == levInfo)
        {
            return;
        }

        // 记录升级前的各种数据 用于升级后的显示
        CardUpdateProp.Singleton.SetOldData();

        float process = (float)card.Exp / (float)levInfo.Monster_Exp;

        m_processBar.value = process;

        m_expPercent.text    = card.Exp * 100 / levInfo.Monster_Exp + "%";
        m_cardBG.mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName);

        m_levelTips.text  = "LV" + card.Level;
        m_tupoCounts.text = "" + (info.BreakThroughCount - card.BreakCounts);

        // 需消耗的金币
        int money = card.Level * OperateCardList.Singleton.LevelUpList.Count;

        m_costMoney.text = "" + money;
        // 持有金币
        m_myMoney.text = "" + User.Singleton.GetMoney();

        if (money > User.Singleton.GetMoney())
        {
            m_costMoney.color = Color.red;
        }
        else
        {
            m_costMoney.color = Color.white;
        }

        // 基本卡牌的
        int baseCardId = card.IDInTable;

        int  index    = 0;
        bool bBreak   = false;       // 是否显示突破信息
        bool bWarning = false;       // 是否显示提示有三星以上卡牌 作为材料
        // 材料所提供的经验
        int supplyExp = 0;

        // 将要突破的次数
        int willBreakCounts = 0;

        // 材料卡牌列表
        foreach (CSItemGuid item in OperateCardList.Singleton.LevelUpList)
        {
            //
            Parma parma = FindChildComponent <Parma>("" + index);
            if (null == parma)
            {
                continue;
            }

            GameObject obj = parma.gameObject;
            obj.SetActive(true);
            card = CardBag.Singleton.GetCardByGuid(item);
            if (null == card)
            {
                continue;
            }

            // 如果材料卡牌和 基本卡牌一样的 则 显示界限突破 信息
            if (card.IDInTable == baseCardId)
            {
                bBreak = true;
                willBreakCounts++;
            }
            info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

            if (null == info)
            {
                continue;
            }

            // 如果是三星以上卡牌
            if (info.Rarity >= 3)
            {
                bWarning = true;
            }

            // guid
            parma.m_guid = item;

            imageInfo = GameTable.IconInfoTableAsset.Lookup(info.headImageId);

            // 提供的经验
            supplyExp = supplyExp + CardUpdateProp.Singleton.GetCardExpByLevel((int)card.IDInTable, card.Level);

            if (null == imageInfo)
            {
                continue;
            }

            //  头像
            obj.transform.Find("Image").GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName);

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

            if (null != rarityInfo)
            {
                imageInfo = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
                //  星级
                obj.transform.Find("Rank").GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(imageInfo.dirName);
            }

            //  名称
            obj.transform.Find("Name").GetComponent <UILabel>().text = info.StrName;
            //  等级
            obj.transform.Find("Level").GetComponent <UILabel>().text = "" + card.Level;

            index++;
        }

        // 三星材料卡提示
        m_warning.gameObject.SetActive(bWarning);

        // 升级后的 等级
        int afterLV = 0;
        // 升级后的经验
        int afterExp = 0;

        card = CardBag.Singleton.GetCardByGuid(CardUpdateProp.Singleton.m_curLevelGuid);

        CardUpdateProp.Singleton.GetLevelUpLVExp(card, supplyExp, willBreakCounts, out afterLV, out afterExp);

        // 经验
        // 只显示 当前经验 并不播放动画
        if (afterLV == 0)
        {
            m_levelBefore.gameObject.SetActive(true);
            m_levelBefore.GetComponent <Animation>().Stop();
            Color color = Color.white;
            color.a             = 1;
            m_levelBefore.color = color;
            m_levelBefore.GetComponent <TweenAlpha>().enabled = false;
            m_levelAfter.gameObject.SetActive(false);
        }

        // 当前经验和 升级后的经验 同时播放动画
        else
        {
            // m_levelBefore.animation.Play("ui-cardstate-00");
            // m_levelAfter.animation.Play("ui-cardstate-01");
            m_levelBefore.GetComponent <TweenAlpha>().enabled = true;
            levInfo = GameTable.LevelUpTableAsset.LookUp(afterLV);
            int afterMaxExp = levInfo.Monster_Exp;
            int per         = afterExp * 100 / afterMaxExp;
            m_levelAfter.gameObject.transform.Find("LevelTipsAfter").GetComponent <UILabel>().text = Localization.Get("CardLevel") + afterLV;
            if (per >= 100)
            {
                per = 100;
            }
            m_levelAfter.gameObject.transform.Find("LevelPercentAfter").GetComponent <UILabel>().text = per + "%";

            m_levelAfter.gameObject.transform.Find("ExpAfter").GetComponent <UISlider>().value = ((float)per) / 100f;

            m_levelAfter.gameObject.SetActive(true);
        }

        // 突破信息显示
        m_break.gameObject.SetActive(bBreak);

        // 隐藏其余的 列表
        for (; index < m_listMax; index++)
        {
            Parma parma = FindChildComponent <Parma>("" + index);
            if (null == parma)
            {
                continue;
            }
            parma.m_guid = CSItemGuid.Zero;
            parma.gameObject.SetActive(false);
        }

        // 是否激活合成按钮 条件 是 基本卡可强化 有材料 够金钱
        m_levelUpBtn.isEnabled = (OperateCardList.Singleton.LevelUpList.Count > 0) /*&&(money <= User.Singleton.GetMoney())*/;

        // 进化合成按钮是否激活
        m_evolution.isEnabled = card.IsEvlotion();

        m_grid.Reposition();
        // 计算消耗金钱

        // 把列表位置 提到最上面
        m_listPanel.transform.Find("Progress").GetComponent <UIProgressBar>().value = 0;
    }
示例#18
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);
    }
示例#19
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);
            }
        }
    }
示例#20
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;
    }
示例#21
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);
            }
        }


        //判断是否可以段位升级(待设定)
    }
示例#22
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++;
        }
    }
示例#23
0
    //
    IEnumerator NewDropItem(GameResPackage.AsyncLoadPackageData loadData, DropItemPerformanceType item, int intParam = 0)
    {
        EventItemInfo eventInfo = GameTable.eventItemAsset.LookUp(item.m_intParam);

        DropItemPerformanceType.Type type = item.m_type;
        if (eventInfo != null)
        {
            type = (DropItemPerformanceType.Type)eventInfo.dropType;
        }

        //
        string objName = "";

        switch (type)
        {
        case DropItemPerformanceType.Type.enGold:
        {
            objName = "Balk/p-b-gold";
            break;
        }

        case DropItemPerformanceType.Type.enCard:
        {
            objName = "Balk/p-b-contract";
            //DropItemPerformanceCard cardItem    = (DropItemPerformanceCard)item;
            // 根据不同星级掉落不同 模型
            HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(intParam);
            if (null != heroInfo)
            {
                RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(heroInfo.Rarity);
                if (null != rarityInfo)
                {
                    ModelInfo modelInfo = GameTable.ModelInfoTableAsset.Lookup(rarityInfo.m_dropItemModelID);
                    if (null != modelInfo)
                    {
                        objName = modelInfo.ModelFile;
                    }
                }
            }
            break;
        }

        case DropItemPerformanceType.Type.enKey:
        {
            // 钥匙模型
            objName = "Balk/p-b-gold";

            EventItemInfo eventItemInfo = GameTable.eventItemAsset.LookUp(intParam);
            if (null != eventItemInfo)
            {
                ModelInfo modelInfo = GameTable.ModelInfoTableAsset.Lookup(eventItemInfo.modelId);
                if (null != modelInfo)
                {
                    objName = modelInfo.ModelFile;
                }
            }
            break;
        }
        }

        float rotation = 30f;

        rotation = UnityEngine.Random.Range(0f, 360f);
        GameResPackage.AsyncLoadObjectData data = new GameResPackage.AsyncLoadObjectData();
        IEnumerator e = PoolManager.Singleton.Coroutine_Load(GameData.GetPrefabPath(objName), data);

        while (true)
        {
            e.MoveNext();
            if (data.m_isFinish)
            {
                break;
            }
            yield return(e.Current);
        }
        GameObject goldObj = data.m_obj as GameObject;

        goldObj.transform.parent   = MainGame.Singleton.MainObject.transform;
        goldObj.transform.position = item.m_deadPos;
        goldObj.SetActive(true);
        goldObj.transform.localEulerAngles = new Vector3(item.m_eulerAngles.x, item.m_eulerAngles.y + rotation, item.m_eulerAngles.z);


        int dropIndex = AddDropItem(goldObj);

        Animation anim = goldObj.transform.Find("gold_body").GetComponent <Animation>();

        PickUpCallback pickUpCallback = goldObj.transform.Find("gold_body").GetComponent <PickUpCallback>();

        if (null != pickUpCallback)
        {
            pickUpCallback.Clear();
            pickUpCallback.m_index = dropIndex;
        }

        // 随机动画
        int animationCount = anim.GetComponent <Animation>().GetClipCount();
        int animationIndex = UnityEngine.Random.Range(1, animationCount);
        int index          = 1;

        foreach (AnimationState state in anim.GetComponent <Animation>())
        {
            if (index == animationIndex)
            {
                anim.CrossFade(state.name);
                break;
            }
            index++;
        }

        loadData.m_isFinish = true;
    }