コード例 #1
0
        public void OnAddGoldClick()
        {
            int gold = BalanceResourceUtil.GetUserGold();

            EB.Sparx.Hub.Instance.GetManager <EB.Sparx.ResourcesManager>().SetResRPC("gold", gold + 100000);
            MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, "您已增加10w金币!");
        }
コード例 #2
0
        public void ShowLevelUp()
        {
            if (OldData != data)
            {
                OldData = data;
                Show(data.Eid);
            }
            string colorStr               = (LTPartnerEquipDataManager.Instance.UpLevelSelectList.Count > 0)?"[42fe79]": "[ffffff]";
            int    totalAddEXP            = 0;
            Dictionary <string, int> Dics = LTPartnerEquipDataManager.Instance.getEquipUpItemNumDic();

            foreach (var item in Dics)
            {
                totalAddEXP += LTPartnerEquipDataManager.Instance.getEquipUpItemExp(item.Key) * item.Value;
            }
            for (int i = 0; i < LTPartnerEquipDataManager.Instance.UpLevelSelectList.Count; i++)
            {
                totalAddEXP += LTPartnerEquipDataManager.Instance.GetTotleExpByEid(LTPartnerEquipDataManager.Instance.UpLevelSelectList[i]);
            }
            Hotfix_LT.Data.EquipmentLevelUp LevelUpInfo = new Hotfix_LT.Data.EquipmentLevelUp();
            bool GetExpInfo = false;

            for (int i = data.EquipLevel; i < MaxLevel; i++)
            {
                if (data.Exp + totalAddEXP < LevelUpList[i].TotalNeedExp)
                {
                    GetExpInfo  = true;
                    LevelUpInfo = LevelUpList[i]; break;
                }
            }
            int OverPlueExp = GetExpInfo? (LevelUpInfo.TotalNeedExp - LevelUpInfo.needExp) : LevelUpList[MaxLevel - 1].TotalNeedExp;
            int costCount   = totalAddEXP;

            if (totalAddEXP > 0 && !GetExpInfo)
            {
                costCount = OverPlueExp - data.Exp;
            }

            int   temp1     = data.Exp - OverPlueExp + totalAddEXP;
            int   temp2     = LevelUpInfo.needExp;
            float tempValue = (float )temp1 / (float)temp2;

            nextExpSlider.value = (LevelUpInfo.level == 0 || (LevelUpInfo.level - 1) > data.EquipLevel)?1: tempValue;


            nextLevelLabel.text = nextLevelLabel.transform.GetChild(0).GetComponent <UILabel>().text = string.Format("{0}{1}", colorStr, (LevelUpInfo.level - 1) >= 0? (LevelUpInfo.level - 1) : LevelUpList.Count);
            nextLevelLabel.gameObject.CustomSetActive(((LevelUpInfo.level - 1) >= 0 ? (LevelUpInfo.level - 1) : MaxLevel) != data.EquipLevel);

            NextLevel        = (LevelUpInfo.level - 1) >= 0 ? (LevelUpInfo.level - 1) : MaxLevel;
            SliderLabel.text = string.Format("{0}{1}/{2}", colorStr, temp1, LevelUpInfo.needExp);

            int    resGold   = BalanceResourceUtil.GetUserGold();
            string colorStr2 = (costCount > resGold) ? "[ff6699]" : "[ffffff]";

            CostLabel.text = CostLabel.transform.GetChild(0).GetComponent <UILabel>().text = string.Format("{0}{1}", colorStr2, costCount);
            //CostLabel.updateAnchors = UIRect.AnchorUpdate.OnUpdate;
            CostIcon.UpdateAnchors();

            SetUplevelBtn(totalAddEXP > 0);
        }
