/// <summary>
 /// 刷新界面
 /// </summary>
 private void FreshUI()
 {
     //列表信息
     DestroyItems();
     if (rankList != null)
     {
         foreach (WorldBossDamageRankInfoClass rankInfo in rankList)
         {
             GameObject newItem = ResourceManager.Instance.loadWidget(rankInfoItem);
             newItem.transform.parent = grid.transform;
             newItem.GetComponent <UIWorldBossRankDetailItemView>().InitItem(rankInfo);
             items.Add(newItem);
         }
     }
     grid.repositionNow = true;
     //玩家信息
     name.text     = Obj_MyselfPlayer.GetMe().accountName;
     fighting.text = Obj_MyselfPlayer.GetMe().GetFightValue().ToString();
     damage.text   = playerInfo.totalDamage.ToString();
     if (playerInfo.rank == -1)
     {
         rankInfo.SetActive(false);
     }
     else
     {
         rank.text = playerInfo.rank.ToString();
         rankInfo.SetActive(true);
     }
     foreach (UserCardItem card in Obj_MyselfPlayer.GetMe().cardBagList)
     {
         if (card.cardID == Obj_MyselfPlayer.GetMe().teamMemberArray[0])
         {
             Tab_Card tabCard = TableManager.GetCardByID(card.templateID);
             if (tabCard != null)
             {
                 int icon_star = tabCard.Star;
                 iconBG.spriteName    = UserCardItem.littleCardFrameName[icon_star];
                 iconFrame.spriteName = UserCardItem.littleCardBorderName[icon_star];
                 Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(tabCard.Appearance);
                 if (tabAppearance != null)
                 {
                     iconCard.spriteName = tabAppearance.HeadIcon;
                 }
             }
             break;
         }
     }
     if (Obj_MyselfPlayer.GetMe().hasWorldBossReward == 1)
     {
         getRewardBtn.isEnabled = true;
     }
     else
     {
         getRewardBtn.isEnabled = false;
     }
 }
        public HeroTableItem(Int32 id, Int32 lvl)
        {
            cardID = id;
            //Tab_Card card = TableManager.GetCardByID(id);
            Tab_Appearance appear = TableManager.GetAppearanceByID(id);

            name     = LanguageManger.GetWords(appear.Name);
            level    = lvl;
            hp       = TableManager.GetCardByID(id).HpBase + TableManager.GetCardByID(id).HpGrow *lvl;
            attack   = TableManager.GetCardByID(id).AttackBase + TableManager.GetCardByID(id).AttackGrow *lvl;
            star     = TableManager.GetCardByID(id).Star;
            locked   = false;
            cardIcon = new CardIcon(id);
        }
Ejemplo n.º 3
0
        public bool Init()
        {
            m_TabCard = TableManager.GetCardByID(m_CardData.CardTempId);
            if (m_TabCard != null)
            {
                m_TabAppear = TableManager.GetAppearanceByID(m_TabCard.Appearance);
            }
            m_BattleCardObj      = GameObject.Instantiate(BattleUI.Instacne.battleCardPrefab) as GameObject;
            m_BattleCardObj.name = "BattleCard-" + m_BattleSlot.SlotIndex;
            ResetPosition();
            m_CardUI       = m_BattleCardObj.GetComponent <CardUI>();
            m_CardUI.Owner = this;
            m_CardUI.SetCardTemplateID(m_CardData.CardTempId);
            m_BuffPosArray = m_CardUI.m_BuffPosArray;

            if (!m_StateMachine.Init())
            {
                Debug.Log("m_StateMachine.Init()");
            }

            Tab_Skill tab_skill1 = TableManager.GetSkillByID(m_CardData.MemberData.commSkillID);
            Tab_Skill tab_skill2 = TableManager.GetSkillByID(m_CardData.MemberData.volSkillID);
            Tab_Skill tab_skill3 = TableManager.GetSkillByID(m_CardData.MemberData.combSkillID);

            if (tab_skill1 != null)
            {
                SkillType type = (SkillType)(tab_skill1.SkillType);
                m_SkillComm = SkillManager.Instance.CreateSkill(this, m_CardData.MemberData.commSkillID, type);
            }

            if (tab_skill2 != null)
            {
                SkillType type = (SkillType)(tab_skill2.SkillType);
                m_SkillVol = SkillManager.Instance.CreateSkill(this, m_CardData.MemberData.volSkillID, type);
            }

            if (tab_skill3 != null)
            {
                SkillType type = (SkillType)(tab_skill3.SkillType);
                m_SkillComb = SkillManager.Instance.CreateSkill(this, m_CardData.MemberData.combSkillID, type);
            }

            return(true);
        }
