Exemplo n.º 1
0
    public void Show(int copy_id, bool before, int header_id)
    {
        gameObject.SetActive(true);
        mBefore = before;
        Tab_Card tab_card = TableManager.GetCardByID(header_id);

        if (tab_card != null)
        {
            AtlasManager.Instance.SetBodyName(headerTex, TableManager.GetAppearanceByID(tab_card.Appearance).BodyIcon);
            headerName.text = LanguageManger.GetWords(TableManager.GetAppearanceByID(tab_card.Appearance).Name);
        }

        Tab_Copydetail tab_detail = TableManager.GetCopydetailByID(copy_id);

        if (before)
        {
            if (tab_detail != null)
            {
                copyText.text = LanguageManger.GetWords(tab_detail.FontText);
            }
            string key = "copy_front_" + Obj_MyselfPlayer.GetMe().accountID + "_" + Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID;
            PlayerPrefs.SetInt(key, 1);
        }
        else
        {
            if (tab_detail != null)
            {
                copyText.text = LanguageManger.GetWords(tab_detail.BackText);
            }
            string key = "copy_back_" + Obj_MyselfPlayer.GetMe().accountID + "_" + Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID;
            PlayerPrefs.SetInt(key, 1);
        }
    }
Exemplo n.º 2
0
        public void SetCard(BattleCard cd)
        {
            m_BattleCard = cd;
            int name_id = TableManager.GetCardByID(cd.Card_Data.CardTempId).Appearance;

            m_SlotName.text = LanguageManger.GetWords(TableManager.GetAppearanceByID(name_id).Name);
        }
Exemplo n.º 3
0
    public void FreshUI()
    {
        Int32 leaderid;
        Int32 skillid = -1;

        if (Obj_MyselfPlayer.GetMe().curPvPLearder > 0)
        {
            leaderid = Obj_MyselfPlayer.GetMe().GetUserCardByGUID(Obj_MyselfPlayer.GetMe().curPvPLearder).templateID;
            skillid  = TableManager.GetCardByID(leaderid).SkillLeader;
        }
        if (skillid == -1)
        {
            leaderSkill.text = "无";
        }
        else
        {
            string describe = LanguageManger.GetWords(TableManager.GetLeaderskillByID(skillid).Note);
            if (string.IsNullOrEmpty(describe))
            {
                Debug.Log("Leader skill describe is -1");
            }
            leaderSkill.text = describe;
        }
//		Debug.LogError("------------------");
        for (int i = 0; i < 6; i++)
        {
//			Debug.LogError("PvPBattleArray : [ " + i + " ] = " + Obj_MyselfPlayer.GetMe().PvPBattleArray[i]);
            Obj_MyselfPlayer.GetMe().refrashPvPBattleArray(i);
            FreshIcon(cardIcon[i], Obj_MyselfPlayer.GetMe().PvPBattleArray[i]);
        }
//		Debug.LogError("------------------");
    }
    //----------------------------END------------------------

    //----------------------------显示新手提示语------------------------------
    public void ShowLabel(int labelID)
    {
        string str = LanguageManger.GetWords(labelID);

        if (GuideManager.Instance.selectedTempletID != 0)
        {
            Tab_Card card = TableManager.GetCardByID(GuideManager.Instance.selectedTempletID);
            if (card != null)
            {
                if (TableManager.GetAppearanceByID(card.Appearance) != null)
                {
                    str = string.Format(str, LanguageManger.GetWords(TableManager.GetAppearanceByID(card.Appearance).Name));
                }
            }
        }
        else
        {
            Debug.LogWarning("*** ****** Guide show label warning : selected Templet ID = 0!");
        }
#if UNITY_ANDROID
        //str = str.Replace(" ", "");
        Utils.EraseColorStrSpace(ref str);
#endif
        playerZhaoLabel.text = str;
    }
    void SetHeaderItem(GameObject newItem, UserCardItem card, bool canUse)
    {
        newItem.name = card.cardID.ToString();
        GameObject cardIcon  = newItem.transform.FindChild("CardIcon").GetChild(0).gameObject;
        UISprite   icon      = cardIcon.transform.FindChild("Sprite-Icon").GetComponent <UISprite>();
        string     atlasname = TableManager.GetAppearanceByID(TableManager.GetCardByID(card.templateID).Appearance).HeadIcon;

        AtlasManager.Instance.setHeadName(icon, atlasname);
        icon.transform.localScale = new Vector3(82, 82, 1);

        UILabel name = newItem.transform.FindChild("Labels/Label-Name").GetComponent <UILabel>();

        name.text = LanguageManger.GetWords(TableManager.GetAppearanceByID(TableManager.GetCardByID(card.templateID).Appearance).Name);

        UILabel hp = newItem.transform.FindChild("Labels/Label-Hp-Value").GetComponent <UILabel>();

        hp.text = card.GetHp().ToString();

        UILabel level = newItem.transform.FindChild("Labels/Panel-Lv/Label-lv").GetComponent <UILabel>();

        level.text = card.level.ToString();

        UILabel attack = newItem.transform.FindChild("Labels/Label-Attack-Value").GetComponent <UILabel>();

        attack.text = card.GetAttack().ToString();

        UILabel leadership = newItem.transform.FindChild("Labels/Label-Leadership-Value").GetComponent <UILabel>();

        if (!canUse)
        {
            leadership.text = "[FF231A]" + card.GetLeaderShip().ToString() + "[000000]";
        }
        else
        {
            leadership.text = "[F1ECCF]" + card.GetLeaderShip().ToString() + "[000000]";
        }

        UISprite property = newItem.transform.FindChild("Sprites/Sprite-Property").GetComponent <UISprite>();

        property.spriteName = UserCardItem.elementTypeName[TableManager.GetCardByID(card.templateID).Element];

        Tab_Card        tab_card    = TableManager.GetCardByID(card.templateID);
        Tab_Leaderskill leaderSkill = TableManager.GetLeaderskillByID(tab_card.SkillLeader);
        UILabel         leaderskill = newItem.transform.FindChild("Labels/Label-HeaderSkill").GetComponent <UILabel>();

        if (leaderSkill != null)
        {
            leaderskill.text = LanguageManger.GetWords(leaderSkill.Name);
        }
        else
        {
            leaderskill.text = "";
        }
        cardIcon.name = card.cardID.ToString();
        UIEventListener.Get(cardIcon).onClick += cardInfo;
    }
    public void SetPlayer(int tempID)
    {
        string picName;

//		if(tempID == 1008 || tempID == 1012 || tempID == 1016)
        picName = TableManager.GetAppearanceByID(TableManager.GetCardByID(tempID).Appearance).HetiIcon;
//		else
//			picName = TableManager.GetAppearanceByID(TableManager.GetCardByID(tempID).Appearance).BodyIcon;
        AtlasManager.Instance.SetBodyName(playerPic, picName);
        playerName.text = LanguageManger.GetWords(TableManager.GetAppearanceByID(TableManager.GetCardByID(tempID).Appearance).Name);
    }
