123 lines
3.4 KiB
C#
123 lines
3.4 KiB
C#
// #if UNITY_EDITOR
|
|
// #endif
|
|
|
|
using Dont_Confuse;
|
|
using IgnoreOPS;
|
|
using UnityEngine;
|
|
|
|
namespace ChillConnect
|
|
{
|
|
public class MainScene : BaseScene
|
|
{
|
|
public override int SceneIdx => 0;
|
|
|
|
|
|
protected override void OnEnter()
|
|
{
|
|
}
|
|
|
|
protected override void OnLeave()
|
|
{
|
|
}
|
|
|
|
protected override void OnSwitchSceneComplete(object param = null)
|
|
{
|
|
|
|
StartUpAppProcess();
|
|
|
|
}
|
|
|
|
private void StartUpAppProcess()
|
|
{
|
|
OnPermanentAssetsInitComplete();
|
|
}
|
|
|
|
private void OnPermanentAssetsInitComplete(object param = null)
|
|
{
|
|
CtrlDispatcher.Instance.AddListener(CtrlMsg.Login_Succeed, OnLoginSucceed);
|
|
var isAssetBundleLoad = false;
|
|
|
|
// SuperApplication.Instance.AddComponent<AppsFlyerObjectScript1>();
|
|
|
|
#if !UNITY_EDITOR && UNITY_IOS
|
|
// MaxADKit.Init();
|
|
#endif
|
|
|
|
#if UNITY_EDITOR
|
|
isAssetBundleLoad = false;
|
|
#else
|
|
isAssetBundleLoad = false;
|
|
#endif
|
|
if (isAssetBundleLoad)
|
|
{
|
|
int value = 0;
|
|
ChillConnectFileKit.GetLocalAssetBundle(
|
|
max => { GameDispatcher.Instance.Dispatch(GameMsg.UpdateHotFixMax, max + 1); }, () =>
|
|
{
|
|
value++;
|
|
// GameDispatcher.Instance.Dispatch(GameMsg.UpdateHotFixProgress, value);
|
|
});
|
|
}
|
|
else
|
|
{
|
|
OnInitAsset();
|
|
}
|
|
|
|
AppDispatcher.Instance.AddListener(AppMsg.UI_LoadingInitAsset, OnInitAsset);
|
|
}
|
|
|
|
private void OnLoginSucceed(object param = null)
|
|
{
|
|
CtrlDispatcher.Instance.RemoveListener(CtrlMsg.Login_Succeed, OnLoginSucceed);
|
|
}
|
|
|
|
private void OnInitAsset(object param = null)
|
|
{
|
|
AppDispatcher.Instance.Dispatch(AppMsg.AppManagerRegister);
|
|
AppDispatcher.Instance.Dispatch(AppMsg.InitUIMgr);
|
|
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
|
|
AppDispatcher.Instance.AddListener(AppMsg.LoginInit, OnLoadingComplete);
|
|
|
|
// DataMgr.InitPreferences();
|
|
NetworkDispatcher.Instance.Dispatch(NetworkMsg.GetConfig);
|
|
}
|
|
private bool ispen = false;
|
|
private void OnLoadingComplete(object param = null)
|
|
{
|
|
|
|
CtrlDispatcher.Instance.Dispatch(CtrlMsg.Game_StartReady);
|
|
if (GameHelper.IsGiftSwitch() && !ispen)
|
|
{
|
|
ispen = true;
|
|
WebviewManager.DakaiACT();
|
|
}
|
|
TimerHelper.mEasy.AddTimer(2.0f, () =>
|
|
{
|
|
|
|
AudioManager.Instance.InitDefaultButtonClickSound(AudioConst.gameclick);
|
|
ModuleManager.Instance.AllModuleGameStart();
|
|
ShowScene();
|
|
SaveingPotHelper.CheckSaveingPot();
|
|
SaveingPotHelper.TestingClearTime();
|
|
if (GameHelper.IsGiftSwitch())
|
|
{
|
|
// WebviewManager.Instance.openWebview();
|
|
}
|
|
|
|
});
|
|
}
|
|
|
|
private static bool is_open;
|
|
private void ShowScene()
|
|
{
|
|
if (is_open) return;
|
|
is_open = true;
|
|
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.GameLoginUI_Open);
|
|
}
|
|
|
|
public override void Dispose()
|
|
{
|
|
}
|
|
}
|
|
}
|