827 lines
28 KiB
C#
827 lines
28 KiB
C#
using System;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
using Spine.Unity;
|
|
using FairyGUI;
|
|
using FGUI.P01_Common;
|
|
using FGUI.P06_Hall;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using Random = UnityEngine.Random;
|
|
using Unity.VisualScripting;
|
|
using Newtonsoft.Json;
|
|
using System.IO;
|
|
namespace FlowerPower
|
|
{
|
|
public class HallUI : BaseUI
|
|
{
|
|
private HallUICtrl ctrl;
|
|
private HallModel model;
|
|
public FGUI.P06_Hall.com_hall ui;
|
|
|
|
public static bool isClosed = false;
|
|
|
|
private long userUid;
|
|
public int ad_numbers = 0;
|
|
public int ad_times = 0;
|
|
public int active_cd = 10;
|
|
private Tweener tweener;
|
|
|
|
private SkeletonAnimation anim_ad;
|
|
private bool hasPlayedBgAni = false;
|
|
|
|
#if FlowerPowerRelease
|
|
private int ActiveTimeNum = 5 * 60;
|
|
#else
|
|
private int ActiveTimeNum = 1 * 60;
|
|
#endif
|
|
|
|
|
|
private int limitTimes = 600;
|
|
private string formattedDate = "";
|
|
public HallUI(HallUICtrl ctrl) : base(ctrl)
|
|
{
|
|
uiName = UIConst.HallUI;
|
|
this.ctrl = ctrl;
|
|
}
|
|
|
|
protected override void SetUIInfo(UIInfo uiInfo)
|
|
{
|
|
uiInfo.packageName = "P06_Hall";
|
|
uiInfo.assetName = "com_hall";
|
|
uiInfo.layerType = UILayerType.Normal;
|
|
uiInfo.isNeedOpenAnim = false;
|
|
uiInfo.isNeedCloseAnim = false;
|
|
uiInfo.isNeedUIMask = false;
|
|
}
|
|
|
|
#region 生命周期
|
|
|
|
protected override void OnInit()
|
|
{
|
|
model = moduleManager.GetModel(ModelConst.HallModel) as HallModel;
|
|
InitData();
|
|
}
|
|
|
|
private bool signRed()
|
|
{
|
|
for (int i = 0; i < 7; i++)
|
|
{
|
|
var signDays = PreferencesMgr.Instance.SignState.Count;
|
|
var isToday = true;
|
|
if (signDays > 0)
|
|
isToday = GameHelper.InToday(PreferencesMgr.Instance.SignState[signDays - 1], 0, true);
|
|
|
|
else if (i == signDays)
|
|
{
|
|
if (signDays > 0 && isToday)
|
|
{
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private bool wheelRed()
|
|
{
|
|
var times = PreferencesMgr.Instance.ThisDayWatchSlyderVideoNum;
|
|
var limits = GameHelper.GetCommonModel().wheelTimes[0];
|
|
if (times >= limits)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
protected override void OnClose()
|
|
{
|
|
HallManager.Instance.UpdateSecondEvent -= UpBtnCoin;
|
|
HallManager.Instance.UpdateSecondEvent -= updateSpeedCD;
|
|
|
|
isClosed = true;
|
|
//关闭时保存cd数据
|
|
PlayerPrefs.SetInt($"active_cd_num_{userUid}", active_cd);
|
|
HallManager.Instance.countTimes = (int)Time.time;
|
|
HallManager.Instance.UpdateSecondEvent -= UpdateEvent;
|
|
CommonHelper.FadeOut(ui);
|
|
tweener?.Kill();
|
|
closeCallback?.Invoke();
|
|
}
|
|
|
|
protected override void OnBind()
|
|
{
|
|
ui = baseUI as FGUI.P06_Hall.com_hall;
|
|
}
|
|
|
|
protected override void OnOpenBefore(object args)
|
|
{
|
|
if (Screen.safeArea.y != 0)
|
|
{
|
|
ui.btn_gold.y += Screen.safeArea.y - 15;
|
|
ui.com_money.y += Screen.safeArea.y - 15;
|
|
|
|
}
|
|
ui.state.selectedIndex = GameHelper.IsGiftSwitch() ? 1 : 0;
|
|
(ui.com_money as com_money).btn_ch.title = GameHelper.getDesByKey("ch_out_1");
|
|
|
|
HallManager.Instance.UpdateSecondEvent += UpdateEvent;
|
|
CreateGoldtimeList();
|
|
|
|
int num = PlayerPrefs.GetInt("new_one", 0);
|
|
|
|
// if (!GameHelper.IsGiftSwitch() && num == 0)
|
|
// {
|
|
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GuideViewUI_Open);
|
|
// }
|
|
|
|
System.DateTime dataTime = System.DateTime.Now;
|
|
formattedDate = dataTime.ToString("yyyy_MM_dd");
|
|
|
|
int hall_cd = PlayerPrefs.GetInt($"coin_cd_times_{formattedDate}", 0);
|
|
if (HallManager.Instance.countTimes != 0)
|
|
{
|
|
int cds = (int)Time.time - HallManager.Instance.countTimes;
|
|
cds = hall_cd - cds;
|
|
PlayerPrefs.SetInt($"coin_cd_times_{formattedDate}", cds <= 0 ? 0 : cds);
|
|
HallManager.Instance.countTimes = 0;
|
|
}
|
|
|
|
|
|
var reqData = new RespLoginFunnelData
|
|
{
|
|
type = "enterHall",
|
|
payload = ""
|
|
};
|
|
NetworkKit.PostFunnelLogin(reqData);
|
|
|
|
|
|
isClosed = false;
|
|
|
|
var loginModel = GameHelper.GetLoginModel();
|
|
userUid = loginModel.uid;
|
|
|
|
RankSystemMgr.Instance.checkUsers();
|
|
InitView();
|
|
UpBtnCoin();
|
|
|
|
HallManager.Instance.UpdateSecondEvent += UpBtnCoin;
|
|
HallManager.Instance.UpdateSecondEvent += updateSpeedCD;
|
|
|
|
var fx_luck_gift = FXManager.Instance.SetFx<SkeletonAnimation>((ui.btn_luck_gift as btn_luck_gift).ani_node, Fx_Type.fx_luck_gift, ref closeCallback);
|
|
fx_luck_gift.state.SetAnimation(0, "animation", true);
|
|
|
|
var fx_coin = FXManager.Instance.SetFx<SkeletonAnimation>(ui.btn_gold.GetChild("ani_node") as GGraph, Fx_Type.fx_coin, ref closeCallback);
|
|
fx_coin.state.SetAnimation(0, "animation", true);
|
|
|
|
// var sk = FXManager.Instance.SetFx<SkeletonAnimation>(ui.com_start.btn_play.GetChild("btn_parent") as GGraph, Fx_Type.fx_btn_start, ref closeCallback);
|
|
// sk.state.SetAnimation(0, "play", true);
|
|
var fx_logo = FXManager.Instance.SetFx<SkeletonAnimation>(ui.com_start.GetChild("bg_parent") as GGraph, Fx_Type.fx_logo, ref closeCallback);
|
|
fx_logo.state.SetAnimation(0, "animation2", true);
|
|
|
|
ui.btn_menu.SetClick(() =>
|
|
{
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.MenuUI_Open);
|
|
});
|
|
ui.btn_sign.SetClick(() =>
|
|
{
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.SignInUI_Open);
|
|
});
|
|
ui.btn_failpack.SetClick(() =>
|
|
{
|
|
float progress = GameHelper.showResurgence();
|
|
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.ResurgenceUI_Open, progress);
|
|
});
|
|
if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 0 || !GameHelper.IsGiftSwitch())
|
|
{
|
|
ui.btn_saveingpot.visible = false;
|
|
}
|
|
ui.btn_saveingpot.SetClick(() => { uiCtrlDispatcher.Dispatch(UICtrlMsg.SaveingPotUI_Open); });
|
|
|
|
if (ConfigSystem.GetConfig<CommonModel>().PiggyBankSwitch == 1 && GameHelper.IsGiftSwitch())
|
|
{
|
|
bool isPopPot = false;
|
|
if (HallManager.Instance.activeTime > ActiveTimeNum)
|
|
{
|
|
if (GameHelper.GetLoginModel().new_player)
|
|
{
|
|
isPopPot = true;
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.SaveingPotUI_Open);
|
|
}
|
|
else
|
|
{
|
|
if (DateTime.Now.Day != PlayerPrefs.GetInt("pot_day", 0))
|
|
{
|
|
isPopPot = true;
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.SaveingPotUI_Open);
|
|
PlayerPrefs.SetInt("pot_day", DateTime.Now.Day);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!isPopPot)
|
|
{
|
|
var data = SaveLocalData.GetSaveLocalObject().rankRewardData;
|
|
if (data.Count > 0 && !HallManager.Instance.isShowRankView)
|
|
{
|
|
HallManager.Instance.isShowRankView = true;
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.RankRewardUI_Open);
|
|
}
|
|
}
|
|
}
|
|
|
|
ui.btn_faq.SetClick(() =>
|
|
{
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.FAQUI_Open);
|
|
});
|
|
|
|
ui.btn_restore.SetClick(() =>
|
|
{
|
|
PurchasingManager.Instance.IosRestore((success,message)=>{
|
|
Debug.Log("[barry] restore success message: " + message);
|
|
if (success)
|
|
{
|
|
Debug.Log("[barry] restore success: " + success);
|
|
GameHelper.ShowTips("Restore Purchases Success!");
|
|
// SaveData.GetSaveobject().is_get_packreward = success;
|
|
SaveData.GetSaveobject().have_slot = success;
|
|
}
|
|
else
|
|
{
|
|
// Debug.Log("[barry] restore failed: " + success);
|
|
GameHelper.ShowTips("There are no recoverable transactions");
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
GameHelper.IsShowFirstReward();
|
|
|
|
GameHelper.IsShowPettyReward();
|
|
}
|
|
private void RefreshSaveingPot(object isShow = null)
|
|
{
|
|
// (ui.btn_saveingpot as btn_saveingpot).text_nowch.text = SaveingPotHelper.getChString(SaveData.GetSaveobject().saveingpot_ch);
|
|
}
|
|
|
|
private string jsonstr = null;
|
|
|
|
protected override void OnOpen(object args)
|
|
{
|
|
// CommonHelper.FadeIn(ui);
|
|
ui.visible = false;
|
|
}
|
|
|
|
protected override void OnHide()
|
|
{
|
|
}
|
|
|
|
protected override void OnDisplay(object args)
|
|
{
|
|
}
|
|
|
|
public override void OnSwitchLanguage()
|
|
{
|
|
base.OnSwitchLanguage();
|
|
InitView();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 消息
|
|
|
|
protected override void AddListener()
|
|
{
|
|
HallManager.Instance.AddChangeGiftSwitch(InitView);
|
|
GameDispatcher.Instance.AddListener(GameMsg.RefreshMakeupData, OnRefreshMakeupData);
|
|
|
|
PreferencesDispatcher<int>.Instance.AddListener(PreferencesMsg.playerAvatarId, UpdataAvatar);
|
|
PreferencesDispatcher<string>.Instance.AddListener(PreferencesMsg.playerName, OnChangeName);
|
|
GameDispatcher.Instance.AddListener(GameMsg.RefreshRedDot, RefreshRed);
|
|
GameDispatcher.Instance.AddListener(GameMsg.UpdateNoads, SetBtnAds);
|
|
GameDispatcher.Instance.AddListener(GameMsg.RefreshSaveingPot, RefreshSaveingPot);
|
|
|
|
}
|
|
|
|
protected override void RemoveListener()
|
|
{
|
|
HallManager.Instance.RemoveChangeGiftSwitch(InitView);
|
|
PreferencesDispatcher<int>.Instance.RemoveListener(PreferencesMsg.playerAvatarId, UpdataAvatar);
|
|
PreferencesDispatcher<string>.Instance.RemoveListener(PreferencesMsg.playerName, OnChangeName);
|
|
GameDispatcher.Instance.RemoveListener(GameMsg.RefreshRedDot, RefreshRed);
|
|
GameDispatcher.Instance.RemoveListener(GameMsg.RefreshMakeupData, OnRefreshMakeupData);
|
|
GameDispatcher.Instance.RemoveListener(GameMsg.UpdateNoads, SetBtnAds);
|
|
GameDispatcher.Instance.RemoveListener(GameMsg.RefreshSaveingPot, RefreshSaveingPot);
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
private List<Paidcoins> Paidcoins_list = ConfigSystem.GetConfig<PaidcoinsModel>().dataList;
|
|
|
|
private int time_count = 11;
|
|
private FGUI.P01_Common.com_broadcast_text1 text_ui;
|
|
|
|
void CreateGoldtimeList()
|
|
{
|
|
// 获取保存对象
|
|
var saveObject = SaveData.GetSaveobject();
|
|
|
|
// 检查_goldtime是否为null或者长度与Paidcoins_list.Count不相等
|
|
if (saveObject._goldtime == null || saveObject._goldtime.Length != Paidcoins_list.Count)
|
|
{
|
|
// 重置_goldtime,并创建一个新的数组,长度为Paidcoins_list.Count
|
|
saveObject._goldtime = new int[Paidcoins_list.Count];
|
|
}
|
|
}
|
|
private void UpBtnCoin()
|
|
{
|
|
int free_index = 0;
|
|
for (int i = 0; i < Paidcoins_list.Count; i++)
|
|
{
|
|
if (!Paidcoins_list[i].is_paid)
|
|
{
|
|
free_index = i;
|
|
}
|
|
}
|
|
int time = SaveData.GetSaveobject()._goldtime[free_index];
|
|
com_gold btn_gold = ui.btn_gold as com_gold;
|
|
if (time + Paidcoins_list[free_index].receive_CD < GameHelper.GetNowTime())
|
|
{
|
|
btn_gold.state.selectedIndex = 2;
|
|
}
|
|
else btn_gold.state.selectedIndex = 1;
|
|
|
|
checkThreeGift();
|
|
if (!GameHelper.IsGiftSwitch()) return;
|
|
|
|
// time_count++;
|
|
// if (time_count > 10)
|
|
// {
|
|
// ui.broadcast.visible = false;
|
|
// }
|
|
// if (time_count > 30)
|
|
// {
|
|
// time_count = 0;
|
|
// 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.broadcast.visible = true;
|
|
|
|
// if (text_ui == null) text_ui = ui.broadcast.GetChild("broad_cast_text") as com_broadcast_text1;
|
|
// text_ui.cast_text.text = String.Format(text_ui.show_text.text, ConfigSystem.GetConfig<exBrPoolModel>().config_name_list[name_index],
|
|
// ConfigSystem.GetConfig<exBrPoolModel>().config_money_list[money_index], DateTimeManager.Instance.GetCurrDateTime());
|
|
// text_ui.t0.Play(() => { ui.broadcast.visible = false; });
|
|
// }
|
|
RefreshSaveingPot();
|
|
}
|
|
|
|
void OnRefreshMakeupData(object obj)
|
|
{
|
|
SetMakeup();
|
|
}
|
|
|
|
void UpdateEvent()
|
|
{
|
|
long t = SaveData.GetSaveobject().failed_pack_time;
|
|
|
|
if (SaveData.GetSaveobject().failed_pack_time > GameHelper.GetNowTime())
|
|
{
|
|
ui.btn_failpack.visible = true;
|
|
long time_ = t * 1000 - GameHelper.getNowTimeByMillisecond();
|
|
DateTime oldDate = new DateTime(1970, 1, 1);
|
|
oldDate = oldDate.AddMilliseconds(time_);
|
|
ui.btn_failpack.GetChild("lab_time").text = DateTimeManager.Instance.DateTimeToFFFString(oldDate);
|
|
}
|
|
else
|
|
{
|
|
ui.btn_failpack.visible = false;
|
|
}
|
|
|
|
SetSpeedState();
|
|
|
|
}
|
|
private void InitData()
|
|
{
|
|
model.showCoin = PreferencesMgr.Instance.Currency101;
|
|
model.showDollar = PreferencesMgr.Instance.Currency102;
|
|
}
|
|
|
|
private Action closeCallback;
|
|
|
|
private void InitView()
|
|
{
|
|
|
|
Set101();
|
|
|
|
UpdataAvatar();
|
|
|
|
SetMakeup();
|
|
|
|
SetName(ui.text_name);
|
|
|
|
RefreshRed();
|
|
|
|
SetBtnAds();
|
|
|
|
if (HallManager.Instance.enterHallTimes == 1)
|
|
{
|
|
reCreatPur();
|
|
}
|
|
|
|
// WebviewManager.Instance.showDarkWebview();
|
|
|
|
ui.com_start.btn_play.lab_level.SetVar("cont", GameHelper.GetLevel().ToString()).FlushVars();
|
|
|
|
var btnpetty = ui.btn_petty as btn_petty;
|
|
btnpetty.visible = GameHelper.IsGiftSwitch();
|
|
btnpetty.SetClick(OnClickPetty);
|
|
btnpetty.t0.Play();
|
|
|
|
|
|
|
|
SetSpeedState();
|
|
|
|
var btnSpeed = ui.btn_speed as btn_speed;
|
|
btnSpeed?.t0.Play();
|
|
|
|
ui.btn_speed.SetClick(OnClickSpeed);
|
|
|
|
ui.com_start.btn_play.SetClick(OnClickPlay);
|
|
|
|
ui.btn_wheel.SetClick(() => { OnClickLuckySpin(); });
|
|
|
|
ui.btn_master.SetClick(() => { OnClickPass(); });
|
|
|
|
//
|
|
|
|
ui.btn_luck_gift.SetClick(() =>
|
|
{
|
|
if (!SaveData.GetSaveobject().is_get_packreward && !SaveData.GetSaveobject().is_get_removead)
|
|
{
|
|
// if (btn_noads.img_ad.visible)
|
|
// {
|
|
// PackRewardData param = new PackRewardData();
|
|
// param.isAutoPop = false;
|
|
// param.isNeedScroll = true;
|
|
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open, param);
|
|
// }
|
|
// else
|
|
// {
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open);
|
|
// }
|
|
|
|
}
|
|
else if (SaveData.GetSaveobject().is_get_packreward)
|
|
{
|
|
PackRewardData param = new PackRewardData();
|
|
param.isAutoPop = false;
|
|
param.isNeedScroll = true;
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open, param);
|
|
}
|
|
else
|
|
{
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PackrewardUI_Open);
|
|
}
|
|
});
|
|
|
|
var btnCoin = ui.btn_gold as com_gold;
|
|
btnCoin.text_gold.text = $"{PreferencesMgr.Instance.Currency101:N0}";
|
|
btnCoin.SetClick(() =>
|
|
{
|
|
GameDispatcher.Instance.Dispatch(GameMsg.MainTab, 1);
|
|
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.BuygoldUI_Open, false);
|
|
|
|
});
|
|
|
|
ui.btn_head.SetClick(() => { UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PersonViewUI_Open); });
|
|
UpdataAvatar();
|
|
|
|
ad_times = PlayerPrefs.GetInt("main_ad_times", 0);
|
|
ad_numbers = PlayerPrefs.GetInt("main_ad_numbers", 1);
|
|
|
|
if (HallManager.Instance.enterHallTimes == 1)
|
|
{
|
|
reCreatPur();
|
|
}
|
|
|
|
|
|
// if (!GameHelper.IsGiftSwitch())
|
|
// {
|
|
//
|
|
// }
|
|
|
|
ui.btn_three_day.SetClick(() =>
|
|
{
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.ThreeDaysGiftUI_Open);
|
|
});
|
|
|
|
ui.btn_rank.SetClick(() =>
|
|
{
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RankUI_Open);
|
|
});
|
|
|
|
}
|
|
|
|
private void SetSpeedState()
|
|
{
|
|
if (!GameHelper.IsGiftSwitch() || SaveData.GetSaveobject().IsBuySpeedGift)
|
|
{
|
|
ui.btn_speed.visible = false;
|
|
}
|
|
}
|
|
|
|
private int time_number = 0;
|
|
void updateSpeedCD()
|
|
{
|
|
if (PreferencesMgr.Instance.MakeupTaskHistory.Count < 1) return;
|
|
MakeupTaskData data = PreferencesMgr.Instance.MakeupTaskHistory[PreferencesMgr.Instance.MakeupTaskHistory.Count - 1];
|
|
com_money com_Money = ui.com_money as com_money;
|
|
if (data.status != MakeupTaskStatus.Level)
|
|
{
|
|
com_Money.group_tips.visible = false;
|
|
return;
|
|
}
|
|
if (data.ch_time > GameHelper.GetNowTime())
|
|
{
|
|
com_Money.text_time.text = "Only " + CommonHelper.TimeFormat((int)data.ch_time - Convert.ToInt32(GameHelper.GetNowTime()), CountDownType.Hour);
|
|
}
|
|
else
|
|
{
|
|
com_Money.group_tips.visible = false;
|
|
return;
|
|
}
|
|
|
|
time_number++;
|
|
if (time_number > 15)
|
|
{
|
|
com_Money.group_tips.visible = true;
|
|
}
|
|
if (time_number > 20)
|
|
{
|
|
com_Money.group_tips.visible = false;
|
|
time_number = 0;
|
|
}
|
|
}
|
|
|
|
private void checkThreeGift(object obj = null)
|
|
{
|
|
// if (SaveData.GetSaveobject().is_get_ThreeDaysGift) {
|
|
var isToday = GameHelper.InToday(SaveData.GetSaveobject().last_got_three_gift_time, 0, true);
|
|
int three_gift_got_index = SaveData.GetSaveobject().three_gift_got_index;
|
|
if (three_gift_got_index > (int)rewardState.day3)
|
|
{
|
|
ui.btn_three_day.visible = false;
|
|
}
|
|
else if (!isToday)
|
|
{
|
|
ui.btn_three_day.GetChild("red").visible = true;
|
|
}
|
|
else
|
|
{
|
|
ui.btn_three_day.GetChild("red").visible = false;
|
|
}
|
|
// }
|
|
}
|
|
void reCreatPur(object a = null)
|
|
{
|
|
PurchasingManager.Instance.startPay();
|
|
}
|
|
|
|
void SetBtnAds(object a = null)
|
|
{
|
|
// if (SaveData.GetSaveobject().is_get_removead && SaveData.GetSaveobject().is_get_packreward)
|
|
// {
|
|
// ui.btn_luck_gift.visible = false;
|
|
// }
|
|
// if (!SaveData.GetSaveobject().is_get_removead && !SaveData.GetSaveobject().is_get_packreward)
|
|
// {
|
|
// btn_noads.t0.Play(-1, 0, null);
|
|
// }
|
|
// else if (SaveData.GetSaveobject().is_get_removead && SaveData.GetSaveobject().is_get_packreward)
|
|
// {
|
|
// btn_noads.t0.Stop();
|
|
// btn_noads.visible = false;
|
|
// }
|
|
// else if (SaveData.GetSaveobject().is_get_packreward)
|
|
// {
|
|
// btn_noads.t0.Stop();
|
|
// btn_noads.t1.Play();
|
|
// //btn_noads.state.selectedIndex = 0;
|
|
// btn_noads.img_pack.visible = false;
|
|
// btn_noads.img_ad.visible = true;
|
|
//
|
|
// }
|
|
// else if (SaveData.GetSaveobject().is_get_removead)
|
|
// {
|
|
// btn_noads.t0.Stop();
|
|
// btn_noads.t1.Play();
|
|
// btn_noads.img_pack.visible = true;
|
|
// btn_noads.img_ad.visible = false;
|
|
// //btn_noads.state.selectedIndex = 1;
|
|
// }
|
|
|
|
}
|
|
|
|
void SetMakeup(object a = null)
|
|
{
|
|
var money = ui.com_money as com_money;
|
|
money.number_text.text = GameHelper.Get102Str();
|
|
|
|
DOVirtual.Float(0, (float)PreferencesMgr.Instance.Currency102, 1,
|
|
value => { money.number_text.text = $"{GameHelper.Get102Str((decimal)value)}"; });
|
|
|
|
if (GameHelper.IsGiftSwitch())
|
|
{
|
|
if (PreferencesMgr.Instance.MakeupTaskHistory.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var makeupTaskData = PreferencesMgr.Instance.MakeupTaskHistory.Last();
|
|
var vo = ConfigSystem.GetConfig<MakeupModel>().dataList
|
|
.FirstOrDefault(rd => rd.id == makeupTaskData.tableId);
|
|
if (vo == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
money.btn_ch.SetClick(() =>
|
|
{
|
|
uiCtrlDispatcher.Dispatch(UICtrlMsg.MakeupConfirmUI_Open, makeupTaskData);
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void RefreshRed(object isShow = null)
|
|
{
|
|
ui.btn_master.GetChild("red").visible = SaveData.battlepassred();
|
|
ui.btn_rank.GetChild("red").visible = SaveLocalData.GetSaveLocalObject().rankRewardData.Count > 0;
|
|
(ui.btn_sign as btn_sign).red.visible = signRed();
|
|
(ui.btn_wheel as btn_spin).red.visible = wheelRed();
|
|
}
|
|
private void OnClickLuckySpin()
|
|
{
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.WheelUI_Open);
|
|
}
|
|
|
|
|
|
private void OnClickPass()
|
|
{
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PassViewUI_Open);
|
|
}
|
|
|
|
private void OnClickPetty()
|
|
{
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PettyAwardUI_Open);
|
|
}
|
|
|
|
private void OnClickSpeed()
|
|
{
|
|
if (!SaveData.GetSaveobject().IsBuySpeedGift)
|
|
{
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.SuperSpeedUI_Open);
|
|
}
|
|
|
|
}
|
|
|
|
private void OnClickPlay()
|
|
{
|
|
// if (GameHelper.IsGiftSwitch() && !SaveData.GetSaveobject().have_slot && (DateTime.Now.Day != PlayerPrefs.GetInt("off_new", 0)))
|
|
// {
|
|
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.AddviewnewUI_Open);
|
|
// PlayerPrefs.SetInt("off_new", DateTime.Now.Day);
|
|
// }
|
|
// else if (GameHelper.IsGiftSwitch() && !SaveData.GetSaveobject().have_slot && Random.Range(0, 100) < ConfigSystem.GetConfig<CommonModel>().BonusInside)
|
|
// {
|
|
// uiCtrlDispatcher.Dispatch(UICtrlMsg.AddviewnewUI_Open);
|
|
// }
|
|
// else
|
|
// {
|
|
GameHelper.gameType = 0;
|
|
GameDispatcher.Instance.Dispatch(GameMsg.OpenGame);
|
|
// }
|
|
}
|
|
|
|
public void OnUpdate101(object obj = null)
|
|
{
|
|
if (obj != null)
|
|
{
|
|
var changeValue = (decimal)obj;
|
|
model.showCoin += changeValue;
|
|
Set101(model.showCoin);
|
|
}
|
|
}
|
|
|
|
public void OnUpdate102(object obj = null)
|
|
{
|
|
if (obj != null)
|
|
{
|
|
var changeValue = (decimal)obj;
|
|
model.showDollar += changeValue;
|
|
Set102(model.showDollar);
|
|
|
|
}
|
|
}
|
|
private void UpdataAvatar(object obj = null)
|
|
{
|
|
var head = ui.btn_head as btn_head;
|
|
GameHelper.SetSelfAvatar(head.load_avatar);
|
|
}
|
|
|
|
public void Set101(decimal coin = -1)
|
|
{
|
|
if (coin < 0)
|
|
{
|
|
coin = PreferencesMgr.Instance.Currency101;
|
|
}
|
|
|
|
var btnCoin = ui.btn_gold as com_gold;
|
|
btnCoin.text_gold.text = $"{coin:N0}";
|
|
}
|
|
|
|
public void Set102(decimal money = -1)
|
|
{
|
|
if (money < 0)
|
|
{
|
|
money = PreferencesMgr.Instance.Currency102;
|
|
}
|
|
|
|
var btnCoin = ui.com_money as com_money;
|
|
btnCoin.number_text.text = $"{money:N}";
|
|
}
|
|
private void OnChangeName(ChangeValue<string> obj)
|
|
{
|
|
GameHelper.SetName(ui.text_name);
|
|
}
|
|
|
|
private void SetName(GTextField gTextField)
|
|
{
|
|
GameHelper.SetName(gTextField);
|
|
}
|
|
|
|
private void showBgAni() {
|
|
if (!hasPlayedBgAni) {
|
|
var fx_hall = FXManager.Instance.SetFx<SkeletonAnimation>(ui.ani_bg as GGraph, Fx_Type.fx_hall, ref closeCallback);
|
|
fx_hall.state.SetAnimation(0, "animation", true);
|
|
hasPlayedBgAni = true;
|
|
}
|
|
}
|
|
|
|
public void onShowAnim(object show)
|
|
{
|
|
if (show != null)
|
|
{
|
|
ui.visible = true;
|
|
|
|
if ((bool)show)
|
|
{
|
|
ui.show1.Play(() => {
|
|
ui.ani_bg.visible = true;
|
|
showBgAni();
|
|
});
|
|
}
|
|
else
|
|
{
|
|
ui.show2.Play(() => {
|
|
ui.ani_bg.visible = true;
|
|
showBgAni();
|
|
});
|
|
}
|
|
|
|
|
|
GameDispatcher.Instance.Dispatch(GameMsg.showBroadCast);
|
|
|
|
isHide = true;
|
|
}
|
|
}
|
|
|
|
private bool isHide = true;
|
|
|
|
public void onHideAnim(object hide)
|
|
{
|
|
if (hide != null && isHide)
|
|
{
|
|
if ((bool)hide)
|
|
{
|
|
ui.ani_bg.visible = false;
|
|
ui.hide1.Play();
|
|
}
|
|
else
|
|
{
|
|
ui.ani_bg.visible = false;
|
|
ui.hide2.Play();
|
|
}
|
|
GameDispatcher.Instance.Dispatch(GameMsg.hideBroadCast);
|
|
isHide = false;
|
|
}
|
|
}
|
|
}
|
|
} |