Ejemplo n.º 4
0
    public void SetCardTemplateID(int id)
    {
        cardTempID = id;
        Tab_Card cardTable = TableManager.GetCardByID(cardTempID);

        if (cardTable == null)
        {
            LogModule.ErrorLog("SetCardTemplateID(), no such template id: " + id);
            return;
        }

//		string atlasname = TableManager.GetAppearanceByID(TableManager.GetCardByID(cardTempID).Appearance).BodyIcon;

        Tab_Appearance apperanceTab = TableManager.GetAppearanceByID(cardTable.Appearance);

        if (apperanceTab != null &&
            nameLabel != null)
        {
            nameLabel.text = LanguageManger.GetWords(apperanceTab.Name);;
        }

        if (nameBg != null)
        {
            nameBg.spriteName = UserCardItem.largeCardNameBg[cardTable.Star];
            nameBg.MakePixelPerfect();
        }

        if (cardBoard != null)
        {
            cardBoard.spriteName = UserCardItem.largeCardBorderName[cardTable.Star];
            cardBoard.MakePixelPerfect();
        }

        AtlasManager.Instance.setBodyByTempletID(cardIcon, cardTempID);       //.SetBodyName(cardIcon, atlasname);
        cardFrame.spriteName = UserCardItem.cardFrameName[cardTable.Star];
        cardFrame.MakePixelPerfect();

        //catFrame.spriteName = UserCardItem.elementFrameName[TableManager.GetCardByID(id).Star];
        //catFrame.MakePixelPerfect();

        category.spriteName = UserCardItem.elementTypeName[cardTable.Element];
        category.MakePixelPerfect();
    }
    public void Show(int copy_id)
    {
        gameObject.SetActive(true);
        copyID        = copy_id;
        tblCopyDetail = TableManager.GetCopydetailByID(copy_id);

        Tab_Card       tbl_card   = TableManager.GetCardByID(tblCopyDetail.NoticeLeft);
        Tab_Appearance tbl_appear = null;

        if (tbl_card != null)
        {
            tbl_appear          = TableManager.GetAppearanceByID(tbl_card.Appearance);
            leftName.spriteName = tbl_appear.ImgName;
            AtlasManager.Instance.SetBodyName(leftPerson, tbl_appear.BodyIcon);
        }
        if (tbl_card != null && TableManager.GetSkillByID(tbl_card.SkillComb) != null)
        {
            int dis_id = TableManager.GetSkillByID(tbl_card.SkillComb).Effect;
            hetiName.text = LanguageManger.GetWords(TableManager.GetSkillDisplayByID(dis_id).Name);
            hetiText.text = LanguageManger.GetWords(tblCopyDetail.NoticeText);

            string wengzi_anim = TableManager.GetSkillDisplayByID(TableManager.GetSkillByID(tbl_card.SkillComb).Effect).AttackAnim;

            GameObject go = Resources.Load("HetiWenZi/" + wengzi_anim, typeof(GameObject)) as GameObject;
            mWengzi = GameObject.Instantiate(go) as GameObject;
            mWengzi.transform.parent                   = wengziPos.transform.parent;
            mWengzi.transform.localPosition            = wengziPos.transform.localPosition;
            mWengzi.transform.localScale               = Vector3.one;
            mWengzi.GetComponent <Animation>().enabled = false;
        }
        else
        {
            Debug.LogError("HeTiPromptUI.Show(), card has no heti skill, card id = " + tblCopyDetail.NoticeLeft);
        }

        tbl_card = TableManager.GetCardByID(tblCopyDetail.NoticeRight);
        if (tbl_card != null)
        {
            tbl_appear           = TableManager.GetAppearanceByID(tbl_card.Appearance);
            rightName.spriteName = tbl_appear.ImgName;
            AtlasManager.Instance.SetBodyName(rightPerson, tbl_appear.BodyIcon);
        }
    }
Ejemplo n.º 6
0
    public WorldBossClass(WorldBoss msg)
    {
        id             = msg.Id;
        name           = msg.Name;
        templateId     = msg.Cardid;
        currentHp      = msg.CurrentHp;
        totalHp        = msg.TotalHp;
        activeFlag     = msg.ActiveFlag;
        remainOpenTime = msg.RemainOpenTime;
        aliveTime      = msg.AliveTime;
        Tab_Card tab_card = TableManager.GetCardByID(msg.Cardid);

        if (tab_card != null)
        {
            Tab_Appearance tab_Appearance = TableManager.GetAppearanceByID(tab_card.Appearance);
            if (tab_Appearance != null)
            {
                name = LanguageManger.GetWords(tab_Appearance.Name);
                des  = LanguageManger.GetWords(tab_Appearance.Story);
            }
        }
    }
