fix:1、添加项目
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
|
||||
namespace FlowerPower
|
||||
{
|
||||
public class HallCtrl : BaseCtrl
|
||||
{
|
||||
public static HallCtrl Instance { get; private set; }
|
||||
|
||||
private HallModel model;
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd5b8e4d648549379d2bc8fcaa0d9a40
|
||||
timeCreated: 1671086538
|
||||
@@ -0,0 +1,49 @@
|
||||
|
||||
namespace FlowerPower
|
||||
{
|
||||
public class HallModel : BaseModel
|
||||
{
|
||||
public decimal showCoin;
|
||||
public decimal showDollar;
|
||||
|
||||
#region 生命周期
|
||||
protected override void OnInit()
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
// protected override void OnReset()
|
||||
// {
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region 读取数据
|
||||
// protected override void OnReadData()
|
||||
// {
|
||||
// }
|
||||
// #endregion
|
||||
|
||||
// #region 本地存储
|
||||
|
||||
|
||||
// protected override void WriteLocalStorage()
|
||||
// {
|
||||
|
||||
// }
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
protected override void AddListener()
|
||||
{
|
||||
|
||||
}
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8449d0d7ae894f44859f02aaf355ea00
|
||||
timeCreated: 1671086538
|
||||
@@ -0,0 +1,827 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3aca551ceb44e4f80986c9da6881522
|
||||
timeCreated: 1671086538
|
||||
@@ -0,0 +1,179 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace FlowerPower
|
||||
{
|
||||
public class HallUICtrl : BaseUICtrl
|
||||
{
|
||||
private HallUI ui;
|
||||
private HallModel model;
|
||||
|
||||
private uint openUIMsg = UICtrlMsg.MainUI_Open;
|
||||
private uint closeUIMsg = UICtrlMsg.MainUI_Close;
|
||||
|
||||
#if ChillConnectRelease
|
||||
private readonly float _countTime = 5 * 60.0f;
|
||||
#else
|
||||
private readonly float _countTime = 1 * 60.0f;
|
||||
#endif
|
||||
|
||||
#region 生命周期
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
model = moduleManager.GetModel(ModelConst.HallModel) as HallModel;
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OpenUI(object args = null)
|
||||
{
|
||||
if (ui == null)
|
||||
{
|
||||
ui = new HallUI(this);
|
||||
ui.Open(args);
|
||||
|
||||
ui.onShowAnim(args);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.onShowAnim(args);
|
||||
}
|
||||
}
|
||||
|
||||
public override void CloseUI(object args = null)
|
||||
{
|
||||
if (args != null && ui != null)
|
||||
{
|
||||
ui.onHideAnim(args);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ui != null && !ui.isClose)
|
||||
{
|
||||
ui.Close();
|
||||
}
|
||||
|
||||
ui = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 消息
|
||||
|
||||
public override uint GetOpenUIMsg(string uiName)
|
||||
{
|
||||
return openUIMsg;
|
||||
}
|
||||
|
||||
public override uint GetCloseUIMsg(string uiName)
|
||||
{
|
||||
return closeUIMsg;
|
||||
}
|
||||
|
||||
protected override void AddListener()
|
||||
{
|
||||
uiCtrlDispatcher.AddListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.AddListener(closeUIMsg, CloseUI);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.Update101, OnUpdate101);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.Update101Completed, OnUpdate101Completed);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.Update102, OnUpdate102);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.Update102Completed, OnUpdate102Completed);
|
||||
HallManager.Instance.UpdateSecondEvent += RefreshConfig;
|
||||
|
||||
}
|
||||
|
||||
protected override void RemoveListener()
|
||||
{
|
||||
uiCtrlDispatcher.RemoveListener(openUIMsg, OpenUI);
|
||||
uiCtrlDispatcher.RemoveListener(closeUIMsg, CloseUI);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.Update101, OnUpdate101);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.Update102, OnUpdate102);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.Update101Completed, OnUpdate101Completed);
|
||||
GameDispatcher.Instance.RemoveListener(GameMsg.Update102Completed, OnUpdate102Completed);
|
||||
HallManager.Instance.UpdateSecondEvent -= RefreshConfig;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected override void AddServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void RemoveServerListener()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void OnUpdate101(object obj)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
ui?.OnUpdate101(obj);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUpdate101Completed(object obj = null)
|
||||
{
|
||||
if (!PreferencesMgr.Instance.IsShowRewardFly101)
|
||||
{
|
||||
var value = PreferencesMgr.Instance.Currency101;
|
||||
model.showCoin = value;
|
||||
ui?.Set101();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUpdate102(object obj)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
ui?.OnUpdate102(obj);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnUpdate102Completed(object obj = null)
|
||||
{
|
||||
if (!PreferencesMgr.Instance.IsShowRewardFly102)
|
||||
{
|
||||
var value = PreferencesMgr.Instance.Currency102;
|
||||
model.showDollar = value;
|
||||
ui?.Set102();
|
||||
|
||||
if (PreferencesMgr.Instance.MakeupTaskHistory.Count == 1)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int _lastUpdateTime;
|
||||
|
||||
private void RefreshConfig()
|
||||
{
|
||||
_lastUpdateTime++;
|
||||
// Debug.Log($"barry RefreshConfig======= {_lastUpdateTime}");
|
||||
if (_lastUpdateTime <= _countTime) return;
|
||||
_lastUpdateTime = 0;
|
||||
NetworkKit.PostWithHeader<LoginModel>("settingRefresh", null, (isSuccess, obj) =>
|
||||
{
|
||||
var savedCfgName = PlayerPrefs.GetString("configFileName");
|
||||
if (!isSuccess) return;
|
||||
|
||||
if (savedCfgName.Equals(obj.setting)) return;
|
||||
// Debug.Log($"barry===== setting==== {obj.setting}" );
|
||||
var loginData = GameHelper.GetLoginModel();
|
||||
loginData.setting = obj.setting;
|
||||
|
||||
NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetConfig,2);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 27962707aa6b41ea8d03411c27188be0
|
||||
timeCreated: 1671086538
|
||||
Reference in New Issue
Block a user