|
|
|
@@ -4,19 +4,19 @@ using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using DG.Tweening;
|
|
|
|
|
using FairyGUI;
|
|
|
|
|
using FGUI.P01_Common;
|
|
|
|
|
using FGUI.P11_Wheel;
|
|
|
|
|
using FGUI.ZM_Common_01;
|
|
|
|
|
using FGUI.ZM_Turntable_11;
|
|
|
|
|
using Spine.Unity;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace FlowerPower
|
|
|
|
|
namespace LoveLegend
|
|
|
|
|
{
|
|
|
|
|
public class WheelViewUI : BaseUI
|
|
|
|
|
{
|
|
|
|
|
private WheelViewUICtrl ctrl;
|
|
|
|
|
private WheelViewModel model;
|
|
|
|
|
private readonly int[] vidieWeight = new int[8];
|
|
|
|
|
private TurntableModel turntableData;
|
|
|
|
|
private List<Turntable> turntableData;
|
|
|
|
|
|
|
|
|
|
private List<com_coin> ItemList = new();
|
|
|
|
|
private bool isClickSpin;
|
|
|
|
@@ -28,7 +28,7 @@ namespace FlowerPower
|
|
|
|
|
private Action closeCallback;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private FGUI.P11_Wheel.com_wheel ui;
|
|
|
|
|
private FGUI.ZM_Turntable_11.com_wheel ui;
|
|
|
|
|
|
|
|
|
|
public WheelViewUI(WheelViewUICtrl ctrl) : base(ctrl)
|
|
|
|
|
{
|
|
|
|
@@ -38,7 +38,7 @@ namespace FlowerPower
|
|
|
|
|
|
|
|
|
|
protected override void SetUIInfo(UIInfo uiInfo)
|
|
|
|
|
{
|
|
|
|
|
uiInfo.packageName = "P11_Wheel";
|
|
|
|
|
uiInfo.packageName = "ZM_Turntable_11";
|
|
|
|
|
uiInfo.assetName = "com_wheel";
|
|
|
|
|
uiInfo.layerType = UILayerType.Popup;
|
|
|
|
|
uiInfo.isNeedOpenAnim = true;
|
|
|
|
@@ -56,20 +56,18 @@ namespace FlowerPower
|
|
|
|
|
protected override void OnClose()
|
|
|
|
|
{
|
|
|
|
|
HallManager.Instance.UpdateSecondEvent -= UpdateTime;
|
|
|
|
|
GameDispatcher.Instance.Dispatch(GameMsg.RefreshRedDot);
|
|
|
|
|
|
|
|
|
|
GameHelper.showGameUI = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnBind()
|
|
|
|
|
{
|
|
|
|
|
ui = baseUI as FGUI.P11_Wheel.com_wheel;
|
|
|
|
|
ui = baseUI as FGUI.ZM_Turntable_11.com_wheel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnOpenBefore(object args)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// ui.t1.Play();
|
|
|
|
|
|
|
|
|
|
LoadLastCheckDate();
|
|
|
|
|
|
|
|
|
|
CheckNewDay();
|
|
|
|
@@ -87,7 +85,7 @@ namespace FlowerPower
|
|
|
|
|
|
|
|
|
|
HallManager.Instance.UpdateSecondEvent += UpdateTime;
|
|
|
|
|
|
|
|
|
|
turntableData = ConfigSystem.GetConfig<TurntableModel>();
|
|
|
|
|
turntableData = ConfigSystem.GetConfig<Turntable>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
normalAnim = FXManager.Instance.SetFx<SkeletonAnimation>(ui.light_parent, Fx_Type.fx_wheel, ref closeCallback);
|
|
|
|
@@ -98,11 +96,6 @@ namespace FlowerPower
|
|
|
|
|
|
|
|
|
|
InitView();
|
|
|
|
|
|
|
|
|
|
if (GameHelper.IsGiftSwitch() && ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1)
|
|
|
|
|
{
|
|
|
|
|
(ui.spin.GetChild("img_saveingpot") as GImage).visible = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private DateTime _lastCheckDate;
|
|
|
|
|
private const string PlayerPrefsKeyLastCheckDate = "Wheel_new_days";
|
|
|
|
@@ -135,7 +128,7 @@ namespace FlowerPower
|
|
|
|
|
if (_lastCheckDate != currentDate)
|
|
|
|
|
{
|
|
|
|
|
// 重置 ThisDayWatchSlyderVideoNum
|
|
|
|
|
PreferencesMgr.Instance.ThisDayWatchSlyderVideoNum = 0;
|
|
|
|
|
DataMgr.ThisDayWatchSlyderVideoNum.Value = 0;
|
|
|
|
|
|
|
|
|
|
// 更新最后检查的日期并保存到PlayerPrefs
|
|
|
|
|
_lastCheckDate = currentDate;
|
|
|
|
@@ -151,17 +144,13 @@ namespace FlowerPower
|
|
|
|
|
normalAnim.state.SetAnimation(0, "daiji", true);
|
|
|
|
|
for (var i = 0; i < ItemList.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
vidieWeight[i] = turntableData.dataList[i].weight;
|
|
|
|
|
vidieWeight[i] = turntableData[i].weight;
|
|
|
|
|
}
|
|
|
|
|
ui.disc.rotation = 0;
|
|
|
|
|
ui.spin.SetClick(SpineAnim);
|
|
|
|
|
ui.btn_spin.SetClick(SpineAnim);
|
|
|
|
|
ui.close.SetClick(() =>
|
|
|
|
|
{
|
|
|
|
|
// ui.t2.Play(() => { });
|
|
|
|
|
TimerHelper.mEasy.AddTimer(0.15f, () =>
|
|
|
|
|
{
|
|
|
|
|
CtrlCloseUI();
|
|
|
|
|
});
|
|
|
|
|
CtrlCloseUI();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -172,7 +161,7 @@ namespace FlowerPower
|
|
|
|
|
for (int i = 0; i < ItemList.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
var item = ItemList[i];
|
|
|
|
|
var turntable = turntableData.dataList[i];
|
|
|
|
|
var turntable = turntableData[i];
|
|
|
|
|
var id = turntable.wheel_item;
|
|
|
|
|
var quantity = turntable.quantity;
|
|
|
|
|
|
|
|
|
@@ -187,10 +176,11 @@ namespace FlowerPower
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var times = PreferencesMgr.Instance.ThisDayWatchSlyderVideoNum;
|
|
|
|
|
var times = DataMgr.ThisDayWatchSlyderVideoNum.Value;
|
|
|
|
|
var limits = GameHelper.GetCommonModel().wheelTimes[0];
|
|
|
|
|
ui.text_spintimes.SetVar("times", times.ToString()).FlushVars();
|
|
|
|
|
ui.text_spintimes.SetVar("limits", limits.ToString()).FlushVars();
|
|
|
|
|
ui.limit.SetVar("times", times.ToString()).FlushVars();
|
|
|
|
|
ui.limit.SetVar("limit", limits.ToString()).FlushVars();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -228,7 +218,7 @@ namespace FlowerPower
|
|
|
|
|
if (isClickSpin)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (GameHelper.GetNowTime() < PreferencesMgr.Instance.NextOpenWheelStampTime) return;
|
|
|
|
|
if (GameHelper.GetNowTime() < DataMgr.NextOpenWheelStampTime.Value) return;
|
|
|
|
|
|
|
|
|
|
if (isClickAbleWatchAD)
|
|
|
|
|
{
|
|
|
|
@@ -255,20 +245,20 @@ namespace FlowerPower
|
|
|
|
|
ui.close.touchable = false;
|
|
|
|
|
ui.close.grayed = false;
|
|
|
|
|
|
|
|
|
|
ui.spin.touchable = false;
|
|
|
|
|
ui.btn_spin.touchable = false;
|
|
|
|
|
|
|
|
|
|
var index = CommonHelper.GetIndexByChanceList(vidieWeight);
|
|
|
|
|
var data = turntableData.dataList[index];
|
|
|
|
|
var data = turntableData[index];
|
|
|
|
|
var angle = 3600 - (data.Seq - 1) * 45;
|
|
|
|
|
AudioManager.Instance.PlayDynamicEffect(AudioConst.wheel_spin);
|
|
|
|
|
DOTween.To(() => ui.disc.rotation, e => ui.disc.rotation = e, angle, turnTime)
|
|
|
|
|
.SetEase(Ease.OutQuad);
|
|
|
|
|
|
|
|
|
|
ResultTween = DOVirtual.DelayedCall(turnTime, () => ReceivePlane(data, index));
|
|
|
|
|
ResultTween = DOVirtual.DelayedCall(turnTime, () => ReceivePlane(data,index));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ReceivePlane(Turntable vo, int index)
|
|
|
|
|
private void ReceivePlane(Turntable vo,int index)
|
|
|
|
|
{
|
|
|
|
|
normalAnim.state.SetAnimation(0, "zhongjiang", true);
|
|
|
|
|
|
|
|
|
@@ -279,9 +269,9 @@ namespace FlowerPower
|
|
|
|
|
ui.close.touchable = true;
|
|
|
|
|
ui.close.grayed = false;
|
|
|
|
|
|
|
|
|
|
ui.spin.cont_spin.selectedIndex = btn_go.Spin_grey;
|
|
|
|
|
ui.btn_spin.cont_spin.selectedIndex = btn_go1.Spin_grey;
|
|
|
|
|
|
|
|
|
|
ui.spin.cont_state.selectedIndex = btn_go.State_Video;
|
|
|
|
|
ui.btn_spin.cont_state.selectedIndex = btn_go1.State_Video;
|
|
|
|
|
|
|
|
|
|
var id = vo.wheel_item;
|
|
|
|
|
var quantity = vo.quantity;
|
|
|
|
@@ -293,18 +283,15 @@ namespace FlowerPower
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var endPoint = GameHelper.GetUICenterPosition(ui.point);
|
|
|
|
|
if (id == 102)
|
|
|
|
|
{
|
|
|
|
|
endPoint = GameHelper.GetUICenterPosition(ui.point_102);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var rewardData = new RewardData();
|
|
|
|
|
var rewardSingleData = new RewardSingleData(id, (decimal)quantity, RewardOrigin.LuckyWheel, index)
|
|
|
|
|
var rewardSingleData = new RewardSingleData(id, (decimal)quantity, RewardOrigin.LuckyWheel,index)
|
|
|
|
|
{
|
|
|
|
|
endPosition = new Vector2(endPoint.x - 150, endPoint.y - 136),
|
|
|
|
|
};
|
|
|
|
|
rewardData.AddReward(rewardSingleData);
|
|
|
|
|
rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.Dialog | RewardDisplayType.ValueChange;
|
|
|
|
|
rewardData.displayType = RewardDisplayType.RewardFly | RewardDisplayType.Dialog |
|
|
|
|
|
RewardDisplayType.ValueChange;
|
|
|
|
|
rewardData.AddCompleted((isScu) =>
|
|
|
|
|
{
|
|
|
|
|
normalAnim.state.SetAnimation(0, "daiji", true);
|
|
|
|
@@ -313,9 +300,9 @@ namespace FlowerPower
|
|
|
|
|
|
|
|
|
|
GameDispatcher.Instance.Dispatch(GameMsg.GetReward, rewardData);
|
|
|
|
|
|
|
|
|
|
PreferencesMgr.Instance.NextOpenWheelStampTime =
|
|
|
|
|
DataMgr.NextOpenWheelStampTime.Value =
|
|
|
|
|
GameHelper.GetNowTime() + GameHelper.GetCommonModel().wheelTimes[1];
|
|
|
|
|
PreferencesMgr.Instance.ThisDayWatchSlyderVideoNum++;
|
|
|
|
|
DataMgr.ThisDayWatchSlyderVideoNum.Value++;
|
|
|
|
|
|
|
|
|
|
UpdateTime();
|
|
|
|
|
refreshData();
|
|
|
|
@@ -324,36 +311,36 @@ namespace FlowerPower
|
|
|
|
|
|
|
|
|
|
private void UpdateTime()
|
|
|
|
|
{
|
|
|
|
|
if (PreferencesMgr.Instance.ThisDayWatchSlyderVideoNum >= GameHelper.GetCommonModel().wheelTimes[0])
|
|
|
|
|
if (DataMgr.ThisDayWatchSlyderVideoNum.Value >= GameHelper.GetCommonModel().wheelTimes[0])
|
|
|
|
|
{
|
|
|
|
|
DateTime currentTime = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ui.spin.cont_state.selectedIndex = btn_go.State_Limit;
|
|
|
|
|
ui.spin.touchable = false;
|
|
|
|
|
ui.spin.enabled = false;
|
|
|
|
|
ui.spin.cont_spin.selectedIndex = btn_go.Spin_grey;
|
|
|
|
|
ui.btn_spin.cont_state.selectedIndex = btn_go1.State_Limit;
|
|
|
|
|
ui.btn_spin.touchable = false;
|
|
|
|
|
ui.btn_spin.enabled = false;
|
|
|
|
|
ui.btn_spin.cont_spin.selectedIndex = btn_go1.Spin_grey;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (GameHelper.GetNowTime() >= PreferencesMgr.Instance.NextOpenWheelStampTime)
|
|
|
|
|
if (GameHelper.GetNowTime() >= DataMgr.NextOpenWheelStampTime.Value)
|
|
|
|
|
{
|
|
|
|
|
ui.spin.touchable = true;
|
|
|
|
|
ui.spin.enabled = true;
|
|
|
|
|
ui.spin.cont_spin.selectedIndex = btn_go.Spin_none;
|
|
|
|
|
ui.spin.cont_state.selectedIndex = btn_go.State_None;
|
|
|
|
|
ui.btn_spin.touchable = true;
|
|
|
|
|
ui.btn_spin.enabled = true;
|
|
|
|
|
ui.btn_spin.cont_spin.selectedIndex = btn_go1.Spin_none;
|
|
|
|
|
ui.btn_spin.cont_state.selectedIndex = btn_go1.State_None;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ui.spin.touchable = false;
|
|
|
|
|
ui.spin.enabled = false;
|
|
|
|
|
ui.spin.cont_spin.selectedIndex = btn_go.Spin_grey;
|
|
|
|
|
ui.spin.cont_state.selectedIndex = btn_go.State_Video;
|
|
|
|
|
ui.btn_spin.touchable = false;
|
|
|
|
|
ui.btn_spin.enabled = false;
|
|
|
|
|
ui.btn_spin.cont_spin.selectedIndex = btn_go1.Spin_grey;
|
|
|
|
|
ui.btn_spin.cont_state.selectedIndex = btn_go1.State_Video;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui.spin.text_time.text = model.NextOpenWheelTimeStr;
|
|
|
|
|
ui.btn_spin.text_time.text = model.NextOpenWheelTimeStr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|