//	private static string cardHuodongMiaoshu1 = "我乃是大理鎮南王段正淳,看少俠骨骼驚奇,必是萬中無一的絕世高手,讓我來助少俠一臂之力!";
//	private static string cardHuodongMiaoshu2 = "妾身乃是大理鎮南王的妻子刀白鳳,道號“玉虛散人”,我和段郎合璧可施展合體技【愛恨交加】,威力不可小覷哦!";
    public void OnShowCardGift()
    {
        if (Obj_MyselfPlayer.GetMe().yunyinHuoDongLists.Count != 0)
        {
            YunyingHuodong yunyinghuodong = Obj_MyselfPlayer.GetMe().yunyinHuoDongLists[0];
            Obj_MyselfPlayer.GetMe().yunyinHuoDongLists.RemoveAt(0);

            if (yunyinghuodong.ItemType == 1)           // 类型,1,卡牌,2,金钱,3,道具, 4,元宝
            {
                GuideDirector.Instance.guidePlayer = GuideDirector.Instance.transform.FindChild("GuidePlayer").GetComponent <GuidePlayer>();
                GuideDirector.Instance.guidePlayer.SetPlayer(yunyinghuodong.ItemValue);
                string str;
                if (yunyinghuodong.ItemValue >= 1079 && yunyinghuodong.ItemValue <= 1083)
                {
                    //str = cardHuodongMiaoshu1;
                    str = LanguageManger.GetWords(180000);
                }
                else if (yunyinghuodong.ItemValue >= 1084 && yunyinghuodong.ItemValue <= 1086)
                {
                    //str = cardHuodongMiaoshu2;
                    str = LanguageManger.GetWords(180001);
                }
                else
                {
                    str = LanguageManger.GetWords(TableManager.GetAppearanceByID(TableManager.GetCardByID(yunyinghuodong.ItemValue).Appearance).Story);
                }

                GuideDirector.Instance.guidePlayer.ShowLabel_temp(str);
                GuideDirector.Instance.guidePlayer.SetZhaoActive(true);

                if (Obj_MyselfPlayer.GetMe().yunyinHuoDongLists.Count != 0)
                {
                    GuideDirector.Instance.guidePlayer.nextStep = OnShowCardGift;
                }
                else
                {
                    GuideDirector.Instance.guidePlayer.nextStep = OnCloseGuide;
                }
            }
            else
            {
                if (Obj_MyselfPlayer.GetMe().yunyinHuoDongLists.Count != 0)
                {
                    OnShowCardGift();
                }
                else
                {
                    GuideDirector.Instance.guidePlayer.nextStep = OnCloseGuide;
                }
            }
        }
    }
    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);
        }
    }
Exemplo n.º 9
0
    //Ë¢ÐÂŒŒÄÜ
    private void FreshSkill()
    {
        Tab_Card  tbl_card      = TableManager.GetCardByID(heroCardItem.templateID);
        Tab_Skill tbl_skill_vol = TableManager.GetSkillByID(tbl_card.SkillVol);

        if (tbl_skill_vol != null && TableManager.GetSkillDisplayByID(tbl_skill_vol.Effect) != null)
        {
            volSkillName.gameObject.SetActive(true);
            volSkillLevel.gameObject.SetActive(true);

            volSkillName.text  = LanguageManger.GetWords(TableManager.GetSkillDisplayByID(tbl_skill_vol.Effect).Name);
            volSkillLevel.text = heroCardItem.skillLevel + "/" + tbl_skill_vol.SkillMaxlevel;
        }
        else
        {
            volSkillName.gameObject.SetActive(false);
            volSkillLevel.gameObject.SetActive(false);
        }
    }
Exemplo n.º 10
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();
    }
Exemplo n.º 11
0
    public bool SetMemberItem(UserCardItem card, bool canUse)
    {
        transform.name = card.cardID.ToString();
        string atlasname = TableManager.GetAppearanceByID(TableManager.GetCardByID(card.templateID).Appearance).HeadIcon;

        AtlasManager.Instance.setHeadName(cardIconSpriteIcon, atlasname);
        cardIconSpriteIcon.transform.localScale = new Vector3(82, 82, 1);

        labelsLabelName.text = LanguageManger.GetWords(TableManager.GetAppearanceByID(TableManager.GetCardByID(card.templateID).Appearance).Name);

        labelsLabelHpValue.text = card.GetHp().ToString();

        labelsLabelLv.text = card.level.ToString();

        labelsLabelAttackValue.text = card.GetAttack().ToString();

        if (!canUse)
        {
            labelsLabelLeadershipValue.text = "[FF231A]" + card.GetLeaderShip().ToString() + "[000000]";
        }
        else
        {
            labelsLabelLeadershipValue.text = "[F1ECCF]" + card.GetLeaderShip().ToString() + "[000000]";
        }

        spritesSpriteProperty.spriteName = UserCardItem.elementTypeName[TableManager.GetCardByID(card.templateID).Element];

        for (int j = 1; j <= 7; j++)
        {
            if (j <= card.quality)
            {
                stars[j - 1].SetActive(true);
            }
            else
            {
                stars[j - 1].SetActive(false);
            }
        }
        cardIconBtn.name = card.cardID.ToString();
        return(true);
    }
Exemplo n.º 12
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);
            }
        }
    }
Exemplo n.º 13
0
    public void SetCardTemplateID(int id)
    {
        if (TableManager.GetCardByID(id) == null || TableManager.GetAppearanceByID(TableManager.GetCardByID(id).Appearance) == null)
        {
            Debug.LogError("SetCardTemplateID(), no such template id: " + id);
            return;
        }

        AtlasManager.Instance.setBodyByTempletID(cardIcon, id);
        cardFrame.spriteName = UserCardItem.cardFrameName[TableManager.GetCardByID(id).Star];
        cardFrame.MakePixelPerfect();

        category.spriteName = UserCardItem.elementTypeName[TableManager.GetCardByID(id).Element];
        category.MakePixelPerfect();

        cardBorder.spriteName = UserCardItem.largeCardBorderName[TableManager.GetCardByID(id).Star];
        cardBorder.MakePixelPerfect();

        cardNameBg.spriteName = UserCardItem.largeCardNameBg[TableManager.GetCardByID(id).Star];
        cardNameBg.MakePixelPerfect();

        cardName.text = LanguageManger.GetWords(TableManager.GetAppearanceByID(TableManager.GetCardByID(id).Appearance).Name);
    }
