using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class InitLogic : MonoBehaviour
{
    private void Start()
    {
        Application.targetFrameRate = 60;

        ToukaSDKManager.Instance.initAnalytics();
        ToukaSDKManager.Instance.initAdsSDK();

#if UNITY_EDITOR
        EnterGame();
#elif IOS_CN
        TGTools.Instance.onAgreeHander += ShowAntiAddiction;
        TGTools.Instance.ShowUserAgreementView("卡通剧情", "8");
#endif
    }

    private void ShowAntiAddiction()
    {
        TGTools.Instance.onAgreeHander -= ShowAntiAddiction;

        ToukaUtils.InitTenjinFirst();
    
        if (StaticOnlineParams.IsShowAuthViewOnlineParams.DefaultValue.Equals("1"))
        {
            TGiOSAdManager.Instance.onAntiSuccessHander += AntiSucceed;
            TGiOSAdManager.Instance.ShowAntiView();
        }
        else
        {
            EnterGame();
        }
    }

    private void AntiSucceed()
    {
        TGiOSAdManager.Instance.onAntiSuccessHander -= AntiSucceed;
        EnterGame();
    }

    private void EnterGame()
    {
        SceneManager.LoadScene("Main");
    }
}