void CalculateHeroData(bool bInUpdateShow) { Tab_Card tbl_card = TableManager.GetCardByID(heroCardItem.templateID); //Tab_Skill tbl_skill_vol = TableManager.GetSkillByID(tbl_card.SkillVol); levelValue.text = heroCardItem.level.ToString(); if (!bInUpdateShow) { nowLev = heroCardItem.level; } nowLev = heroCardItem.level; hpValue.text = heroCardItem.GetHp().ToString(); attackValue.text = heroCardItem.GetAttack().ToString(); // if (nowLev == tbl_card.MaxLevel) { expProgressBar.sliderValue = 0f; } else { expProgressBar.sliderValue = (float)heroCardItem.cardExp / (float)TableManager.GetCardexperienceByID(heroCardItem.level).CardExp; } this.FreshSkill(); }
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 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); }
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; }
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 = ""; } }
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; } }
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); }
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; } }