Exemplo n.º 14
0
    public void ShowCardItem(AssistFriend af)
    {
        if (af == null)
        {
            return;
        }
        //如果是0的数据有错空过去
        if (af.cardTempleId == 0 || af.name == "")
        {
            return;
        }
        GameObject newItem = ResourceManager.Instance.loadWidget(SelectAssistItem);                 //(GameObject)Instantiate(SelectAssistItem);

        newItem.transform.parent        = listParent.transform;
        newItem.transform.localPosition = new Vector3(0, 0, -1);
        newItem.transform.localScale    = new Vector3(1, 1, 1);
        //update item content
        UILabel nameLabel = newItem.transform.FindChild("Labels/Label-Name").GetComponent <UILabel>();

        nameLabel.text = af.name;
        //------------------------卡牌背景及外框--------------------------------
        //2013-10-12 Jack Wen
        UISprite icon_bg     = newItem.transform.FindChild("CardIcon/CardIconBtn/Sprite-BG").GetComponent <UISprite>();
        UISprite icon_border = newItem.transform.FindChild("CardIcon/CardIconBtn/Sprite").GetComponent <UISprite>();
        int      icon_star   = TableManager.GetCardByID(af.cardTempleId).Star;

        icon_bg.spriteName     = UserCardItem.littleCardFrameName[icon_star];
        icon_border.spriteName = UserCardItem.littleCardBorderName[icon_star];
        //--------------------------------------------------------------------
        UILabel isFriendLabel = newItem.transform.FindChild("Labels/Label-Is-Friend").GetComponent <UILabel>();

        isFriendLabel.text = af.isMyFriend?"八拜之交":"江湖侠士";
        UILabel         skillLabel  = newItem.transform.FindChild("Labels/Label-Friend-Skill").GetComponent <UILabel>();
        Tab_Card        tab_card    = TableManager.GetCardByID(af.cardTempleId);
        Tab_Leaderskill leaderSkill = TableManager.GetLeaderskillByID(tab_card.SkillLeader);

        if (leaderSkill != null)
        {
            skillLabel.text = LanguageManger.GetWords(leaderSkill.Name);
        }
        else
        {
            skillLabel.text = "";
        }
        UILabel friendShipValueLabel = newItem.transform.FindChild("Labels/Label-FriendShip-Value").GetComponent <UILabel>();

        friendShipValueLabel.text = af.friendShipNum.ToString();
        UILabel friendLevelLabel = newItem.transform.FindChild("Labels/Label-Friend-Level-Value").GetComponent <UILabel>();

        friendLevelLabel.text = af.level.ToString();
        UILabel cardLevelLabel = newItem.transform.FindChild("Labels/Panel-Lv/Label-lv").GetComponent <UILabel>();

        cardLevelLabel.text = af.cardLevel.ToString();
        UISprite icon      = newItem.transform.FindChild("CardIcon/CardIconBtn/Sprite-Icon").GetComponent <UISprite>();
        string   atlasname = TableManager.GetAppearanceByID(TableManager.GetCardByID(af.cardTempleId).Appearance).HeadIcon;

        AtlasManager.Instance.setHeadName(icon, atlasname);
        icon.transform.localScale = new Vector3(82, 82, 1);
        GameObject starManage     = newItem.transform.FindChild("StarManager").gameObject;
        Transform  transformStars = starManage.transform;

        for (int j = 1; j <= 7; j++)
        {
            if (j <= TableManager.GetCardByID(af.cardTempleId).Star)
            {
                GameObject starIcon = transformStars.FindChild("Star_" + j).gameObject;
                starIcon.SetActive(true);
            }
            else
            {
                GameObject starIcon = transformStars.FindChild("Star_" + j).gameObject;
                starIcon.SetActive(false);
            }
        }
        UISprite property = newItem.transform.FindChild("Sprite/Sprite-Property").GetComponent <UISprite>();

        property.spriteName = UserCardItem.elementTypeName[TableManager.GetCardByID(af.cardTempleId).Element];
//			UISprite bg = newItem.transform.FindChild("CardIcon/CardIconBtn/Sprite-BG").GetComponent<UISprite>();
//			bg.spriteName = UserCardItem.iconFrameName[TableManager.GetCardByID(af.cardTempleId).Star];
//			bg.transform.localScale=new Vector3(95,90,1);

        newItem.name = af.guid.ToString();
        UIEventListener.Get(newItem).onClick += SelectAssistHero;
        GameObject cardInfo = newItem.transform.FindChild("CardIcon/CardIconBtn").gameObject;

        cardInfo.name = af.guid.ToString();
        UIEventListener.Get(cardInfo).onClick += SelectCardInfo;
        if (friendGuid == 0)
        {
            guideItem  = newItem;
            friendGuid = -1;
        }
        Transform QxzbTopStarTrans = newItem.transform.FindChild("QxzbTopStar");

        if (QxzbTopStarTrans != null)
        {
            //沒有群雄爭霸第一名
            if (af.nQxzbTopStar >= 3 &&
                af.nQxzbTopStar <= 7)
            {
                QxzbTopStarTrans.gameObject.SetActive(true);

                Transform starBgSpTrans = QxzbTopStarTrans.FindChild("StarBgObj/starBgSp");
                if (starBgSpTrans != null)
                {
                    UISprite spStarBg = starBgSpTrans.GetComponent <UISprite>();
                    if (spStarBg != null)
                    {
                        spStarBg.spriteName = UserFriend.friendStarTopBg[af.nQxzbTopStar];
                    }
                }

                Transform topStarTrans = QxzbTopStarTrans.FindChild("StarRank");
                if (topStarTrans != null)
                {
                    UISprite spTopStar = topStarTrans.GetComponent <UISprite>();
                    if (spTopStar != null)
                    {
                        spTopStar.spriteName = UserFriend.friendStarTop[af.nQxzbTopStar];
                    }
                }
            }
            else
            {
                QxzbTopStarTrans.gameObject.SetActive(false);
            }
        }
        items.Add(newItem);
    }
    void OnEnable()
    {
        mainUILogic = GameObject.Find("MainUILogic");
        Debug.Log("xlym: OnEnable BattleEndController");
        if (Obj_MyselfPlayer.GetMe().battleData.isPlayed)
        {
            if (Obj_MyselfPlayer.GetMe().battleType == BattleType.WORLD_BOSS)
            {
                normalBattle.SetActive(false);
                worldBossBattle.SetActive(true);
                pataBattle.SetActive(false);
                if (Obj_MyselfPlayer.GetMe().battleData.isWin)
                {
                    worldBossName.text = Obj_MyselfPlayer.GetMe().lastKillInfo.lastBossInfo.name;
                }
                else
                {
                    worldBossName.text = Obj_MyselfPlayer.GetMe().activeBoss.name;
                }
                UIEventListener.Get(backGround).onClick += OnWorldBossController;
                moneyMax = Obj_MyselfPlayer.GetMe().worldBossRewardMoney;
                moneyCut = moneyMax / 50;
                if (moneyCut == 0)
                {
                    moneyCut = 1;
                }
                damageMax = (int)Obj_MyselfPlayer.GetMe().worldBossCurrentDamage;
                damageCut = damageMax / 50;
                if (damageCut == 0)
                {
                    damageCut = 1;
                }
            }
            else if (Obj_MyselfPlayer.GetMe().battleType == BattleType.CHONG_LOU)
            {
                normalBattle.SetActive(false);
                worldBossBattle.SetActive(false);
                pataBattle.SetActive(true);
                pataMoney.text = Obj_MyselfPlayer.GetMe().pataTotalRewardMoney.ToString();
                pataRuby.text  = Obj_MyselfPlayer.GetMe().pataTotalRewardYuanbao.ToString();
                pataFloor.text = Obj_MyselfPlayer.GetMe().lastPataNum.ToString();


                UIEventListener.Get(pataBackBtn).onClick += OnPataBackBtn;
                if (Obj_MyselfPlayer.GetMe().pataTimes > 0)
                {
                    pataContinueBtn.collider.enabled = true;
                    pataContinueBtn.transform.FindChild("Sprite").GetComponent <UISprite>().spriteName     = "jixutiaozhan_1";
                    pataContinueBtn.transform.FindChild("Background").GetComponent <UISprite>().spriteName = "anniu_1";
                    UIEventListener.Get(pataContinueBtn).onClick += OnPataContinueBtn;
                }
                else
                {
                    pataContinueBtn.collider.enabled = false;
                    pataContinueBtn.transform.FindChild("Sprite").GetComponent <UISprite>().spriteName     = "jixutiaozhan_3";
                    pataContinueBtn.transform.FindChild("Background").GetComponent <UISprite>().spriteName = "anniu_3";
                }
            }
            else
            {
                worldBossBattle.SetActive(false);
                normalBattle.SetActive(true);
                pataBattle.SetActive(false);
                if (!Obj_MyselfPlayer.GetMe().battleData.isWin)
                {
                    Obj_MyselfPlayer.GetMe().battleData.addExp = 0;
                }
                if (Obj_MyselfPlayer.GetMe().exp - Obj_MyselfPlayer.GetMe().battleData.addExp < 0)
                {
                    nowLev          = Obj_MyselfPlayer.GetMe().lastLevel;
                    levelValue.text = nowLev.ToString();
                    lastLevelExp    = TableManager.GetIdexperienceByID((Obj_MyselfPlayer.GetMe().lastLevel)).IDExperience;
                    if (Obj_MyselfPlayer.GetMe().level == 16)
                    {
                        mainUILogic.SendMessage("flashLunJian");
                    }
                }
                else
                {
                    nowLev          = Obj_MyselfPlayer.GetMe().level;
                    levelValue.text = nowLev.ToString();
                    lastLevelExp    = TableManager.GetIdexperienceByID((Obj_MyselfPlayer.GetMe().level)).IDExperience;
                }
                expProgress.sliderValue = (float)Obj_MyselfPlayer.GetMe().lastExp / (float)lastLevelExp;
                nexLevelExp             = TableManager.GetIdexperienceByID((Obj_MyselfPlayer.GetMe().level)).IDExperience;
                Debug.Log("nexLevelExp=" + nexLevelExp);
                mainCopy.text = LanguageManger.GetWords(TableManager.GetCopyByID(Obj_MyselfPlayer.GetMe().curMainCopy.copyId).Copyname);
                subCopy.text  = LanguageManger.GetWords(TableManager.GetCopydetailByID(Obj_MyselfPlayer.GetMe().curSubcopy.subCopyID).Copyname);
                //expProgress.sliderValue = 0.8f;
                dropBags = Obj_MyselfPlayer.GetMe().battleData.winDropBags;
                BattleTrophys.gameObject.SetActive(false);
                if (Obj_MyselfPlayer.GetMe().battleData.isWin)
                {
                    AniStart = true;
                    moneyMax = 0;
                    foreach (DropBag bag in dropBags)
                    {
                        Debug.Log("bag.type=" + bag.type.ToString());
                        if (bag.type == DropType.MONEY && bag.val > 0)
                        {
                            moneyMax += bag.val;
                        }
                    }
                    Debug.Log("moneyMax=" + moneyMax);
                    moneyCut = moneyMax / 50;
                    if (moneyCut == 0)
                    {
                        moneyCut = 1;
                    }
                    //moneyCount.text = money.ToString();
                    expCount.text = Obj_MyselfPlayer.GetMe().battleData.addExp.ToString();
                    expMax        = Obj_MyselfPlayer.GetMe().battleData.addExp;
                    expCut        = expMax / 50;
                    if (expCut == 0)
                    {
                        expCut = 1;
                    }
                    //				BattleTrophys.gameObject.SetActive(true);
                    SetDropCard();
                }

                if (Obj_MyselfPlayer.GetMe().exp - Obj_MyselfPlayer.GetMe().battleData.addExp < 0)
                {
                    //升级
                    AudioManager.Instance.PlayEffectSound("upgrade");
                    levUpData.SetActive(true);
                    RefreshLevUpData();
                    trophy.spriteName = "shengji";
                    trophy.MakePixelPerfect();
                    UIEventListener.Get(backGround).onClick += OnMainWindow;
                }
                else
                {
                    AudioManager.Instance.PlayEffectSound("reward");
                    levUpData.SetActive(false);
                    if (Obj_MyselfPlayer.GetMe().newTemplateID.Count > 0)
                    {
                        //获得图鉴中没有的新卡牌进入卡牌展示界面
                        UIEventListener.Get(backGround).onClick += HeroInfoWindowClick;
                    }
                    else
                    {
                        UIEventListener.Get(backGround).onClick += OnConfirmButtonClick;
                    }
                    if (Obj_MyselfPlayer.GetMe().battleData.isWin)
                    {
                        trophy.spriteName = "zhandou_zhanlipin";
                        trophy.MakePixelPerfect();
                        BattleTrophys.gameObject.SetActive(true);
                    }
                }
                //星级
                int starLev = Obj_MyselfPlayer.GetMe().currentCopyStar;
                //显示星级
                for (int i = 1; i <= 3; i++)
                {
                    //判断星级
                    if (i <= starLev)
                    {
                        Stars.transform.FindChild("Sprite-Star" + i).gameObject.SetActive(true);
                        Stars.transform.FindChild("Star" + i + "Ani").gameObject.SetActive(true);
                    }
                    else
                    {
                        Stars.transform.FindChild("Sprite-Star" + i).gameObject.SetActive(false);
                        Stars.transform.FindChild("Star" + i + "Ani").gameObject.SetActive(false);
                    }
                }
                Stars.GetComponent <Animation>().Play();
                //碎片
                //clear
                for (int i = 0; i < Fragments.Length; i++)
                {
                    Fragments[i].text = "0";
                }
                List <FragmentInfo> fragementResult = new List <FragmentInfo>();
                if (Obj_MyselfPlayer.GetMe().currentFragmentList != null)
                {
                    foreach (var fragment in Obj_MyselfPlayer.GetMe().currentFragmentList)
                    {
                        bool isFind = false;
                        for (int i = 0; i < fragementResult.Count; i++)
                        {
                            if (fragementResult[i].id == fragment.id)
                            {
                                isFind = true;
                                fragementResult[i].num += fragment.num;
                                break;
                            }
                        }
                        if (!isFind)
                        {
                            FragmentInfo newone = new FragmentInfo();
                            newone.id  = fragment.id;
                            newone.num = fragment.num;
                            fragementResult.Add(newone);
                        }
                    }
                }
                if (fragementResult != null)
                {
                    foreach (var fragment in fragementResult)
                    {
                        Fragments[fragment.id].text = fragment.num.ToString();
                    }
                }
            }
        }
        GameObject.FindWithTag("main_controller").SendMessage("updateUserInfo");
    }
