647 lines
28 KiB
C#
647 lines
28 KiB
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
using FairyGUI;
|
||
|
|
using BingoBrain.Core;
|
||
|
|
|
||
|
|
using BingoBrain;
|
||
|
|
using FGUI.G008_reward_animal;
|
||
|
|
using DG.Tweening;
|
||
|
|
using FGUI.Common_animal;
|
||
|
|
using Newtonsoft.Json;
|
||
|
|
using System.Linq;
|
||
|
|
|
||
|
|
using FGUI.G003_play_animal;
|
||
|
|
using System;
|
||
|
|
using Spine.Unity;
|
||
|
|
using BingoBrain.HotFix;
|
||
|
|
using DontConfuse;
|
||
|
|
|
||
|
|
namespace BingoBrain
|
||
|
|
{
|
||
|
|
public class LevelSuccessUI : BaseUI
|
||
|
|
{
|
||
|
|
private LevelSuccessUICtrl ctrl;
|
||
|
|
private LevelSuccessModel model;
|
||
|
|
private FGUI.G008_reward_animal.com_lvsuccess ui;
|
||
|
|
private bool is_success;
|
||
|
|
private bool is_level_success;
|
||
|
|
private bool is_h5_reward;
|
||
|
|
public static bool aftershow_success = false;//用于在倒数第二个奖励是钞票是关卡结束奖励弹不出来
|
||
|
|
private SuccessData success_data;
|
||
|
|
|
||
|
|
public LevelSuccessUI(LevelSuccessUICtrl ctrl) : base(ctrl)
|
||
|
|
{
|
||
|
|
uiName = UIConst.LevelSuccessUI;
|
||
|
|
this.ctrl = ctrl;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void SetUIInfo(UIInfo uiInfo)
|
||
|
|
{
|
||
|
|
uiInfo.packageName = "G008_reward_animal";
|
||
|
|
uiInfo.assetName = "com_lvsuccess";
|
||
|
|
uiInfo.layerType = UILayerType.Popup;
|
||
|
|
uiInfo.isNeedOpenAnim = false;
|
||
|
|
uiInfo.isNeedCloseAnim = false;
|
||
|
|
uiInfo.isNeedUIMask = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
#region 生命周期
|
||
|
|
protected override void OnInit()
|
||
|
|
{
|
||
|
|
//model = ModuleManager.Instance.GetModel(ModelConst.LevelSuccessModel) as LevelSuccessModel;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnClose()
|
||
|
|
{
|
||
|
|
GameHelper.SetCloseResult(false);
|
||
|
|
|
||
|
|
closeCallback?.Invoke();
|
||
|
|
//if (is_level_success && !GameHelper.is_first_login) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, is_success);
|
||
|
|
if (is_h5_reward)
|
||
|
|
{
|
||
|
|
WebviewManager.Instance.ShowH5View(true);
|
||
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.resetH5progress);
|
||
|
|
}
|
||
|
|
// if (UI.Instance.IsExistUI(UIConst.H5UI))
|
||
|
|
// {
|
||
|
|
// WebviewManager.Instance.SetDarkThough(true);
|
||
|
|
|
||
|
|
// }
|
||
|
|
WebviewManager.Instance.SetDarkThough(true);
|
||
|
|
if (aftershow_success)
|
||
|
|
{
|
||
|
|
GameDispatcher.Instance.Dispatch(GameMsg.checkGameState);
|
||
|
|
aftershow_success = false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
private Action closeCallback;
|
||
|
|
protected override void OnBind()
|
||
|
|
{
|
||
|
|
ui = baseUI as FGUI.G008_reward_animal.com_lvsuccess;
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnOpenBefore(object arg)
|
||
|
|
{
|
||
|
|
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1) (ui.btn_adclaim.GetChild("img_saveingpot") as GImage).visible = true;
|
||
|
|
if (UI.Instance.IsExistUI(UIConst.H5UI))
|
||
|
|
{
|
||
|
|
WebviewManager.Instance.SetDarkThough(false);
|
||
|
|
WebviewManager.Instance.ShowH5View(false);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (Screen.safeArea.y != 0)
|
||
|
|
{//刘海屏
|
||
|
|
ui.gold.y += Screen.safeArea.y;
|
||
|
|
ui.top_money.y += Screen.safeArea.y;
|
||
|
|
ui.tips_bg.y += Screen.safeArea.y;
|
||
|
|
ui.tips_text.y += Screen.safeArea.y;
|
||
|
|
}
|
||
|
|
|
||
|
|
SuccessData args = arg as SuccessData;
|
||
|
|
success_data = args;
|
||
|
|
|
||
|
|
is_level_success = args.IsLevelSuccess;
|
||
|
|
is_h5_reward = args.IsH5Reward;
|
||
|
|
|
||
|
|
if (GameHelper.IsGiftSwitch())
|
||
|
|
{
|
||
|
|
ui.switchgift.selectedIndex = 1;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
ui.switchgift.selectedIndex = 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (is_level_success && !is_h5_reward) {
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Open);
|
||
|
|
|
||
|
|
GameHelper.PlayGameTimeEvent(1, () => {
|
||
|
|
GameHelper.RequestGameConfig();
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
GameHelper.SetCloseResult(true);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
Debug.Log(args);
|
||
|
|
is_success = args.IsWin;
|
||
|
|
if (is_success)
|
||
|
|
{
|
||
|
|
if (Audio.Instance.IsOpenEffect)
|
||
|
|
{
|
||
|
|
Audio.Instance.PlayDynamicEffect("Victoriously");
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
if (is_success) ui.state.selectedIndex = 0;
|
||
|
|
else ui.state.selectedIndex = 1;
|
||
|
|
ui.level_text.text = "Level " + GameHelper.GetLevel();
|
||
|
|
(ui.btn_adclaim as btn_tabad).color.selectedIndex = 1;
|
||
|
|
ui.btn_restart.SetClick(() =>
|
||
|
|
{
|
||
|
|
if (!GameHelper.GetCloseResult()) return;
|
||
|
|
|
||
|
|
GameHelper.addInterAdnumber();
|
||
|
|
if (!is_success)
|
||
|
|
{
|
||
|
|
GameHelper.SetLevelstate(3);
|
||
|
|
GameDispatcher.Instance.Dispatch(GameMsg.sendLog, false);
|
||
|
|
}
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, is_success);
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
||
|
|
|
||
|
|
});
|
||
|
|
ui.top_money.GetChild("number_text").text = "$" + PreferencesMgr.Instance.Currency102;
|
||
|
|
float cash_number = args.cash_number;
|
||
|
|
int rate = 1;
|
||
|
|
if (is_success)
|
||
|
|
{
|
||
|
|
rate = args.rate;
|
||
|
|
ui.btn_adclaim.GetChild("title").text = "Claim X" + rate;
|
||
|
|
// var sk = FX.Instance.SetFx<SkeletonAnimation>(baseUI.GetChild("bg_parent") as GGraph, Fx_Type.fx_win, ref closeCallback);
|
||
|
|
// sk.state.SetAnimation(0, "out", true);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
ui.bg_parent.y += 200;
|
||
|
|
// var sk = FX.Instance.SetFx<SkeletonAnimation>(ui.bg_parent, Fx_Type.fx_lose, ref closeCallback);
|
||
|
|
// sk.state.SetAnimation(0, "animation", true);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
InitView();
|
||
|
|
|
||
|
|
if (GameHelper.IsGiftSwitch())
|
||
|
|
{
|
||
|
|
if (is_success) ui.money_text.text = "$" + cash_number.ToString("0.00");
|
||
|
|
else
|
||
|
|
{
|
||
|
|
ui.money_text.text = "$" + PreferencesMgr.Instance.Currency102;
|
||
|
|
ui.top_money.visible = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
ui.btn_adclaim.SetClick(() =>
|
||
|
|
{
|
||
|
|
if (!GameHelper.GetCloseResult()) return;
|
||
|
|
|
||
|
|
GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
|
||
|
|
{
|
||
|
|
if (isSuccess)
|
||
|
|
|
||
|
|
{
|
||
|
|
ui.btn_claim.SetClick(() => { });
|
||
|
|
ui.btn_adclaim.SetClick(() => { });
|
||
|
|
ui.top_money.GetChild("btn_cashout").SetClick(() => { });
|
||
|
|
ui.com_cash.btn_cash.SetClick(() => { });
|
||
|
|
var start = GameHelper.GetUICenterPosition(ui.btn_adclaim);
|
||
|
|
var end = GameHelper.GetUICenterPosition(ui.top_money.GetChild("number_text"));
|
||
|
|
|
||
|
|
var rewardData = new RewardData
|
||
|
|
{
|
||
|
|
displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange
|
||
|
|
};
|
||
|
|
var rewardSingleData = new Goda(102, (decimal)cash_number * rate, RewardOrigin.Play)
|
||
|
|
{
|
||
|
|
startPosition = start,
|
||
|
|
endPosition = end,
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
rewardData.AddReward(rewardSingleData);
|
||
|
|
rewardData.AddCompleted(success =>
|
||
|
|
{
|
||
|
|
if (success)
|
||
|
|
{
|
||
|
|
// RefreshGold((decimal)awardNum);
|
||
|
|
|
||
|
|
DOVirtual.DelayedCall(0.3f, () =>
|
||
|
|
{
|
||
|
|
CtrlCloseUI();
|
||
|
|
if (is_level_success) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.GetReward, rewardData);
|
||
|
|
DOVirtual.DelayedCall(1, () =>
|
||
|
|
{
|
||
|
|
DOVirtual.Float(0, (float)PreferencesMgr.Instance.Currency102, 1f,
|
||
|
|
value => { (ui.top_money.GetChild("number_text") as GTextField).text = "$" + value.ToString("0.00"); });
|
||
|
|
});
|
||
|
|
|
||
|
|
DOVirtual.DelayedCall(2f, () =>
|
||
|
|
{
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
||
|
|
});
|
||
|
|
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
|
||
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.RefreshMakeupData);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
ui.btn_claim.SetClick(() =>
|
||
|
|
{
|
||
|
|
if (!GameHelper.GetCloseResult()) return;
|
||
|
|
|
||
|
|
ui.btn_claim.SetClick(() => { });
|
||
|
|
ui.btn_adclaim.SetClick(() => { });
|
||
|
|
ui.top_money.GetChild("btn_cashout").SetClick(() => { });
|
||
|
|
ui.com_cash.btn_cash.SetClick(() => { });
|
||
|
|
var start = GameHelper.GetUICenterPosition(ui.btn_claim);
|
||
|
|
var end = GameHelper.GetUICenterPosition(ui.top_money.GetChild("number_text"));
|
||
|
|
|
||
|
|
|
||
|
|
// reward_data temp = new reward_data() { start = start, end = end, change = cash_number, type = 111 };
|
||
|
|
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.CoinWnd_newUI_Open, temp);
|
||
|
|
// GameHelper.addMoney(cash_number);
|
||
|
|
|
||
|
|
var rewardData = new RewardData
|
||
|
|
{
|
||
|
|
displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange
|
||
|
|
};
|
||
|
|
var rewardSingleData = new Goda(102, (decimal)cash_number, RewardOrigin.Play)
|
||
|
|
{
|
||
|
|
startPosition = start,
|
||
|
|
endPosition = end,
|
||
|
|
|
||
|
|
};
|
||
|
|
rewardData.AddReward(rewardSingleData);
|
||
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.GetReward, rewardData);
|
||
|
|
rewardData.AddCompleted(success =>
|
||
|
|
{
|
||
|
|
if (success)
|
||
|
|
{
|
||
|
|
// RefreshGold((decimal)awardNum);
|
||
|
|
|
||
|
|
DOVirtual.DelayedCall(0.3f, () =>
|
||
|
|
{
|
||
|
|
CtrlCloseUI();
|
||
|
|
if (is_level_success) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
DOVirtual.DelayedCall(1, () =>
|
||
|
|
{
|
||
|
|
DOVirtual.Float(0, (float)PreferencesMgr.Instance.Currency102, 1f,
|
||
|
|
value => { (ui.top_money.GetChild("number_text") as GTextField).text = "$" + value.ToString("0.00"); });
|
||
|
|
});
|
||
|
|
|
||
|
|
DOVirtual.DelayedCall(2f, () =>
|
||
|
|
{
|
||
|
|
GameHelper.addInterAdnumber();
|
||
|
|
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
||
|
|
|
||
|
|
});
|
||
|
|
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
|
||
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.RefreshMakeupData);
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
//int name_index = UnityEngine.Random.Range(0, ConfigSystem.GetConfig<exBrPoolModel>().config_name_list.Count);
|
||
|
|
var name_index = UnityEngine.Random.Range(0, exBrPoolModel.config_name_list.Count);
|
||
|
|
var money_index = UnityEngine.Random.Range(0, exBrPoolModel.config_money_list.Count);
|
||
|
|
|
||
|
|
System.DateTime oldtime = System.DateTime.Now.AddSeconds(-UnityEngine.Random.Range(1 * 3600, 2 * 3600));
|
||
|
|
|
||
|
|
ui.com_cash.broad.cast_text.text = string.Format("Congratulations, [color=#e3a13a]{0}[/color] withdrew [color=#83c93c]{1} [/color]dollars", exBrPoolModel.config_name_list[name_index],
|
||
|
|
exBrPoolModel.config_money_list[money_index]);
|
||
|
|
|
||
|
|
var makeupTaskData = PreferencesMgr.Instance.MakeupTaskHistory.Last();
|
||
|
|
var vo = ConfigSystem.GetConfig<MakeupModel>().GetData(makeupTaskData.tableId);
|
||
|
|
|
||
|
|
ui.com_cash.btn_cash.SetClick(() =>
|
||
|
|
{
|
||
|
|
if (!GameHelper.GetCloseResult()) return;
|
||
|
|
|
||
|
|
ui.btn_claim.SetClick(() => { });
|
||
|
|
ui.btn_adclaim.SetClick(() => { });
|
||
|
|
ui.top_money.GetChild("btn_cashout").SetClick(() => { });
|
||
|
|
ui.com_cash.btn_cash.SetClick(() => { });
|
||
|
|
if (is_success)
|
||
|
|
{
|
||
|
|
var start = GameHelper.GetUICenterPosition(ui.btn_claim);
|
||
|
|
var end = GameHelper.GetUICenterPosition(ui.top_money.GetChild("number_text"));
|
||
|
|
var rewardData = new RewardData
|
||
|
|
{
|
||
|
|
displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange
|
||
|
|
};
|
||
|
|
var rewardSingleData = new Goda(102, (decimal)cash_number, RewardOrigin.Play)
|
||
|
|
{
|
||
|
|
startPosition = start,
|
||
|
|
endPosition = end,
|
||
|
|
|
||
|
|
};
|
||
|
|
rewardData.AddReward(rewardSingleData);
|
||
|
|
rewardData.AddCompleted(success =>
|
||
|
|
{
|
||
|
|
if (success)
|
||
|
|
{
|
||
|
|
// RefreshGold((decimal)awardNum);
|
||
|
|
|
||
|
|
DOVirtual.DelayedCall(0.3f, () =>
|
||
|
|
{
|
||
|
|
CtrlCloseUI();
|
||
|
|
if (is_level_success) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.GetReward, rewardData);
|
||
|
|
DOVirtual.DelayedCall(1, () =>
|
||
|
|
{
|
||
|
|
DOVirtual.Float(0, (float)PreferencesMgr.Instance.Currency102, 1f,
|
||
|
|
value => { (ui.top_money.GetChild("number_text") as GTextField).text = "$" + value.ToString("0.00"); });
|
||
|
|
});
|
||
|
|
|
||
|
|
DOVirtual.DelayedCall(1.0f, () =>
|
||
|
|
{
|
||
|
|
uiCtrlDispatcher.Dispatch(SkinInfo.MakeupConfirmUI_Open, makeupTaskData);
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
||
|
|
GameHelper.addInterAdnumber();
|
||
|
|
|
||
|
|
});
|
||
|
|
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
|
||
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.RefreshMakeupData);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
uiCtrlDispatcher.Dispatch(SkinInfo.MakeupConfirmUI_Open, makeupTaskData);
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
||
|
|
GameHelper.addInterAdnumber();
|
||
|
|
}
|
||
|
|
if (is_level_success && !is_success) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
ui.top_money.GetChild("btn_cashout").SetClick(() =>
|
||
|
|
{
|
||
|
|
if (!GameHelper.GetCloseResult()) return;
|
||
|
|
|
||
|
|
ui.btn_claim.SetClick(() => { });
|
||
|
|
ui.btn_adclaim.SetClick(() => { });
|
||
|
|
ui.top_money.GetChild("btn_cashout").SetClick(() => { });
|
||
|
|
ui.com_cash.btn_cash.SetClick(() => { });
|
||
|
|
if (is_success)
|
||
|
|
{
|
||
|
|
var start = GameHelper.GetUICenterPosition(ui.btn_claim);
|
||
|
|
var end = GameHelper.GetUICenterPosition(ui.top_money.GetChild("number_text"));
|
||
|
|
var rewardData = new RewardData
|
||
|
|
{
|
||
|
|
displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange
|
||
|
|
};
|
||
|
|
var rewardSingleData = new Goda(102, (decimal)cash_number, RewardOrigin.Play)
|
||
|
|
{
|
||
|
|
startPosition = start,
|
||
|
|
endPosition = end,
|
||
|
|
|
||
|
|
};
|
||
|
|
rewardData.AddReward(rewardSingleData);
|
||
|
|
rewardData.AddCompleted(success =>
|
||
|
|
{
|
||
|
|
|
||
|
|
if (success)
|
||
|
|
{
|
||
|
|
// RefreshGold((decimal)awardNum);
|
||
|
|
|
||
|
|
DOVirtual.DelayedCall(0.3f, () =>
|
||
|
|
{
|
||
|
|
CtrlCloseUI();
|
||
|
|
Debug.Log("66666666666666666666662"); if (is_level_success) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
});
|
||
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.GetReward, rewardData);
|
||
|
|
DOVirtual.DelayedCall(1, () =>
|
||
|
|
{
|
||
|
|
DOVirtual.Float(0, (float)PreferencesMgr.Instance.Currency102, 1f,
|
||
|
|
value => { (ui.top_money.GetChild("number_text") as GTextField).text = "$" + value.ToString("0.00"); });
|
||
|
|
});
|
||
|
|
|
||
|
|
DOVirtual.DelayedCall(1.0f, () =>
|
||
|
|
{
|
||
|
|
|
||
|
|
uiCtrlDispatcher.Dispatch(SkinInfo.MakeupConfirmUI_Open, makeupTaskData);
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
||
|
|
GameHelper.addInterAdnumber();
|
||
|
|
|
||
|
|
});
|
||
|
|
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
|
||
|
|
GameDispatcher.Instance.Dispatch(BingoInfo.RefreshMakeupData);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
uiCtrlDispatcher.Dispatch(SkinInfo.MakeupConfirmUI_Open, makeupTaskData);
|
||
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
||
|
|
GameHelper.addInterAdnumber();
|
||
|
|
}
|
||
|
|
if (is_level_success && !is_success) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
|
||
|
|
|
||
|
|
});
|
||
|
|
|
||
|
|
Debug.Log(JsonConvert.SerializeObject(vo));
|
||
|
|
if (GameHelper.GetLevel() <= vo.levels_need)
|
||
|
|
{
|
||
|
|
ui.com_cash.cash_text.text = "Withdrawals can be made through level " + vo.levels_need;
|
||
|
|
ui.com_cash.progress.width = 676f * (GameHelper.GetLevel() - 1) / vo.levels_need;
|
||
|
|
ui.com_cash.progress_text.text = (GameHelper.GetLevel() - 1) + "/" + vo.levels_need;
|
||
|
|
}
|
||
|
|
else if ((float)PreferencesMgr.Instance.Currency102 < vo.item_need)
|
||
|
|
{
|
||
|
|
ui.com_cash.cash_text.text = "Collect " + vo.item_need + " to cash out";
|
||
|
|
if ((float)PreferencesMgr.Instance.Currency102 > vo.item_need)
|
||
|
|
{
|
||
|
|
ui.com_cash.progress.width = 676;
|
||
|
|
ui.com_cash.progress_text.text = "$" + vo.item_need + "/" + "$" + vo.item_need;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
ui.com_cash.progress.width = 676 * ((float)PreferencesMgr.Instance.Currency102 / vo.item_need);
|
||
|
|
ui.com_cash.progress_text.text = "$" + PreferencesMgr.Instance.Currency102 + "/" + "$" + vo.item_need;
|
||
|
|
}
|
||
|
|
|
||
|
|
Debug.Log((float)PreferencesMgr.Instance.Currency102);
|
||
|
|
}
|
||
|
|
else if ((float)PreferencesMgr.Instance.MakeupTaskH5Time < vo.task_need)
|
||
|
|
{
|
||
|
|
ui.com_cash.cash_text.text = "Cumulataive " + (vo.task_need / 60) + @" minutes in ""Hall"" to cash out";
|
||
|
|
if ((float)PreferencesMgr.Instance.MakeupTaskH5Time > vo.task_need)
|
||
|
|
{
|
||
|
|
ui.com_cash.progress.width = 676;
|
||
|
|
ui.com_cash.progress_text.text = (vo.task_need / 60) + "/" + (vo.task_need / 60);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
ui.com_cash.progress.width = 676 * ((float)PreferencesMgr.Instance.MakeupTaskH5Time / vo.task_need);
|
||
|
|
ui.com_cash.progress_text.text = Math.Round(((float)(PreferencesMgr.Instance.MakeupTaskH5Time / 60)), 2) + "/" + (vo.task_need / 60);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
else if (makeupTaskData.videoCount < vo.ad_need)
|
||
|
|
{
|
||
|
|
|
||
|
|
ui.com_cash.cash_text.text = "Watch " + vo.ad_need + " Reward Ads to cash out";
|
||
|
|
if (makeupTaskData.videoCount > vo.ad_need)
|
||
|
|
{
|
||
|
|
ui.com_cash.progress.width = 676;
|
||
|
|
ui.com_cash.progress_text.text = vo.ad_need + "/" + vo.ad_need;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
ui.com_cash.progress.width = 676 * ((float)makeupTaskData.videoCount / vo.ad_need);
|
||
|
|
ui.com_cash.progress_text.text = makeupTaskData.videoCount + "/" + vo.ad_need;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
ui.com_cash.cash_text.text = "Watch " + vo.ad_need + " Reward Ads to cash out";
|
||
|
|
if (makeupTaskData.videoCount > vo.ad_need)
|
||
|
|
{
|
||
|
|
ui.com_cash.progress.width = 676;
|
||
|
|
ui.com_cash.progress_text.text = vo.ad_need + "/" + vo.ad_need;
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
ui.com_cash.progress.width = 676 * ((float)makeupTaskData.videoCount / vo.ad_need);
|
||
|
|
ui.com_cash.progress_text.text = makeupTaskData.videoCount + "/" + vo.ad_need;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
// ui.money_text.text = "20";
|
||
|
|
// ui.gold.GetChild("number_text").text = GameHelper.GetGoldNumber().ToString();
|
||
|
|
// ui.btn_adclaim.GetChild("title").text = "Claim X2";
|
||
|
|
// ui.btn_adclaim.SetClick(() =>
|
||
|
|
// {
|
||
|
|
// GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
|
||
|
|
// {
|
||
|
|
// if (isSuccess)
|
||
|
|
|
||
|
|
// {
|
||
|
|
// ui.btn_claim.SetClick(() => { });
|
||
|
|
// ui.btn_adclaim.SetClick(() => { });
|
||
|
|
// var start = GameHelper.GetUICenterPosition(ui.btn_adclaim);
|
||
|
|
// var end = GameHelper.GetUICenterPosition(ui.gold.GetChild("number_text"));
|
||
|
|
|
||
|
|
// reward_data temp = new reward_data() { start = start, end = end, change = 40, type = 101 };
|
||
|
|
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.CoinWnd_newUI_Open, temp);
|
||
|
|
// GameHelper.addGoldNumber(40);
|
||
|
|
// DOVirtual.DelayedCall(1, () =>
|
||
|
|
// {
|
||
|
|
// DOVirtual.Float(0, GameHelper.getGoldNumber(), 1,
|
||
|
|
// value => { ui.gold.GetChild("number_text").text = ((int)value).ToString(); });
|
||
|
|
// }
|
||
|
|
// );
|
||
|
|
|
||
|
|
// DOVirtual.DelayedCall(2f, () =>
|
||
|
|
// {
|
||
|
|
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
||
|
|
// });
|
||
|
|
// GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
|
||
|
|
// }
|
||
|
|
// });
|
||
|
|
// });
|
||
|
|
// ui.btn_claim.SetClick(() =>
|
||
|
|
// {
|
||
|
|
// ui.btn_claim.SetClick(() => { });
|
||
|
|
// ui.btn_adclaim.SetClick(() => { });
|
||
|
|
// var start = GameHelper.GetUICenterPosition(ui.btn_claim);
|
||
|
|
// var end = GameHelper.GetUICenterPosition(ui.gold.GetChild("number_text"));
|
||
|
|
// // var reward = GameHelper.GetQuizRewardValue();
|
||
|
|
// // var rewardData = new RewardData();
|
||
|
|
// // var rewardSingleData = new RewardSingleData(111, (decimal)reward, RewardOrigin.GameWin)
|
||
|
|
// // {
|
||
|
|
// // startPosition = start,
|
||
|
|
// // endPosition = end
|
||
|
|
// // };
|
||
|
|
// // rewardData.AddReward(rewardSingleData);
|
||
|
|
|
||
|
|
// // //rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange;
|
||
|
|
// // rewardData.displayType = RewardDisplayType.RewardFly ;
|
||
|
|
// //GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
|
||
|
|
// reward_data temp = new reward_data() { start = start, end = end, change = 20, type = 101 };
|
||
|
|
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.CoinWnd_newUI_Open, temp);
|
||
|
|
// GameHelper.addGoldNumber(20);
|
||
|
|
// DOVirtual.DelayedCall(1, () =>
|
||
|
|
// {
|
||
|
|
// DOVirtual.Float(0, GameHelper.getGoldNumber(), 1,
|
||
|
|
// value => { ui.gold.GetChild("number_text").text = ((int)value).ToString(); });
|
||
|
|
// }
|
||
|
|
// );
|
||
|
|
|
||
|
|
// DOVirtual.DelayedCall(2f, () =>
|
||
|
|
// {
|
||
|
|
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
||
|
|
// });
|
||
|
|
// GameDispatcher.Instance.Dispatch(GameMsg.Gold_refresh);
|
||
|
|
// });
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
private int time_count = 0;
|
||
|
|
|
||
|
|
void timeEvent()
|
||
|
|
{
|
||
|
|
time_count++;
|
||
|
|
|
||
|
|
if (time_count > 3)
|
||
|
|
{
|
||
|
|
time_count = 0;
|
||
|
|
ui.com_cash.broad.t0.Play(() =>
|
||
|
|
{
|
||
|
|
var name_index = UnityEngine.Random.Range(0, exBrPoolModel.config_name_list.Count);
|
||
|
|
var money_index = UnityEngine.Random.Range(0, exBrPoolModel.config_money_list.Count);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
System.DateTime oldtime = System.DateTime.Now.AddSeconds(-UnityEngine.Random.Range(1 * 3600, 2 * 3600));
|
||
|
|
ui.com_cash.broad.cast_text.text = string.Format("Congratulations, [color=#e3a13a]{0}[/color] withdrew [color=#83c93c]{1} [/color]dollars ", exBrPoolModel.config_name_list[name_index],
|
||
|
|
exBrPoolModel.config_money_list[money_index]);
|
||
|
|
//, oldtime.Hour + ":" + (oldtime.Minute > 10 ? oldtime.Minute : "0" + oldtime.Minute)
|
||
|
|
ui.com_cash.broad.t1.Play();
|
||
|
|
});
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
protected override void OnOpen(object args)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnHide()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
protected override void OnDisplay(object args)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
#region 消息
|
||
|
|
protected override void AddListener()
|
||
|
|
{
|
||
|
|
Hall.Instance.UpdateSecondEvent += timeEvent;
|
||
|
|
}
|
||
|
|
protected override void RemoveListener()
|
||
|
|
{
|
||
|
|
Hall.Instance.UpdateSecondEvent -= timeEvent;
|
||
|
|
}
|
||
|
|
#endregion
|
||
|
|
|
||
|
|
//初始化页面逻辑
|
||
|
|
private void InitView()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|