private void InstantiateBonus(DailyBonusReturnDialogNode dialog, DailyBonusData bonus) { DailyBonusType dailyBonusType = bonus.DailyBonusType; switch (dailyBonusType) { case DailyBonusType.CRY: dialog.exitGameDialog.InstantiateCryBonus(bonus.CryAmount); break; case DailyBonusType.XCRY: dialog.exitGameDialog.InstantiateXCryBonus(bonus.XcryAmount); break; case DailyBonusType.ENERGY: dialog.exitGameDialog.InstantiateEnergyBonus(bonus.EnergyAmount); break; case DailyBonusType.CONTAINER: dialog.exitGameDialog.InstantiateContainerBonus(bonus.ContainerReward.MarketItemId); break; default: if (dailyBonusType == DailyBonusType.DETAIL) { dialog.exitGameDialog.InstantiateDetailBonus(bonus.DetailReward.MarketItemId); } break; } }
public void Init(DailyBonusData data, UIDailyBonus uiDailyBonus) { _dbData = data; _uiDailyBonus = uiDailyBonus; UpdateDisplay(); }
private void UpdateDisplay() { DailyBonusData bonusData = _dbData; dayLabel.text = string.Format(Localization.instance.Get("IDS_DAILY_BONUS_DAY"), bonusData.day); amountLabel.text = "x" + _dbData.amount.ToString(); if (bonusData.day % 5 == 0) { iconBG1.gameObject.SetActive(false); iconBG2.gameObject.SetActive(true); } else { iconBG1.gameObject.SetActive(true); iconBG2.gameObject.SetActive(false); } ItemData itemData = DataManager.Instance.GetItemData(bonusData.reward_item_id); Texture2D tex = InJoy.AssetBundles.AssetBundles.Load(itemData.iconPath) as Texture2D; icon.mainTexture = tex; tick.SetActive(_uiDailyBonus.ActiveDays >= _dbData.day); blinkEffect.SetActive(_uiDailyBonus.ActiveDays + 1 == _dbData.day); //x2, x3 if (_uiDailyBonus.VIPLevel >= 4) //vip level 4: 3x { X3.SetActive(true); X2.SetActive(false); } else if (_uiDailyBonus.VIPLevel >= 1) { X2.SetActive(true); X3.SetActive(false); } else { X2.SetActive(false); X3.SetActive(false); } }
public static void ReadDailyBonusData(string fileName, string outFileName) { bool newFile = false; DailyBonusDataList dataList = null; UnityEngine.Object oldFile = AssetDatabase.LoadAssetAtPath(outFileName, typeof(DailyBonusDataList)); if (oldFile == null) { newFile = true; dataList = ScriptableObject.CreateInstance(typeof(DailyBonusDataList)) as DailyBonusDataList; } else { dataList = oldFile as DailyBonusDataList; } dataList.dataList.Clear(); string jsonStr = File.ReadAllText(fileName); JsonHashtable ht = FCJson.jsonDecode(jsonStr) as JsonHashtable; foreach (System.Object obj in ht.ValueList) { Hashtable data = obj as Hashtable; DailyBonusData newData = new DailyBonusData(); newData.day = (int)(data["day"]); newData.reward_item_id = (string)data["reward_item_id"]; newData.amount = (int)(data["amount"]); dataList.dataList.Add(newData); } if (newFile) { AssetDatabase.CreateAsset(dataList, outFileName); } else { EditorUtility.SetDirty(dataList); } Debug.Log(dataList.dataList.Count + " daily bonus records read."); }
private DailyBonusGarageItemReward GetCompleteUntakenDetailTargetItem(DailyBonusScreenSystem.UserDailyBonusNode userDailyBonusNode, DailyBonusScreenSystem.DailyBonusConfig dailyBonusConfigNode) { DailyBonusCycleComponent cycle = this.GetCycle(userDailyBonusNode, dailyBonusConfigNode); int num = cycle.Zones[(int)((IntPtr)userDailyBonusNode.userDailyBonusZone.ZoneNumber)]; DailyBonusData[] dailyBonuses = cycle.DailyBonuses; List <long> receivedRewards = userDailyBonusNode.userDailyBonusReceivedRewards.ReceivedRewards; for (int i = 0; i <= num; i++) { DailyBonusData data = dailyBonuses[i]; if (receivedRewards.Contains(data.Code) && (data.DailyBonusType == DailyBonusType.DETAIL)) { DetailItem item = GarageItemsRegistry.GetItem <DetailItem>(data.DetailReward.MarketItemId); if (item.Count == item.RequiredCount) { return(data.DetailReward); } } } return(null); }
private string GetTooltipText(DailyBonusData dailyBonusData, BonusElementState elementState) { if (elementState == BonusElementState.INACCESSIBLE) { return((string)this.hiddenText); } DailyBonusType dailyBonusType = dailyBonusData.DailyBonusType; switch (dailyBonusType) { case DailyBonusType.CRY: return(FirstCharToUpper(this.crystalText.Value) + " x" + dailyBonusData.CryAmount); case DailyBonusType.XCRY: return(FirstCharToUpper(this.xCrystalText.Value) + " x" + dailyBonusData.XcryAmount); case DailyBonusType.ENERGY: return(FirstCharToUpper(this.chargesText.Value) + " x" + dailyBonusData.EnergyAmount); case DailyBonusType.CONTAINER: return(FirstCharToUpper(GarageItemsRegistry.GetItem <GarageItem>(dailyBonusData.ContainerReward.MarketItemId).Name)); } return((dailyBonusType == DailyBonusType.DETAIL) ? GarageItemsRegistry.GetItem <DetailItem>(dailyBonusData.DetailReward.MarketItemId).Name : string.Empty); }
public void ExitDialogRewards(NodeAddedEvent e, DailyBonusReturnDialogNode dialog, [JoinAll] UserDailyBonusNode user, [JoinAll] DailyBonusConfig dailyBonusConfig) { bool flag = false; if (user.userStatistics.Statistics.ContainsKey("BATTLES_PARTICIPATED")) { flag = user.userStatistics.Statistics["BATTLES_PARTICIPATED"] >= dailyBonusConfig.dailyBonusCommonConfig.BattleCountToUnlockDailyBonuses; } if (!flag) { dialog.exitGameDialog.content.SetActive(false); } else { dialog.exitGameDialog.content.SetActive(true); DailyBonusFirstCycleComponent dailyBonusFirstCycle = dailyBonusConfig.dailyBonusFirstCycle; DailyBonusEndlessCycleComponent dailyBonusEndlessCycle = dailyBonusConfig.dailyBonusEndlessCycle; int num = 0; DailyBonusData bonus = dailyBonusConfig.dailyBonusFirstCycle.DailyBonuses[0]; bool flag2 = true; dialog.exitGameDialog.ReceivedRewards.AddRange(user.userDailyBonusReceivedRewards.ReceivedRewards); if (user.userDailyBonusCycle.CycleNumber == 0L) { num = dailyBonusFirstCycle.Zones[(int)((IntPtr)user.userDailyBonusZone.ZoneNumber)]; if (user.userDailyBonusReceivedRewards.ReceivedRewards.Count == (num + 1)) { if ((user.userDailyBonusZone.ZoneNumber + 1L) < dailyBonusFirstCycle.Zones.Length) { num = dailyBonusFirstCycle.Zones[(int)((IntPtr)(user.userDailyBonusZone.ZoneNumber + 1L))]; } else { flag2 = false; num = dailyBonusEndlessCycle.Zones[0]; dialog.exitGameDialog.ReceivedRewards.Clear(); } } } else { num = dailyBonusEndlessCycle.Zones[(int)((IntPtr)user.userDailyBonusZone.ZoneNumber)]; flag2 = false; if (user.userDailyBonusReceivedRewards.ReceivedRewards.Count == (num + 1)) { if ((user.userDailyBonusZone.ZoneNumber + 1L) < dailyBonusEndlessCycle.Zones.Length) { num = dailyBonusEndlessCycle.Zones[(int)((IntPtr)(user.userDailyBonusZone.ZoneNumber + 1L))]; } else { num = dailyBonusEndlessCycle.Zones[0]; dialog.exitGameDialog.ReceivedRewards.Clear(); } } } for (int i = 0; i <= num; i++) { DailyBonusData data2 = !flag2 ? dailyBonusConfig.dailyBonusEndlessCycle.DailyBonuses[i] : dailyBonusConfig.dailyBonusFirstCycle.DailyBonuses[i]; if (!dialog.exitGameDialog.ReceivedRewards.Contains(data2.Code)) { if (data2.DailyBonusType == DailyBonusType.CONTAINER) { bonus = data2; } if ((bonus.DailyBonusType != DailyBonusType.CONTAINER) && (data2.DailyBonusType == DailyBonusType.DETAIL)) { bonus = data2; } if ((bonus.DailyBonusType != DailyBonusType.CONTAINER) && ((bonus.DailyBonusType != DailyBonusType.DETAIL) && (data2.DailyBonusType == DailyBonusType.XCRY))) { bonus = data2; } if ((bonus.DailyBonusType != DailyBonusType.CONTAINER) && ((bonus.DailyBonusType != DailyBonusType.DETAIL) && ((bonus.DailyBonusType != DailyBonusType.XCRY) && (data2.DailyBonusType == DailyBonusType.ENERGY)))) { bonus = data2; } if ((bonus.DailyBonusType != DailyBonusType.CONTAINER) && ((bonus.DailyBonusType != DailyBonusType.DETAIL) && ((bonus.DailyBonusType != DailyBonusType.XCRY) && ((bonus.DailyBonusType != DailyBonusType.ENERGY) && ((data2.DailyBonusType == DailyBonusType.CRY) && (data2.CryAmount >= bonus.CryAmount)))))) { bonus = data2; } } } this.InstantiateBonus(dialog, bonus); } }