Exemplo n.º 16
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;
    }
Exemplo n.º 17
0
    public void FreshUI()
    {
        //this.LoadFightArray();

        Obj_MyselfPlayer.GetMe().RefreshBattleArray();

        for (int i = 0; i < 6; i++)
        {
            FreshIcon(cardIcon[i], Obj_MyselfPlayer.GetMe().battleArray[i]);
        }



        //refresh friedn skill
        Int64 leaderguid = Obj_MyselfPlayer.GetMe().teamMemberArray[0];

        if (leaderguid == -1)
        {
            Debug.LogError("Team leader guid is -1");
            return;
        }
        Int32 leaderid = Obj_MyselfPlayer.GetMe().GetUserCardByGUID(leaderguid).templateID;
        Int32 skillid  = TableManager.GetCardByID(leaderid).SkillLeader;

        if (skillid == -1)
        {
            leaderSkill.text = "无";
            Debug.Log("leader skill is -1");
        }
        else
        {
            string describe = LanguageManger.GetWords(TableManager.GetLeaderskillByID(skillid).Note);
            if (string.IsNullOrEmpty(describe))
            {
                Debug.Log("Leader skill describe is -1");
            }
            leaderSkill.text = describe;
        }

        if (Obj_MyselfPlayer.GetMe().currentAssistFriend != null && Obj_MyselfPlayer.GetMe().battleType == Games.Battle.BattleType.PVE)
        {
            friendSkillName.gameObject.SetActive(true);
            Int32 friendid = Obj_MyselfPlayer.GetMe().currentAssistFriend.cardTempleId;
            skillid = TableManager.GetCardByID(friendid).SkillLeader;
            if (skillid == -1)
            {
                friendSkill.text = "无";
                Debug.LogError("leader skill is -1");
            }
            else
            {
                string describe = LanguageManger.GetWords(TableManager.GetLeaderskillByID(skillid).Note);
                if (string.IsNullOrEmpty(describe))
                {
                    Debug.Log("Friend skill describe is -1");
                }
                friendSkill.text = describe;
            }
        }
        else
        {
            friendSkill.text = "";
            friendSkillName.gameObject.SetActive(false);
            //Debug.LogError("no friend");
        }
    }
