public void UpdateUI() { if (string.IsNullOrEmpty(Data.id)) { mDMono.gameObject.CustomSetActive(false); return; } else { mDMono.gameObject.CustomSetActive(true); } //m_Have_Label.text = string.Format(HaveFormatStr,EB.Localizer.GetString("ID_LABEL_NAME_HADE"),Data.have); if (m_Discount_Label != null) { m_Discount_Label.text = LTChargeManager.GetDiscountText(Data.discount); m_Discount_Label.gameObject.CustomSetActive(Data.discount > 0 && Data.discount < 1); } int resBalance = BalanceResourceUtil.GetResValue(Data.cost_id); if (resBalance < Data.cost) { m_Cost_Label.color = LT.Hotfix.Utility.ColorUtility.RedColor; } else { m_Cost_Label.color = LT.Hotfix.Utility.ColorUtility.WhiteColor; } LTUIUtil.AddBlackOutLineToLabel(m_Cost_Label, Data.cost.ToString()); m_Cost_Sprite.spriteName = BalanceResourceUtil.GetResSpriteName(Data.cost_id); if (m_UIResourceComponent != null) { m_UIResourceComponent.m_ResID = Data.cost_id; } m_Item.LTItemData = new LTShowItemData(Data.id, Data.num, Data.type, false); LTIconNameQuality itemInfo = LTItemInfoTool.GetInfo(m_Item.LTItemData.id, m_Item.LTItemData.type, m_Item.LTItemData.coloring); Data.item_name = itemInfo.name; m_Item.Name.applyGradient = false; if (Data.sell_out) { m_Cost_Label.gameObject.CustomSetActive(false); m_Cost_Sprite.gameObject.CustomSetActive(false); m_SellOut_Sprite.gameObject.CustomSetActive(true); m_BuyBtn.enabled = false; } else { m_Cost_Label.gameObject.CustomSetActive(true); m_Cost_Sprite.gameObject.CustomSetActive(true); m_SellOut_Sprite.gameObject.CustomSetActive(false); m_BuyBtn.enabled = true; } }
public void Set(int trainingId, Action act) { var trainingInfo = CharacterTemplateManager.Instance.GetPromotionTrainingInfo(trainingId); if (trainingInfo == null) { EB.Debug.LogError("LTPromotionTrainingButtonController.Set -> info is null"); return; } var strs1 = trainingInfo.cost.Split(';'); var usedTimes = LTPromotionManager.Instance.GetUsedTrainingTimes(trainingId); var index = usedTimes >= strs1.Length ? strs1.Length - 1 : usedTimes; if (index < 0) { index = 0; } var strs2 = strs1[index].Split(','); var iconName = BalanceResourceUtil.GetResSpriteName(strs2[0]); var cost = strs2[1]; int.TryParse(cost, out int costNum); var isEnough = trainingId == 1 ? BalanceResourceUtil.GetUserGold() >= costNum : BalanceResourceUtil.GetUserDiamond() >= costNum; var coststrcolor = isEnough ? LT.Hotfix.Utility.ColorUtility.WhiteColorHexadecimal : LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal; var remainingTimes = trainingInfo.count - usedTimes; var isFree = LTPromotionManager.Instance.IsTrainingFree(trainingId); if (trainingInfo.count > 0) { var colorStr = remainingTimes > 0 ? LT.Hotfix.Utility.ColorUtility.GreenColorHexadecimal : LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal; _labTips.text = EB.StringUtil.Format(EB.Localizer.GetString("ID_codefont_in_LTUltimateTrialHudCtrl_11054"), EB.StringUtil.Format("[{0}]", colorStr), remainingTimes, trainingInfo.count); } else { _labTips.text = string.Empty; } _icon.spriteName = iconName; _btnSprite.spriteName = trainingId == 1 ? "Ty_Button_1" : "Ty_Button_3"; _goFreeTips.SetActive(isFree); _goCost.SetActive(!isFree); _labCost.text = string.Format("[{0}]{1}[-]", coststrcolor, cost); _labName.text = trainingInfo.name; _btn.clickEvent.Clear(); _btn.clickEvent.Add(new EventDelegate(() => act?.Invoke())); ShowRedPoint(trainingId); }
private void SetTilteAndIcon() { if (data.type == "res") { int tplID = BalanceResourceUtil.GetResID(data.id); Hotfix_LT.Data.EconemyItemTemplate itemTpl = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetItem(tplID); titleLab.text = string.Format(EB.Localizer.GetString("ID_codefont_in_LTMainInstanceLampItem_1974"), itemTpl.Name); CoinSp.spriteName = BalanceResourceUtil.GetResSpriteName(data.id); } else if (data.type == "heroshard") { titleLab.text = EB.Localizer.GetString("ID_codefont_in_LTMainInstanceLampItem_2168"); CoinSp.spriteName = BalanceResourceUtil.GetResSpriteName(data.type); } }
public override void Awake() { base.Awake(); var t = controller.transform; GeneralDiceNumLabel = t.GetComponent <UILabel>("Edge/Bottom/Btn/Num"); GeneralDiceCostLabel = t.GetComponent <UILabel>("Edge/Bottom/Btn/Cost"); GeneralDiceCostSprite = t.GetComponent <UISprite>("Edge/Bottom/Btn/Cost/Icon"); SpecialDiceNumLabel = t.GetComponent <UILabel>("Edge/Bottom/Btn (1)/Num"); SpecialDiceCostLabel = t.GetComponent <UILabel>("Edge/Bottom/Btn (1)/Cost"); SpecialDiceCostSprite = t.GetComponent <UISprite>("Edge/Bottom/Btn (1)/Cost/Icon"); RateOfProgressLabel = t.GetComponent <UILabel>("Edge/Bottom/Back/Label"); MapLabel = t.GetComponent <UILabel>("Edge/TopRight/MapPanel/Map/LevelLabel"); NumLabel = t.GetComponent <UILabel>("Edge/PlayerPanel/Panel/Label"); tweener = NumLabel.GetComponents <UITweener>(); Slider = t.GetComponent <UISlider>("Edge/Bottom/Back"); controller.FindAndBindingBtnEvent(new List <string>(3) { "Edge/Bottom/Btn", "Edge/Bottom/Btn (1)" }, new List <EventDelegate>(3) { new EventDelegate(OnGeneralDiceBtnClick), new EventDelegate(OnSpecialDiceBtnClick) }); controller.FindAndBindingCoolTriggerEvent(new List <string>(2) { "Edge/TopLeft/BackBtn", "Edge/Bottom/Back/Box" }, new List <EventDelegate>(2) { new EventDelegate(OnCancelButtonClick), new EventDelegate(OnRewardBtnClick) }); string itemStr = Data.NewGameConfigTemplateManager.Instance.GetGameConfigStrValue(DiceCost); LTShowItemData item = GetItemData(itemStr); GeneralDiceCostLabel.text = item.count.ToString(); GeneralDiceCostSprite.spriteName = BalanceResourceUtil.GetResSpriteName(item.id); itemStr = Data.NewGameConfigTemplateManager.Instance.GetGameConfigStrValue(ExDiceCost); item = GetItemData(itemStr); SpecialDiceCostLabel.text = item.count.ToString(); SpecialDiceCostSprite.spriteName = BalanceResourceUtil.GetResSpriteName(item.id); }
private void ShowRefreshPrice() { if (RefreshCostLabel != null) { RefreshCostLabel.text = m_RefreshCost.ToString(); if (m_RefreshCost > BalanceResourceUtil.GetResValue(m_RefreshCostId)) { RefreshCostLabel.color = LT.Hotfix.Utility.ColorUtility.RedColor; } else { RefreshCostLabel.color = LT.Hotfix.Utility.ColorUtility.WhiteColor; } if (RefreshCostSprite != null) { RefreshCostSprite.spriteName = BalanceResourceUtil.GetResSpriteName(m_RefreshCostId); } } }
private void SetCurrency(string shopType) { var shopTemplate = ShopTemplateManager.Instance.GetShopByShopType(shopType); if (shopTemplate == null) { EB.Debug.LogError("LTActivityBodyItem_BossChallenge.SetCurrency: shopTemplate is null"); return; } string[] strs = shopTemplate.shop_balance_type.Split(','); if (_currencyDisplay1 == null) { _currencyDisplay1 = mDMono.transform.GetMonoILRComponent <CurrencyDisplay>("Currency_1"); } if (_currencyDisplay1 != null && strs != null && strs.Length > 0) { var count = BalanceResourceUtil.NumFormat(BalanceResourceUtil.GetDataLookupValue(string.Format("res.{0}.v", strs[0])).ToString()); _currencyDisplay1.SetData(count, BalanceResourceUtil.GetResSpriteName(strs[0])); _currencyDisplay1.SetPopTip(LTShowItemType.TYPE_RES, strs[0]); } if (_currencyDisplay2 == null) { _currencyDisplay2 = mDMono.transform.GetMonoILRComponent <CurrencyDisplay>("Currency_2"); } if (_currencyDisplay2 != null && strs != null && strs.Length > 1) { var count = BalanceResourceUtil.NumFormat(BalanceResourceUtil.GetDataLookupValue(string.Format("res.{0}.v", strs[1])).ToString()); _currencyDisplay2.SetData(count, BalanceResourceUtil.GetResSpriteName(strs[1])); _currencyDisplay2.SetPopTip(LTShowItemType.TYPE_RES, strs[1]); } }
public override void SetMenuData(object param) { base.SetMenuData(param); Data = param as StoreItemData; Item.LTItemData = new LTShowItemData(Data.id, Data.num, Data.type, false); HaveLabel.text = EB.Localizer.GetString("ID_codefont_in_LTStoreBuyController_544") + Data.have; m_Discount_Label.text = LTChargeManager.GetDiscountText(Data.discount); m_Discount_Label.gameObject.CustomSetActive(Data.discount > 0 && Data.discount < 1); m_Cost_Label.text = m_Cost_Label.transform.GetChild(0).GetComponent <UILabel>().text = Data.cost.ToString(); int resBalance = BalanceResourceUtil.GetResValue(Data.cost_id); if (resBalance < Data.cost) { m_Cost_Label.color = LT.Hotfix.Utility.ColorUtility.RedColor; } else { m_Cost_Label.color = LT.Hotfix.Utility.ColorUtility.WhiteColor; } m_Cost_Sprite.spriteName = BalanceResourceUtil.GetResSpriteName(Data.cost_id); string desc = string.Empty; if (Data.store_type == "challenge") { Hotfix_LT.Data.SkillTemplate skillTpl = Hotfix_LT.Data.SkillTemplateManager.Instance.GetTemplate(int.Parse(Data.id)); desc = skillTpl.Description; } else { var item = Hotfix_LT.Data.EconemyTemplateManager.Instance.GetItem(Data.id); desc = item.Desc; } Info.text = desc; }
/// <summary> /// 获取数据刷新 /// </summary> public virtual void RefreshData() { string title = EB.Localizer.GetString(m_StoreName); IDictionary data = null; if (DataLookupsCache.Instance.SearchDataByID <IDictionary>(m_DataID, out data) && data != null) { m_RefreshCost = EB.Dot.Integer("refreshCost.quantity", data, m_RefreshCost); m_RefreshCostId = EB.Dot.String("refreshCost.data", data, m_RefreshCostId); m_LastRefreshTime = EB.Dot.Integer("lastRefreshTime", data, m_LastRefreshTime); int time = EB.Dot.Integer("nextRefreshTime", data, m_NextRefreshTime); m_NextRefreshTime = time; ShowRefreshPrice(); int limit = EB.Dot.Integer("unlimited", data, 0); if (limit == 1) { if (m_RefreshTimeLabel != null) { m_RefreshTimeLabel.gameObject.CustomSetActive(false); } if (RefreshBtnRoot != null) { RefreshBtnRoot.gameObject.CustomSetActive(false); } } else { if (m_RefreshTimeLabel != null) { m_RefreshTimeLabel.gameObject.CustomSetActive(true); } if (RefreshBtnRoot != null) { RefreshBtnRoot.gameObject.CustomSetActive(true); RefreshBtnRoot.onClick.Clear(); RefreshBtnRoot.onClick.Add(new EventDelegate(RefreshBtnClick)); } } if (NewCurrencyCommonLabel != null && NewCurrencyCommonSprite != null) { if (m_CurStoreGold == "gold") { NewCurrencyCommonLabel.transform.parent.gameObject.SetActive(false); } else { NewCurrencyCommonLabel.transform.parent.gameObject.SetActive(true); } NewCurrencyCommonLabel.text = BalanceResourceUtil.NumFormat(BalanceResourceUtil.GetResValue(m_CurStoreGold).ToString()); NewCurrencyCommonSprite.spriteName = BalanceResourceUtil.GetResSpriteName(m_CurStoreGold); } if (act != null) { StopCoroutine(act); act = null; } act = RefreshTime(m_NextRefreshTime); StartCoroutine(act); List <StoreItemData> datas = new List <StoreItemData>(); ArrayList items = Hotfix_LT.EBCore.Dot.Array("itemList", data, null); float discount = 1; bool isGoldVIP = LTChargeManager.Instance.IsGoldVIP(); if (!m_StoreType.Equals("bosschallenge1") && !m_StoreType.Equals("bosschallenge2") && !m_StoreType.Equals("bosschallenge3")) { discount = VIPTemplateManager.Instance.GetVIPPercent(VIPPrivilegeKey.ShopDiscount); } if (items != null && items.Count > 0) { for (int i = 0; i < items.Count; i++) { int sid = EB.Dot.Integer("id", items[i], 0); string id = EB.Dot.String("redeems.data", items[i], ""); string type = EB.Dot.String("redeems.type", items[i], ""); int buy_num = EB.Dot.Integer("redeems.quantity", items[i], 0); int have = GameItemUtil.GetItemAlreadyHave(id, type); string cost_id = EB.Dot.String("spends.data", items[i], ""); int cost_num = EB.Dot.Integer("spends.quantity", items[i], 0); int num = EB.Dot.Integer("num", items[i], 0); float mdiscount = EB.Dot.Single("discount", items[i], 1); bool sell_out = num > 0 || num == -1 ? false : true; int weight = 1; float result = cost_num * discount + 0.05f; cost_num = (int)(result); if (!string.IsNullOrEmpty(id)) { StoreItemData itemdata = new StoreItemData(sid, id, type, buy_num, have, cost_id, cost_num, sell_out, weight, i, m_StoreType, mdiscount, num); datas.Add(itemdata); } } int left = datas.Count % m_Columns; if (left > 0) //补全 { left = m_Columns - left; for (int i = 0; i < left; i++) { StoreItemData itemdata = new StoreItemData(0, "", "", 1, 1, "", 1, true, 1, i, m_StoreType, 1); datas.Add(itemdata); } } m_Scroll.SetItemDatas(datas); } else { EB.Debug.LogWarning("{0}===no data items", m_DataID); } } else { EB.Debug.LogWarning("{0}===no data", m_DataID); } }