Ejemplo n.º 7
0
    public void InitItem(WorldBossDamageRankInfoClass rankInfo)
    {
        transform.localPosition = new Vector3(0, 0, -1);
        transform.localScale    = new Vector3(1, 1, 1);
        playerName.text         = rankInfo.name;
        level.text  = rankInfo.level.ToString();
        rank.text   = rankInfo.rank.ToString();
        fight.text  = rankInfo.fighting.ToString();
        damage.text = rankInfo.totalDamage.ToString();
        Tab_Card tabCard = TableManager.GetCardByID(rankInfo.templateId);

        if (tabCard != null)
        {
            int icon_star = tabCard.Star;
            iconBG.spriteName    = UserCardItem.littleCardFrameName[icon_star];
            iconFrame.spriteName = UserCardItem.littleCardBorderName[icon_star];
            Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(tabCard.Appearance);
            if (tabAppearance != null)
            {
                iconCard.spriteName = tabAppearance.HeadIcon;
            }
        }
    }
    //zbz修改(以后显示的计算都放在这里) 如果Card != null 则用card, 否用templateid
    private void CalculateCardInfoAndShow(UserCardItem card, int nTemplateid)
    {
        int templateid = 0;

        if (card != null)
        {
            templateid = card.templateID;
        }
        else if (nTemplateid > 0)
        {
            templateid = nTemplateid;
        }
        else
        {
            return;
        }
        Tab_Card tabCard = TableManager.GetCardByID(templateid);

        if (tabCard != null)
        {
            Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(tabCard.Appearance);
            if (tabAppearance != null)
            {
                cardName.text = LanguageManger.GetWords(tabAppearance.Name);
                if (tabAppearance.DropDescripe == -1)
                {
                    level_src.text = "获得途径:无";
                }
                else
                {
                    level_src.text = LanguageManger.GetWords(tabAppearance.DropDescripe);
                }
            }
            if (largeCardObj != null)
            {
                largeCardObj.GetComponent <CardLarge>().SetCardTemplateID(templateid);
            }
            if (card != null)
            {
                if (Obj_MyselfPlayer.GetMe().IsCardInBagByID(card.cardID))
                {
                    HP.text     = (card.GetHpBase() + card.GetFengShuiHp() + card.GetStudySkillHp()).ToString();
                    attack.text = (card.GetAttackBase() + card.GetFengShuiAttc()).ToString();
                }
                else
                {
                    HP.text     = card.GetHpBase().ToString();
                    attack.text = card.GetAttackBase().ToString();
                }

                if (card.GetHpAdd() > 0) //有加成
                {
                    HP_add.text = "+" + card.GetHpAdd().ToString();
                }
                else
                {
                    HP_add.text = "";
                }
                if (card.GetAttackAdd() > 0)
                {
                    attack_add.text = "+" + card.GetAttackAdd().ToString();
                }
                else
                {
                    attack_add.text = "";
                }
                level.text = card.level + "/" + tabCard.MaxLevel.ToString();
                //学习技能
                Tab_Studyskill studySkill = TableManager.GetStudyskillByID(card.skillStudyId);
                if (studySkill != null)
                {
                    string color = "";
                    switch (studySkill.SkillQuality)
                    {
                    case 0:
                        color = "[2d8560]";
                        break;

                    case 1:
                        color = "[2368ad]";
                        break;

                    case 2:
                        color = "[852bed]";
                        break;

                    default:
                        break;
                    }
                    studySkillName.text  = color + studySkill.SkillName;
                    studySkillName.text += "[9d2f07] " + card.skillStudyLev + "/" + studySkill.SkillHighLevel;
                    sdudySkillDes.text   = ConvertAttType(studySkill.SkillDes, templateid);
                }
                else
                {
                    studySkillName.text = "[a65a04]无";
                    sdudySkillDes.text  = "";
                }
                leadership.text = card.GetLeaderShip().ToString();
            }
            else
            {
                int hp       = tabCard.HpBase;
                int nLevBase = tabCard.LevelBase;
                hp     += tabCard.HpGrow * (tabCard.GambleLevel - nLevBase);
                HP.text = hp.ToString();
                int att = tabCard.AttackBase;
                att            += tabCard.AttackGrow * (tabCard.GambleLevel - nLevBase);
                attack.text     = att.ToString();
                attack_add.text = "";
                HP_add.text     = "";
                level.text      = tabCard.GambleLevel.ToString() + "/" + tabCard.MaxLevel.ToString();
                //学习技能
                Tab_Studyskill studySkill = TableManager.GetStudyskillByID(tabCard.SkillStudy);
                if (studySkill != null)
                {
                    string color = "";
                    switch (studySkill.SkillQuality)
                    {
                    case 0:
                        color = "[2d8560]";
                        break;

                    case 1:
                        color = "[2368ad]";
                        break;

                    case 2:
                        color = "[852bed]";
                        break;

                    default:
                        break;
                    }
                    studySkillName.text  = color + studySkill.SkillName;
                    studySkillName.text += "[9d2f07] " + tabCard.SkillStudylv + "/" + studySkill.SkillHighLevel;
                    sdudySkillDes.text   = ConvertAttType(studySkill.SkillDes, templateid);
                    //领导力
                    leadership.text = (tabCard.LeaderBase + studySkill.LeaderNum).ToString();
                }
                else
                {
                    studySkillName.text = "[a65a04]无";
                    sdudySkillDes.text  = "";
                    //领导力
                    leadership.text = tabCard.LeaderBase.ToString();
                }
            }
            Tab_Skill        skill        = null;
            Tab_SkillDisplay skillDisplay = null;
            skill = TableManager.GetSkillByID(tabCard.SkillComm);
            if (skill != null)
            {
                skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect);
                N_name.text  = LanguageManger.GetWords(skillDisplay.Name);
                N_des.text   = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), templateid);
            }
            skill             = TableManager.GetSkillByID(tabCard.SkillVol);
            cardLevelMax.text = "";
            if (skill != null)
            {
                skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect);
                Z_name.text  = LanguageManger.GetWords(skillDisplay.Name);
                Z_des.text   = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), templateid);
                //当实现的卡牌是存在的卡牌时(就是除了进化后预览效果这样的卡牌)
                if (card != null)
                {
                    Z_name.text += "[9d2f07]" + card.skillLevel + "/" + skill.SkillMaxlevel;
                    Debug.Log("card skill level : " + card.skillLevel);
                }
                else
                {
                    Z_name.text += "[9d2f07]" + 1 + "/" + skill.SkillMaxlevel;

                    Debug.Log("card skill level : not find card");
                }
                //2013-8-9 Jack Wen
                cardLevelMax.gameObject.SetActive(false);
                ShowRoundNum(skill.FirstRelease);
            }
            else
            {
                ShowRoundNum(2);
            }

            Tab_Leaderskill leaderSkill = TableManager.GetLeaderskillByID(tabCard.SkillLeader);//.GetSkillByID(tabCard.SkillLeader);
            if (leaderSkill != null)
            {
                L_name.text = LanguageManger.GetWords(leaderSkill.Name);
                Debug.Log("L_name.text=" + L_name.text);
                L_des.text = ConvertAttType(LanguageManger.GetWords(leaderSkill.Note), templateid);
            }
            else
            {
                L_name.text = "无";
                L_des.text  = "";
            }
            skill = TableManager.GetSkillByID(tabCard.SkillComb);
            if (skill != null)
            {
                skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect);
                H_name.text  = LanguageManger.GetWords(skillDisplay.Name);
                H_des.text   = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), templateid);
            }
            cardCanEvl.spriteName = tabCard.NextCard == -1 ? "cannotEvl" : "canEvl";
            int maxStar = tabCard.HighStarDisplay;
            //		level;
            for (int i = 0; i < startManager.Length; i++)
            {
                if (i < tabCard.Star)
                {
                    UISprite starIcon = startManager[i].GetComponent <UISprite>();
                    starIcon.spriteName = "xingxing";
                    starIcon.MakePixelPerfect();
                    starIcon.gameObject.SetActive(true);
                }
                else
                {
                    UISprite starIcon = startManager[i].GetComponent <UISprite>();
                    if (i < maxStar)
                    {
                        starIcon.spriteName = "haoyou_xingxing_beijing";
                        starIcon.MakePixelPerfect();
                        starIcon.gameObject.SetActive(true);
                    }
                    else
                    {
                        starIcon.gameObject.SetActive(false);
                    }
                }
            }
        }
    }
    public bool InitFriendMailWithMail(MailInfo mail)
    {
        transform.name          = mail.mailID.ToString();
        transform.localPosition = new Vector3(0, 0, -1);
        transform.localScale    = new Vector3(1, 1, 1);

        if (mail == null)
        {
            return(false);
        }

        YesBtn.name     = mail.mailID.ToString();
        NoBtn.name      = mail.mailID.ToString();
        cardBtn.name    = mail.mailID.ToString();
        cardBtn.name    = mail.mailID.ToString();
        labelLevel.text = mail.cardLevel.ToString();

        labelName.text       = mail.source;
        labelLevelValue.text = mail.level.ToString();

        Tab_Card tabCard = TableManager.GetCardByID(mail.icon_id);

        if (tabCard == null)
        {
            return(false);
        }
        Tab_Appearance tabApp = TableManager.GetAppearanceByID(tabCard.Appearance);

        if (tabApp == null)
        {
            return(false);
        }
        Tab_Card tabCardTemp = TableManager.GetCardByID(mail.cardTempleId);

        if (tabCardTemp == null)
        {
            return(false);
        }

        string atlasname = tabApp.HeadIcon;

        AtlasManager.Instance.setHeadName(icon, atlasname);
        icon.transform.localScale = new Vector3(82, 82, 1);
        //------------------------卡牌背景及外框--------------------------------
        //2013-10-12 Jack Wen
        int icon_star = tabCard.Star;

        iconBg.spriteName     = UserCardItem.littleCardFrameName[icon_star];
        iconBorder.spriteName = UserCardItem.littleCardBorderName[icon_star];
        //--------------------------------------------------------------------
        for (int j = 1; j <= 7; j++)
        {
            if (j <= tabCardTemp.Star)
            {
                star[j - 1].SetActive(true);
            }
            else
            {
                star[j - 1].SetActive(false);
            }
        }

        return(true);
    }