Exemplo n.º 18
0
    private void CreateCopyList(CopyType type)
    {
        GameObject prompt = activeBtn.transform.FindChild("PromptAni").gameObject;

        prompt.SetActive(false);

        GameObject parent = GridNormal;

        if (type == CopyType.ACTIVITY)
        {
            parent = GridActivity;
        }

        int count = parent.transform.childCount;

        for (int i = count - 1; i >= 0; i--)
        {
            Destroy(parent.transform.GetChild(i).gameObject);
        }
        parent.GetComponent <UIGrid>().repositionNow = true;

        if (type == CopyType.NORMAL)
        {
            for (int i = normalCopys.Count - 1; i >= 0; i--)
            {
                bool canOpen = false;
                if (normalCopys[i].copyState == CopyState.UNOPEN)
                {
                    if (i == 0)
                    {
                        canOpen = true;
                    }
                    else if (normalCopys[i - 1].copyState == CopyState.PASSED)
                    {
                        canOpen = true;
                    }
                    //mainCopy.subCopys[i].copyState = CopyState.OPENED;
                }
                else if (normalCopys[i].copyState == CopyState.PASSED)
                {
                    canOpen = true;
                }
                //				bool isNewOpen = false;
                //				if(normalCopys[i].copyState == CopyState.UNOPEN)
                //				{
                //					isNewOpen = true;
                //					normalCopys[i].copyState = CopyState.OPENED;
                //				}
                normalCopys[i].listOrder = i;
                if (canOpen)
                {
                    GameObject new_item = ResourceManager.Instance.loadWidget(mainCopyNormalItem);
                    new_item.transform.parent        = parent.transform;
                    new_item.transform.localPosition = Vector3.zero;
                    new_item.transform.localScale    = Vector3.one;
                    new_item.transform.name          = normalCopys[i].listOrder.ToString();

                    //副本缩略图
                    UISprite coypIcon = new_item.transform.FindChild("Sprite-bg").GetComponent <UISprite>();
                    string   iconName = TableManager.GetCopyByID(normalCopys[i].copyId).Thumb;
                    coypIcon.spriteName = iconName;
                    //掉落描述
                    UILabel dropDesc = new_item.transform.FindChild("Labels/DropDescribe").GetComponent <UILabel>();
                    dropDesc.gameObject.SetActive(false);

                    //name
                    UILabel label_name = new_item.transform.FindChild("Labels/Label-Name-Value").GetComponent <UILabel>();
                    label_name.text = LanguageManger.GetWords(normalCopys[i].tblCopy.Copyname);

                    //设置名字为"无量山遇险"的item为clone obj
                    Debug.Log("name:" + normalCopys[i].tblCopy.Copyname);
                    if (normalCopys[i].tblCopy.Copyname == 11000)
                    {
                        if (GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_1 ||
                            GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_2 ||
                            GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_3 ||
                            GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_4 ||
                            GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_5)
                        {
                            this.guideItem = new_item;
                        }
                    }
                    else if (normalCopys[i].tblCopy.Copyname == 11001)
                    {
                        if (GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY2_1)
                        {
                            this.guideItem = new_item;
                        }
                    }

                    //state
                    UILabel label_state = new_item.transform.FindChild("Labels/Label-State-Value").GetComponent <UILabel>();
                    if (normalCopys[i].copyState == CopyState.PASSED)
                    {
                        label_state.text = "[d4a106]已通关[000000]";
                    }
                    else
                    {
                        label_state.text = "[89ca88]新开启[000000]";
                    }

                    //level
                    GameObject goLev       = new_item.transform.FindChild("Level").gameObject;
                    UILabel    label_level = goLev.transform.FindChild("Label-Level-Value").GetComponent <UILabel>();
                    GameObject lockTip     = new_item.transform.FindChild("Sprite-CanOpen").gameObject;
                    if (normalCopys[i].tblCopy.PlayerLevel > 0)
                    {
                        if (Obj_MyselfPlayer.GetMe().level < normalCopys[i].tblCopy.PlayerLevel)
                        {
                            label_level.text = normalCopys[i].tblCopy.PlayerLevel.ToString();
                            goLev.transform.localPosition = closeLevPo;
                            lockTip.SetActive(true);
                        }
                        else
                        {
                            label_level.text = normalCopys[i].tblCopy.PlayerLevel.ToString();
                            goLev.transform.localPosition = openLevPo;
                            lockTip.SetActive(false);
                        }
                        goLev.SetActive(true);
                    }
                    else
                    {
                        goLev.SetActive(false);
                    }

                    //time
                    UILabel label_time = new_item.transform.FindChild("Labels/Label-Time").GetComponent <UILabel>();
                    label_time.gameObject.SetActive(false);
                    label_time = new_item.transform.FindChild("Labels/Label-Time-Value").GetComponent <UILabel>();
                    label_time.gameObject.SetActive(false);
                    GameObject name_bg = new_item.transform.FindChild("Sprite").gameObject;
                    if (Obj_MyselfPlayer.GetMe().level >= normalCopys[i].tblCopy.PlayerLevel)
                    {
                        label_name.text = "[F1ECCF]" + LanguageManger.GetWords(normalCopys[i].tblCopy.Copyname) + "[000000]";
                        label_state.gameObject.SetActive(true);
                        label_name.transform.localPosition     = new Vector3(-160, -15, -20);
                        name_bg.transform.localPosition        = new Vector3(-105, -14, -2);
                        UIEventListener.Get(new_item).onClick += OnSelectMainCopy;
                    }
                    else
                    {
                        label_name.text = "[7F7F7F]" + LanguageManger.GetWords(normalCopys[i].tblCopy.Copyname) + "[000000]";
                        label_state.gameObject.SetActive(false);
                        label_name.transform.localPosition = new Vector3(-160, -5, -20);
                        name_bg.transform.localPosition    = new Vector3(-105, -5, -2);
                        Destroy(new_item.GetComponent <UIImageButton>());
                    }
                    openNormalCount++;
                }
                //				if(isNewOpen)
                //				{
                //					break;
                //				}
            }
        }
        else
        {
            activityCopys.Sort(ActiveCompareTo);
            for (int i = 0; i < activityCopys.Count; i++)
            {
                if (activityCopys[i].clostTime == 0)
                {
                    continue;
                }
                activityCopys[i].listOrder = i;

                GameObject new_item = ResourceManager.Instance.loadWidget(mainCopyNormalItem);
                new_item.transform.parent        = parent.transform;
                new_item.transform.localPosition = Vector3.zero;
                new_item.transform.localScale    = Vector3.one;
                new_item.transform.name          = activityCopys[i].listOrder.ToString();

                //副本缩略图
                UISprite coypIcon = new_item.transform.FindChild("Sprite-bg").GetComponent <UISprite>();
                string   iconName = TableManager.GetCopyByID(activityCopys[i].copyId).Thumb;
                coypIcon.spriteName = iconName;

                //name
                UILabel label_name = new_item.transform.FindChild("Labels/Label-Name-Value").GetComponent <UILabel>();
                //label_name.text = LanguageManger.GetWords(activityCopys[i].tblCopy.Copyname);

                //state
                UILabel label_state = new_item.transform.FindChild("Labels/Label-State-Value").GetComponent <UILabel>();
                if (activityCopys[i].startTime == 0)
                {
                    label_state.text = "[89ca88]开启中[000000]";
                    foreach (SubCopy sub in activityCopys[i].subCopys)
                    {
                        int copyCount = TableManager.GetCopydetailByID(sub.subCopyID).CopyLimit - sub.count;
                        if (copyCount > 0)
                        {
                            prompt.SetActive(true);
                            break;
                        }
                    }
                }
                else if (activityCopys[i].clostTime == 0)
                {
                    label_state.text = "[c83809]未开启[000000]";
                }

                //level
                GameObject goLev       = new_item.transform.FindChild("Level").gameObject;
                UILabel    label_level = goLev.transform.FindChild("Label-Level-Value").GetComponent <UILabel>();
                GameObject lockTip     = new_item.transform.FindChild("Sprite-CanOpen").gameObject;
                if (activityCopys[i].tblCopy.PlayerLevel > 0)
                {
                    if (Obj_MyselfPlayer.GetMe().level < activityCopys[i].tblCopy.PlayerLevel)
                    {
                        label_level.text = activityCopys[i].tblCopy.PlayerLevel.ToString();
                        goLev.transform.localPosition = closeLevPo;
                        lockTip.SetActive(true);
                    }
                    else
                    {
                        label_level.text = activityCopys[i].tblCopy.PlayerLevel.ToString();
                        goLev.transform.localPosition = openLevPo;
                        lockTip.SetActive(false);
                    }
                    goLev.SetActive(true);
                }
                else
                {
                    goLev.SetActive(false);
                }
                //time
                UILabel label_time       = new_item.transform.FindChild("Labels/Label-Time").GetComponent <UILabel>();
                UILabel label_time_value = new_item.transform.FindChild("Labels/Label-Time-Value").GetComponent <UILabel>();
                if (activityCopys[i].startTime == 0)
                {
                    label_time.text       = "关闭剩余:";
                    label_time_value.text = ConvertSecond(activityCopys[i].clostTime);
                    UIEventListener.Get(new_item).onClick += OnSelectMainCopy;
                }
                else if (activityCopys[i].clostTime == 0)
                {
                    label_time.text       = "开启剩余:";
                    label_time_value.text = ConvertSecond(activityCopys[i].startTime);
                    //new_item.GetComponent<UIImageButton>().enabled=false;
                    Destroy(new_item.GetComponent <UIImageButton>());
                }

                //掉落描述
                UILabel dropDesc = new_item.transform.FindChild("Labels/DropDescribe").GetComponent <UILabel>();
                int     dropID   = activityCopys[i].tblCopy.Drop;
                if (dropID != -1)
                {
                    UILabel      level    = new_item.transform.FindChild("Labels/DropDescribe").GetComponent <UILabel>();
                    Tab_Language language = TableManager.GetLanguageByID(dropID);
                    level.text = language.Chinese;
                }
                GameObject name_bg = new_item.transform.FindChild("Sprite").gameObject;
                if (Obj_MyselfPlayer.GetMe().level >= activityCopys[i].tblCopy.PlayerLevel)
                {
                    label_name.text = "[F1ECCF]" + LanguageManger.GetWords(activityCopys[i].tblCopy.Copyname) + "[000000]";
                    label_state.gameObject.SetActive(true);
                    label_time.gameObject.SetActive(true);
                    label_time_value.gameObject.SetActive(true);
                    dropDesc.gameObject.SetActive(true);
                    label_name.transform.localPosition = new Vector3(-160, -15, -20);
                    name_bg.transform.localPosition    = new Vector3(-105, -14, -2);
                }
                else
                {
                    label_name.text = "[7F7F7F]" + LanguageManger.GetWords(activityCopys[i].tblCopy.Copyname) + "[000000]";
                    label_state.gameObject.SetActive(false);
                    label_time.gameObject.SetActive(false);
                    label_time_value.gameObject.SetActive(false);
                    dropDesc.gameObject.SetActive(false);
                    label_name.transform.localPosition = new Vector3(-160, -5, -20);
                    name_bg.transform.localPosition    = new Vector3(-105, -5, -2);
                    if (new_item.GetComponent <UIImageButton>() != null)
                    {
                        Destroy(new_item.GetComponent <UIImageButton>());
                        UIEventListener.Get(new_item).onClick -= OnSelectMainCopy;
                    }
                }
                openActiveCount++;
            }
        }
        parent.GetComponent <UIGrid>().repositionNow = true;
    }
