//所需英雄的属性权重和 public float GetEffectAttriSUM() { float nSUM = 0; for (int i = 0; i < GlobalMembers.MAX_ARTIFACT_HERO_COUNT; i++) { if (m_pRowData.getHeroID()[i] != -1) { nSUM += m_pRowData.getHeroNum()[i] * m_pRowData.getWeight()[i]; } } return(nSUM); }
public void ShowInfo(ArtifactTemplate artifact, int index, bool isReach = false) { if (isReach) { _reach.SetActive(true); _count.SetActive(false); _possess.SetActive(false); } HeroTemplate heroData = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(artifact.getHeroID()[index]); // 星级 int quality = heroData.getQuality(); for (int i = 5; i < quality + 5; i++) { _star.transform.GetChild(i).gameObject.SetActive(true); } // icon ArtresourceTemplate artresourcedata = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(heroData.getArtresources()); Sprite _img = UIResourceMgr.LoadSprite(common.defaultPath + artresourcedata.getHeadiconresource()); _icon.sprite = _img; //图片 // 名称 _name.text = GameUtils.getString(heroData.getTitleID()); // 现在的英雄数量 Text curCount = _count.transform.FindChild("CurCount").GetComponent <Text>(); curCount.text = "0"; // 需要的英雄的数量 Text needCount = _count.transform.FindChild("NeedCount").GetComponent <Text>(); needCount.text = "/" + artifact.getHeroNum()[index].ToString(); // 每一个英雄的 iD int heroID = artifact.getHeroID()[index]; _possess.transform.FindChild("Number").GetComponent <Text>().text = GetHeroCount(heroID).ToString(); }
public void ShowInfoReach(ArtifactTemplate artifact, bool isReach = false) { _artifactName.text = GameUtils.getString(artifact.getName()); if (isReach) { _artifactState.text = GameUtils.getString("relics_content8"); } else { ArtifactTemplate temp = (ArtifactTemplate)DataTemplate.GetInstance().m_ArtifactTable.getTableData(artifact.getId() - 1); string str = GameUtils.getString("relics_content10"); str = string.Format(str, GameUtils.getString(temp.getName())); _artifactState.text = str; } // 英雄 ID int[] heroID = artifact.getHeroID(); int[] heroNumber = artifact.getHeroNum(); // 每一个英雄数据 for (int i = 0; i < heroID.Length; i++) { if (heroID[i] == -1) { continue; } HeroTemplate heroData = (HeroTemplate)DataTemplate.GetInstance().m_HeroTable.getTableData(heroID[i]); GameObject cell = _heroLayout.transform.GetChild(i).gameObject; cell.SetActive(true); HeroCountItem item = cell.AddComponent <HeroCountItem>(); item.ShowInfo(artifact, i, isReach); } Show(artifact, isReach); }
void Show(ArtifactTemplate artifact, bool isReach) { // 英雄 ID int[] heroID = artifact.getHeroID(); int[] heroNumber = artifact.getHeroNum(); // 初始化属性数据 int[] attrType = artifact.getAttriType(); int[] attrValue = artifact.getAttriValue(); for (int i = 0; i < attrType.Length; i++) { if (attrType[i] == -1) { continue; } _attributeList.transform.GetChild(i).gameObject.SetActive(true); Text attrNameText = _attributeList.transform.GetChild(i).FindChild("AttrName").GetComponent <Text>(); Text attrValueText = _attributeList.transform.GetChild(i).FindChild("AttrValue").GetComponent <Text>(); Text attrStateText = _attributeList.transform.GetChild(i).FindChild("AttrState").GetComponent <Text>(); attrStateText.color = new Color(133.0f / 255, 247.0f / 255, 32.0f / 255); if (isReach) { attrValueText.text = attrValue[i].ToString(); } else { attrValueText.text = "0"; string str = GameUtils.getString("relics_content5"); attrStateText.text = string.Format(str, attrValue[i].ToString()); } switch (attrType[i]) { case (int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_POINT_MAXHP: { attrNameText.text = GameUtils.getString("baseattribute1des"); } break; case (int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_POINT_PHYSICALATTACK: { attrNameText.text = GameUtils.getString("hero_train_type2"); } break; case (int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_POINT_PHYSICALDEFENCE: { attrNameText.text = GameUtils.getString("hero_train_type4"); } break; case (int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_POINT_MAGICATTACK: { attrNameText.text = GameUtils.getString("hero_train_type3"); } break; case (int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_POINT_MAGICDEFENCE: { attrNameText.text = GameUtils.getString("hero_train_type5"); } break; case (int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_POINT_HIT: { attrNameText.text = GameUtils.getString("baseattribute6des"); } break; case (int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_POINT_DODGE: { attrNameText.text = GameUtils.getString("baseattribute7des"); } break; case (int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_POINT_CRITICAL: { attrNameText.text = GameUtils.getString("baseattribute8des"); } break; case (int)EM_EXTEND_ATTRIBUTE.EM_EXTEND_ATTRIBUTE_POINT_TENACITY: { attrNameText.text = GameUtils.getString("baseattribute9des"); } break; default: break; } } }