private void LocalizationStatusChanged(LocalizationState state)
 {
     if (state > LocalizationState.Initializing)
     {
         this.RaisePropertyChanged("Item");
     }
 }
        public static void ParseLocalizationLine(object state)
        {
            LocalizationState localizationFileState = state as LocalizationState;

            if (IsTaskCanceled(localizationFileState))
            {
                return;
            }

            var pdxLocalization = LocalizationParser.ParseLocalization(localizationFileState.line);

            if (pdxLocalization != null)
            {
                var key   = (String)pdxLocalization.GetType().GetProperty("Key").GetValue(pdxLocalization);
                var value = (String)pdxLocalization.GetType().GetProperty("Value").GetValue(pdxLocalization);

                lock (localizationFileState.localizations) {
                    var localization = localizationFileState.localizations.Find(l => l.Key.Equals(key));
                    if (localization != null)
                    {
                        if (localizationFileState.sub == STELLARIS_PATH_LOCALIZATION_ENGLISH)
                        {
                            localization.ValueEnglish = value;
                        }
                        else if (localizationFileState.sub == STELLARIS_PATH_LOCALIZATION_SIMPLE_CHINESE)
                        {
                            localization.ValueSimpChinese = value;
                        }
                    }
                    else
                    {
                        var fileName = localizationFileState.file.Name.Substring(0, localizationFileState.file.Name.LastIndexOf("."));
                        fileName = fileName.Replace("_l_simp_chinese", "");
                        fileName = fileName.Replace("_l_english", "");
                        fileName = fileName.Replace("l_simp_chinese", "");
                        fileName = fileName.Replace("l_english", "");

                        PdxLocalization newLocalization = new PdxLocalization {
                            Key      = key,
                            FileName = fileName
                        };

                        if (localizationFileState.sub == STELLARIS_PATH_LOCALIZATION_ENGLISH)
                        {
                            newLocalization.ValueEnglish = value;
                        }
                        else if (localizationFileState.sub == STELLARIS_PATH_LOCALIZATION_SIMPLE_CHINESE)
                        {
                            newLocalization.ValueSimpChinese = value;
                        }

                        localizationFileState.localizations.AddLast(newLocalization);
                    }
                }
            }
        }
Exemple #3
0
        // Start is called before the first frame update
        void Start()
        {
            LocalizationState lcd = LocalizationSave.LoadData();

            if (lcd == null)
            {
                lc.LoadLocalizeText("en_EN.json");
            }
            else
            {
                lc.LoadLocalizeText(lcd.LocalizationFileName);
            }

            DataState loadedData = SaveState.LoadData();

            if (loadedData != null)
            {
                PhotonNetwork.AuthValues.UserId = loadedData.UserId;
                //Debug.Log(PhotonNetwork.AuthValues.UserId);
                PhotonNetwork.NickName = loadedData.NickName;

                StartCoroutine(LoadRole());

                if (loadedData.IsInMenu)
                {
                    PhotonNetwork.LeaveLobby();
                    launchServerList();
                }
                else if (loadedData.endGame)
                {
                    launchMainMenu();
                }

                Cursor.lockState = CursorLockMode.None;
                Cursor.visible   = true;
            }
            else
            {
                launchLoginMenu();
                Cursor.lockState = CursorLockMode.None;
                Cursor.visible   = true;
            }
        }