#define STEAM using System; using System.Collections; using System.Diagnostics; using com.adjust.sdk; using RedShellUnity; using Steamworks; using UnityEngine; using Wizard; namespace Cute; public class BootSystem : MonoBehaviour { [SerializeField] [Tooltip("チェックするとMaxFramerateが有効")] private bool _dontVsync; [SerializeField] [Range(0f, 60f)] private int _maxFramerate; public static bool isRootBootCamera; private Coroutine _logCoroutine; private string _logMsg = ""; private void Awake() { _logMsg += "Awake"; if (isRootBootCamera) { UnityEngine.Object.Destroy(GameObject.Find("BootCamera")); isRootBootCamera = false; } VisibleBootCamera(enable: true); UnityEngine.Object.DontDestroyOnLoad(base.gameObject); } private IEnumerator Start() { _logCoroutine = StartCoroutine(WaitToAccumulateTraceLog()); _logMsg += " Start"; while (Toolbox.DeviceManager == null) { yield return 0; } _logMsg += " DeviceManager"; while (Toolbox.SavedataManager == null) { yield return 0; } _logMsg += " SavedataManager"; while (Toolbox.QualityManager == null) { yield return 0; } _logMsg += " QualityManager"; while (Toolbox.SceneManager == null) { yield return 0; } _logMsg += " SceneManager"; while (Toolbox.ResourcesManager == null) { yield return 0; } _logMsg += " ResourcesManager"; while (Toolbox.AssetManager == null) { yield return 0; } _logMsg += " AssetManager"; while (Toolbox.AudioManager == null) { yield return 0; } _logMsg += " AudioManager"; while (Toolbox.MovieManager == null) { yield return 0; } _logMsg += " MovieManager"; SocialServiceUtility.CreateInstance(); bootAdjust(); setupRedShell(); if (_dontVsync) { QualitySettings.vSyncCount = 0; Application.targetFrameRate = _maxFramerate; } StopCoroutine(_logCoroutine); Toolbox.BootSystem = this; } private IEnumerator WaitToAccumulateTraceLog() { yield return new WaitForSeconds(5f); LocalLog.AccumulateTraceInquiryLog("BootSystem " + _logMsg); } private void bootAdjust() { try { } catch (Exception ex) { LocalLog.AccumulateTraceLog(ex.ToString()); } Adjust.addSessionCallbackParameter("viewer_id", Certification.ViewerId.ToString()); } private void OnDestroy() { } public void VisibleBootCamera(bool enable) { GameObject gameObject = base.transform.Find("BootCamera").gameObject; if (gameObject != null) { gameObject.SetActive(enable); } } [Conditional("STEAM")] private void setupRedShell() { RedShell.SetVerboseLogs(verboseLogs: true); RedShell.SetApiKey("04b8d4a58416140132fdcd680b17a0d8"); try { RedShell.SetUserId(SteamUser.GetSteamID().m_SteamID.ToString()); } catch (Exception ex) { Debug.LogError("steam client が起動していない。steamの機能を使えません。"); Debug.LogError(ex.Message); Debug.LogError(ex.StackTrace); } RedShell.MarkConversion(); } }