mergemilitary/Assets/Scripts/Logic/InitLogic.cs

55 lines
1.6 KiB
C#
Raw Normal View History

2022-05-23 13:39:59 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2022-07-04 11:17:39 +00:00
#if USE_IAP
using UnityEngine.Purchasing;
#endif
2022-05-23 13:39:59 +00:00
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);
2022-07-04 11:17:39 +00:00
GameManager.Instance.GameSpeed = 1;
2022-05-23 13:39:59 +00:00
2022-07-04 11:17:39 +00:00
#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
2022-10-10 08:11:41 +00:00
2022-09-09 14:35:49 +00:00
2022-10-08 02:31:53 +00:00
#if UNITY_EDITOR
MMOModule.Instance.EnableMMO(GameConfig.Instance.IsDebug);
#else
2022-09-28 11:41:06 +00:00
MMOModule.Instance.EnableMMO(TKGSDKManager.Instance.IsIAPEnabled);
2022-10-08 02:31:53 +00:00
#endif
2022-09-28 11:41:06 +00:00
2022-07-04 11:17:39 +00:00
TKGSDKManager.Instance.InitSDK(SDKDone);
2022-09-09 14:35:49 +00:00
TKGSDKManager.Instance.IsRemoveAds = PlayerData.Instance.IsNoAds;
TKGSDKManager.Instance.SetGameFocusListener(AudioManager.Instance.SetListenerOn);
2022-07-04 11:17:39 +00:00
2022-05-23 13:39:59 +00:00
if (GameConfig.Instance.IsDebug)
{
SRDebug.Init();
}
}
2022-07-04 11:17:39 +00:00
private void SDKDone()
{
2022-10-10 08:11:41 +00:00
PlayerData.Instance.Login();
2022-07-04 11:17:39 +00:00
MMOModule.Instance.Init(GameManager.Instance.LoadGame);
}
2022-05-23 13:39:59 +00:00
}