Exemplo n.º 19
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);
    }
Exemplo n.º 21
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;
        }
    }
    private void CreateList()
    {
        //title.text = LanguageManger.GetWords( mainCopy.tblCopy.Copyname );

        GameObject parent = grid;
        int        count  = parent.transform.childCount;

        for (int i = count - 1; i >= 0; i--)
        {
            Destroy(parent.transform.GetChild(i).gameObject);
        }

        parent.GetComponent <UIGrid>().repositionNow = true;
        parent.SetActive(true);
        if (mainCopy.tblCopy.GetCopyTypebyIndex(0) == (int)CopyType.NORMAL)
        {
            for (int i = mainCopy.subCopys.Count - 1; i >= 0; i--)
            {
                bool canOpen = false;
                if (mainCopy.subCopys[i].copyState == CopyState.UNOPEN)
                {
                    if (i == 0)
                    {
                        canOpen = true;
                    }
                    else if (mainCopy.subCopys[i - 1].copyState == CopyState.PASSED)
                    {
                        canOpen = true;
                    }
                    //mainCopy.subCopys[i].copyState = CopyState.OPENED;
                }
                else if (mainCopy.subCopys[i].copyState == CopyState.PASSED)
                {
                    canOpen = true;
                }
                if (canOpen)
                {
                    GameObject new_item = ResourceManager.Instance.loadWidget(subCopyItem);
                    new_item.transform.parent        = parent.transform;
                    new_item.transform.localPosition = Vector3.zero;
                    new_item.transform.localScale    = Vector3.one;
                    new_item.transform.name          = mainCopy.subCopys[i].subCopyID.ToString();
                    //name
                    UILabel label_name = new_item.transform.FindChild("Labels/Label-Name-Value").GetComponent <UILabel>();
                    label_name.text = LanguageManger.GetWords(mainCopy.subCopys[i].tblCopyDetail.Copyname);


                    //设置名字为"无量剑西宗"的item为clone obj
                    if (mainCopy.subCopys[i].tblCopyDetail.Copyname == TableManager.GetCopydetailByID(TableManager.GetCopyByID(1).GetSubcopybyIndex(0)).Copyname&&
                        GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_1)
                    {
                        this.guideItem = new_item;
                    }
                    else if (mainCopy.subCopys[i].tblCopyDetail.Copyname == TableManager.GetCopydetailByID(TableManager.GetCopyByID(1).GetSubcopybyIndex(1)).Copyname&&
                             GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_2)
                    {
                        this.guideItem = new_item;
                    }
                    else if (mainCopy.subCopys[i].tblCopyDetail.Copyname == TableManager.GetCopydetailByID(TableManager.GetCopyByID(1).GetSubcopybyIndex(2)).Copyname&&
                             GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_3)
                    {
                        this.guideItem = new_item;
                    }
                    else if (mainCopy.subCopys[i].tblCopyDetail.Copyname == TableManager.GetCopydetailByID(TableManager.GetCopyByID(1).GetSubcopybyIndex(3)).Copyname&&
                             GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_4)
                    {
                        this.guideItem = new_item;
                    }
                    else if (mainCopy.subCopys[i].tblCopyDetail.Copyname == TableManager.GetCopydetailByID(TableManager.GetCopyByID(1).GetSubcopybyIndex(4)).Copyname&&
                             GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_5)
                    {
                        this.guideItem = new_item;
                    }
                    else if (mainCopy.subCopys[i].tblCopyDetail.Copyname == TableManager.GetCopydetailByID(TableManager.GetCopyByID(2).GetSubcopybyIndex(0)).Copyname&&
                             GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY2_1)
                    {
                        this.guideItem = new_item;
                    }

                    //state
                    UISprite sprite_state = new_item.transform.FindChild("Sprites/Sprite-State").GetComponent <UISprite>();
                    //UILabel label_state = new_item.transform.FindChild("Labels/Label-State-Value").GetComponent<UILabel>();
                    if (mainCopy.subCopys[i].copyState == CopyState.PASSED)
                    {
                        sprite_state.spriteName = "yitongguan";
                        //label_state.text = "[d4a106]已通关[000000]";
                    }
                    else
                    {
                        sprite_state.spriteName = "xinkaiqi";
                        //label_state.text = "[89ca88]新开启[000000]";
                    }

                    //power
                    UILabel label_power = new_item.transform.FindChild("Labels/Label-Power-Value").GetComponent <UILabel>();
                    label_power.text = mainCopy.subCopys[i].tblCopyDetail.CostValue.ToString();

                    //Count
                    UILabel label_count = new_item.transform.FindChild("Labels/Label-Count-Value").GetComponent <UILabel>();
                    label_count.gameObject.SetActive(false);
                    label_count = new_item.transform.FindChild("Labels/Label-Count").GetComponent <UILabel>();
                    label_count.gameObject.SetActive(false);

                    //Star
                    GameObject go_star = new_item.transform.FindChild("Star").gameObject;
                    for (int j = 0; j < 3; j++)
                    {
                        if (j < mainCopy.subCopys[i].maxStar)
                        {
                            go_star.transform.GetChild(j).gameObject.SetActive(true);
                        }
                        else
                        {
                            go_star.transform.GetChild(j).gameObject.SetActive(false);
                        }
                    }

                    UIEventListener.Get(new_item).onClick += OnSelectSubCopy;
                    subCopyCount++;
                }
            }
            if (GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_2 ||
                GuideManager.Instance.currentStep == GuideManager.GUIDE_STEP.COPY1_3)
            {
                GuideManager.Instance.checkGuideState(0);
            }
        }
        else
        {
            for (int i = 0; i < mainCopy.subCopys.Count; i++)
            {
                GameObject new_item = ResourceManager.Instance.loadWidget(subCopyItem);//(GameObject)Instantiate(subCopyItem);
                new_item.transform.parent        = parent.transform;
                new_item.transform.localPosition = Vector3.zero;
                new_item.transform.localScale    = Vector3.one;
                new_item.transform.name          = mainCopy.subCopys[i].subCopyID.ToString();

                //name
                UILabel label_name = new_item.transform.FindChild("Labels/Label-Name-Value").GetComponent <UILabel>();
                label_name.text = LanguageManger.GetWords(mainCopy.subCopys[i].tblCopyDetail.Copyname);

                //state
                //UILabel label_state = new_item.transform.FindChild("Labels/Label-State-Value").GetComponent<UILabel>();
                UISprite sprite_state = new_item.transform.FindChild("Sprites/Sprite-State").GetComponent <UISprite>();
                sprite_state.spriteName = "xinkaiqi";
                //power
                UILabel label_power = new_item.transform.FindChild("Labels/Label-Power-Value").GetComponent <UILabel>();
                label_power.text = mainCopy.subCopys[i].tblCopyDetail.CostValue.ToString();

                //count
                UILabel label_count      = new_item.transform.FindChild("Labels/Label-Count-Value").GetComponent <UILabel>();
                UILabel label_countTitle = new_item.transform.FindChild("Labels/Label-Count").GetComponent <UILabel>();
                int     copyCount        = TableManager.GetCopydetailByID(mainCopy.subCopys[i].subCopyID).CopyLimit - mainCopy.subCopys[i].count;
                //				if(copyCount<0)
                //				{
                //					label_count.text="无限次";
                //				}
                //				else
                //				{
                //					label_count.text = copyCount+"次";
                //				}
                if (copyCount <= 0)//JackWen 加入容错,避免服务器错误数据导致玩家无限刷bug
                {
                    //new_item.GetComponent<UIImageButton>().isEnabled=false;
                    Destroy(new_item.GetComponent <UIImageButton>());
                    label_countTitle.text = "[ff231a]今日剩余:[000000]";
                    label_count.text      = "[ff231a]" + copyCount + "次[000000]";
                }
                else
                {
                    UIEventListener.Get(new_item).onClick += OnSelectSubCopy;
                    label_countTitle.text = "[f1eccf]今日剩余:[000000]";
                    label_count.text      = "[f1eccf]" + copyCount + "次[000000]";
                }
                //Star
                GameObject go_star = new_item.transform.FindChild("Star").gameObject;
                for (int j = 0; j < 3; j++)
                {
                    if (j < mainCopy.subCopys[i].maxStar)
                    {
                        go_star.transform.GetChild(j).gameObject.SetActive(true);
                    }
                    else
                    {
                        go_star.transform.GetChild(j).gameObject.SetActive(false);
                    }
                }
                subCopyCount++;
            }
        }

        parent.GetComponent <UIGrid>().repositionNow = true;
        scrollBar.scrollValue = 0;
    }
