public static string GenerateItemId(int itemId, BaseResType baseResType) { string result = ""; switch (baseResType) { case BaseResType.Hero: { HeroData data = HeroData.GetHeroDataByID(itemId); if (data == null) { Debugger.LogError("[TalkingDataController]GenerateItemId, can not find HeroData,id:" + itemId); } else { result = Localization.Get(data.name); } } break; case BaseResType.Equipment: { EquipmentData data = EquipmentData.GetEquipmentDataByID(itemId); if (data == null) { Debugger.LogError("[TalkingDataController]GenerateItemId, can not find EquipData,id:" + itemId); } else { result = Localization.Get(data.name); } } break; case BaseResType.Item: { ItemData data = ItemData.GetItemDataByID(itemId); if (data == null) { Debugger.LogError("[TalkingDataController]GenerateItemId, can not find ItemData,id:" + itemId); } else { result = Localization.Get(data.name); } } break; default: { ItemData data = ItemData.GetBasicResItemByType(baseResType); if (data == null) { Debugger.LogError("[TalkingDataController]GenerateItemId, can not find ItemData by baseResType:" + baseResType); } else { result = Localization.Get(data.name); } } break; } return(result); }
public void AddSystemNotice(int id, List <string> param = null) { BroadCastData data = BroadCastData.GetBroadcastDataById(id); if (data == null) { return; } string log = "[AddSystemNotice]id " + id; for (int i = 0; i < param.Count; i++) { log += " ,param:" + param[i]; } Debugger.Log(log); string s = string.Empty; if (param == null || param.Count == 0) { s = Localization.Get(data.des); } else { if (data.id == 2001 && param.Count >= 2) //恭喜{0}玩家获得橙色英雄{1},从此之后实力更进一步 { int heroId = param[1].ToInt32(); HeroData heroData = HeroData.GetHeroDataByID(heroId); if (heroData != null) { s = string.Format(Localization.Get(data.des), param[0], UIUtil.FormatStringWithinQualityColor(heroData.roleQuality, Localization.Get(heroData.name))); } else { Debugger.Log("can not find herodata by id:" + heroId); } } else if (data.id == 2002 && param.Count >= 3) // { int heroId = param[1].ToInt32(); HeroData heroData = HeroData.GetHeroDataByID(heroId); if (heroData != null) { s = string.Format(Localization.Get(data.des), param[0], Localization.Get(heroData.name), param[2]); } else { Debugger.Log("can not find herodata by id:" + heroId); } } else if (data.id == 2003 && param.Count >= 2) //恭喜{0}玩家获得橙色品质装备{1},如虎添翼,战无不胜 { int equipId = param[1].ToInt32(); EquipmentData equipData = EquipmentData.GetEquipmentDataByID(equipId); if (equipData != null) { s = string.Format(Localization.Get(data.des), param[0], UIUtil.FormatStringWithinQualityColor(equipData.quality, Localization.Get(equipData.name))); } else { Debugger.Log("can not find equipdata by id:" + equipId); } } else { s = string.Format(Localization.Get(data.des), param.ToArray()); } } AddSystemNotice(s); }
private IEnumerator RefreshCoroutine() { GameResData data; string tips = "error"; tipTextPrefab.SetActive(false); int i = 0; while (true) { if (i >= _dataList.Count) { _isLast = true; yield return(null); continue; } data = _dataList[i]; if (data.type == BaseResType.Hero) { HeroData heroData = HeroData.GetHeroDataByID(data.id); if (heroData != null) { tips = string.Format(Localization.Get("ui.reward_view.gain_hero"), data.star, Localization.Get(heroData.name), data.count); } else { Debugger.LogError("奖励的英雄不存在 id:" + data.id); } } else if (data.type == BaseResType.Equipment) { EquipmentData equipData = EquipmentData.GetEquipmentDataByID(data.id); if (equipData != null) { tips = string.Format(Localization.Get("ui.reward_view.gain_equip"), Localization.Get(equipData.name), data.count); } else { Debugger.LogError("奖励的装备不存在 id:" + data.id); } } else if (data.type == BaseResType.Item) { ItemData itemData = ItemData.GetItemDataByID(data.id); if (itemData != null) { tips = string.Format(Localization.Get("ui.reward_view.gain_item"), Localization.Get(itemData.name), data.count); } else { Debugger.LogError("奖励的道具不存在 id:" + data.id); } } else { ItemData itemData = ItemData.GetBasicResItemByType(data.type); if (itemData != null) { tips = string.Format(Localization.Get("ui.reward_view.gain_base_res"), Localization.Get(itemData.name), data.count); } else { Debugger.LogError("奖励的基础资源不存在 id:" + data.id); } } for (int j = 0, count = _tipList.Count; j < count; j++) { GameObject go = _tipList[j]; if (go != null) { CommonMoveByAnimation.Get(go).Init(0.15f, 0, new Vector3(0, 30, 0)); } } GameObject tipObj = Instantiate <GameObject>(tipTextPrefab); tipObj.SetActive(true); tipObj.transform.SetParent(tipRoot, false); tipObj.transform.localPosition = Vector3.zero; tipObj.GetComponent <Text>().text = tips; CommonFadeInAnimation.Get(tipObj).set(0.3f, 0); //CommonMoveByAnimation.Get(tipObj).Init(2,0,new Vector3(0,100,0)); StartCoroutine(FadeOutCoroutine(2f, tipObj)); _totalDelay += _delay; _tipList.Add(tipObj); yield return(new WaitForSeconds(_delay)); i++; } }
public void Refresh() { itemQualityFrameImage.SetSprite(UIUtil.GetItemQualityFrameSprite(_itemInfo.itemData.itemQuality)); RefreshItemIconImage(); if (_itemInfo.itemData.type == (int)ITEM_TYPE.HeroPiece) { PieceData heroPieceData = PieceData.GetPieceDataByID(_itemInfo.itemData.id); HeroInfo heroInfo = new HeroInfo(heroPieceData.heroGameResData); itemIconImage.SetSprite(ResMgr.instance.LoadSprite(heroInfo.HeadIcon)); for (int i = 0, count = starImages.Count; i < count; i++) { if (i < heroInfo.advanceLevel) { starImages[i].SetSprite(ResMgr.instance.LoadSprite("sprite/main_ui/icon_star")); } else { starImages[i].SetSprite(ResMgr.instance.LoadSprite("sprite/main_ui/icon_star2_big_disable")); } starImages[i].gameObject.SetActive(i < heroInfo.MaxAdvanceLevel); } pieceMarkImage.gameObject.SetActive(true); roleTypeIcon.SetSprite(UIUtil.GetRoleTypeSmallIconSprite(heroInfo.heroData.roleType)); roleTypeIcon.gameObject.SetActive(true); // starsRoot.gameObject.SetActive(_itemInfo.itemData.star > 0); } else if (_itemInfo.itemData.type == (int)ITEM_TYPE.EquipPiece) { PieceData pieceData = PieceData.GetPieceDataByID(_itemInfo.itemData.id); EquipmentData equipmentData = EquipmentData.GetEquipmentDataByID(pieceData.heroGameResData.id); itemIconImage.SetSprite(ResMgr.instance.LoadSprite(ResPath.GetEquipmentIconPath(equipmentData.icon))); pieceMarkImage.gameObject.SetActive(true); roleTypeIcon.SetSprite(UIUtil.GetRoleTypeSmallIconSprite(equipmentData.equipmentRoleType)); roleTypeIcon.gameObject.SetActive(true); } else { pieceMarkImage.gameObject.SetActive(false); roleTypeIcon.gameObject.SetActive(false); // starsRoot.gameObject.SetActive(false); } starsRoot.gameObject.SetActive(false); textCount.text = _itemInfo.count.ToString(); if (_itemInfo.count >= 1) { ShowCount(); } else { HideCount(); } textName.text = _itemInfo.itemData.id.ToString(); textName.gameObject.SetActive(false); }