Ejemplo n.º 10
0
    public UILabel cardAttack;           //攻击

    /// <summary>
    /// 初始化Item
    /// </summary>
    /// <param name="card"></param>
    /// <param name="isUpdateChild"></param>
    public void InitItem(UserCardItem card, bool isUpdateChild)
    {
        transform.localPosition = new Vector3(0, 0, -1);
        transform.localScale    = new Vector3(1, 1, 1);
        transform.name          = card.cardID.ToString();
        cardHp.text             = card.GetHp().ToString();
        cardAttack.text         = card.GetAttack().ToString();
        cardLev.text            = card.level.ToString();
        Tab_Studyskill tabStydyskill = TableManager.GetStudyskillByID(card.skillStudyId);

        if (tabStydyskill != null)
        {
            string color = "";
            switch (tabStydyskill.SkillQuality)
            {
            case 0:
                color = "[2d8560]";
                break;

            case 1:
                color = "[2368ad]";
                break;

            case 2:
                color = "[852bed]";
                break;

            default:
                break;
            }
            skillName.text = color + tabStydyskill.SkillName;
            if (isUpdateChild)
            {
                skillInfo.text = tabStydyskill.SkillExperience.ToString();
            }
            else
            {
                skillInfo.text = card.skillStudyLev.ToString();
            }
        }
        else
        {
            skillName.text = "";
            skillInfo.text = "0";
        }
        if (isUpdateChild)
        {
            skillInfoIcon.spriteName           = "zhujiemian_zi_13";
            skillInfoIcon.transform.localScale = new Vector3(45, 24, 1);
        }
        else
        {
            skillInfoIcon.spriteName = "haoyou_dengji";
            skillInfoIcon.MakePixelPerfect();
        }
        Tab_Card tabCard = TableManager.GetCardByID(card.templateID);

        if (tabCard != null)
        {
            Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(tabCard.Appearance);
            if (tabAppearance != null)
            {
                cardName.text = LanguageManger.GetWords(tabAppearance.Name);
                string atlasname = tabAppearance.HeadIcon;
                AtlasManager.Instance.setHeadName(cardIconSpriteIcon, atlasname);
            }
            cardIconSpriteFrame.spriteName = UserCardItem.littleCardFrameName[tabCard.Star];
            cardIconSpriteBG.spriteName    = UserCardItem.littleCardBorderName[tabCard.Star];
            cardProperty.spriteName        = UserCardItem.elementTypeName[tabCard.Element];
        }
        chexkBox.isChecked = false;
        backGround.alpha   = 1;
    }