コード例 #3
0
 public bool CheckRes(string res, int cost, bool showTip = true)
 {
     if (res.Equals("hc"))
     {
         if (BalanceResourceUtil.GetUserDiamond() < cost)
         {
             if (showTip)
             {
                 BalanceResourceUtil.HcLessMessage();
             }
             return(false);
         }
     }
     else if (res.Equals("gold"))
     {
         if (BalanceResourceUtil.GetUserGold() < cost)
         {
             if (showTip)
             {
                 BalanceResourceUtil.GoldLessMessage();
             }
             return(false);
         }
     }
     return(true);
 }
コード例 #4
0
        public void GetDrawCardRequireMsg(string type, string tag, int times, System.Action <bool> callback = null)
        {
            int CurGold = BalanceResourceUtil.GetUserGold();

            Api.RequestBuy(type, tag, times, delegate(Hashtable result)
            {
                if (result == null)
                {
                    if (callback != null)
                    {
                        callback(false);
                    }
                    return;
                }
                DataLookupsCache.Instance.CacheData(result);
                InitAllDrawPartner(result, type.Equals(BalanceResourceUtil.HcName));
                if (callback != null)
                {
                    callback(result != null);
                }
                if (CurGold - BalanceResourceUtil.GetUserGold() > 0)
                {
                    FusionTelemetry.CurrencyChangeData.PostEvent(FusionTelemetry.CurrencyChangeData.gold, BalanceResourceUtil.GetUserGold() - CurGold, "金币抽卡");
                }
            });
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        private void SetColorShow()
        {
            switch (typeindex)
            {
            case -1: return;

            case 2:
                colorstr = BalanceResourceUtil.GetUserGold() >= costperTime ? "[ffffff]" : "[ff6699]";
                break;

            default:
                colorstr = BalanceResourceUtil.GetUserDiamond() >= costperTime ? "[ffffff]" : "[ff6699]";
                break;
            }
            LTUIUtil.SetText(donateNumLabel, string.Format("{0}{1}[-]", colorstr, costperTime));
        }
コード例 #7
0
            /// <summary>
            /// 货币变化日志
            /// </summary>
            /// <param name="currency_type">货币类型(钻石,金币)</param>
            /// <param name="currency_count">货币变化量</param>
            /// <param name="reason">变化原因(商店购买、钻石抽奖)</param>
            /// <param name="currency_left">货币变化后数量</param>
            /// <param name="items_id">涉及物品名</param>
            /// <param name="items_num">物品数量</param>
            public static void PostEvent(string currency_type, int currency_count, string reason, string items_id = "", int items_num = 0)
            {
                Dictionary <string, object> data = new Dictionary <string, object>();

                data.Add("topic", topic);
                data.Add("event_id", event_id);

                data.Add("currency_type", currency_type);
                data.Add("currency_count", currency_count);
                data.Add("reason", reason);
                if (currency_type.Equals(hc))
                {
                    int currency_left = BalanceResourceUtil.GetUserDiamond();
                    data.Add("currency_left", currency_left);
                }
                else if (currency_type.Equals(gold))
                {
                    int currency_left = BalanceResourceUtil.GetUserGold();
                    data.Add("currency_left", currency_left);
                }
                data.Add("items_id", items_id);
                data.Add("items_num", items_num);
                AddUmengEvent(UmengId, data);
            }
コード例 #8
0
        private bool isCouldTraining(int trainingId)
        {
            var info = LTPromotionManager.Instance.GetPromotion();

            if (info == null)
            {
                EB.Debug.LogError("LTPromotionUIController.OpenTrainingView -> info is null");
                return(false);
            }

            if (!LTPromotionManager.Instance.IsTrainingFree(trainingId) && trainingId == 1 && BalanceResourceUtil.GetUserGold() < LTPromotionManager.Instance.GetTrainingCost(trainingId))
            {
                BalanceResourceUtil.ResLessMessage("gold");
                return(false);
            }

            if (!LTPromotionManager.Instance.IsTrainingFree(trainingId) && trainingId == 2 && BalanceResourceUtil.GetUserDiamond() < LTPromotionManager.Instance.GetTrainingCost(trainingId))
            {
                BalanceResourceUtil.ResLessMessage("hc");
                return(false);
            }

            if (LTPromotionManager.Instance.GetUsedTrainingTimes(trainingId) >= LTPromotionManager.Instance.GetTrainingTotalTimes(trainingId))
            {
                MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_BUY_TIMES_NOT_ENOUGH"));
                return(false);
            }

            if (!LTPromotionManager.Instance.HasUnfinishedAttr())
            {
                MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, EB.Localizer.GetString("ID_PROMOTION_TRAINING_UPPER_LIMIT_TIPS"));
                return(false);
            }
            return(true);
        }
