public void SetDataForTeamCustomer(long teamId) { CptUtil.RemoveChildsByActive(objLoveMenuContainer); //获取团队数据 NpcTeamBean npcTeamData = NpcTeamHandler.Instance.manager.GetCustomerTeam(teamId); if (npcTeamData == null) { return; } //获取喜爱的菜单 List <long> listLoveMenu = npcTeamData.GetLoveMenus(); GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); UserAchievementBean userAchievement = gameData.GetAchievementData(); foreach (long menuId in listLoveMenu) { MenuInfoBean menuInfo = InnFoodHandler.Instance.manager.GetFoodDataById(menuId); Sprite spFood = InnFoodHandler.Instance.manager.GetFoodSpriteByName(menuInfo.icon_key); GameObject objLoveMenu = Instantiate(objLoveMenuContainer, objLoveMenuModel); ItemBaseTextCpt itemLoveMenu = objLoveMenu.GetComponent <ItemBaseTextCpt>(); if (userAchievement.CheckHasTeamCustomerLoveMenu(teamId, menuId)) { itemLoveMenu.SetData(spFood, menuInfo.name, ""); } else { itemLoveMenu.SetData(spUnLock, "???", Color.gray, ""); } } }
/// <summary> /// 创建效果信息 /// </summary> /// <param name="attributes"></param> /// <param name="attributesStr"></param> private void CreateItemAttributes(Sprite spIcon, Color colorSp, string details) { GameObject objItem = Instantiate(objAttributeContainer, objAttributeModel); ItemBaseTextCpt itemAttributes = objItem.GetComponent <ItemBaseTextCpt>(); if (colorSp == null || colorSp.a == 0) { itemAttributes.SetData(spIcon, Color.white, details, ""); } else { itemAttributes.SetData(spIcon, colorSp, details, ""); } }
/// <summary> /// 创建图书列表 /// </summary> /// <param name="listData"></param> public void CreateBookList(List <ItemsInfoBean> listData) { CptUtil.RemoveChildsByActive(objBookItemContainer); if (CheckUtil.ListIsNull(listData)) { tvNull.gameObject.SetActive(true); return; } else { tvNull.gameObject.SetActive(false); } for (int i = 0; i < listData.Count; i++) { ItemsInfoBean itemData = listData[i]; if (!listBook.Contains(itemData.id)) { continue; } GameObject objItem = Instantiate(objBookItemContainer, objBookItemModel); ItemBaseTextCpt itemBaseText = objItem.GetComponent <ItemBaseTextCpt>(); PopupItemsButton infoItemsPopup = objItem.GetComponent <PopupItemsButton>(); Sprite spIcon = IconDataHandler.Instance.manager.GetIconSpriteByName(itemData.icon_key); itemBaseText.SetData(spIcon, itemData.name, ""); infoItemsPopup.SetData(itemData, spIcon); } }
/// <summary> /// 创建属性信息 /// </summary> /// <param name="attributes"></param> /// <param name="attributesStr"></param> private void CreateItemAttributes(string iconKey, int attributes, string attributesStr, Color colorIcon) { if (attributes == 0) { return; } GameObject objItem = Instantiate(objAttributeContainer, objAttributeModel); ItemBaseTextCpt itemAttributes = objItem.GetComponent <ItemBaseTextCpt>(); Sprite spIcon = IconDataHandler.Instance.manager.GetIconSpriteByName(iconKey); itemAttributes.SetData(spIcon, colorForAttribute, attributesStr + "+" + attributes, colorIcon, ""); }
/// <summary> /// 设置状态 /// </summary> public void SetEffect(List <MiniGameCombatEffectBean> listEffect) { CptUtil.RemoveChildsByActive(objEffectContainer); //如果没有战斗信息 则隐藏展示栏 if (CheckUtil.ListIsNull(listEffect)) { objEffectContainer.SetActive(false); } else { objEffectContainer.SetActive(true); for (int i = 0; i < listEffect.Count; i++) { MiniGameCombatEffectBean itemEffectData = listEffect[i]; if (itemEffectData.listEffectTypeData != null) { for (int f = 0; f < itemEffectData.listEffectTypeData.Count; f++) { EffectTypeBean effectTypeData = itemEffectData.listEffectTypeData[f]; GameObject objEffectItem = Instantiate(objEffectContainer, objEffectModel); ItemBaseTextCpt itemEffect = objEffectItem.GetComponent <ItemBaseTextCpt>(); Sprite spEffect; if (effectTypeData.spIconRemark != null) { spEffect = effectTypeData.spIconRemark; } else { spEffect = effectTypeData.spIcon; } itemEffect.SetData(spEffect, effectTypeData.colorIcon, "", effectTypeData.effectDescribe); } } } } }