Ejemplo n.º 11
0
    public void ShowCardItem(UserCardItem card)
    {
        if (card == null)
        {
            return;
        }

        GameObject newItem = CardListItemPool.Instance.GetListItem("CardSellItem");//(GameObject)Instantiate(cardPrefab);

        if (newItem == null)
        {
            return;
        }

        newItem.transform.parent        = listParent.transform;
        newItem.transform.localPosition = new Vector3(0, 0, -1);
        newItem.transform.localScale    = new Vector3(1, 1, 1);
        newItem.name = card.cardID.ToString();
        items.Add(newItem);
        //			UIEventListener.Get(newItem).onClick +=

        Tab_Card tabCard = TableManager.GetCardByID(card.templateID);

        Transform labNameTrans = newItem.transform.FindChild("Labels/Label-Name");

        if (labNameTrans != null &&
            tabCard != null)
        {
            Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(tabCard.Appearance);
            if (tabAppearance != null)
            {
                UILabel nameLabel = labNameTrans.GetComponent <UILabel>();
                if (nameLabel != null)
                {
                    int nameLangId = tabAppearance.Name;
                    nameLabel.text = LanguageManger.GetWords(nameLangId);
                }
            }
        }


        //------------------------卡牌背景及外框--------------------------------
        //2013-10-12 Jack Wen
        Transform tranSpBg = newItem.transform.FindChild("CardIcon/CardIconBtn/Sprite-BG");

        if (tranSpBg != null &&
            tabCard != null)
        {
            UISprite icon_bg = tranSpBg.GetComponent <UISprite>();
            if (icon_bg != null)
            {
                icon_bg.spriteName = UserCardItem.littleCardFrameName[tabCard.Star];
            }
        }

        Transform tranSp_Outside = newItem.transform.FindChild("CardIcon/CardIconBtn/sp-Outside");

        if (tranSp_Outside != null &&
            tabCard != null)
        {
            UISprite icon_border = tranSp_Outside.GetComponent <UISprite>();
            icon_border.spriteName = UserCardItem.littleCardBorderName[tabCard.Star];
        }
        //--------------------------------------------------------------------

        Transform transLabel_lev_value = newItem.transform.FindChild("Labels/Label-Level-Value");

        if (transLabel_lev_value != null)
        {
            UILabel cardLevelLabel = transLabel_lev_value.GetComponent <UILabel>();
            if (cardLevelLabel != null)
            {
                cardLevelLabel.text = card.level.ToString();
            }
        }
        //UILabel cardLevelLabel = newItem.transform.FindChild("Labels/Label-Level-Value").GetComponent<UILabel>();


        Transform tranLab_Hp_Val = newItem.transform.FindChild("Labels/Label-Hp-Value");

        if (tranLab_Hp_Val != null)
        {
            UILabel cardHPLabel = tranLab_Hp_Val.GetComponent <UILabel>();
            if (cardHPLabel != null)
            {
                cardHPLabel.text = card.GetHp().ToString();
            }
        }

        Transform tranLab_Att_Val = newItem.transform.FindChild("Labels/Label-Attack-Value");

        if (tranLab_Att_Val != null)
        {
            UILabel cardAttackValueLabel = tranLab_Att_Val.GetComponent <UILabel>();
            if (cardAttackValueLabel != null)
            {
                cardAttackValueLabel.text = card.GetAttack().ToString();
            }
        }

        Transform tranLab_Mony_Val = newItem.transform.FindChild("Labels/Label-Money-Value");

        if (tranLab_Mony_Val != null)
        {
            UILabel cardMoneyValueLabel = tranLab_Mony_Val.GetComponent <UILabel>();
            if (cardMoneyValueLabel != null)
            {
                cardMoneyValueLabel.text = card.GetMoneyValue().ToString();
            }
        }


        Transform tranSp_Icon = newItem.transform.FindChild("CardIcon/CardIconBtn/Sprite-Icon");

        if (tranSp_Icon != null)
        {
            UISprite       icon          = tranSp_Icon.GetComponent <UISprite>();
            Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(tabCard.Appearance);
            if (icon != null &&
                tabAppearance != null)
            {
                icon.spriteName = tabAppearance.HeadIcon;
            }
        }


        //星级显示
        Transform transformStars = newItem.transform.FindChild("Stars");

        if (transformStars != null)
        {
            for (int j = 1; j <= 7; j++)
            {
                if (j <= card.quality)
                {
                    Transform tranStar = transformStars.FindChild("star_" + j);
                    if (tranStar != null)
                    {
                        tranStar.gameObject.SetActive(true);
                    }
                }
                else
                {
                    Transform tranStar = transformStars.FindChild("star_" + j);
                    if (tranStar != null)
                    {
                        tranStar.gameObject.SetActive(false);
                    }
                }
            }
        }


        Transform tranSp_Selected = newItem.transform.FindChild("Sprites/Sprite-Selected");

        if (tranSp_Selected != null)
        {
            UISprite selectSprite = tranSp_Selected.GetComponent <UISprite>();
            //设置显示状态
            if (CheckIfChooseItem(card))
            {
                if (selectSprite != null)
                {
                    selectSprite.gameObject.SetActive(true);
                }
            }
            else
            {
                if (selectSprite != null)
                {
                    selectSprite.gameObject.SetActive(false);
                }
            }
        }



        //五行图标显示
        Transform tranSpAttribut = newItem.transform.FindChild("Sprite-Attribute");

        if (tranSpAttribut != null)
        {
            UISprite sttributeIcon = tranSpAttribut.GetComponent <UISprite>();
            if (sttributeIcon != null)
            {
                sttributeIcon.spriteName = card.GetAttributeIconName();
            }
        }



//         UISprite selectSprite = newItem.transform.FindChild("Sprites/Sprite-Selected").GetComponent<UISprite>();
//         selectSprite.gameObject.SetActive(false);

        UIEventListener.Get(newItem).onClick += OnSelectItem;
        Transform tranCardIconBtn = newItem.transform.FindChild("CardIcon/CardIconBtn");

        if (tranCardIconBtn != null)
        {
            GameObject CardIconBtn = tranCardIconBtn.gameObject;
            UIEventListener.Get(CardIconBtn).onClick += ShowCardInfo;
        }
    }
