public void Unlock(int arrayIndex, TextDatabase array) { index = arrayIndex; database = array; GetComponentInChildren <Text>().text = database.entries[index].title; unlocked = true; }
public static string ToLongRegionalString(this DateTime date) { GeoRegion region = CloudUser.instance.region; int pattern = 8000012; switch (TextDatabase.GetLanguage()) { case SystemLanguage.English: pattern = region == GeoRegion.Europe ? 8000000 : 8000001; break; case SystemLanguage.German: pattern = 8000002; break; case SystemLanguage.French: pattern = region == GeoRegion.Europe ? 8000003 : 8000004; break; case SystemLanguage.Italian: pattern = 8000005; break; case SystemLanguage.Spanish: pattern = region == GeoRegion.Europe ? 8000006 : 8000007; break; case SystemLanguage.Russian: pattern = 8000008; break; case SystemLanguage.Japanese: pattern = 8000009; break; case SystemLanguage.Chinese: pattern = 8000010; break; case SystemLanguage.Korean: pattern = 8000011; break; default: break; } return(date.ToString(TextDatabase.instance[pattern])); }
// Use this for initialization void Start() { player1SnailScript = Player1Snail.GetComponent <PlayerMovement>(); player2SnailScript = Player2Snail.GetComponent <PlayerMovement>(); cpu1SnailScript = CPU1Snail.GetComponent <CPUMovement>(); cpu2SnailScript = CPU2Snail.GetComponent <CPUMovement>(); textDatabaseScript = GetComponent <TextDatabase>(); frenzyBar1Script = FrenzyBar1.GetComponent <FrenzyBarControl>(); frenzyBar2Script = FrenzyBar2.GetComponent <FrenzyBarControl>(); audioSource = GetComponent <AudioSource>(); InstantiatePowerUps(); StartCountdown(); }
// ======================================================================= /// Private part ... static TextDatabase GetInstance() { if (s_Instance == null) { s_Instance = ScriptableObject.CreateInstance <TextDatabase>(); if (s_Instance == null) { Debug.LogError("Can't create TextDatabase"); return(null); } ScriptableObject.DontDestroyOnLoad(s_Instance); // TODO reload default language. This nead to be changed... s_Instance.Reload(); } return(s_Instance); }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { if (m_IconValid == null) { m_IconValid = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/!MFCommon/Editor Resources/accept.png", typeof(Texture2D)); } if (m_IconInvalid == null) { m_IconInvalid = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/!MFCommon/Editor Resources/cross.png", typeof(Texture2D)); } float height = base.GetPropertyHeight(prop, label); pos.height = height; EditorGUI.BeginProperty(pos, label, prop); // text id pos.width -= height; EditorGUI.BeginChangeCheck(); int value = EditorGUI.IntField(pos, label, prop.intValue); if (EditorGUI.EndChangeCheck() == true) { prop.intValue = value; } if (prop.hasMultipleDifferentValues == false && prop.intValue != 0) { GUIStyle style = new GUIStyle(); style.fixedHeight = height; style.fixedWidth = height; style.normal.background = TextDatabase.Contains(prop.intValue) ? m_IconValid : m_IconInvalid; EditorGUI.LabelField(new Rect(pos.x + pos.width - height, pos.y, height, height), GUIContent.none, style); } pos.width += height; pos.width -= 4; // text preview pos.y += height; EditorGUI.BeginDisabledGroup(true); pos = EditorGUI.PrefixLabel(pos, -1, new GUIContent("Text Dyn")); if (prop.hasMultipleDifferentValues == false && prop.intValue != 0 && TextDatabase.Contains(prop.intValue)) { GUI.TextField(pos, TextDatabase.instance[prop.intValue], EditorStyles.textField); } EditorGUI.EndDisabledGroup(); // language selector pos.x -= 16; pos.y += height; pos.width += 16; pos.width *= 0.5f; EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = false; int idx = System.Array.IndexOf(GuiOptions.convertLanguageToSysLanguage, TextDatabase.GetLanguage()); GuiOptions.E_Language language = idx != -1 ? (GuiOptions.E_Language)idx : GuiOptions.E_Language.English; language = (GuiOptions.E_Language)EditorGUI.EnumPopup(pos, language, EditorStyles.toolbarPopup); EditorGUI.showMixedValue = prop.hasMultipleDifferentValues; if (EditorGUI.EndChangeCheck() == true) { TextDatabase.SetLanguage(GuiOptions.convertLanguageToSysLanguage[(int)language]); } // reload button pos.x += pos.width; EditorGUI.BeginChangeCheck(); bool reload = GUI.Toggle(pos, false, "Reload", EditorStyles.toolbarButton); if (EditorGUI.EndChangeCheck() == true && reload == true) { TextDatabase.instance.Reload(); } EditorGUI.EndProperty(); }
private void ButtonOK_Click(object sender, RoutedEventArgs e) { if ((RadioLibrarySteam.IsChecked == true && RadioSteamLibName.IsChecked == true) && string.IsNullOrEmpty(TextSteamAccountName.Text)) { PlayniteMessageBox.Show(FindResource("SettingsInvalidSteamAccountName") as string, FindResource("InvalidDataTitle") as string, MessageBoxButton.OK, MessageBoxImage.Error); return; } if (RadioLibrarySteam.IsChecked == true && RadioSteamLibAccount.IsChecked == true && ((ulong)ComboSteamAccount.SelectedValue) == 0) { PlayniteMessageBox.Show(FindResource("SettingsInvalidSteamAccountLibImport") as string, FindResource("InvalidDataTitle") as string, MessageBoxButton.OK, MessageBoxImage.Error); return; } if (!Paths.GetValidFilePath(TextDatabase.Text)) { PlayniteMessageBox.Show(FindResource("SettingsInvalidDBLocation") as string, FindResource("InvalidDataTitle") as string, MessageBoxButton.OK, MessageBoxImage.Error); return; } var databasePath = TextDatabase.GetBindingExpression(TextBox.TextProperty); if (databasePath.IsDirty) { databaseLocationChanged = true; databasePath.UpdateSource(); } var steamEnabled = CheckSteamEnabled.GetBindingExpression(CheckBox.IsCheckedProperty); if (steamEnabled.IsDirty) { providerIntegrationChanged = true; steamEnabled.UpdateSource(); } var steamDownloadLib = RadioLibrarySteam.GetBindingExpression(RadioButton.IsCheckedProperty); if (steamDownloadLib.IsDirty) { providerIntegrationChanged = true; steamDownloadLib.UpdateSource(); } RadioButton radioSteam = RadioSteamLibName.IsChecked == true ? RadioSteamLibName : RadioSteamLibAccount; var steamIdSource = radioSteam.GetBindingExpression(RadioButton.IsCheckedProperty); if (steamIdSource.IsDirty) { providerIntegrationChanged = true; steamIdSource.UpdateSource(); } var steamAccount = ComboSteamAccount.GetBindingExpression(ComboBox.SelectedValueProperty); if (steamAccount.IsDirty) { providerIntegrationChanged = true; steamAccount.UpdateSource(); } var steamAccountName = TextSteamAccountName.GetBindingExpression(TextBox.TextProperty); if (steamAccountName.IsDirty) { providerIntegrationChanged = true; steamAccountName.UpdateSource(); } var gogEnabled = CheckGogEnabled.GetBindingExpression(CheckBox.IsCheckedProperty); if (gogEnabled.IsDirty) { providerIntegrationChanged = true; gogEnabled.UpdateSource(); } var gogRunGalaxy = CheckGogRunGalaxy.GetBindingExpression(CheckBox.IsCheckedProperty); if (gogRunGalaxy.IsDirty) { gogRunGalaxy.UpdateSource(); } var gogIcons = CheckGogIcons.GetBindingExpression(CheckBox.IsCheckedProperty); if (gogIcons.IsDirty) { gogIcons.UpdateSource(); } var gogDownloadLib = RadioLibraryGOG.GetBindingExpression(RadioButton.IsCheckedProperty); if (gogDownloadLib.IsDirty) { providerIntegrationChanged = true; gogDownloadLib.UpdateSource(); } var originEnabled = CheckOriginEnabled.GetBindingExpression(CheckBox.IsCheckedProperty); if (originEnabled.IsDirty) { providerIntegrationChanged = true; originEnabled.UpdateSource(); } var originDownloadLib = RadioLibraryOrigin.GetBindingExpression(RadioButton.IsCheckedProperty); if (originDownloadLib.IsDirty) { providerIntegrationChanged = true; originDownloadLib.UpdateSource(); } var uplayEnabled = CheckUplayEnabled.GetBindingExpression(CheckBox.IsCheckedProperty); if (uplayEnabled.IsDirty) { providerIntegrationChanged = true; uplayEnabled.UpdateSource(); } var trayMinimize = CheckMinimizeToTray.GetBindingExpression(CheckBox.IsCheckedProperty); if (trayMinimize.IsDirty) { trayMinimize.UpdateSource(); } var trayClose = CheckCloseToTray.GetBindingExpression(CheckBox.IsCheckedProperty); if (trayClose.IsDirty) { trayClose.UpdateSource(); } var trayEnable = CheckEnableTray.GetBindingExpression(CheckBox.IsCheckedProperty); if (trayEnable.IsDirty) { trayEnable.UpdateSource(); } var updateLibStartupEnable = CheckUpdateLibStartup.GetBindingExpression(CheckBox.IsCheckedProperty); if (updateLibStartupEnable.IsDirty) { updateLibStartupEnable.UpdateSource(); } var language = ComboLanguage.GetBindingExpression(ComboBox.SelectedValueProperty); if (language.IsDirty) { language.UpdateSource(); } var minimizeLaunch = CheckMinimizeLaunch.GetBindingExpression(CheckBox.IsCheckedProperty); if (minimizeLaunch.IsDirty) { minimizeLaunch.UpdateSource(); } var asyncImageLoad = CheckAsyncImages.GetBindingExpression(CheckBox.IsCheckedProperty); if (asyncImageLoad.IsDirty) { asyncImageLoad.UpdateSource(); } var nameCoverArt = CheckNameEmptyCover.GetBindingExpression(CheckBox.IsCheckedProperty); if (nameCoverArt.IsDirty) { nameCoverArt.UpdateSource(); } var showIcons = CheckShowIcons.GetBindingExpression(CheckBox.IsCheckedProperty); if (showIcons.IsDirty) { showIcons.UpdateSource(); } Playnite.Settings.Instance.SaveSettings(); Close(); }
static void OnLanguageChange() { // Debug.Log("Language is: " + language); TextDatabase.SetLanguage(convertLanguageToSysLanguage[(int)language]); MFGuiManager.OnLanguageChanged(convertLanguageToFullName[(int)language]); }
void Awake() { instance = this; }