Example #1
0
 public void GamePause()
 {
     audioSource.Pause();
     currentState = StaticVar.STATE_GAME_PAUSE;
     uiController.ActivateUI(StaticVar.UI_MENU_PAUSE);
     Time.timeScale = 0;
 }
Example #2
0
    private void FinishGame()
    {
        m_bFinished = true;

        float colorDiff    = 0.0f;
        var   paintTexture = m_painter.PaintTexture;

        for (int x = 0; x < paintTexture.width; x++)
        {
            for (int y = 0; y < paintTexture.height; y++)
            {
                Color color       = paintTexture.GetPixel(x, y);
                Color targetColor = m_targetImage.Sprite.texture.GetPixelBilinear((float)x / paintTexture.width, (float)y / paintTexture.height);
                float diff        = Vector3.Distance(ColorConvertor.RGBToYUV(color), ColorConvertor.RGBToYUV(targetColor));

                colorDiff += diff;
            }
        }

        float score = colorDiff / (paintTexture.width + paintTexture.height);

        m_scoreText.Value = $"{score:F0}";

        UIController.ActivateUI(m_scoreUIName);
    }
Example #3
0
    public void StartPlay(string playSceneName)
    {
        if (m_bPlaying)
        {
            StopPlay();
        }

        m_bPlaying = true;

        m_sceneController.LoadScene(playSceneName, false);
        m_uiController.DeactivateUI(m_mainMenuUIName);

        m_loadingProgress.Value = 0.0f;
        m_uiController.ActivateUI(m_loadingUIName);
        m_uiController.ActivateUI(m_loadingTextUIName);
        m_uiController.DeactivateUI(m_loadingCompleteTextUIName);
    }
Example #4
0
        public override void Load()
        {
            Monitor.Log("Loading...");

            Events = new Events();

            //Disables FPS throttling when window is unfocused
            Terraria.Main.instance.InactiveSleepTime = new TimeSpan(0);

            //Make sure it doesnt start in borderless fullscreen
            Terraria.Main.screenBorderless = false;
            SplitScreen.Events.QuitGame   += (o, e) => Terraria.Main.screenBorderless = false;
            toggleBorders = new ToggleBorders();

            SplitScreen.Events.SecondaryLoad += delegate {
                //Multiple keyboard/mice
                keyboardManager = new MultipleKeyboardManager();
                miceManager     = new MultipleMiceManager();
                miceManager.RegisterMice();

                uiController = new UIController(keyboardManager, miceManager);

                Events.PreUpdate += OnPreUpdate;
            };

            SplitScreen.Events.JoinedServer += delegate
            {
                uiController.ActivateUI();
                keyboardManager.Initialize();
            };

            try {
                HarmonyInstance harmony = HarmonyInstance.Create("me.ilyaki.terrariaSplitScreen");                //Run AFTER subscribing to Events
                harmony.PatchAll(Assembly.GetExecutingAssembly());
            }catch (Exception) {
                Monitor.Log("Could not patch with Harmony. This is probably because of a mod reload instead of a fresh restart");
            }
        }
Example #5
0
 private void PausePlay()
 {
     UIController.ActivateUI(m_menuUI.ElementID);
     AudioManager.PlayUIAudio(m_menuOpenAudio);
 }
Example #6
0
 public virtual void OnPlayStart()
 {
     m_uiController.ActivateUI(m_uiCanvasName);
 }