Ejemplo n.º 12
0
    private bool SetSprite(UISprite sprite, string spriteName /*,SPRITE_TYPE type*/)
    {
        if (sprite == null || spriteName == null || spriteName == "")
        {
            return(false);
        }
        if (atlasPool == null)
        {
            atlasPool = new Dictionary <string, UIAtlas>();
        }

//		if(type == SPRITE_TYPE.HEAD)
//		{
        Hashtable cardList = TableManager.GetAppearance();

        foreach (DictionaryEntry dic in cardList)
        {
            Tab_Appearance appearance = (Tab_Appearance)dic.Value;
            if (appearance.HeadIcon == spriteName)
            {
                //已找到对应名字,查询是否atlas已经被缓存过
                if (!atlasPool.ContainsKey(appearance.HeadAtlas))
                {
                    UIAtlas newAtlas = ResourceManager.Instance.LoadCardAtlas(appearance.HeadAtlas);
                    atlasPool.Add(appearance.HeadAtlas, newAtlas);
                }
                sprite.atlas      = atlasPool[appearance.HeadAtlas];
                sprite.spriteName = spriteName;
                sprite.MakePixelPerfect();
                return(true);
            }
        }
//		}
//		else if(type == SPRITE_TYPE.BODY)
//		{
//			if(!atlasPool.ContainsKey(spriteName))
//			{
//				Texture newTex = ResourceManager.Instance.LoadCardTexture(spriteName);
//				atlasPool.Add(spriteName,newTex);
//			}
//			sprite.atlas = atlasPool[spriteName];
//			sprite.spriteName = spriteName;
//			sprite.MakePixelPerfect();
//			return true;
//			foreach(DictionaryEntry dic in cardList)
//			{
//				Tab_Appearance appearance = (Tab_Appearance)dic.Value;
//				if(appearance.BodyIcon == spriteName)
//				{
//					//已找到对应名字,查询是否atlas已经被缓存过
//					if(!atlasPool.ContainsKey(appearance.BodyAtlas))
//					{
//						//未缓存
//						UIAtlas newAtlas = ResourceManager.Instance.LoadCardAtlas(appearance.BodyAtlas);
//						atlasPool.Add(appearance.BodyAtlas,newAtlas);
//					}
//					sprite.atlas = atlasPool[appearance.BodyAtlas];
//					sprite.spriteName = spriteName;
//					sprite.MakePixelPerfect();
//					return true;
//				}
//			}
//		}


        return(false);
    }
Ejemplo n.º 13
0
    public void FreshCardInfo(long cardID)
    {
        Obj_MyselfPlayer.GetMe().bShowCardInfo = true;

        List <UserCardItem> cardList = Obj_MyselfPlayer.GetMe().cardBagList;

        foreach (UserCardItem card in cardList)
        {
            if (card.cardID == cardID)
            {
                if (largeCardObj != null)
                {
                    largeCardObj.GetComponent <CardLarge>().SetCardTemplateID(card.templateID);
                }
                Tab_Card tab_card = TableManager.GetCardByID(card.templateID);
                if (tab_card != null)
                {
                    Tab_Appearance tab_Appearance = TableManager.GetAppearanceByID(tab_card.Appearance);
                    if (tab_Appearance != null)
                    {
                        cardName.text  = LanguageManger.GetWords(tab_Appearance.Name);
                        otherInfo.text = LanguageManger.GetWords(tab_Appearance.DropDescripe);
                    }
                    cardLevel.text = card.level + "/" + tab_card.MaxLevel.ToString();
                    if (card.GetHpAdd() > 0) //有加成
                    {
                        cardHPAdd.text = "+" + card.GetHpAdd().ToString();
                    }
                    else
                    {
                        cardHPAdd.text = "";
                    }
                    if (card.GetAttackAdd() > 0)
                    {
                        cardAttackAdd.text = "+" + card.GetAttackAdd().ToString();
                    }
                    else
                    {
                        cardAttackAdd.text = "";
                    }

                    cardHP.text     = (card.GetHpBase() + card.GetFengShuiHp() + card.GetStudySkillHp()).ToString();
                    cardAttack.text = (card.GetAttackBase() + card.GetFengShuiAttc()).ToString();

                    cardLeaderShip.text = card.GetLeaderShip().ToString();
                    Transform transformStars = starManage.transform;
                    int       maxStar        = tab_card.HighStarDisplay;
                    for (int j = 1; j <= 7; j++)
                    {
                        if (j <= card.quality)
                        {
                            UISprite starIcon = transformStars.FindChild("Star_" + j).GetComponent <UISprite>();
                            starIcon.spriteName = "xingxing";
                            starIcon.MakePixelPerfect();
                            starIcon.gameObject.SetActive(true);
                        }
                        else
                        {
                            UISprite starIcon = transformStars.FindChild("Star_" + j).GetComponent <UISprite>();
                            if (j <= maxStar)
                            {
                                starIcon.spriteName = "haoyou_xingxing_beijing";
                                starIcon.MakePixelPerfect();
                                starIcon.gameObject.SetActive(true);
                            }
                            else
                            {
                                starIcon.gameObject.SetActive(false);
                            }
                        }
                    }
                    Tab_Skill        skill        = null;
                    Tab_SkillDisplay skillDisplay = null;
                    //普通技能
                    skill = TableManager.GetSkillByID(tab_card.SkillComm);
                    if (skill != null)
                    {
                        skillDisplay         = TableManager.GetSkillDisplayByID(skill.Effect);
                        skillNormalName.text = LanguageManger.GetWords(skillDisplay.Name);
                        skillNormal.text     = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), card.templateID);
                    }
                    //主动技能
                    skill = TableManager.GetSkillByID(tab_card.SkillVol);
                    if (skill != null)
                    {
                        skillDisplay          = TableManager.GetSkillDisplayByID(skill.Effect);
                        skillActiveName.text  = LanguageManger.GetWords(skillDisplay.Name);
                        skillActive.text      = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), card.templateID);
                        skillActiveName.text += "[9d2f07]" + card.skillLevel + "/" + skill.SkillMaxlevel;
                        //显示进恩释放回合数
                        ShowRoundNum(skill.FirstRelease);
                    }
                    else
                    {
                        //没有绝技,不显示
                        ShowRoundNum(2);
                    }
                    //队长技能
                    Tab_Leaderskill leaderSkill = TableManager.GetLeaderskillByID(tab_card.SkillLeader);
                    if (leaderSkill != null)
                    {
                        skillLeaderName.text = LanguageManger.GetWords(leaderSkill.Name);
                        skillLeader.text     = ConvertAttType(LanguageManger.GetWords(leaderSkill.Note), card.templateID);
                    }
                    else
                    {
                        skillLeaderName.text = "无";
                        skillLeader.text     = "";
                    }
                    skill = TableManager.GetSkillByID(tab_card.SkillComb);
                    if (skill != null)
                    {
                        skillDisplay      = TableManager.GetSkillDisplayByID(skill.Effect);
                        skillMixName.text = LanguageManger.GetWords(skillDisplay.Name);
                        skillMix.text     = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), card.templateID);
                    }
                    else
                    {
                        skillMixName.text = "无";
                        skillMix.text     = "";
                    }
                    cardCanEvl.spriteName  = tab_card.NextCard == -1 ? "cannotEvl" : "canEvl";
                    isProtected.spriteName = card.isProtected ? "renwuxinxi_quxiaobaohu" : "renwuxinxi_baohu";
                    isProtected.MakePixelPerfect();
                    //学习技能
                    Tab_Studyskill studySkill = TableManager.GetStudyskillByID(card.skillStudyId);
                    if (studySkill != null)
                    {
                        string color = "";
                        switch (studySkill.SkillQuality)
                        {
                        case 0:
                            color = "[2d8560]";
                            break;

                        case 1:
                            color = "[2368ad]";
                            break;

                        case 2:
                            color = "[852bed]";
                            break;

                        default:
                            break;
                        }
                        studySkillName.text  = color + studySkill.SkillName;
                        studySkillName.text += "[9d2f07] " + card.skillStudyLev + "/" + studySkill.SkillHighLevel;
                        sdudySkillDes.text   = ConvertAttType(studySkill.SkillDes, card.templateID);
                    }
                    else
                    {
                        studySkillName.text = "[a65a04]无";
                        sdudySkillDes.text  = "";
                    }
                }
                break;
            }
        }
    }
    public bool InitWithUserCardItem(UserCardItem card)
    {
        transform.localPosition = new Vector3(0, 0, -1);
        transform.localScale    = new Vector3(1, 1, 1);
        gameObject.name         = card.cardID.ToString();

        if (card == null)
        {
            return(false);
        }

        //读表双重验证
        Tab_Card tabCard = TableManager.GetCardByID(card.templateID);

        if (tabCard == null)
        {
            return(false);
        }
        Tab_Appearance tabApp = TableManager.GetAppearanceByID(tabCard.Appearance);

        if (tabApp == null)
        {
            return(false);
        }

        iconCard.spriteName = tabApp.HeadIcon;
        //------------------------卡牌背景及外框--------------------------------
        //2013-10-12 Jack Wen
        int icon_star = tabCard.Star;

        iconBG.spriteName    = UserCardItem.littleCardFrameName[icon_star];
        iconFrame.spriteName = UserCardItem.littleCardBorderName[icon_star];
        //--------------------------------------------------------------------

        int nameLangId = tabApp.Name;

        labelName.text      = LanguageManger.GetWords(nameLangId);
        labelHP.text        = card.GetHp().ToString();
        labelAttack.text    = card.GetAttack().ToString();
        labelCardLevel.text = card.level.ToString();
        HideSelected();

        //等级状态显示
        labelMaxLevel.text = card.level.ToString() + "/" + tabCard.MaxLevel;

        //五行图标显示
        attribute.spriteName = card.GetAttributeIconName();


        //星级显示
        for (int j = 1; j <= 7; j++)
        {
            if (j <= card.quality)
            {
                starArray[j - 1].SetActive(true);
            }
            else
            {
                starArray[j - 1].SetActive(false);
            }
        }

        return(true);
    }
