Ejemplo n.º 1
0
        private void UpdateFullScreenStatus(bool to)
        {
            if (Application.isMobilePlatform)
            {
                return;
            }

            // Debug.LogFormat("Full screen status changing from {0} (logical {1}) to {2}", Screen.fullScreen, isLogicalFullScreen, to);
            if (isLogicalFullScreen == to)
            {
                return;
            }

            isLogicalFullScreen = to;
            if (to)
            {
                configManager.SetInt(LastWindowedWidthKey, Screen.width);
                configManager.SetInt(LastWindowedHeightKey, Screen.height);
                Screen.SetResolution(
                    Screen.currentResolution.width,
                    Screen.currentResolution.height,
                    FullScreenMode.FullScreenWindow
                    );
            }
            else
            {
                var targetW = configManager.GetInt(LastWindowedWidthKey);
                var targetH = configManager.GetInt(LastWindowedHeightKey);
                if (targetW == 0 || targetH == 0)
                {
                    if (Screen.resolutions.Length == 0)
                    {
                        targetW = 1280;
                        targetH = 720;
                    }
                    else
                    {
                        var defaultResolution = Screen.resolutions[Screen.resolutions.Length / 2];
                        targetW = defaultResolution.width;
                        targetH = defaultResolution.height;
                    }
                }

                Screen.SetResolution(targetW, targetH, FullScreenMode.Windowed);

                if (configManager.GetInt(ChangeWindowSizeFirstShownKey) == 0)
                {
                    Alert.Show(I18n.__("config.changewindowsize"));
                    configManager.SetInt(ChangeWindowSizeFirstShownKey, 1);
                }
            }
        }
Ejemplo n.º 2
0
        private void _resetAlerts()
        {
            foreach (string key in configManager.GetAllTrackedKeys())
            {
                if (key.StartsWith(Alert.AlertKeyPrefix))
                {
                    configManager.SetInt(key, 1);
                }

                if (key.EndsWith(FirstShownKeySuffix))
                {
                    configManager.SetInt(key, 0);
                }
            }
        }
Ejemplo n.º 3
0
        private void _resetAlerts()
        {
            foreach (string key in configManager.GetAllTrackedKeys())
            {
                if (key.StartsWith(Alert.AlertKeyPrefix, StringComparison.Ordinal))
                {
                    configManager.SetInt(key, 1);
                }

                if (key.StartsWith(ConfigManager.FirstShownKeyPrefix, StringComparison.Ordinal))
                {
                    configManager.SetInt(key, 0);
                }
            }
        }
Ejemplo n.º 4
0
        public override void Show(Action onFinish)
        {
            base.Show(() =>
            {
                viewManager.dialoguePanel.SetActive(false);
                viewManager.StopAllAnimations();
                gameState.ResetGameState();

                if (bgmController != null && !string.IsNullOrEmpty(bgmName))
                {
                    bgmController.scriptVolume = bgmVolume;
                    bgmController.Play(bgmName);
                }

                var reachedChapterCount = gameState.GetAllStartupNodeNames()
                                          .Count(name => checkpointManager.IsReachedForAnyVariables(name, 0) != null);
                if (reachedChapterCount > 1 && configManager.GetInt(ChapterFirstUnlockedKey) == 0)
                {
                    Alert.Show(I18n.__("title.first.selectchapter"));
                    configManager.SetInt(ChapterFirstUnlockedKey, 1);
                }

                onFinish?.Invoke();
            });
        }
Ejemplo n.º 5
0
        private void Awake()
        {
            configManager = Utils.FindNovaGameController().ConfigManager;
            var localeInt = configManager.GetInt(configKeyName);

            if (localeInt < 0)
            {
                configManager.SetInt(configKeyName, (int)I18n.CurrentLocale);
            }
            else
            {
                I18n.CurrentLocale = (SystemLanguage)localeInt;
            }

            this.RuntimeAssert(localeTogglePairs.Length > 0, "Empty language toggle list");
            foreach (var pair in localeTogglePairs)
            {
                pair.toggle.isOn = pair.locale == I18n.CurrentLocale;
            }

            foreach (var pair in localeTogglePairs)
            {
                pair.toggle.onValueChanged.AddListener(value => SetLocale(value, pair.locale));
            }
        }
Ejemplo n.º 6
0
        private IEnumerator DoAlert(AlertParameters param)
        {
            yield return(3);

            this.param = param;

            if (param.ignoreKey != "" && configManager.GetInt(param.ignoreKey) == 0)
            {
                param.onConfirm?.Invoke();
                yield break;
            }

            titleText.gameObject.SetActive(param.title != null);
            titleText.text = param.title;
            bodyContentText.gameObject.SetActive(param.bodyContent != null);
            bodyContentText.text = param.bodyContent;
            cancelButton.gameObject.SetActive(param.onConfirm != null || param.onCancel != null);
            ignoreToggle.gameObject.SetActive(param.ignoreKey != "");

            confirmButton.onClick.RemoveAllListeners();
            confirmButton.onClick.AddListener(() => Hide(param.onConfirm));

            cancelButton.onClick.RemoveAllListeners();
            cancelButton.onClick.AddListener(() =>
            {
                if (param.ignoreKey != "")
                {
                    configManager.SetInt(param.ignoreKey, 1);
                }

                Hide(param.onCancel);
            });

            ignoreToggle.onValueChanged.RemoveAllListeners();
            ignoreToggle.isOn = false;
            if (param.ignoreKey != "")
            {
                // 0: ignore alert, 1: show alert
                ignoreToggle.onValueChanged.AddListener(value =>
                {
                    configManager.SetInt(param.ignoreKey, value ? 0 : 1);
                    configManager.Apply();
                });
            }

            Show();
        }
Ejemplo n.º 7
0
 private void SetLocale(bool value, SystemLanguage locale)
 {
     if (!value)
     {
         return;
     }
     I18n.CurrentLocale = locale;
     configManager.SetInt(configKeyName, (int)locale);
 }
Ejemplo n.º 8
0
        protected override void Start()
        {
            base.Start();

            if (configManager.GetInt(GameFirstShownKey) == 0)
            {
                configManager.SetInt(GameFirstShownKey, 1);
                Show();
            }
        }
Ejemplo n.º 9
0
 private void OnValueChange(bool _)
 {
     for (int i = 0; i < toggles.Count; i++)
     {
         if (toggles[i].isOn)
         {
             configManager.SetInt(configKeyName, i);
             return;
         }
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Show log panel
        /// </summary>
        public override void Show(Action onFinish)
        {
            if (configManager.GetInt(LogViewFirstShownKey) == 0)
            {
                Alert.Show(I18n.__("log.first.hint"));
                configManager.SetInt(LogViewFirstShownKey, 1);
            }

            scrollRect.verticalNormalizedPosition = 0.0f;
            base.Show(onFinish);
            scrollRect.verticalNormalizedPosition = 0.0f;
            lastClickedLogIndex = -1;
        }
Ejemplo n.º 11
0
 private void OnValueChange(bool value)
 {
     configManager.SetInt(configKeyName, toggle.isOn ? 1 : 0);
 }
Ejemplo n.º 12
0
 private void OnDisable()
 {
     config.SetInt(configKey, (int)controller.mode);
 }