mergemilitary/Assets/Scripts/Logic/InitLogic.cs

55 lines
1.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if USE_IAP
using UnityEngine.Purchasing;
#endif
public class InitLogic : MonoBehaviour
{
private void Start()
{
Application.targetFrameRate = 60;
Input.multiTouchEnabled = false;
AudioManager.Instance.SetSoundOn(SettingData.Instance.IsSoundOn);
VibrateManager.Instance.SetVibrateOn(SettingData.Instance.IsVibrateOn);
GameManager.Instance.GameSpeed = 1;
#if USE_IAP
if (GameConfig.Instance.UseDiamond)
{
List<DataIAP> tIAPProducts = TableIAP.Instance.GetAll();
Dictionary<string, ProductType> tProductDic = new Dictionary<string, ProductType>();
for (int i = 0; i < tIAPProducts.Count; i++)
{
tProductDic.Add(tIAPProducts[i].ProductID, ProductType.Consumable);
}
IAPTool.Instance.AddProducts(tProductDic);
}
#endif
#if UNITY_EDITOR
MMOModule.Instance.EnableMMO(GameConfig.Instance.IsDebug);
#else
MMOModule.Instance.EnableMMO(TKGSDKManager.Instance.IsIAPEnabled);
#endif
TKGSDKManager.Instance.InitSDK(SDKDone);
TKGSDKManager.Instance.IsRemoveAds = PlayerData.Instance.IsNoAds;
TKGSDKManager.Instance.SetGameFocusListener(AudioManager.Instance.SetListenerOn);
if (GameConfig.Instance.IsDebug)
{
SRDebug.Init();
}
}
private void SDKDone()
{
PlayerData.Instance.Login();
MMOModule.Instance.Init(GameManager.Instance.LoadGame);
}
}