Exemplo n.º 23
0
    public void ShowCardItem(UserCardItem card)
    {
        if (card == null)
        {
            return;
        }

        //GameObject newItem = ResourceManager.Instance.loadWidget(listItem);//(GameObject)Instantiate(listItem);
        GameObject newItem = CardListItemPool.Instance.GetListItem(listItem);

        newItem.transform.parent        = listParent.transform;
        newItem.transform.localPosition = new Vector3(0, 0, -2);
        newItem.transform.localScale    = new Vector3(1, 1, 1);
        newItem.name = card.cardID.ToString();
        items.Add(newItem);
        currentPageCount++;
        UIEventListener.Get(newItem).onClick += ShowCardInfo;
        //------------------------卡牌背景及外框--------------------------------
        //2013-10-12 Jack Wen
        UISprite icon_bg     = newItem.transform.FindChild("CardIcon/Button-CardIcon/SpriteBG").GetComponent <UISprite>();
        UISprite icon_border = newItem.transform.FindChild("CardIcon/Button-CardIcon/Sprite").GetComponent <UISprite>();
        int      icon_star   = TableManager.GetCardByID(card.templateID).Star;

        icon_bg.spriteName     = UserCardItem.littleCardFrameName[icon_star];
        icon_border.spriteName = UserCardItem.littleCardBorderName[icon_star];
        //--------------------------------------------------------------------
        UILabel nameLabel  = newItem.transform.FindChild("Labels/Label-Name").GetComponent <UILabel>();
        int     nameLangId = TableManager.GetAppearanceByID(TableManager.GetCardByID(card.templateID).Appearance).Name;

        nameLabel.text = LanguageManger.GetWords(nameLangId);

        UILabel lifeLabel = newItem.transform.FindChild("Labels/Label-Hp-Value").GetComponent <UILabel>();

        lifeLabel.text = (card.GetHp()).ToString();

        UILabel attackLabel = newItem.transform.FindChild("Labels/Label-Attack-Value").GetComponent <UILabel>();

        attackLabel.text = (card.GetAttack()).ToString();

        UILabel levelLabel = newItem.transform.FindChild("Labels/Label-Level-Value").GetComponent <UILabel>();

        levelLabel.text = card.level.ToString();

        //UIPanel panel = newItem.GetComponent<UIPanel>();

        //让图标无响应
        //newItem.transform.FindChild("CardIcon/Button-CardIcon").GetComponent<BoxCollider>().enabled = false;
        // GameObject CardIconBtn = newItem.transform.FindChild("CardIcon/Button-CardIcon").gameObject;
        UIEventListener.Get(newItem).onClick += ShowCardInfo;

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

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

        //五行图标显示
        UISprite sttributeIcon = newItem.transform.FindChild("Sprite-Attribute").GetComponent <UISprite>();

        sttributeIcon.spriteName = card.GetAttributeIconName();

        UISprite icon = newItem.transform.FindChild("CardIcon/Button-CardIcon/Sprite-Icon").GetComponent <UISprite>();

        icon.spriteName = TableManager.GetAppearanceByID(TableManager.GetCardByID(card.templateID).Appearance).HeadIcon;

        UILabel protectedLabel = newItem.transform.FindChild("Labels/Label-Is-Protected").GetComponent <UILabel>();
        bool    isMember       = false;

        for (int i = 0; i < Obj_MyselfPlayer.GetMe().teamMemberArray.Length; i++)
        {
            if (Obj_MyselfPlayer.GetMe().teamMemberArray[i] == card.cardID)
            {
                isMember = true;
            }
        }

        //判断卡牌是否被保护
        if (card.isProtected)
        {
            newItem.transform.FindChild("Sprites/sp-suo").gameObject.SetActive(true);
        }
        else
        {
            newItem.transform.FindChild("Sprites/sp-suo").gameObject.SetActive(false);
        }

        //显示是否上场
        if (isMember)
        {
            protectedLabel.text = "上场";
        }
        else
        {
            protectedLabel.text = "";
        }
    }
    //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);
                    }
                }
            }
        }
    }
