fix:1、添加项目
This commit is contained in:
@@ -0,0 +1,182 @@
|
||||
namespace FlowerPower
|
||||
{
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Unity.VisualScripting;
|
||||
using IgnoreOPS;
|
||||
|
||||
public class HallManager : BaseUnityManager<HallManager>
|
||||
{
|
||||
public event Action UpdateSecondEvent;
|
||||
public event Action UpdateFiveSecondEvent;
|
||||
|
||||
private float _secondTime;
|
||||
private float _secondTime1;
|
||||
private LoginModel loginModel;
|
||||
private bool isGameStart;
|
||||
private GameDataSystem gameDataSys;
|
||||
private WindowSystem windowSys;
|
||||
private RewardSystem rewardSys;
|
||||
private ConsumeSystem consumeSys;
|
||||
|
||||
private bool isFirstEnter = true;
|
||||
public int enterHallTimes = 0;
|
||||
public bool isShowRankView = false;
|
||||
public event Action UpdateEvent;
|
||||
|
||||
public int countTimes = 0;
|
||||
public int activeTime = 0;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
CtrlDispatcher.Instance.AddListener(CtrlMsg.Game_Start, OnGameStart);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.OpenGame, EnterGame);
|
||||
GameDispatcher.Instance.AddListener(GameMsg.BackMainScene, EnterHall);
|
||||
|
||||
AppDispatcher.Instance.AddListener(MainThreadMsg.App_Focus_True, BackToGame);
|
||||
InitSystem();
|
||||
}
|
||||
|
||||
private void InitSystem()
|
||||
{
|
||||
gameDataSys = new GameDataSystem();
|
||||
windowSys = new WindowSystem();
|
||||
rewardSys = new RewardSystem();
|
||||
consumeSys = new ConsumeSystem();
|
||||
}
|
||||
|
||||
void BackToGame(object obj = null)
|
||||
{
|
||||
if (MaxPayManager.isPay)
|
||||
{
|
||||
MaxPayManager.isPay = false;
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
|
||||
MaxPayManager.Instance.PaySuccess();
|
||||
}
|
||||
var last_time = PlayerPrefs.GetInt("Dayreftimes", 0);
|
||||
DateTime newDate = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
newDate = newDate.AddSeconds(GameHelper.GetNowTime(true));
|
||||
// Debug.Log($"barry newdate==== {newDate}");
|
||||
var newDays = newDate.Day;
|
||||
|
||||
}
|
||||
private void OnGameStart(object obj)
|
||||
{
|
||||
var lang = PlayerPrefsKit.ReadString("LangIdKey");
|
||||
if (lang.IsNullOrWhiteSpace())
|
||||
{
|
||||
lang = "en";
|
||||
}
|
||||
|
||||
if (GameHelper.GetLoginModel().new_player)
|
||||
{
|
||||
SaveData.GetSaveobject().ExchangeModeToggle = ConfigSystem.GetConfig<CommonModel>().ExchangeModeToggle;
|
||||
SaveData.GetSaveobject().ExchangeProcessMode = ConfigSystem.GetConfig<CommonModel>().ExchangeProcessMode;
|
||||
SaveData.GetSaveobject().CHProcessMode = ConfigSystem.GetConfig<CommonModel>().CHProcessMode;
|
||||
}
|
||||
|
||||
PurchasingManager.Instance.InitProduct();
|
||||
UIManager.Instance.SetSwitchLanguage(lang);
|
||||
EnterHall();
|
||||
UnityManager.Instance.initACTData();
|
||||
isGameStart = true;
|
||||
|
||||
bool enterGame = CommonHelper.GetBoolByChance(ConfigSystem.GetConfig<CommonModel>().roomrate / 100f);
|
||||
// if (GameHelper.IsGiftSwitch() && enterGame)
|
||||
// {
|
||||
// if (!SaveData.GetSaveobject().have_slot && UnityEngine.Random.Range(0, 100) < ConfigSystem.GetConfig<CommonModel>().BonusInside)
|
||||
// {
|
||||
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.AddviewnewUI_Open);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
EnterGame(enterGame);
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
private void EnterHall(object obj = null)
|
||||
{
|
||||
int index = obj != null ? (int)obj : 2;
|
||||
|
||||
enterHallTimes++;
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PlayUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RewardAniUI_Close);
|
||||
AudioManager.Instance.StopBGM();
|
||||
AudioManager.Instance.PlayBGM(AudioConst.hallbgm);
|
||||
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Open, index);
|
||||
if (GameHelper.IsGiftSwitch()) UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.BroadcastUI_Open);
|
||||
|
||||
|
||||
GameHelper.PlayGameTimeEvent(1);
|
||||
}
|
||||
|
||||
|
||||
private void EnterGame(object obj)
|
||||
{
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainTabUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.MainUI_Close);
|
||||
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.RainPlayUI_Open);
|
||||
AudioManager.Instance.StopBGM();
|
||||
|
||||
AudioManager.Instance.PlayBGM(AudioConst.gamebgm);
|
||||
|
||||
}
|
||||
|
||||
#region 缓存资源
|
||||
|
||||
public void GetGalleryNet(int imageID, Action<bool> action = null)
|
||||
{
|
||||
StartCoroutine(TextureHelper.GetGalleryFromNet(imageID, action));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!isGameStart) return;
|
||||
UpdateEvent?.Invoke();
|
||||
_secondTime += Time.deltaTime;
|
||||
_secondTime1 += Time.deltaTime;
|
||||
if (_secondTime >= 1)
|
||||
{
|
||||
_secondTime = 0;
|
||||
activeTime++;
|
||||
if (UpdateSecondEvent == null)
|
||||
{
|
||||
Debug.Log("xxxxxxx");
|
||||
}
|
||||
UpdateSecondEvent?.Invoke();
|
||||
}
|
||||
|
||||
if (_secondTime1 >= 5)
|
||||
{
|
||||
_secondTime1 = 0;
|
||||
UpdateFiveSecondEvent?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddChangeGiftSwitch(Action action)
|
||||
{
|
||||
}
|
||||
|
||||
public void RemoveChangeGiftSwitch(Action action)
|
||||
{
|
||||
}
|
||||
|
||||
void OnApplicationQuit()
|
||||
{
|
||||
PreferencesMgr.Instance.ImmediateSendSave();
|
||||
}
|
||||
|
||||
private bool isInH5;
|
||||
|
||||
public void SetInH5(bool isInH5)
|
||||
{
|
||||
this.isInH5 = isInH5;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user