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; }
/// <summary> /// 普通排序 /// </summary> /// <param name="cardA"></param> /// <param name="cardB"></param> /// <returns></returns> static public int CompareTo(UserCardItem cardA, UserCardItem cardB) { if (cardB.GetLeaderShip() != cardA.GetLeaderShip()) { return(cardB.GetLeaderShip().CompareTo(cardA.GetLeaderShip())); } else if (cardB.templateID != cardA.templateID) { return(-1 * cardB.templateID.CompareTo(cardA.templateID)); } else { return(cardB.level.CompareTo(cardA.level)); } }
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); }
//zbz修改(以后显示的计算都放在这里) 如果Card != null 则用card, 否用templateid private void CalculateCardInfoAndShow(UserCardItem card, int nTemplateid) { int templateid = 0; if (card != null) { templateid = card.templateID; } else if (nTemplateid > 0) { templateid = nTemplateid; } else { return; } Tab_Card tabCard = TableManager.GetCardByID(templateid); if (tabCard != null) { Tab_Appearance tabAppearance = TableManager.GetAppearanceByID(tabCard.Appearance); if (tabAppearance != null) { cardName.text = LanguageManger.GetWords(tabAppearance.Name); if (tabAppearance.DropDescripe == -1) { level_src.text = "获得途径:无"; } else { level_src.text = LanguageManger.GetWords(tabAppearance.DropDescripe); } } if (largeCardObj != null) { largeCardObj.GetComponent <CardLarge>().SetCardTemplateID(templateid); } if (card != null) { if (Obj_MyselfPlayer.GetMe().IsCardInBagByID(card.cardID)) { HP.text = (card.GetHpBase() + card.GetFengShuiHp() + card.GetStudySkillHp()).ToString(); attack.text = (card.GetAttackBase() + card.GetFengShuiAttc()).ToString(); } else { HP.text = card.GetHpBase().ToString(); attack.text = card.GetAttackBase().ToString(); } if (card.GetHpAdd() > 0) //有加成 { HP_add.text = "+" + card.GetHpAdd().ToString(); } else { HP_add.text = ""; } if (card.GetAttackAdd() > 0) { attack_add.text = "+" + card.GetAttackAdd().ToString(); } else { attack_add.text = ""; } level.text = card.level + "/" + tabCard.MaxLevel.ToString(); //学习技能 Tab_Studyskill studySkill = TableManager.GetStudyskillByID(card.skillStudyId); if (studySkill != null) { string color = ""; switch (studySkill.SkillQuality) { case 0: color = "[2d8560]"; break; case 1: color = "[2368ad]"; break; case 2: color = "[852bed]"; break; default: break; } studySkillName.text = color + studySkill.SkillName; studySkillName.text += "[9d2f07] " + card.skillStudyLev + "/" + studySkill.SkillHighLevel; sdudySkillDes.text = ConvertAttType(studySkill.SkillDes, templateid); } else { studySkillName.text = "[a65a04]无"; sdudySkillDes.text = ""; } leadership.text = card.GetLeaderShip().ToString(); } else { int hp = tabCard.HpBase; int nLevBase = tabCard.LevelBase; hp += tabCard.HpGrow * (tabCard.GambleLevel - nLevBase); HP.text = hp.ToString(); int att = tabCard.AttackBase; att += tabCard.AttackGrow * (tabCard.GambleLevel - nLevBase); attack.text = att.ToString(); attack_add.text = ""; HP_add.text = ""; level.text = tabCard.GambleLevel.ToString() + "/" + tabCard.MaxLevel.ToString(); //学习技能 Tab_Studyskill studySkill = TableManager.GetStudyskillByID(tabCard.SkillStudy); if (studySkill != null) { string color = ""; switch (studySkill.SkillQuality) { case 0: color = "[2d8560]"; break; case 1: color = "[2368ad]"; break; case 2: color = "[852bed]"; break; default: break; } studySkillName.text = color + studySkill.SkillName; studySkillName.text += "[9d2f07] " + tabCard.SkillStudylv + "/" + studySkill.SkillHighLevel; sdudySkillDes.text = ConvertAttType(studySkill.SkillDes, templateid); //领导力 leadership.text = (tabCard.LeaderBase + studySkill.LeaderNum).ToString(); } else { studySkillName.text = "[a65a04]无"; sdudySkillDes.text = ""; //领导力 leadership.text = tabCard.LeaderBase.ToString(); } } Tab_Skill skill = null; Tab_SkillDisplay skillDisplay = null; skill = TableManager.GetSkillByID(tabCard.SkillComm); if (skill != null) { skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect); N_name.text = LanguageManger.GetWords(skillDisplay.Name); N_des.text = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), templateid); } skill = TableManager.GetSkillByID(tabCard.SkillVol); cardLevelMax.text = ""; if (skill != null) { skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect); Z_name.text = LanguageManger.GetWords(skillDisplay.Name); Z_des.text = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), templateid); //当实现的卡牌是存在的卡牌时(就是除了进化后预览效果这样的卡牌) if (card != null) { Z_name.text += "[9d2f07]" + card.skillLevel + "/" + skill.SkillMaxlevel; Debug.Log("card skill level : " + card.skillLevel); } else { Z_name.text += "[9d2f07]" + 1 + "/" + skill.SkillMaxlevel; Debug.Log("card skill level : not find card"); } //2013-8-9 Jack Wen cardLevelMax.gameObject.SetActive(false); ShowRoundNum(skill.FirstRelease); } else { ShowRoundNum(2); } Tab_Leaderskill leaderSkill = TableManager.GetLeaderskillByID(tabCard.SkillLeader);//.GetSkillByID(tabCard.SkillLeader); if (leaderSkill != null) { L_name.text = LanguageManger.GetWords(leaderSkill.Name); Debug.Log("L_name.text=" + L_name.text); L_des.text = ConvertAttType(LanguageManger.GetWords(leaderSkill.Note), templateid); } else { L_name.text = "无"; L_des.text = ""; } skill = TableManager.GetSkillByID(tabCard.SkillComb); if (skill != null) { skillDisplay = TableManager.GetSkillDisplayByID(skill.Effect); H_name.text = LanguageManger.GetWords(skillDisplay.Name); H_des.text = ConvertAttType(LanguageManger.GetWords(skillDisplay.Describe), templateid); } cardCanEvl.spriteName = tabCard.NextCard == -1 ? "cannotEvl" : "canEvl"; int maxStar = tabCard.HighStarDisplay; // level; for (int i = 0; i < startManager.Length; i++) { if (i < tabCard.Star) { UISprite starIcon = startManager[i].GetComponent <UISprite>(); starIcon.spriteName = "xingxing"; starIcon.MakePixelPerfect(); starIcon.gameObject.SetActive(true); } else { UISprite starIcon = startManager[i].GetComponent <UISprite>(); if (i < maxStar) { starIcon.spriteName = "haoyou_xingxing_beijing"; starIcon.MakePixelPerfect(); starIcon.gameObject.SetActive(true); } else { starIcon.gameObject.SetActive(false); } } } } }
public void ShowCardItem(UserCardItem card) { if (card == null) { return; } if (card.cardID == Obj_MyselfPlayer.GetMe().teamMemberArray[0]) { //GameObject newItem = ResourceManager.Instance.loadWidget(teamHeaderItem); GameObject newItem = CardListItemPool.Instance.GetListItem(teamHeaderItem); newItem.transform.GetComponent <UIDragPanelContents>().draggablePanel = dragPanel; newItem.transform.parent = grid.transform; newItem.transform.localPosition = new Vector3(0, 0, -1); newItem.transform.localScale = new Vector3(1, 1, 1); SetHeaderItem(newItem, card, true); //------------------------卡牌背景及外框-------------------------------- //2013-10-12 Jack Wen UISprite icon_bg = newItem.transform.FindChild("CardIcon").GetChild(0).FindChild("Sprite-Frame").GetComponent <UISprite>(); UISprite icon_border = newItem.transform.FindChild("CardIcon").GetChild(0).FindChild("Sprite-BG").GetComponent <UISprite>(); int icon_star = TableManager.GetCardByID(card.templateID).Star; icon_bg.spriteName = UserCardItem.littleCardFrameName[icon_star]; icon_border.spriteName = UserCardItem.littleCardBorderName[icon_star]; //-------------------------------------------------------------------- newItem.transform.FindChild("Sprites/Sprite-Header").gameObject.SetActive(true); newItem.transform.FindChild("Checkbox").GetComponent <UICheckbox>().isChecked = true; newItem.transform.FindChild("Checkbox").GetComponent <UICheckbox>().enabled = false; newItem.transform.FindChild("BG").GetComponent <UIImageButton>().isEnabled = false; newItem.transform.FindChild("Sprites/Sprite-name-bg").GetComponent <UISprite>().alpha = 0.5f; //newItem.transform.FindChild("BG").GetComponent<UIButton>().isEnabled = false; headerLeaderShip = card.GetLeaderShip(); items.Add(newItem); } else { //GameObject newItem = ResourceManager.Instance.loadWidget(teamHeaderItem); GameObject newItem = CardListItemPool.Instance.GetListItem(teamHeaderItem); newItem.transform.GetComponent <UIDragPanelContents>().draggablePanel = dragPanel; newItem.transform.parent = grid.transform; newItem.transform.localPosition = new Vector3(0, 0, -1); newItem.transform.localScale = new Vector3(1, 1, 1); items.Add(newItem); //------------------------卡牌背景及外框-------------------------------- //2013-10-12 Jack Wen UISprite icon_bg = newItem.transform.FindChild("CardIcon").GetChild(0).FindChild("Sprite-Frame").GetComponent <UISprite>(); UISprite icon_border = newItem.transform.FindChild("CardIcon").GetChild(0).FindChild("Sprite-BG").GetComponent <UISprite>(); int icon_star = TableManager.GetCardByID(card.templateID).Star; icon_bg.spriteName = UserCardItem.littleCardFrameName[icon_star]; icon_border.spriteName = UserCardItem.littleCardBorderName[icon_star]; //-------------------------------------------------------------------- newItem.transform.FindChild("Sprites/Sprite-Header").gameObject.SetActive(false); newItem.transform.FindChild("Checkbox").GetComponent <UICheckbox>().isChecked = false; newItem.transform.FindChild("Checkbox").GetComponent <UICheckbox>().enabled = true; newItem.transform.FindChild("BG").GetComponent <UIImageButton>().isEnabled = true; newItem.transform.FindChild("Sprites/Sprite-name-bg").GetComponent <UISprite>().alpha = 1f; //测试 领导力判断 bool isFind = false; for (int i = 0; i < Obj_MyselfPlayer.GetMe().teamMemberArray.Length; i++) { if (card.cardID == Obj_MyselfPlayer.GetMe().teamMemberArray[i]) { isFind = true; break; } } if (isFind) { if (nowLeaderShip - headerLeaderShip > maxLeaderShip) { SetHeaderItem(newItem, card, false); //newItem.transform.FindChild("BG").GetComponent<UIButton>().isEnabled = false; newItem.transform.FindChild("BG").GetComponent <UIImageButton>().isEnabled = false; newItem.transform.FindChild("Checkbox").GetComponent <UICheckbox>().enabled = false; newItem.transform.FindChild("Sprites/Sprite-name-bg").GetComponent <UISprite>().alpha = 0.5f; } else { UIEventListener.Get(newItem).onClick += SelectHeader; SetHeaderItem(newItem, card, true); //newItem.transform.FindChild("BG").GetComponent<UIButton>().isEnabled = true; newItem.transform.FindChild("BG").GetComponent <UIImageButton>().isEnabled = true; newItem.transform.FindChild("Sprites/Sprite-name-bg").GetComponent <UISprite>().alpha = 1; } } else { if (nowLeaderShip - headerLeaderShip + card.GetLeaderShip() > maxLeaderShip) { SetHeaderItem(newItem, card, false); //newItem.transform.FindChild("BG").GetComponent<UIButton>().isEnabled = false; newItem.transform.FindChild("BG").GetComponent <UIImageButton>().isEnabled = false; newItem.transform.FindChild("Checkbox").GetComponent <UICheckbox>().enabled = false; newItem.transform.FindChild("Sprites/Sprite-name-bg").GetComponent <UISprite>().alpha = 0.5f; } else { UIEventListener.Get(newItem).onClick += SelectHeader; SetHeaderItem(newItem, card, true); //newItem.transform.FindChild("BG").GetComponent<UIButton>().isEnabled = true; newItem.transform.FindChild("BG").GetComponent <UIImageButton>().isEnabled = true; newItem.transform.FindChild("Sprites/Sprite-name-bg").GetComponent <UISprite>().alpha = 1; } } if (iguide == 0) { guideItem = newItem; iguide = -1; } } }
public bool InitTeamMemberOtherWithCard(UserCardItem card, UIEventListener.VoidDelegate selectMember, int memberNum, int nowLeaderShip, int maxLeaderShip, bool isPVP) { transform.localPosition = new Vector3(0, 0, -1); transform.localScale = new Vector3(1, 1, 1); spriteSpriteHeader.SetActive(false); checkbox.isChecked = false; checkboxCheckmark.spriteName = "xuanze"; checkboxCheckmark.transform.localPosition = new Vector3(0, 0, -5); //------------------------卡牌背景及外框-------------------------------- //2013-10-12 Jack Wen int icon_star = TableManager.GetCardByID(card.templateID).Star; cardIconSpriteFrame.spriteName = UserCardItem.littleCardFrameName[icon_star]; cardIconSpriteBG.spriteName = UserCardItem.littleCardBorderName[icon_star]; //-------------------------------------------------------------------- //newItem.transform.FindChild("BG").GetComponent<UIButton>().isEnabled = false; bG.isEnabled = true; spriteSpriteNameBG.alpha = 1f; UIEventListener.Get(gameObject).onClick += selectMember; bool canUse = true; if (memberNum == 4) { bG.isEnabled = false; spriteSpriteNameBG.alpha = 0.5f; UIEventListener.Get(gameObject).onClick -= selectMember; } else if (nowLeaderShip + card.GetLeaderShip() > maxLeaderShip) { bG.isEnabled = false; spriteSpriteNameBG.alpha = 0.5f; UIEventListener.Get(gameObject).onClick -= selectMember; canUse = false; } //搜索队员卡牌 分两种情况 PVP选队员 和 普通的选队员 int length = isPVP ? Obj_MyselfPlayer.GetMe().PvPBattleArray.Length : Obj_MyselfPlayer.GetMe().teamMemberArray.Length; for (int i = isPVP ? 0 : 1; i < length; i++) { if (card.cardID == (isPVP ? Obj_MyselfPlayer.GetMe().PvPBattleArray[i] : Obj_MyselfPlayer.GetMe().teamMemberArray[i])) { checkbox.isChecked = true; bG.isEnabled = true; spriteSpriteNameBG.alpha = 1; UIEventListener.Get(gameObject).onClick -= selectMember; UIEventListener.Get(gameObject).onClick += selectMember; canUse = true; break; } } SetMemberItem(card, canUse); checkboxCheckmark.MakePixelPerfect(); return(true); }
public void SelectLeaderShowCardItem(UserCardItem card) { if (card == null) { return; } // Debug.LogError("Card ID = " + card.cardID); if (card.cardID == Obj_MyselfPlayer.GetMe().curPvPLearder) { GameObject newItem = CardListItemPool.Instance.GetListItem(teamHeaderItem); newItem.transform.GetComponent <UIDragPanelContents>().draggablePanel = dragPanel; newItem.transform.parent = grid.transform; newItem.transform.localPosition = new Vector3(0, 0, -1); newItem.transform.localScale = new Vector3(1, 1, 1); SetHeaderItem(newItem, card, true); //------------------------卡牌背景及外框-------------------------------- //2013-10-12 Jack Wen UISprite icon_bg = newItem.transform.FindChild("CardIcon").GetChild(0).FindChild("Sprite-Frame").GetComponent <UISprite>(); UISprite icon_border = newItem.transform.FindChild("CardIcon").GetChild(0).FindChild("Sprite-BG").GetComponent <UISprite>(); int icon_star = TableManager.GetCardByID(card.templateID).Star; icon_bg.spriteName = UserCardItem.littleCardFrameName[icon_star]; icon_border.spriteName = UserCardItem.littleCardBorderName[icon_star]; //-------------------------------------------------------------------- newItem.transform.FindChild("Sprites/Sprite-Header").gameObject.SetActive(true); newItem.transform.FindChild("Checkbox").GetComponent <UICheckbox>().isChecked = true; newItem.transform.FindChild("Checkbox").GetComponent <UICheckbox>().enabled = false; newItem.transform.FindChild("BG").GetComponent <UIImageButton>().isEnabled = false; newItem.transform.FindChild("Sprites/Sprite-name-bg").GetComponent <UISprite>().alpha = 0.5f; headerLeaderShip = card.GetLeaderShip(); items.Add(newItem); } else { //GameObject newItem = ResourceManager.Instance.loadWidget(teamHeaderItem); GameObject newItem = CardListItemPool.Instance.GetListItem(teamHeaderItem); newItem.transform.GetComponent <UIDragPanelContents>().draggablePanel = dragPanel; newItem.transform.parent = grid.transform; newItem.transform.localPosition = new Vector3(0, 0, -1); newItem.transform.localScale = new Vector3(1, 1, 1); items.Add(newItem); //------------------------卡牌背景及外框-------------------------------- //2013-10-12 Jack Wen UISprite icon_bg = newItem.transform.FindChild("CardIcon").GetChild(0).FindChild("Sprite-Frame").GetComponent <UISprite>(); UISprite icon_border = newItem.transform.FindChild("CardIcon").GetChild(0).FindChild("Sprite-BG").GetComponent <UISprite>(); int icon_star = TableManager.GetCardByID(card.templateID).Star; icon_bg.spriteName = UserCardItem.littleCardFrameName[icon_star]; icon_border.spriteName = UserCardItem.littleCardBorderName[icon_star]; //-------------------------------------------------------------------- newItem.transform.FindChild("Sprites/Sprite-Header").gameObject.SetActive(false); newItem.transform.FindChild("Checkbox").GetComponent <UICheckbox>().isChecked = false; newItem.transform.FindChild("Checkbox").GetComponent <UICheckbox>().enabled = true; newItem.transform.FindChild("BG").GetComponent <UIImageButton>().isEnabled = true; newItem.transform.FindChild("Sprites/Sprite-name-bg").GetComponent <UISprite>().alpha = 1f; UIEventListener.Get(newItem).onClick += SelectHeader; SetHeaderItem(newItem, card, true); //newItem.transform.FindChild("BG").GetComponent<UIButton>().isEnabled = true; newItem.transform.FindChild("BG").GetComponent <UIImageButton>().isEnabled = true; newItem.transform.FindChild("Sprites/Sprite-name-bg").GetComponent <UISprite>().alpha = 1; } }