692 lines
28 KiB
C#
692 lines
28 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using DG.Tweening;
|
|
using Dont_Confuse;
|
|
using FairyGUI;
|
|
using FGUI.Common_01;
|
|
using FGUI.GameResult_08;
|
|
using IgnoreOPS;
|
|
using Newtonsoft.Json;
|
|
using Spine.Unity;
|
|
using UnityEngine;
|
|
using Random = UnityEngine.Random;
|
|
|
|
namespace ChillConnect
|
|
{
|
|
public class GameResultUI : BaseUI
|
|
{
|
|
private GameResultUICtrl ctrl;
|
|
private GameResultModel model;
|
|
private com_end ui;
|
|
private bool IsWin;
|
|
private bool IsLevelSuccess;
|
|
private bool IsH5Reward;
|
|
|
|
private float AwardNum = 20;
|
|
private Action closeCallback;
|
|
|
|
private int AwardRate = 10;
|
|
|
|
public GameResultUI(GameResultUICtrl ctrl) : base(ctrl)
|
|
{
|
|
uiName = UIConst.GameResultUI;
|
|
this.ctrl = ctrl;
|
|
}
|
|
|
|
protected override void SetUIInfo(UIInfo uiInfo)
|
|
{
|
|
uiInfo.packageName = "GameResult_08";
|
|
uiInfo.assetName = "com_end";
|
|
uiInfo.layerType = UILayerType.Popup;
|
|
uiInfo.isNeedOpenAnim = false;
|
|
uiInfo.isNeedCloseAnim = false;
|
|
uiInfo.isNeedUIMask = true;
|
|
}
|
|
|
|
#region 生命周期
|
|
|
|
protected override void OnInit()
|
|
{
|
|
//model = ModuleManager.Instance.GetModel(ModelConst.GameResultModel) as GameResultModel;
|
|
}
|
|
|
|
protected override void OnClose()
|
|
{
|
|
GameHelper.SetCloseResult(false);
|
|
closeCallback?.Invoke();
|
|
if (IsLevelSuccess && !GameHelper.is_first_login)
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
|
|
|
|
|
|
|
|
}
|
|
//
|
|
protected override void OnBind()
|
|
{
|
|
ui = baseUI as com_end;
|
|
}
|
|
private SuccessData successData_;
|
|
protected override void OnOpenBefore(object args)
|
|
{
|
|
if (Screen.safeArea.y != 0)
|
|
{//刘海屏
|
|
ui.btn_gold.y += 68;
|
|
}
|
|
|
|
var anim_paly = FXManager.Instance.SetFx<SkeletonAnimation>(ui.btn_gold.GetChild("gold_anim") as GGraph, Fx_Type.fx_coin, ref closeCallback);
|
|
anim_paly.state.SetAnimation(0, "animation", true);
|
|
(ui.top_money as com_money).btn_ch.title = GameHelper.getDesByKey("ch_out_1");
|
|
if (GameHelper.IsGiftSwitch())
|
|
ui.switchgift.selectedIndex = 1;
|
|
|
|
ui.tips_text.text = GameHelper.getDesByKey("ww_condition_lv");
|
|
SuccessData SuccessDatas = args as SuccessData;
|
|
AwardNum = SuccessDatas.cash_number;
|
|
AwardRate = SuccessDatas.rate;
|
|
IsWin = SuccessDatas.IsWin;
|
|
|
|
IsLevelSuccess = SuccessDatas.IsLevelSuccess;
|
|
IsH5Reward = SuccessDatas.IsH5Reward;
|
|
|
|
successData_ = SuccessDatas;
|
|
if (!GameHelper.IsGiftSwitch())
|
|
{
|
|
successData_.cash_number = (int)successData_.cash_number;
|
|
successData_.rate = 2;
|
|
}
|
|
if (IsLevelSuccess && !IsH5Reward)
|
|
{
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Open);
|
|
|
|
GameHelper.PlayGameTimeEvent(1, () =>
|
|
{
|
|
GameHelper.RequestGameConfig();
|
|
});
|
|
}
|
|
else
|
|
{
|
|
GameHelper.SetCloseResult(true);
|
|
}
|
|
if (!GameHelper.IsGiftSwitch())
|
|
{
|
|
AwardNum = 20;
|
|
AwardRate = 2;
|
|
ui.btn_claim.title = "Claim(" + AwardNum + ")";
|
|
}
|
|
else ui.btn_claim.title = "Claim(" + GameHelper.getChString((decimal)AwardNum) + ")";
|
|
if (IsWin)
|
|
{
|
|
if (PlayerPrefs.GetFloat("soundVolume", 1.0f) > 0f)
|
|
{
|
|
AudioManager.Instance.PlayDynamicEffect(AudioConst.Victoriously);
|
|
}
|
|
|
|
}
|
|
if (IsWin)
|
|
{
|
|
ui.win_lose.selectedIndex = ui._Win_lose_win;
|
|
}
|
|
else
|
|
{
|
|
ui.win_lose.selectedIndex = ui._Win_lose_lose;
|
|
ui.lab_lose_des.text = GameHelper.getDesByKey("game_resulte_1");
|
|
}
|
|
ui.btn_restart.SetClick(() =>
|
|
{
|
|
if (!GameHelper.GetCloseResult())
|
|
return;
|
|
GameHelper.addInterAdnumber();
|
|
if (!IsWin)
|
|
{
|
|
GameHelper.SetLevelstate(3);
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
|
|
GameDispatcher.Instance.Dispatch(GameMsg.sendLog, false);
|
|
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, false);
|
|
}
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
|
});
|
|
|
|
ui.btn_mult.GetChild("title").text = "Claim X" + AwardRate;
|
|
|
|
if (SuccessDatas.IsH5Reward)
|
|
ui.com_ch.visible = false;
|
|
InitView();
|
|
if (IsWin)
|
|
{
|
|
if (GameHelper.IsGiftSwitch())
|
|
ui.text_award.text = GameHelper.Get102Str((decimal)AwardNum);
|
|
else
|
|
ui.text_award.text = ((int)AwardNum).ToString();
|
|
|
|
|
|
var sk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent, Fx_Type.fx_win, ref closeCallback);
|
|
sk.state.SetAnimation(0, "out", true);
|
|
|
|
var sk1 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent_title, Fx_Type.fx_winstar, ref closeCallback);
|
|
sk1.state.SetAnimation(0, "animation", false);
|
|
|
|
}
|
|
else
|
|
{
|
|
// var sk1 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent_fail, Fx_Type.fx_fail, ref closeCallback);
|
|
// sk1.state.SetAnimation(0, "animation", true);
|
|
|
|
if (GameHelper.IsGiftSwitch())
|
|
ui.text_award.text = GameHelper.Get102Str(DataMgr.Ticket.Value);
|
|
else
|
|
ui.text_award.text = DataMgr.Coin.Value.ToString();
|
|
}
|
|
ui.com_ch.btn_cash.title = GameHelper.getDesByKey("ch_out_1");
|
|
// if (IsWin)
|
|
// {
|
|
// if (GameHelper.IsGiftSwitch()) ui.text_award.text = GameHelper.Get102Str((decimal)AwardNum);
|
|
// else ui.text_award.text = ((int)AwardNum).ToString();
|
|
|
|
// var sk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent, Fx_Type.fx_win, ref closeCallback);
|
|
// sk.state.SetAnimation(0, "out", true);
|
|
|
|
// var sk1 = FXManager.Instance.SetFx<SkeletonAnimation>(ui.bg_parent_title, Fx_Type.fx_win_title, ref closeCallback);
|
|
// sk1.state.SetAnimation(0, "animation", false);
|
|
|
|
// }
|
|
// else
|
|
// {
|
|
|
|
// if (GameHelper.IsGiftSwitch()) ui.text_award.text = GameHelper.Get102Str(DataMgr.Ticket.Value);
|
|
// else ui.text_award.text = DataMgr.Coin.Value.ToString();
|
|
// }
|
|
|
|
|
|
|
|
if (GameHelper.IsGiftSwitch())
|
|
{
|
|
if (SaveData.GetSaveObject().LargeRewardNum < ConfigSystem.GetConfig<CommonModel>().FreeClaims)
|
|
{
|
|
(ui.btn_mult as btn_claim3).state.selectedIndex = 1;
|
|
}
|
|
else if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1)
|
|
{
|
|
(ui.btn_mult.GetChild("img_saveingpot") as GImage).visible = true;
|
|
}
|
|
}
|
|
ui.btn_gold.GetChild("text_gold").text = $"{DataMgr.Coin.Value:N0}";
|
|
ui.top_money.GetChild("text_gold").text = DataMgr.Ticket.Value.ToString();
|
|
ui.btn_mult.SetClick(() =>
|
|
{
|
|
if (!GameHelper.GetCloseResult())
|
|
return;
|
|
if (GameHelper.IsGiftSwitch())
|
|
{
|
|
if (SaveData.GetSaveObject().LargeRewardNum < ConfigSystem.GetConfig<CommonModel>().FreeClaims)
|
|
{
|
|
ui.com_ch.btn_cash.SetClick(() => { });
|
|
ui.btn_claim.SetClick(() => { });
|
|
ui.btn_mult.SetClick(() => { });
|
|
StartScroll();
|
|
}
|
|
else
|
|
{
|
|
GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
|
|
{
|
|
if (isSuccess)
|
|
{
|
|
ui.com_ch.btn_cash.SetClick(() => { });
|
|
ui.btn_claim.SetClick(() => { });
|
|
ui.btn_mult.SetClick(() => { });
|
|
StartScroll();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
GameHelper.ShowVideoAd("reward_lobby", isSuccess =>
|
|
{
|
|
if (isSuccess)
|
|
{
|
|
ui.com_ch.btn_cash.SetClick(() => { });
|
|
ui.btn_claim.SetClick(() => { });
|
|
ui.btn_mult.SetClick(() => { });
|
|
GetReward(AwardNum * 2);
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
ui.btn_claim.SetClick(() =>
|
|
{
|
|
if (!GameHelper.GetCloseResult())
|
|
return;
|
|
|
|
ui.com_ch.btn_cash.SetClick(() => { });
|
|
ui.btn_claim.SetClick(() => { });
|
|
ui.btn_mult.SetClick(() => { });
|
|
GetReward(AwardNum);
|
|
DOVirtual.DelayedCall(2f, () =>
|
|
{
|
|
GameHelper.addInterAdnumber();
|
|
});
|
|
});
|
|
//}
|
|
}
|
|
private bool isget;
|
|
private void GetReward(float awardNum)
|
|
{
|
|
if (isget)
|
|
return;
|
|
isget = true;
|
|
var rewardData = new RewardData();
|
|
|
|
int curr_type = 101;
|
|
Vector2 end_ = GameHelper.GetUICenterPosition(ui.btn_gold, true);
|
|
|
|
if (GameHelper.IsGiftSwitch())
|
|
{
|
|
curr_type = 102;
|
|
end_ = GameHelper.GetUICenterPosition(ui.top_money, true);
|
|
|
|
}
|
|
var rewardSingleData = new RewardSingleData(curr_type, (decimal)awardNum, RewardOrigin.Play)
|
|
{
|
|
startPosition = GameHelper.GetUICenterPosition(ui.btn_mult, true),
|
|
endPosition = new Vector2(end_.x - 110, end_.y - 110),
|
|
};
|
|
|
|
rewardData.AddReward(rewardSingleData);
|
|
rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.ValueChange;
|
|
rewardData.AddCompleted(success =>
|
|
{
|
|
if (success)
|
|
{
|
|
// RefreshGold((decimal)awardNum);
|
|
|
|
DOVirtual.DelayedCall(0.7f, () =>
|
|
{
|
|
CtrlCloseUI();
|
|
// if (IsLevelSuccess) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.OpenGameUI_Open, true);
|
|
});
|
|
}
|
|
});
|
|
|
|
GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
|
|
DOVirtual.DelayedCall(1, () =>
|
|
{
|
|
DOVirtual.Float(0, (float)DataMgr.Ticket.Value, 1,
|
|
value => { ui.top_money.GetChild("text_gold").text = ((decimal)value).ToString("0.00"); });
|
|
});
|
|
}
|
|
|
|
private void RefreshGold(decimal coin = -1)
|
|
{
|
|
if (coin < 0)
|
|
{
|
|
coin = DataMgr.Coin.Value;
|
|
}
|
|
var btnCoin = ui.btn_gold as com_gold;
|
|
|
|
CommonHelper.ShowNumAnim(btnCoin.text_gold, coin);
|
|
}
|
|
protected override void OnOpen(object args)
|
|
{
|
|
}
|
|
|
|
protected override void OnHide()
|
|
{
|
|
}
|
|
|
|
protected override void OnDisplay(object args)
|
|
{
|
|
}
|
|
#endregion
|
|
|
|
#region 消息
|
|
protected override void AddListener()
|
|
{
|
|
HallManager.Instance.UpdateSecondEvent += timeEvent;
|
|
}
|
|
protected override void RemoveListener()
|
|
{
|
|
HallManager.Instance.UpdateSecondEvent -= timeEvent;
|
|
}
|
|
#endregion
|
|
private int time_count;
|
|
void timeEvent()
|
|
{
|
|
time_count++;
|
|
|
|
if (time_count > 3)
|
|
{
|
|
time_count = 0;
|
|
ui.com_ch.broad.t0.Play(() =>
|
|
{
|
|
var name_index = Random.Range(0, ConfigSystem.GetConfig<exBrPoolModel>().config_name_list.Count);
|
|
var money_index = Random.Range(0, ConfigSystem.GetConfig<exBrPoolModel>().config_money_list.Count);
|
|
|
|
DateTime oldtime = DateTime.Now.AddSeconds(-Random.Range(1 * 3600, 2 * 3600));
|
|
|
|
// ui.com_ch.broad.cast_text.text = string.Format("Congratulations, [color=#dfad42]{0}[/color] withdrew [color=#90c04e]{1} [/color]dollars", ConfigSystem.GetConfig<exBrPoolModel>().config_name_list[name_index],
|
|
// ConfigSystem.GetConfig<exBrPoolModel>().config_money_list[money_index]);
|
|
string broad_text = String.Format(GameHelper.getDesByKey("makeup_5"), ConfigSystem.GetConfig<exBrPoolModel>().config_name_list[name_index],
|
|
ConfigSystem.GetConfig<exBrPoolModel>().config_money_list[money_index]);
|
|
ui.com_ch.broad.cast_text.text = broad_text;
|
|
|
|
//, oldtime.Hour + ":" + (oldtime.Minute > 10 ? oldtime.Minute : "0" + oldtime.Minute)
|
|
ui.com_ch.broad.t1.Play();
|
|
});
|
|
}
|
|
}
|
|
//初始化页面逻辑
|
|
private void InitView()
|
|
{
|
|
if (Screen.safeArea.y != 0)
|
|
{//刘海屏
|
|
ui.top_group.y += 68;
|
|
}
|
|
closeCallback = null;
|
|
if (!GameHelper.IsGiftSwitch())
|
|
return;
|
|
var name_index = Random.Range(0, ConfigSystem.GetConfig<exBrPoolModel>().config_name_list.Count);
|
|
var money_index = Random.Range(0, ConfigSystem.GetConfig<exBrPoolModel>().config_money_list.Count);
|
|
// ui.com_ch.broad.cast_text.text = string.Format("Congratulations, [color=#dfad42]{0}[/color] withdrew [color=#90c04e]{1} [/color]dollars", ConfigSystem.GetConfig<exBrPoolModel>().config_name_list[name_index],
|
|
// ConfigSystem.GetConfig<exBrPoolModel>().config_money_list[money_index]);
|
|
string broad_text = String.Format(GameHelper.getDesByKey("makeup_5"), ConfigSystem.GetConfig<exBrPoolModel>().config_name_list[name_index],
|
|
ConfigSystem.GetConfig<exBrPoolModel>().config_money_list[money_index]);
|
|
ui.com_ch.broad.cast_text.text = broad_text;
|
|
if (DataMgr.MakeupTaskHistory.Value.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
var makeupTaskData = DataMgr.MakeupTaskHistory.Value.Last();
|
|
var vo = ConfigSystem.GetConfig<MakeupModel>().GetData(makeupTaskData.tableId);
|
|
|
|
ui.com_ch.btn_cash.SetClick(() =>
|
|
{
|
|
if (!GameHelper.GetCloseResult())
|
|
return;
|
|
|
|
ui.btn_claim.SetClick(() => { });
|
|
ui.btn_mult.SetClick(() => { });
|
|
ui.com_ch.btn_cash.SetClick(() => { });
|
|
ui.top_money.GetChild("btn_ch").SetClick(() => { });
|
|
if (IsWin)
|
|
{
|
|
//ui.btn_claim.FireClick(false, true);
|
|
GetReward(AwardNum);
|
|
DOVirtual.DelayedCall(2f, () =>
|
|
{
|
|
GameHelper.addInterAdnumber();
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
|
});
|
|
|
|
}
|
|
else
|
|
{
|
|
GameHelper.addInterAdnumber();
|
|
if (!IsWin)
|
|
GameHelper.SetLevelstate(3);
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
|
GameDispatcher.Instance.Dispatch(GameMsg.reset_game, false);
|
|
|
|
}
|
|
// ui.btn_claim.enabled = false;
|
|
// ui.btn_mult.enabled = false;
|
|
|
|
});
|
|
|
|
ui.top_money.GetChild("btn_ch").SetClick(() =>
|
|
{
|
|
ui.btn_claim.SetClick(() => { });
|
|
ui.btn_mult.SetClick(() => { });
|
|
ui.com_ch.btn_cash.SetClick(() => { });
|
|
ui.top_money.GetChild("btn_ch").SetClick(() => { });
|
|
if (IsWin)
|
|
{
|
|
//ui.btn_claim.FireClick(false, true);
|
|
GetReward(AwardNum);
|
|
DOVirtual.DelayedCall(2f, () =>
|
|
{
|
|
GameHelper.addInterAdnumber();
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
|
});
|
|
|
|
}
|
|
else
|
|
{
|
|
GameHelper.addInterAdnumber();
|
|
if (!IsWin)
|
|
GameHelper.SetLevelstate(3);
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.LevelSuccessUI_Close);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if ((float)DataMgr.Ticket.Value < vo.item_need)
|
|
{
|
|
string str = string.Format(GameHelper.getDesByKey("makeup_2"), vo.item_need);
|
|
ui.com_ch.ch_text.text = str;
|
|
if ((float)DataMgr.Ticket.Value > vo.item_need)
|
|
{
|
|
ui.com_ch.progress.width = 590;
|
|
ui.com_ch.progress_text.text = GameHelper.Get102Str(vo.item_need) + "/" + GameHelper.Get102Str(vo.item_need);
|
|
}
|
|
else
|
|
{
|
|
ui.com_ch.progress.width = 590 * ((float)DataMgr.Ticket.Value / vo.item_need);
|
|
ui.com_ch.progress_text.text = GameHelper.Get102Str(DataMgr.Ticket.Value) + "/" + GameHelper.Get102Str(vo.item_need);
|
|
}
|
|
|
|
Debug.Log((float)DataMgr.Ticket.Value);
|
|
}
|
|
// else if ((float)DataMgr.MakeupTaskH5Time < vo.task_need)
|
|
// {
|
|
// ui.com_ch.ch_text.text = "Cumulataive " + (vo.task_need / 60) + @" minutes in ""Game"" to cash out";
|
|
// if ((float)DataMgr.MakeupTaskH5Time > vo.task_need)
|
|
// {
|
|
// ui.com_ch.progress.width = 590;
|
|
// ui.com_ch.progress_text.text = (vo.task_need / 60) + "/" + (vo.task_need / 60);
|
|
// }
|
|
// else
|
|
// {
|
|
// ui.com_ch.progress.width = 590 * ((float)DataMgr.MakeupTaskH5Time / vo.task_need);
|
|
// ui.com_ch.progress_text.text = Math.Round(((float)(DataMgr.MakeupTaskH5Time / 60)), 2) + "/" + (vo.task_need / 60);
|
|
// }
|
|
//
|
|
// }
|
|
else if (makeupTaskData.videoCount < vo.ad_need)
|
|
{
|
|
|
|
string str = string.Format(GameHelper.getDesByKey("makeup_1"), vo.ad_need);
|
|
ui.com_ch.ch_text.text = str;
|
|
if (makeupTaskData.videoCount > vo.ad_need)
|
|
{
|
|
ui.com_ch.progress.width = 590;
|
|
ui.com_ch.progress_text.text = vo.ad_need + "/" + vo.ad_need;
|
|
}
|
|
else
|
|
{
|
|
ui.com_ch.progress.width = 590 * ((float)makeupTaskData.videoCount / vo.ad_need);
|
|
ui.com_ch.progress_text.text = makeupTaskData.videoCount + "/" + vo.ad_need;
|
|
}
|
|
}
|
|
else if (GameHelper.GetLevel() <= vo.levels_need)
|
|
{
|
|
string str = string.Format(GameHelper.getDesByKey("makeup_3"), vo.levels_need);
|
|
ui.com_ch.ch_text.text = str;
|
|
ui.com_ch.progress.width = 590 * (GameHelper.GetLevel() - 1) / vo.levels_need;
|
|
ui.com_ch.progress_text.text = (GameHelper.GetLevel() - 1) + "/" + vo.levels_need;
|
|
}
|
|
else
|
|
{
|
|
var vo1 = ConfigSystem.GetConfig<MakeupModel>().GetData(makeupTaskData.tableId + 1);
|
|
if (vo1 == null)
|
|
vo1 = vo;
|
|
string str1 = string.Format(GameHelper.getDesByKey("makeup_2"), vo1.item_need);
|
|
ui.com_ch.ch_text.text = str1;
|
|
|
|
if ((float)(DataMgr.Ticket.Value - vo.item_need) < vo1.item_need)
|
|
{
|
|
string str = string.Format(GameHelper.getDesByKey("makeup_2"), vo1.item_need);
|
|
ui.com_ch.ch_text.text = str;
|
|
|
|
ui.com_ch.progress.width = 590f * ((float)(DataMgr.Ticket.Value - vo.item_need) / vo1.item_need);
|
|
ui.com_ch.progress_text.text = GameHelper.Get102Str((DataMgr.Ticket.Value - vo.item_need)) + "/" + GameHelper.Get102Str(vo1.item_need);
|
|
|
|
|
|
// Debug.Log((float)DataMgr.Ticket.Value);
|
|
}
|
|
else if (makeupTaskData.videoCount < vo1.ad_need)
|
|
{
|
|
|
|
string str = string.Format(GameHelper.getDesByKey("makeup_1"), vo1.ad_need);
|
|
ui.com_ch.ch_text.text = str;
|
|
if (makeupTaskData.videoCount > vo1.ad_need)
|
|
{
|
|
ui.com_ch.progress.width = 590f;
|
|
ui.com_ch.progress_text.text = vo1.ad_need + "/" + vo1.ad_need;
|
|
}
|
|
else
|
|
{
|
|
ui.com_ch.progress.width = 590f * ((float)makeupTaskData.videoCount / vo1.ad_need);
|
|
ui.com_ch.progress_text.text = makeupTaskData.videoCount + "/" + vo1.ad_need;
|
|
}
|
|
}
|
|
else if (GameHelper.GetLevel() <= vo1.levels_need)
|
|
{
|
|
string str = string.Format(GameHelper.getDesByKey("makeup_3"), vo1.levels_need);
|
|
ui.com_ch.ch_text.text = str;
|
|
ui.com_ch.progress.width = 590f * (GameHelper.GetLevel() - 1) / vo1.levels_need;
|
|
ui.com_ch.progress_text.text = (GameHelper.GetLevel() - 1) + "/" + vo1.levels_need;
|
|
}
|
|
|
|
else
|
|
{
|
|
|
|
string str = string.Format(GameHelper.getDesByKey("makeup_3"), vo1.levels_need);
|
|
ui.com_ch.ch_text.text = str;
|
|
ui.com_ch.progress.width = 590f * (GameHelper.GetLevel() - 1) / vo1.levels_need;
|
|
ui.com_ch.progress_text.text = (GameHelper.GetLevel() - 1) + "/" + vo1.levels_need;
|
|
}
|
|
|
|
|
|
}
|
|
if (successData_.boost_array != null && GameHelper.IsGiftSwitch())
|
|
{
|
|
(ui.wheel.GetChild("wheel_") as wheel_).t0.Play(Scroll);
|
|
(ui.wheel.GetChild("wheel_") as wheel_).t1.Play(() =>
|
|
{
|
|
rate_idnex++;
|
|
ui.btn_mult.title = "(" + GameHelper.getChString((decimal)successData_.cash_number * successData_.boost_array[rate_idnex % 5]) + ")";
|
|
});
|
|
ui.btn_mult.title = "(" + GameHelper.getChString((decimal)successData_.cash_number * successData_.boost_array[rate_idnex]) + ")";
|
|
|
|
list_1 = new List<item_wheel>() { (ui.wheel.GetChild("wheel_") as wheel_).item_0, (ui.wheel.GetChild("wheel_") as wheel_).item_1, (ui.wheel.GetChild("wheel_") as wheel_).item_2, (ui.wheel.GetChild("wheel_") as wheel_).item_3, (ui.wheel.GetChild("wheel_") as wheel_).item_4, (ui.wheel.GetChild("wheel_") as wheel_).item_5, (ui.wheel.GetChild("wheel_") as wheel_).item_6, (ui.wheel.GetChild("wheel_") as wheel_).item_7, };
|
|
// list_1[2].img_light.visible = true;
|
|
|
|
for (int i = 0; i < list_1.Count; i++)
|
|
{
|
|
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
|
|
list_1[i].text_rate.text = "X" + successData_.boost_array[i % successData_.boost_array.Length];
|
|
}
|
|
}
|
|
}
|
|
List<item_wheel> list_1;
|
|
private int rate_idnex = 3;
|
|
private int scroll_number;
|
|
List<int> rate_list = new List<int>();
|
|
private int scroll_type = 1;
|
|
|
|
private void StartScroll()
|
|
{
|
|
(ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = (ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = 5.0f;
|
|
scroll_type = 2;
|
|
}
|
|
private void Scroll()
|
|
{
|
|
if (scroll_type == 1)
|
|
{
|
|
scroll_number++;
|
|
rate_list.Clear();
|
|
for (int i = 0; i < 8; i++)
|
|
{
|
|
rate_list.Add(successData_.boost_array[(scroll_number + i) % successData_.boost_array.Length]);
|
|
}
|
|
Debug.Log(JsonConvert.SerializeObject(rate_list));
|
|
for (int i = 0; i < list_1.Count; i++)
|
|
{
|
|
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
|
|
list_1[i].text_rate.text = "X" + rate_list[i];
|
|
}
|
|
|
|
(ui.wheel.GetChild("wheel_") as wheel_).t1.Play(() =>
|
|
{
|
|
rate_idnex++;
|
|
ui.btn_mult.title = "(" + GameHelper.getChString((decimal)successData_.cash_number * successData_.boost_array[rate_idnex % successData_.boost_array.Length]) + ")";
|
|
});
|
|
|
|
(ui.wheel.GetChild("wheel_") as wheel_).t0.Play(Scroll);
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
scroll_number++;
|
|
|
|
rate_list.Clear();
|
|
for (int i = 0; i < 8; i++)
|
|
{
|
|
rate_list.Add(successData_.boost_array[(scroll_number + i) % successData_.boost_array.Length]);
|
|
}
|
|
|
|
// bool need_return = false;
|
|
if (((ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale < 2.2f) && (list_1[4].text_rate.text == ("X" + successData_.rate)))
|
|
{
|
|
//开始领取
|
|
float reward = successData_.cash_number * successData_.rate;
|
|
|
|
if (GameHelper.IsGiftSwitch())
|
|
GetReward(reward);
|
|
else
|
|
GetReward(reward);
|
|
GameDispatcher.Instance.Dispatch(GameMsg.RefreshMakeupData);
|
|
SaveData.GetSaveObject().LargeRewardNum++;
|
|
SaveData.saveDataFunc();
|
|
return;
|
|
}
|
|
for (int i = 0; i < list_1.Count; i++)
|
|
{
|
|
list_1[i].type.selectedIndex = (i + scroll_number) % 3;
|
|
list_1[i].text_rate.text = "X" + rate_list[i];
|
|
Debug.Log((ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale);
|
|
}
|
|
|
|
// if (need_return)
|
|
// {
|
|
// (ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = 0;
|
|
// return;
|
|
// }
|
|
|
|
(ui.wheel.GetChild("wheel_") as wheel_).t1.Play(() =>
|
|
{
|
|
rate_idnex++;
|
|
ui.btn_mult.title = "(" + GameHelper.getChString((decimal)successData_.cash_number * successData_.boost_array[rate_idnex % successData_.boost_array.Length]) + ")";
|
|
});
|
|
|
|
(ui.wheel.GetChild("wheel_") as wheel_).t0.Play(Scroll);
|
|
(ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale = (ui.wheel.GetChild("wheel_") as wheel_).t0.timeScale - 0.3f;
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|