コード例 #9
0
        private void SetInfo(bool showTween = false)
        {
            int curlevel = partnerData.GetProficiencyLevelByType(CurType);

            CurUpData  = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetProficiencyUpByTypeAndLevel(CurType, curlevel);
            NextUpData = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetProficiencyUpByTypeAndLevel(CurType, curlevel + 1);

            CurTipLabel.text  = string.Format("{0} Lv.{1}", EB.Localizer.GetString("ID_CURRENT_LEVEL"), curlevel);
            NextTipLabel.text = string.Format("{0} Lv.{1}", EB.Localizer.GetString("ID_NEXT_LEVEL"), curlevel + 1);

            for (int i = 0; i < FxList.Count; i++)
            {
                FxList[i].CustomSetActive(false);
            }
            if (CurUpData != null)
            {
                string str = string.Format("+{0}%", CurUpData.ATK * 100);
                if (showTween && !CurATKTipLabel.text.Equals(str))
                {
                    ShowUpFx(0);
                }
                CurATKTipLabel.text = str;

                str = string.Format("+{0}%", CurUpData.maxHP * 100);
                if (showTween && !CurHPTipLabel.text.Equals(str))
                {
                    ShowUpFx(1);
                }
                CurHPTipLabel.text = str;

                str = string.Format("+{0}%", CurUpData.DEF * 100);
                if (showTween && !CurDEFTipLabel.text.Equals(str))
                {
                    ShowUpFx(2);
                }
                CurDEFTipLabel.text = str;
            }
            else
            {
                CurATKTipLabel.text = "+0%";
                CurHPTipLabel.text  = "+0%";
                CurDEFTipLabel.text = "+0%";
            }

            if (NextUpData != null)
            {
                NextATKTipLabel.text = string.Format("+{0}%", NextUpData.ATK * 100);
                NextHPTipLabel.text  = string.Format("+{0}%", NextUpData.maxHP * 100);
                NextDEFTipLabel.text = string.Format("+{0}%", NextUpData.DEF * 100);

                string color      = LT.Hotfix.Utility.ColorUtility.WhiteColorHexadecimal;
                int    resBalance = BalanceResourceUtil.GetUserPoten();
                if (resBalance < NextUpData.potenCost)
                {
                    color = LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal;
                }
                else
                {
                    color = LT.Hotfix.Utility.ColorUtility.GreenColorHexadecimal;
                }

                MetCostLabel.text = string.Format("[{0}]{1}[-]/{2}", color, BalanceResourceUtil.GetUserPoten(), NextUpData.potenCost);

                color      = LT.Hotfix.Utility.ColorUtility.WhiteColorHexadecimal;
                resBalance = BalanceResourceUtil.GetUserGold();
                int grade = partnerData.HeroInfo.role_grade;
                if (grade > NextUpData.goldCost.Length)
                {
                    grade = NextUpData.goldCost.Length;
                }
                if (resBalance < NextUpData.goldCost[grade - 1])
                {
                    color = LT.Hotfix.Utility.ColorUtility.RedColorHexadecimal;
                }
                GoldCostLabel.text = string.Format("[{0}]{1}[-]", color, NextUpData.goldCost[grade - 1]);
                NextInfoObj.CustomSetActive(true);
                MaxLevelObj.CustomSetActive(false);
                CostObj.CustomSetActive(true);
            }
            else
            {
                NextInfoObj.CustomSetActive(false);
                MaxLevelObj.CustomSetActive(true);
                CostObj.CustomSetActive(false);
            }
        }