Beispiel #1
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        if (Instance != this)
        {
            Destroy(gameObject);
            return;
        }

        anim = GetComponent <Animator>();

        defaultZoom = mainCamera.orthographicSize;

        screenWidth  = Screen.width;
        screenHeight = Screen.height;

        mainCamera = Camera.main;

        QualitySettings.vSyncCount = 0;

        LocalizedStringManager.Init();
        LocalizedStringManager.ParseTranslations();

        string currentCultureName = Localizer.GetCurrentCultureInfo().Name;

        Debug.LogFormat("Current culture: {0}", currentCultureName);

        LocalizedTextRegistry.Clear();

        bool isFirstLoad = IsFirstLoad();

        Options.Load();

        if (isFirstLoad)
        {
            Options.currentCulture = CultureInfo.GetCultureInfo(currentCultureName);
        }

        Debug.LogFormat("Loading culture {0}", Options.currentCulture.Name);
        if (Options.currentCulture == null)
        {
            Debug.Log("Setting current culture!");
            if (!LocalizedStringManager.availableCultures.Contains(currentCultureName))
            {
                Debug.LogFormat("Culture {0} is not supported, defaulting to en-US");
                Options.currentCulture = CultureInfo.GetCultureInfo("en-US");
            }
        }
        LocalizedStringManager.SetCulture(Options.currentCulture.Name);

        Options.ApplyGraphics();

        Options.Save();

        OnGameReady += () => canPause = true;
    }
    void SetScoreTexts()
    {
        scoreText.text = ScoreSystem.Instance.Score.ToString();

        if (GameManager.Instance.isHighScore)
        {
            highScoreText.text = LocalizedStringManager.GetLocalizedString("ui.highScore");
        }
        else
        {
            highScoreText.text = "";
        }
    }
    private void Awake()
    {
        musicVolSlider.value = Options.musicVolume;
        sfxVolSlider.value   = Options.sfxVolume;

        bloomToggle.isOn      = Options.postProcessingOptions.bloom;
        aberrationToggle.isOn = Options.postProcessingOptions.aberration;
        fisheyeToggle.isOn    = Options.postProcessingOptions.fisheye;
        grainToggle.isOn      = Options.postProcessingOptions.grain;

        maxFPSSlider.value = Options.maxFPS / 30;
        fpsText.text       = Options.maxFPS.ToString();

        BuildLanguageOptions();

        invertControlsText.text = LocalizedStringManager.GetLocalizedString(Options.invertControls ? "ui.options.other.invertControls.enabled" : "ui.options.other.invertControls.disabled");
    }
 void SetDeathText()
 {
     deathText.text = LocalizedStringManager.GetLocalizedString($"game.loss.{GenericRNG.Instance.Next(1, deathTextCount)}");
 }
Beispiel #5
0
 public static void ApplyLanguage()
 {
     LocalizedStringManager.SetCulture(currentCulture.Name);
 }
Beispiel #6
0
    public void SetText(string id)
    {
        textID = id;

        text.text = withVariants ? LocalizedStringManager.GetLocalizedStringRandomVariant(textID) : LocalizedStringManager.GetLocalizedString(textID);
    }