Ejemplo n.º 15
0
    public bool InitWithPlayerInfo(PVPPlayerInfo playerInfo, UIEventListener.VoidDelegate ShowCardInfo, UIEventListener.VoidDelegate OnSelectPvPItem)
    {
        transform.localPosition = new Vector3(0, 0, -1);
        transform.localScale    = new Vector3(1, 1, 1);
        gameObject.name         = playerInfo.nlGUID.ToString();

        //------------------------卡牌背景及外框--------------------------------
        //2013-10-12 Jack Wen
        //templeID < 0 情况的容错处理,暂时显示默认头像,且错误头像点击不给予反映//
        Tab_Card tabPCard = TableManager.GetCardByID(playerInfo.nTempleID);

        if (tabPCard != null)
        {
            int icon_star = tabPCard.Star;
            cardIconBG.spriteName     = UserCardItem.littleCardFrameName[icon_star];
            cardIconBorder.spriteName = UserCardItem.littleCardBorderName[icon_star];

            UIEventListener.Get(cardIconBtn).onClick = ShowCardInfo;
        }
        //--------------------------------------------------------------------

        labelRankValuel.text = playerInfo.nRank.ToString();
        labelScoreValue.text = GetOccupyScoreByRank(playerInfo.nRank).ToString();

        long         leadCardID = 0;
        UserCardItem leaderCard = null;

        if (playerInfo.nlGUID == Obj_MyselfPlayer.GetMe().accountID)
        {
            leadCardID = Obj_MyselfPlayer.GetMe().GetTeamLeaderCardID();
            leaderCard = Obj_MyselfPlayer.GetMe().GetUserCardByGUID(leadCardID);
        }

        int      apperanceID = 0;
        Tab_Card tabCard;

        if (playerInfo.nlGUID == Obj_MyselfPlayer.GetMe().accountID)
        {
            labelName.text       = Obj_MyselfPlayer.GetMe().accountName;
            labelFightValue.text = Obj_MyselfPlayer.GetMe().GetFightValue().ToString();
            labelLevelValue.text = leaderCard.level.ToString();

            tabCard = TableManager.GetCardByID(leaderCard.templateID);
            if (tabCard != null)
            {
                apperanceID = tabCard.Appearance;
            }
        }
        else
        {
            labelName.text       = playerInfo.strName;
            labelFightValue.text = playerInfo.nFight.ToString();
            labelLevelValue.text = playerInfo.nLev.ToString();

            tabCard = TableManager.GetCardByID(playerInfo.nTempleID);
            if (tabCard != null)
            {
                apperanceID = tabCard.Appearance;
            }
        }

        Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(apperanceID);

        if (tabAppearance != null)
        {
            cardIconIcon.spriteName = tabAppearance.HeadIcon;
        }


        if (playerInfo.nRank >= Obj_MyselfPlayer.GetMe().nHeroRank)
        {
            fightBtn.SetActive(false);
        }
        else if (Obj_MyselfPlayer.GetMe().nHeroRank >= 16 && playerInfo.nRank <= 10)         //大于等于16名的情况是前10不能挑战
        {
            fightBtn.SetActive(false);
        }
        else if (Obj_MyselfPlayer.GetMe().nHeroRank < 16 && playerInfo.nRank < (Obj_MyselfPlayer.GetMe().nHeroRank - 5))           //
        {
            fightBtn.SetActive(false);
        }
        else
        {
            fightBtn.SetActive(true);
        }

        UIEventListener.Get(fightBtn).onClick = OnSelectPvPItem;

        if (tabPCard == null ||
            tabCard == null ||
            tabAppearance == null)
        {
            return(false);
        }
        return(true);
    }
    public bool InitWithUserFriend(UserFriend card)
    {
        transform.localPosition = new Vector3(0, 0, -1);
        transform.localScale    = new Vector3(1, 1, 1);
        gameObject.name         = card.guid.ToString();

        if (card == null)
        {
            return(false);
        }

        labelName.text = card.name;//friendList[i].GetAccountName();

        //读表双重验证
        Tab_Card tabCard = TableManager.GetCardByID(card.cardTempletID);

        if (tabCard == null)
        {
            return(false);
        }
        Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(tabCard.Appearance);

        if (tabAppearance == null)
        {
            return(false);
        }

        //------------------------卡牌背景及外框--------------------------------
        //2013-10-12 Jack Wen
        int icon_star = tabCard.Star;

        iconBG.spriteName    = UserCardItem.littleCardFrameName[icon_star];
        iconFrame.spriteName = UserCardItem.littleCardBorderName[icon_star];
        //--------------------------------------------------------------------
        //五行显示
        int nAttributeID = 0;        //默认为金

        nAttributeID = tabCard.Element;
        string strIconName = "";

        switch (nAttributeID)
        {
        case 0: strIconName = "jin"; break;

        case 1: strIconName = "mu"; break;

        case 2: strIconName = "shui"; break;

        case 3: strIconName = "huo"; break;

        case 4: strIconName = "tu"; break;
        }
        attribute.spriteName = strIconName;
        //---------------------------------------------------------------------
        //2013-7-26 Jack Wen
        labelPlayerLevel.text = card.level.ToString();
        int lastOnlineTime = card.lastOnlineHours;
        int lastLogoutTime = card.lastLogoutHours;

        if (lastOnlineTime != -1)
        {
            UIImageButton button = gameObject.GetComponent <UIImageButton>();
            button.normalSprite  = "liebiao_beijing_1";
            button.hoverSprite   = "liebiao_beijing_1";
            button.pressedSprite = "liebiao_beijing_2";
            UISprite back = gameObject.transform.FindChild("Sprite/Background").GetComponent <UISprite>();
            back.spriteName = "liebiao_beijing_1";
            back            = gameObject.transform.FindChild("Sprite/haoyoubeijing").GetComponent <UISprite>();
            back.alpha      = 1.0f;
            if (lastOnlineTime / 60 >= 24)
            {
                labelState.text = "[a5e295]登录:" + lastOnlineTime / 60 / 24 + "天";
            }
            else if (lastOnlineTime / 60 < 24 && lastOnlineTime / 60 > 0)
            {
                labelState.text = "[a5e295]登录:" + lastOnlineTime / 60 + "小时";
            }
            else
            {
                labelState.text = "[a5e295]登录:" + System.Math.Abs(lastOnlineTime % 60) + "分钟";
            }
            //labelState.text = "[a5e295]登录:"+lastOnlineTime/60+"小时前";
        }
        else
        {
            UIImageButton button = gameObject.GetComponent <UIImageButton>();
            button.normalSprite  = "liebiao_beijing_3";
            button.hoverSprite   = "liebiao_beijing_3";
            button.pressedSprite = "liebiao_beijing_3";
            UISprite back = gameObject.transform.FindChild("Sprite/Background").GetComponent <UISprite>();
            back.spriteName = "liebiao_beijing_3";
            back            = gameObject.transform.FindChild("Sprite/haoyoubeijing").GetComponent <UISprite>();
            back.alpha      = 0.5f;
            if (lastLogoutTime / 60 >= 24)
            {
                labelState.text = "[222222]离线:" + lastLogoutTime / 60 / 24 + "天";
            }
            else if (lastLogoutTime / 60 < 24 && lastLogoutTime / 60 > 0)
            {
                labelState.text = "[222222]离线:" + lastLogoutTime / 60 + "小时";
            }
            else
            {
                labelState.text = "[222222]离线:" + System.Math.Abs(lastLogoutTime % 60) + "分钟";
            }
        }

        iconCard.spriteName = tabAppearance.HeadIcon;
        //2013-7-29 Jack Wen
        if (card.canGetPower)
        {
            giftLabel.SetActive(true);
            if (Obj_MyselfPlayer.GetMe().receive_power_time < 10)
            {
                giftLabel.GetComponent <TweenAlpha>().style = UITweener.Style.PingPong;
            }
            else
            {
                giftLabel.GetComponent <TweenAlpha>().style = UITweener.Style.Once;
            }
        }
        else
        {
            giftLabel.SetActive(false);
        }
        //2013-8-2 Jack Wen
        //加入好友主卡牌星级显示
        for (int start_i = 1; start_i < 8; start_i++)
        {
            if (start_i <= tabCard.Star)
            {
                starArray[start_i - 1].SetActive(true);
            }
            else
            {
                starArray[start_i - 1].SetActive(false);
            }
        }
        //2013-8-6 Jack Wen
        //显示卡牌等级
        labelCardLevel.text = card.cardLevel.ToString();
        //---------------------------------------------------------------------

        return(true);
    }