663 lines
27 KiB
C#
663 lines
27 KiB
C#
using System;
|
|
using BingoBrain.Core;
|
|
using UnityEngine;
|
|
using BingoBrain.HotFix;
|
|
using System.Text;
|
|
using System.Linq;
|
|
using System.Linq.Expressions;
|
|
using System.Collections.Generic;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace BingoBrain
|
|
{
|
|
public class BingoDataSystem : BaseSystem
|
|
{
|
|
private Action onChangeDollar;
|
|
|
|
private Action onChangeGiftSwitch;
|
|
|
|
public BingoDataSystem(bool isAutoInit = true)
|
|
{
|
|
if (isAutoInit)
|
|
{
|
|
Init();
|
|
}
|
|
}
|
|
|
|
public sealed override void Init()
|
|
{
|
|
base.Init();
|
|
|
|
AddListener();
|
|
}
|
|
|
|
private void AddListener()
|
|
{
|
|
CtrlDispatcher.Instance.AddPriorityListener(CtrlMsg.Game_StartBefore, InitPreferences);
|
|
PreferencesDispatcher<int>.Instance.AddListener(PreferencesMsg.currency101, Add101);
|
|
PreferencesDispatcher<decimal>.Instance.AddListener(PreferencesMsg.currency102, Add102);
|
|
PreferencesDispatcher<bool>.Instance.AddListener(PreferencesMsg.isShowRewardFly101, OnChangeRewardFly101);
|
|
PreferencesDispatcher<bool>.Instance.AddListener(PreferencesMsg.isShowRewardFly102, OnChangeRewardFly102);
|
|
CtrlDispatcher.Instance.AddListener(CtrlMsg.ResetDailyTaskActive, ResetDailyTaskActive);
|
|
CtrlDispatcher.Instance.AddListener(CtrlMsg.GameNewDays, NewDay);
|
|
CtrlDispatcher.Instance.AddListener(CtrlMsg.Module_GiftSwitchChange, OnChangeGiftSwitch);
|
|
CtrlDispatcher.Instance.AddListener(CtrlMsg.WatchVideoFinish, AddWatchVideo);
|
|
GameDispatcher.Instance.AddListener(BingoInfo.ProcessReward, OnGetReward);
|
|
GameDispatcher.Instance.AddListener(BingoInfo.RefreshMakeupData, AddMakeupTaskData);
|
|
GameDispatcher.Instance.AddListener(BingoInfo.RefreshMakeupData, CheckCoinMakeupTaskData);
|
|
}
|
|
public static void AddMakeupTaskData(object a = null)
|
|
{
|
|
var makeupVOModel = ConfigSystem.GetConfig<MakeupModel>();
|
|
if (makeupVOModel == null || makeupVOModel.dataList == null || makeupVOModel.dataList.Count <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Debug.Log("????????????????????????3");
|
|
var lastId = -1;
|
|
|
|
var isRepeat = PreferencesMgr.Instance.MakeupTaskHistory.Count >= makeupVOModel.dataList.Count;
|
|
if (PreferencesMgr.Instance.MakeupTaskHistory.Count > 0)
|
|
{
|
|
var makeupTaskData = PreferencesMgr.Instance.MakeupTaskHistory.Last();
|
|
|
|
if (makeupTaskData.status != MakeupTaskStatus.Inline)
|
|
{
|
|
return;
|
|
}
|
|
|
|
lastId = makeupTaskData.tableId;
|
|
}
|
|
|
|
|
|
if (lastId == makeupVOModel.dataList.Last().id)
|
|
{
|
|
lastId = -1;
|
|
}
|
|
|
|
foreach (var makeupVo in makeupVOModel.dataList)
|
|
{
|
|
if (makeupVo.id > lastId)
|
|
{
|
|
if ((isRepeat && !makeupVo.is_onetime) || !isRepeat)
|
|
{
|
|
var makeupTaskData = new MakeupTaskData();
|
|
makeupTaskData.tableId = makeupVo.id;
|
|
makeupTaskData.id = PreferencesMgr.Instance.MakeupTaskHistory.Count + 1;
|
|
makeupTaskData.amountStr = $"{makeupVo.item_need}";
|
|
makeupTaskData.amount = makeupVo.item_need;
|
|
makeupTaskData.orderID = GetRandomNum(8);
|
|
|
|
PreferencesMgr.Instance.MakeupTaskHistory.Add(makeupTaskData);
|
|
|
|
if ((GameHelper.isRDExchangeMode() && SaveData.GetSaveobject().ExchangeProcessMode == 1) || (!GameHelper.isRDExchangeMode() && SaveData.GetSaveobject().CHProcessMode == 1)) makeupTaskData.SetStatus(MakeupTaskStatus.Level);
|
|
else makeupTaskData.SetStatus(MakeupTaskStatus.None);
|
|
PreferencesMgr.Instance.SaveMakeupTaskHistory();
|
|
|
|
PreferencesMgr.Instance.MakeupTaskH5Time = 0;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public static void CheckMakeupTaskData()
|
|
{
|
|
Debug.Log("????????????????????????1");
|
|
if (!GameHelper.IsGiftSwitch())
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
if (PreferencesMgr.Instance.MakeupTaskHistory.Count == 0)
|
|
{
|
|
AddMakeupTaskData();
|
|
}
|
|
else
|
|
{
|
|
Debug.Log("????????????????????????2");
|
|
var common = ConfigSystem.GetConfig<CommonModel>();
|
|
var userId = GameHelper.GetLoginModel().uid;
|
|
foreach (var makeuptaskData in PreferencesMgr.Instance.MakeupTaskHistory)
|
|
{
|
|
if (makeuptaskData.status == MakeupTaskStatus.Inline
|
|
&& makeuptaskData.inlineNum > common.inlineMin)
|
|
{
|
|
var redeemVOModel = ConfigSystem.GetConfig<MakeupModel>().dataList
|
|
.FirstOrDefault(redeem => redeem.id == makeuptaskData.tableId);
|
|
|
|
var days = PlayerPrefs.GetInt($"days_{userId}_{makeuptaskData.tableId}", 0);
|
|
Debug.Log("------------------" + days);
|
|
Debug.Log("------------------" + DateTime.Today.Day);
|
|
if (days == DateTime.Today.Day)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
PlayerPrefs.SetInt($"days_{userId}_{makeuptaskData.tableId}", DateTime.Today.Day);
|
|
var loginNum = UnityEngine.Random.Range(common.inlineLoginDown[0],
|
|
common.inlineLoginDown[1]);
|
|
makeuptaskData.loginSpeedNum += loginNum;
|
|
//如果登录减少人数大于配置的阈值,则不能减少排名了
|
|
Debug.Log($"登录累计增加的排名为:{makeuptaskData.loginSpeedNum} 阈值为:{redeemVOModel.Login_Limit_times}");
|
|
if (makeuptaskData.loginSpeedNum > redeemVOModel.Login_Limit_times)
|
|
{
|
|
makeuptaskData.loginSpeedNum = redeemVOModel.Login_Limit_times;
|
|
continue;
|
|
}
|
|
|
|
Debug.Log($"订单为: {makeuptaskData.tableId} 通过登录减少的排名为:{loginNum}");
|
|
makeuptaskData.inlineNum -= loginNum;
|
|
if (makeuptaskData.inlineNum < common.inlineMin)
|
|
{
|
|
makeuptaskData.inlineNum = common.inlineMin;
|
|
}
|
|
}
|
|
}
|
|
|
|
PreferencesMgr.Instance.SaveMakeupTaskHistory();
|
|
}
|
|
if (SaveData.GetSaveobject().saveingpot_history.Count == 0)
|
|
{
|
|
// Debug.Log("tianjialishiiiiiiiiiiiiii");
|
|
// AddMakeupTaskData();
|
|
}
|
|
else
|
|
{
|
|
var common = ConfigSystem.GetConfig<CommonModel>();
|
|
foreach (var makeuptaskData in SaveData.GetSaveobject().saveingpot_history)
|
|
{
|
|
if (makeuptaskData.status == SaveingPotTaskStatus.Inline
|
|
&& makeuptaskData.inlineNum > common.inlineMin)
|
|
{
|
|
|
|
|
|
|
|
var redeemVOModel = ConfigSystem.GetConfig<MakeupModel_2>().dataList
|
|
.FirstOrDefault(redeem => redeem.id == makeuptaskData.tableId);
|
|
|
|
var days = PlayerPrefs.GetInt($"days__{makeuptaskData.tableId}_pot", 0);
|
|
if (days == DateTime.Today.Day)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
PlayerPrefs.SetInt($"days__{makeuptaskData.tableId}_pot", DateTime.Today.Day);
|
|
var loginNum = UnityEngine.Random.Range(common.inlineLoginDown[0],
|
|
common.inlineLoginDown[1]);
|
|
makeuptaskData.loginSpeedNum += loginNum;
|
|
//如果登录减少人数大于配置的阈值,则不能减少排名了
|
|
// Debug.Log($"登录累计增加的排名为:{makeuptaskData.loginSpeedNum} 阈值为:{redeemVOModel.Login_Limit_times}");
|
|
if (makeuptaskData.loginSpeedNum > redeemVOModel.Login_Limit_times)
|
|
{
|
|
makeuptaskData.loginSpeedNum = redeemVOModel.Login_Limit_times;
|
|
continue;
|
|
}
|
|
|
|
//Debug.Log($"订单为: {makeuptaskData.tableId} 通过登录减少的排名为:{loginNum}");
|
|
makeuptaskData.inlineNum -= loginNum;
|
|
if (makeuptaskData.inlineNum < common.inlineMin)
|
|
{
|
|
makeuptaskData.inlineNum = common.inlineMin;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
SaveData.saveDataFunc();
|
|
}
|
|
public static string GetRandomNum(int count)
|
|
{
|
|
var resultStr = new StringBuilder();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
resultStr.Append(UnityEngine.Random.Range(0, 10));
|
|
}
|
|
|
|
return resultStr.ToString();
|
|
}
|
|
public void AddChangeGiftSwitch(Action action)
|
|
{
|
|
onChangeGiftSwitch += action;
|
|
}
|
|
|
|
public void RemoveChangeGiftSwitch(Action action)
|
|
{
|
|
onChangeGiftSwitch -= action;
|
|
}
|
|
|
|
private void OnChangeGiftSwitch(object obj)
|
|
{
|
|
onChangeGiftSwitch?.Invoke();
|
|
}
|
|
|
|
|
|
private void InitPreferences(object obj)
|
|
{
|
|
|
|
if (PreferencesMgr.Instance.Currency101 == -1)
|
|
{
|
|
PreferencesMgr.Instance.Currency101 = GameHelper.GetCommonModel().Initial101;
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.Update101Completed);
|
|
}
|
|
|
|
if (PreferencesMgr.Instance.CardBoardSum == -1 ||
|
|
(PreferencesMgr.Instance.CardBoardSum == 0 && PlayerPrefs.GetInt("First", 0) == 0))
|
|
{
|
|
PreferencesMgr.Instance.CardBoardSum = GameHelper.GetCommonModel().Fisrtcard[0];
|
|
Debug.Log("777777777777777777777777777");
|
|
//PlayerPrefs.SetInt("First", 1);
|
|
}
|
|
|
|
if (PreferencesMgr.Instance.Currency102 == -1)
|
|
{
|
|
PreferencesMgr.Instance.Currency102 = 0;
|
|
}
|
|
|
|
|
|
if (PreferencesMgr.Instance.DailyTaskState.Count == 0)
|
|
{
|
|
ResetDailyTaskActive();
|
|
}
|
|
|
|
|
|
if (PreferencesMgr.Instance.DailyTaskActiveState.Count == 0)
|
|
{
|
|
ResetDailyTaskActive();
|
|
}
|
|
|
|
|
|
|
|
|
|
if (PreferencesMgr.Instance.IsResetGuide)
|
|
{
|
|
PreferencesMgr.Instance.IsResetGuide = false;
|
|
PreferencesMgr.Instance.CompleteGuideList.Clear();
|
|
PreferencesMgr.Instance.SaveCompleteGuideList();
|
|
}
|
|
|
|
PreferencesMgr.Instance.IsShowRewardFly101 = false;
|
|
PreferencesMgr.Instance.IsShowRewardFly102 = false;
|
|
PreferencesMgr.Instance.IsShowRewardFly105 = false;
|
|
PreferencesMgr.Instance.IsShowRewardFly106 = false;
|
|
|
|
CheckCoinMakeupTaskData();
|
|
CheckMakeupTaskData();
|
|
PreferencesMgr.Instance.IsShowOpenReward = true;
|
|
}
|
|
|
|
private void Add101(ExiteValue<int> obj)
|
|
{
|
|
var val = obj.newValue - obj.oldValue;
|
|
if (val > 0)
|
|
{
|
|
PreferencesMgr.Instance.Max101 += val;
|
|
}
|
|
|
|
if (!PreferencesMgr.Instance.IsShowRewardFly101)
|
|
{
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.Update101Completed);
|
|
}
|
|
}
|
|
|
|
|
|
private void Add102(ExiteValue<decimal> obj)
|
|
{
|
|
var val = obj.newValue - obj.oldValue;
|
|
if (val > 0)
|
|
{
|
|
PreferencesMgr.Instance.Max102 += val;
|
|
}
|
|
|
|
if (!PreferencesMgr.Instance.IsShowRewardFly102)
|
|
{
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.Update102Completed);
|
|
}
|
|
|
|
onChangeDollar?.Invoke();
|
|
}
|
|
|
|
private void ResetDailyTaskActive(object obj = null)
|
|
{
|
|
PreferencesMgr.Instance.DailyTaskActiveState.Clear();
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
PreferencesMgr.Instance.DailyTaskActiveState.Add(false);
|
|
}
|
|
|
|
PreferencesMgr.Instance.SaveDailyTaskActiveState();
|
|
PreferencesMgr.Instance.Active = 0;
|
|
}
|
|
|
|
private void NewDay(object obj)
|
|
{
|
|
PreferencesMgr.Instance.ToDayMaxScore = 0;
|
|
ResetDailyTaskActive();
|
|
}
|
|
|
|
private void AddWatchVideo(object obj = null)
|
|
{
|
|
if (PreferencesMgr.Instance.IsRealProcessing)
|
|
{
|
|
PreferencesMgr.Instance.RealWatchVideo++;
|
|
}
|
|
if (PreferencesMgr.Instance.MakeupTaskHistory.Count > 0)
|
|
{
|
|
|
|
CheckSpeedUpTaskData();
|
|
|
|
var taskData = PreferencesMgr.Instance.MakeupTaskHistory.Last();
|
|
if (taskData.status == MakeupTaskStatus.Task)
|
|
{
|
|
var makeupVo = ConfigSystem.GetConfig<MakeupModel>().dataList.FirstOrDefault(card => card.id == taskData.tableId);
|
|
if (makeupVo != null && taskData.videoCount < makeupVo.ad_need)
|
|
{
|
|
taskData.videoCount++;
|
|
NetworkKit.BuriedPoint(BuriedPointEvent.ad_task, BuriedPointEvent.watch_ad_number, 1);
|
|
PreferencesMgr.Instance.SaveMakeupTaskHistory();
|
|
PlayerPrefs.SetInt("finish_ad_number", 0);
|
|
}
|
|
else
|
|
{
|
|
if (PlayerPrefs.GetInt("finish_ad_number", 0) == 0)
|
|
{
|
|
NetworkKit.BuriedPoint(BuriedPointEvent.ad_task, BuriedPointEvent.finish_ad_number, 1);
|
|
PlayerPrefs.SetInt("finish_ad_number", 1);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
// if (PreferencesMgr.Instance.CoinMakeupTaskHistory.Count > 0)
|
|
// {
|
|
// var taskData = PreferencesMgr.Instance.CoinMakeupTaskHistory.Last();
|
|
// if (taskData.status == MakeupTaskStatus.Task)
|
|
// {
|
|
// var cardRedeemNewModel = ConfigSystem.GetConfig<CardRedeemNewModel>();
|
|
// var makeupVo = cardRedeemNewModel.dataList.FirstOrDefault(card => card.id == taskData.tableId);
|
|
// if (makeupVo != null && taskData.videoCount < makeupVo.fee_need)
|
|
// {
|
|
// taskData.videoCount++;
|
|
// PreferencesMgr.Instance.SaveCoinMakeupTaskHistory();
|
|
// }
|
|
// }
|
|
// }
|
|
if (SaveData.GetSaveobject().saveingpot_history.Count > 0)
|
|
{
|
|
SaveingPotHelper.TestingClearTime();
|
|
CheckSpeedUpTaskData(2);
|
|
SaveingPotClass taskData = SaveData.GetSaveobject().saveingpot_history.Last();
|
|
makeup_2 makeupVo = ConfigSystem.GetConfig<MakeupModel_2>().GetData(taskData.tableId);
|
|
SaveData.GetSaveobject().saveingpot_ch += makeupVo.ADIncrease;
|
|
// GameDispatcher.Instance.Dispatch(GameMsg.RefreshSaveingPot);
|
|
if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1 && GameHelper.IsGiftSwitch())
|
|
{
|
|
if ((SaveData.GetSaveobject().saveingpot_ch > taskData.amount) && (!taskData.auto_show) && !UI.Instance.IsExistUI(UIConst.H5UI))
|
|
{
|
|
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SaveingPotUI_Open);
|
|
taskData.auto_show = true;
|
|
}
|
|
}
|
|
|
|
if (taskData.status == SaveingPotTaskStatus.Task)
|
|
{
|
|
;
|
|
if (makeupVo != null && taskData.videoCount < makeupVo.ad_need)
|
|
{
|
|
taskData.videoCount++;
|
|
//NetworkKit.BuriedPoint(BuriedPointEvent.ad_task, BuriedPointEvent.watch_ad_number, 1);
|
|
PlayerPrefs.SetInt("fin_ad_num_saveingpot", 0);
|
|
}
|
|
else
|
|
{
|
|
if (PlayerPrefs.GetInt("fin_ad_num_saveingpot", 0) == 0)
|
|
{
|
|
//NetworkKit.BuriedPoint(BuriedPointEvent.ad_task, BuriedPointEvent.finish_ad_number, 1);
|
|
PlayerPrefs.SetInt("fin_ad_num_saveingpot", 1);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
public static void CheckCoinMakeupTaskData(object a = null)
|
|
{
|
|
if (!GameHelper.IsGiftSwitch())
|
|
{
|
|
return;
|
|
}
|
|
//if (PreferencesMgr.Instance.CoinMakeupTaskHistory == null) PreferencesMgr.Instance.CoinMakeupTaskHistory = new List<MakeupTaskData>();
|
|
// MakeupTaskData taskData = null;
|
|
// if (PreferencesMgr.Instance.CoinMakeupTaskHistory.Count != 0) taskData = PreferencesMgr.Instance.CoinMakeupTaskHistory.Last();
|
|
// if (PreferencesMgr.Instance.CoinMakeupTaskHistory.Count == 0 || taskData.status == MakeupTaskStatus.Inline)
|
|
// {
|
|
// AddCoinMakeupTaskData();
|
|
// }
|
|
// else
|
|
// {
|
|
// foreach (var makeuptaskData in PreferencesMgr.Instance.CoinMakeupTaskHistory)
|
|
// {
|
|
// if (makeuptaskData.status == MakeupTaskStatus.Inline
|
|
// && makeuptaskData.inlineNum > GameHelper.GetCommonModel().inlineMin)
|
|
// {
|
|
// makeuptaskData.inlineNum -= UnityEngine.Random.Range(
|
|
// GameHelper.GetCommonModel().inlineLoginDown[0],
|
|
// GameHelper.GetCommonModel().inlineLoginDown[1]);
|
|
// if (makeuptaskData.inlineNum < GameHelper.GetCommonModel().inlineMin)
|
|
// {
|
|
// makeuptaskData.inlineNum = GameHelper.GetCommonModel().inlineMin;
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// PreferencesMgr.Instance.SaveCoinMakeupTaskHistory();
|
|
// }
|
|
}
|
|
public static void AddCoinMakeupTaskData()
|
|
{
|
|
var cardRedeemNewVOModel = ConfigSystem.GetConfig<CardRedeemNewModel>();
|
|
|
|
if (cardRedeemNewVOModel.dataList.Count <= 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
var lastId = -1;
|
|
// if (PreferencesMgr.Instance.CoinMakeupTaskHistory.Count > 0)
|
|
// {
|
|
// var makeupTaskData = PreferencesMgr.Instance.CoinMakeupTaskHistory.Last();
|
|
|
|
// if (makeupTaskData.status == MakeupTaskStatus.None
|
|
// || makeupTaskData.status == MakeupTaskStatus.Task)
|
|
// {
|
|
// return;
|
|
// }
|
|
|
|
// lastId = makeupTaskData.tableId;
|
|
// }
|
|
|
|
|
|
// var lastVoId = cardRedeemNewVOModel.dataList.Last().id;
|
|
// if (lastId == lastVoId)
|
|
// {
|
|
// lastId = lastVoId - 1;
|
|
// }
|
|
|
|
// foreach (var makeupVo in cardRedeemNewVOModel.dataList)
|
|
// {
|
|
// if (makeupVo.id > lastId)
|
|
// {
|
|
// var makeupTaskData = new MakeupTaskData();
|
|
// //makeupTaskData.makeupTaskType = MakeupTaskType.Coin;
|
|
// makeupTaskData.tableId = makeupVo.id;
|
|
// makeupTaskData.id = PreferencesMgr.Instance.CoinMakeupTaskHistory.Count + 1;
|
|
// makeupTaskData.is_gold = true;
|
|
// // makeupTaskData.amountStr = GameHelper.GetMoneyStr(makeupVo);
|
|
// //makeupTaskData.orderID = GameHelper.GetRandomNum(8);
|
|
|
|
// PreferencesMgr.Instance.CoinMakeupTaskHistory.Add(makeupTaskData);
|
|
// makeupTaskData.SetStatus(MakeupTaskStatus.None);
|
|
// PreferencesMgr.Instance.SaveCoinMakeupTaskHistory();
|
|
|
|
// PreferencesMgr.Instance.CoinMakeupTaskH5Time = 0;
|
|
// break;
|
|
// }
|
|
// }
|
|
}
|
|
private void CheckSpeedUpTaskData(int type = 1)
|
|
{
|
|
if (!GameHelper.IsGiftSwitch())
|
|
{
|
|
return;
|
|
}
|
|
|
|
var common = ConfigSystem.GetConfig<CommonModel>();
|
|
|
|
if (type == 1 && PreferencesMgr.Instance.MakeupTaskHistory.Count > 0)
|
|
{
|
|
foreach (var makeuptaskData in PreferencesMgr.Instance.MakeupTaskHistory)
|
|
{
|
|
if (makeuptaskData.status == MakeupTaskStatus.Inline
|
|
&& makeuptaskData.inlineNum > common.inlineMin)
|
|
{
|
|
var redeemVOModel = ConfigSystem.GetConfig<MakeupModel>().dataList
|
|
.FirstOrDefault(redeem => redeem.id == makeuptaskData.tableId);
|
|
|
|
var dowmNum = redeemVOModel.AD_Down;
|
|
Debug.Log($"CheckSpeedUpTaskData dowmNum=== {dowmNum} makeuptaskData.WatchVideoSpeedNum ==== {makeuptaskData.WatchVideoSpeedNum}");
|
|
|
|
makeuptaskData.WatchVideoSpeedNum += dowmNum;
|
|
//如果看广告的减少人数大于配置的阈值,则不能减少排名了
|
|
if (makeuptaskData.WatchVideoSpeedNum > redeemVOModel.AD_Limit_times)
|
|
{
|
|
makeuptaskData.WatchVideoSpeedNum = redeemVOModel.AD_Limit_times;
|
|
continue;
|
|
}
|
|
|
|
Debug.Log($"订单为: {makeuptaskData.tableId} 通过看广告减少的排名为:{dowmNum}");
|
|
makeuptaskData.inlineNum -= dowmNum;
|
|
Debug.Log($"订单为: {makeuptaskData.tableId} 减少后的排名:{makeuptaskData.inlineNum}");
|
|
if (makeuptaskData.inlineNum < common.inlineMin)
|
|
{
|
|
makeuptaskData.inlineNum = common.inlineMin;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (type == 2 && SaveData.GetSaveobject().saveingpot_history.Count > 0)
|
|
{
|
|
foreach (var makeuptaskData in SaveData.GetSaveobject().saveingpot_history)
|
|
{
|
|
if (makeuptaskData.status == SaveingPotTaskStatus.Inline
|
|
&& makeuptaskData.inlineNum > common.inlineMin)
|
|
{
|
|
var redeemVOModel = ConfigSystem.GetConfig<MakeupModel_2>().dataList
|
|
.FirstOrDefault(redeem => redeem.id == makeuptaskData.tableId);
|
|
|
|
var dowmNum = redeemVOModel.AD_Down;
|
|
// Debug.Log($"CheckSpeedUpTaskData dowmNum=== {dowmNum} makeuptaskData.WatchVideoSpeedNum ==== {makeuptaskData.WatchVideoSpeedNum}");
|
|
|
|
makeuptaskData.WatchVideoSpeedNum += dowmNum;
|
|
//如果看广告的减少人数大于配置的阈值,则不能减少排名了
|
|
if (makeuptaskData.WatchVideoSpeedNum > redeemVOModel.AD_Limit_times)
|
|
{
|
|
makeuptaskData.WatchVideoSpeedNum = redeemVOModel.AD_Limit_times;
|
|
continue;
|
|
}
|
|
|
|
//Debug.Log($"订单为: {makeuptaskData.tableId} 通过看广告减少的排名为:{dowmNum}");
|
|
makeuptaskData.inlineNum -= dowmNum;
|
|
//Debug.Log($"订单为: {makeuptaskData.tableId} 减少后的排名:{makeuptaskData.inlineNum}");
|
|
if (makeuptaskData.inlineNum < common.inlineMin)
|
|
{
|
|
makeuptaskData.inlineNum = common.inlineMin;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
private void OnGetReward(object obj)
|
|
{
|
|
if (obj is RewardData rewardModel)
|
|
{
|
|
foreach (var rewardData in rewardModel.GetRewardDataList())
|
|
{
|
|
ProcessData(rewardData);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ProcessData(Goda goda)
|
|
{
|
|
if (goda.origin == RewardOrigin.None)
|
|
{
|
|
return;
|
|
}
|
|
|
|
switch (goda.id)
|
|
{
|
|
case 101:
|
|
{
|
|
var roomTicket = PreferencesMgr.Instance.Currency101;
|
|
roomTicket += (int)goda.GetTotalValue();
|
|
|
|
PreferencesMgr.Instance.Currency101 = roomTicket;
|
|
}
|
|
break;
|
|
case 102:
|
|
{
|
|
var dollar = PreferencesMgr.Instance.Currency102;
|
|
dollar += goda.GetTotalValue();
|
|
|
|
PreferencesMgr.Instance.Currency102 = dollar;
|
|
}
|
|
break;
|
|
case 104:
|
|
PreferencesMgr.Instance.CardBoardSum += (int)goda.GetTotalValue();
|
|
break;
|
|
case 106:
|
|
PreferencesMgr.Instance.Sum777 += (int)goda.GetTotalValue();
|
|
break;
|
|
case 110:
|
|
BingoCell.AddKeyCardSum((int)goda.GetTotalValue());
|
|
break;
|
|
}
|
|
}
|
|
|
|
private void OnChangeRewardFly101(ExiteValue<bool> obj)
|
|
{
|
|
var oldValue = obj.oldValue;
|
|
var newValue = obj.newValue;
|
|
|
|
InitChangeRewardFly(101, oldValue, newValue);
|
|
}
|
|
|
|
private void OnChangeRewardFly102(ExiteValue<bool> obj)
|
|
{
|
|
var oldValue = obj.oldValue;
|
|
var newValue = obj.newValue;
|
|
|
|
InitChangeRewardFly(102, oldValue, newValue);
|
|
}
|
|
|
|
private void InitChangeRewardFly(int id, bool oldValue, bool newValue)
|
|
{
|
|
if (oldValue && !newValue)
|
|
{
|
|
switch (id)
|
|
{
|
|
case 101:
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.Update101Completed);
|
|
break;
|
|
case 102:
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.Update102Completed);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |