Exemple #1
0
 private void Awake()
 {
     if (Instance)
     {
         enabled = false;
         return;
     }
     Instance = this;
 }
Exemple #2
0
    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");
            }
        }
    }
Exemple #3
0
    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;
    }