Exemple #1
0
	/// <summary>
	/// Returns true if the window should show, returns false if not.
	/// If false, it will draw an editor label that says the window is unavailable
	/// </summary>
	public static bool ShouldShowWindow(bool isAvailableInPlayMode = false)
	{
		if(Application.isPlaying && !isAvailableInPlayMode)
		{
			GUILayout.Label ("This Smart Localization Window is not available in play mode", EditorStyles.boldLabel);
			if(LanguageManager.HasInstance)
			{
				if(GUILayout.Button("Go to translation window"))
				{
					TranslateLanguageWindow.ShowWindow(LanguageManager.Instance.GetCultureInfo(LanguageManager.Instance.CurrentlyLoadedCulture.languageCode), null);
				}
			}
			return false;
		}
		else if(!LocalizationWorkspace.Exists())
		{
			GUILayout.Label ("There is no localization workspace available in this project", EditorStyles.boldLabel);
			if(GUILayout.Button("Create localization workspace"))
			{
				if(LocalizationWorkspace.Create())
				{
					return true;
				}
			}

			return false;
		}
		else
		{
			return true;
		}
	}
        /// <summary>
        /// Returns if the key selector should be shown.
        /// </summary>
        /// <returns>Returns if the key selector should be shown.</returns>
        public static bool ShouldShowKeySelector()
        {
            if (Application.isPlaying)
            {
                GUILayout.Label("Feature not available in play mode.", EditorStyles.miniLabel);
                return(false);
            }

            if (!LocalizationWorkspace.Exists())
            {
                GUILayout.Label("There is no Smart Localization workspace created", EditorStyles.miniLabel);
                //There is no language created
                if (GUILayout.Button("Create Workspace"))
                {
                    LocalizationWorkspace.Create();
                }
                return(false);
            }

            return(true);
        }