Exemplo n.º 25
0
    void FreshUI()
    {
        if (heroCardItem != null)
        {
            int next = TableManager.GetCardByID(heroCardItem.templateID).NextCard;
            if (TableManager.GetCardByID(next) == null)
            {
                next = heroCardItem.templateID;
            }
            evolutionBefore.gameObject.SetActive(true);
            evolutionAfter.gameObject.SetActive(true);

            evolutionBefore.GetComponent <CardLarge>().SetCardTemplateID(heroCardItem.templateID);
            evolutionAfter.GetComponent <CardLarge>().SetCardTemplateID(next);
            evolutionAfter.name = next.ToString();  //-----žøÍŒ±êž¶ÏàÓŠµÄ TempleID

            UserCardItem tgtCardItem = new UserCardItem();
            tgtCardItem.templateID = next;
            tgtCardItem.level      = TableManager.GetCardByID(next).LevelBase;
            //tgtCardItem.skillLevel = TableManager.GetSkillByID(TableManager.GetCardByID(next).SkillVol).SkillLevel;
            tgtCardItem.skillLevel    = heroCardItem.skillLevel;     //Ÿ«œø¿šÅƺóµÄŒŒÄܵȌ¶ºÍÇ¿»¯¶ŒÒª±£Áô
            tgtCardItem.addQualityAtt = heroCardItem.addQualityAtt;
            tgtCardItem.addQualityHp  = heroCardItem.addQualityHp;
            targetCardItem            = tgtCardItem;
            //œø»¯Ç°µÄÐÅÏ¢--
            heroInfo.SetActive(true);
            int heroMaxLevel = TableManager.GetCardByID(heroCardItem.templateID).MaxLevel;
            heroLevel.text = heroCardItem.level + "/" + heroMaxLevel;
            if (heroCardItem.level < heroMaxLevel)  //----µÈŒ¶²»×㣬Óúì×ÖÀŽÌáÊŸ
            {
                heroLevel.color = Color.red;
            }
            else
            {
                heroLevel.color = Color.white;
            }

            heroHp.text         = heroCardItem.GetHp().ToString();
            heroHpGrow.text     = TableManager.GetCardByID(heroCardItem.templateID).HpGrow.ToString();
            heroAttack.text     = heroCardItem.GetAttack().ToString();
            heroAttackGrow.text = TableManager.GetCardByID(heroCardItem.templateID).AttackGrow.ToString();

            int skill_id  = TableManager.GetCardByID(heroCardItem.templateID).SkillVol;
            int skiil_dis = TableManager.GetSkillByID(skill_id).Effect;
            heroSkillName.text  = LanguageManger.GetWords(TableManager.GetSkillDisplayByID(skiil_dis).Name);
            heroSkillLevel.text = heroCardItem.skillLevel + "/" + TableManager.GetSkillByID(skill_id).SkillMaxlevel;


            //œø»¯ºóµÄÐÅÏ¢--
            tgtInfo.SetActive(true);
            tgtLevel.text      = tgtCardItem.level + "/" + TableManager.GetCardByID(tgtCardItem.templateID).MaxLevel;
            tgtHp.text         = tgtCardItem.GetHp().ToString();
            tgtHpGrow.text     = TableManager.GetCardByID(tgtCardItem.templateID).HpGrow.ToString();
            tgtAttack.text     = tgtCardItem.GetAttack().ToString();
            tgtAttackGrow.text = TableManager.GetCardByID(tgtCardItem.templateID).AttackGrow.ToString();
            skill_id           = TableManager.GetCardByID(tgtCardItem.templateID).SkillVol;
            skiil_dis          = TableManager.GetSkillByID(skill_id).Effect;
            tgtSkillName.text  = LanguageManger.GetWords(TableManager.GetSkillDisplayByID(skiil_dis).Name);
            tgtSkillLevel.text = tgtCardItem.skillLevel + "/" + TableManager.GetSkillByID(skill_id).SkillMaxlevel;


            //evolution material

            /*
             * for(int i = 0; i < 5; i++)
             * {
             *      if(materialCardItems[i] != null)
             *      {
             *              evolutionMaterial[i].gameObject.SetActive(true);
             *              evolutionMaterial[i].GetComponent<CardIcon>().SetCardTemplateID(materialCardItems[i].templateID);
             *      }
             *      else
             *      {
             *              evolutionMaterial[i].gameObject.SetActive(false);
             *      }
             * }
             */

            for (int i = 0; i < 5; i++)
            {
                if (matIDArray[i] > 0 && materialCardItems[i] != null)
                {
                    evolutionMaterial[i].gameObject.SetActive(true);
                    //evolutionMaterial[i].GetComponent<CardIcon>().SetCardTemplateID(matIDArray[i]);
                    //ÓвÄÁϵÄʱºòÏÔÊŸÕý³£
                    evolutionMaterial[i].GetComponent <CardIcon>().SetCardTemplateID(matIDArray[i], Color.white);
                }
                else if (matIDArray[i] > 0)
                {
                    //ȱÉÙ²ÄÁϵÄʱºò»Ò̬
                    evolutionMaterial[i].gameObject.SetActive(true);
                    evolutionMaterial[i].GetComponent <CardIcon>().SetCardTemplateID(matIDArray[i], Color.grey);
                }
                else
                {
                    evolutionMaterial[i].gameObject.SetActive(false);
                }

                evolutionMaterial[i].name = matIDArray[i].ToString();
            }

            //ÔÝʱÕâÑù×ö ÐÇŒ¶*10000
            evolutionCost.text = "" + heroCardItem.quality * 10000;

            //targetBg.transform.Find("spWaifaguang").gameObject.SetActive(true);
        }
        else
        {
            //targetBg.transform.Find("spWaifaguang").gameObject.SetActive(false);
            tgtSkillName.text   = "";
            heroSkillName.text  = "";
            heroSkillLevel.text = "";
            evolutionCost.text  = "";
            evolutionBefore.gameObject.SetActive(false);
            evolutionAfter.gameObject.SetActive(false);
            heroInfo.SetActive(false);
            tgtInfo.SetActive(false);
            for (int i = 0; i < 5; i++)
            {
                evolutionMaterial[i].gameObject.SetActive(false);
            }
        }

        if (isCanEvo)
        {
            evolutionBtn.transform.GetComponent <UIImageButton>().isEnabled = true;
            evolutionAfter.transform.FindChild("Panel/Card").GetComponent <UITexture>().color = Color.white;
            //if (evolutionBtnSpLabel != null)
            //{
            // evolutionBtnSpLabel.GetComponent<UISprite>().color = Color.white;
            // }
        }
        else
        {
            evolutionBtn.transform.GetComponent <UIImageButton>().isEnabled = false;
            // if (evolutionBtnSpLabel != null)
            // {
            //  evolutionBtnSpLabel.GetComponent<UISprite>().color = Color.grey;
            //  }

            //Transform gbTest = evolutionAfter.transform.FindChild("Panel/Card");
            evolutionAfter.transform.FindChild("Panel/Card").GetComponent <UITexture>().color = Color.grey;
        }
    }