private void Awake() { if (Instance) { enabled = false; return; } Instance = this; }
public override void OnInspectorGUI() { DrawDefaultInspector(); Tic80Config tic80Config = (Tic80Config)target; Tic80 activeComponent = tic80Config.GetComponents <Tic80> ().ToList().Find(x => x.enabled); if (GUILayout.Button("Make Cover")) { if (Application.isPlaying) { activeComponent.SaveScreenshot(); } else { Debug.LogError("The cover can only be produce in runtime"); } } }
public void OnEnable() { if (this.enabled) { var scripts = GetComponents <Tic80> (); foreach (var item in scripts) { if (item != this) { item.enabled = false; } } } Application.targetFrameRate = Tic80Config.FRAMERATE; QualitySettings.vSyncCount = 0; Screen.SetResolution(Tic80Config.SCREEN_AND_BORDER_WIDTH, Tic80Config.SCREEN_AND_BORDER_HEIGHT, false); screenTexture = View.Instance.GetScreenTexture(); borderTexture = View.Instance.GetBorderTexture(); tic80Config = GetComponent <Tic80Config> (); if (!isInited) { tic80Config.OnFontChange += OnFontChange; } if (!isInited) { tic80Config.OnPaletteChange += OnPaletteChange; } #if UNITY_EDITOR GameViewUtils.InitTIC80Size((int)tic80Config.ViewScale); #endif Invoke("init", 0f); border(); isInited = true; }