public void RadioButtonSelected(RadioGroupView rgView, int position, RadioButtonView rbview) { AudioHandler.Instance.PlaySound(AudioSoundEnum.ButtonForNormal); selectType = EnumUtil.GetEnum <StoreForCarpenterTypeEnum>(rbview.name); InitDataByType(selectType); }
/// <summary> /// 根据备注类型获取数据 /// </summary> /// <param name="mark"></param> /// <returns></returns> public List <StoreInfoBean> GetCerpenterListDataByType(StoreForCarpenterTypeEnum type) { List <StoreInfoBean> listData = new List <StoreInfoBean>(); if (mCarpenterListData == null) { return(listData); } for (int i = 0; i < mCarpenterListData.Count; i++) { StoreInfoBean itemData = mCarpenterListData[i]; if (itemData.store_goods_type == (int)type) { listData.Add(itemData); } } return(listData); }
/// <summary> /// 设置图标 /// </summary> /// <param name="iconKey"></param> /// <param name="mark"></param> /// <param name="markId"></param> public void SetIcon(StoreForCarpenterTypeEnum type, BuildItemBean buildItem, StoreInfoBean storeInfo) { Sprite spIcon = null; if (type == StoreForCarpenterTypeEnum.Expansion) { spIcon = IconDataHandler.Instance.manager.GetIconSpriteByName(storeInfo.icon_key); } else { spIcon = BuildItemTypeEnumTools.GetBuildItemSprite(buildItem); } if (ivIcon != null && spIcon != null) { ivIcon.sprite = spIcon; } }
/// <summary> /// 设置属性 /// </summary> /// <param name="type"></param> /// <param name="a"></param> public void SetAttribute(StoreForCarpenterTypeEnum type, float aesthetics) { if (objAttribute == null) { return; } if (type == StoreForCarpenterTypeEnum.Expansion) { objAttribute.gameObject.SetActive(false); } else { objAttribute.gameObject.SetActive(true); } if (tvAttribute != null) { tvAttribute.text = TextHandler.Instance.manager.GetTextById(10) + "+" + aesthetics; } }
/// <summary> /// 设置拥有数量 /// </summary> public void SetOwn(StoreForCarpenterTypeEnum type) { if (objOwn == null) { return; } if (type == StoreForCarpenterTypeEnum.Expansion) { objOwn.gameObject.SetActive(false); } else { objOwn.gameObject.SetActive(true); GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); if (tvOwn == null) { return; } tvOwn.text = (TextHandler.Instance.manager.GetTextById(4001) + "\n" + gameData.GetBuildNumber(storeInfo.mark_id)); } }
/// <summary> /// 创建商品列表 /// </summary> /// <param name="listData"></param> public void CreateCarpenterData(List <StoreInfoBean> listData, StoreForCarpenterTypeEnum type) { CptUtil.RemoveChildsByActive(objCarpenterContent.transform); if (listData == null || objCarpenterContent == null) { return; } GameDataBean gameData = GameDataHandler.Instance.manager.GetGameData(); for (int i = 0; i < listData.Count; i++) { StoreInfoBean itemData = listData[i]; //如果扩建 InnBuildBean innBuild = gameData.GetInnBuildData(); if (itemData.store_goods_type == (int)StoreForCarpenterTypeEnum.Expansion) { if (itemData.mark_type == 1) { if (innBuild.buildLevel + 1 != int.Parse(itemData.mark)) { continue; } } else if (itemData.mark_type == 2) { if (innBuild.buildSecondLevel + 1 != int.Parse(itemData.mark) || innBuild.buildSecondLevel > innBuild.buildLevel) { continue; } } } GameObject itemObj = Instantiate(objCarpenterContent, objCarpenterModel); ItemTownCerpenterCpt cerpenterCpt = itemObj.GetComponent <ItemTownCerpenterCpt>(); cerpenterCpt.SetData(itemData); //itemObj.transform.DOScale(new Vector3(0, 0, 0), 0.5f).SetEase(Ease.OutBack).SetDelay(i * 0.05f).From(); } }
public void SetData(StoreInfoBean itemData) { storeInfo = itemData; float aesthetics = 0; string iconKey = ""; string name = ""; string content = ""; StoreForCarpenterTypeEnum type = (StoreForCarpenterTypeEnum)storeInfo.store_goods_type; if (type == StoreForCarpenterTypeEnum.Expansion) { iconKey = storeInfo.icon_key; name = storeInfo.name; content = storeInfo.content; } else { buildItemData = InnBuildHandler.Instance.manager.GetBuildDataById(itemData.mark_id); if (buildItemData != null) { aesthetics = buildItemData.aesthetics; iconKey = buildItemData.icon_key; name = buildItemData.name; content = buildItemData.content; } } SetPrice(storeInfo.price_l, storeInfo.price_m, storeInfo.price_s, storeInfo.guild_coin, storeInfo.trophy_elementary, storeInfo.trophy_intermediate, storeInfo.trophy_advanced, storeInfo.trophy_legendary); SetName(name); SetIcon(type, buildItemData, itemData); SetAttribute(type, aesthetics); SetContent(content); SetOwn(type); SetGetNumber(storeInfo.get_number); SetPopup(content); }
public void InitDataByType(StoreForCarpenterTypeEnum type) { List <StoreInfoBean> listData = GetCerpenterListDataByType(type); CreateCarpenterData(listData, type); }
public void SetStoreData(List <StoreInfoBean> listData) { mCarpenterListData = listData; selectType = StoreForCarpenterTypeEnum.Expansion; InitDataByType(selectType); }