Пример #1
0
    private void OnValidate()
    {
        Palette   = _palette;
        Font      = _font;
        ViewScale = _viewScale;
#if UNITY_EDITOR
        if (Instance)
        {
            GameViewUtils.InitTIC80Size((int)ViewScale);
        }
#endif
    }
Пример #2
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;
    }