コード例 #1
0
        public override void OnGUI(string searchContext)
        {
            if (LocalizationPlayerSettings.ActiveLocalizationSettings == null)
            {
                EditorGUI.BeginChangeCheck();
                var obj = EditorGUILayout.ObjectField(s_Texts.activeSettings, LocalizationPlayerSettings.ActiveLocalizationSettings, typeof(LocalizationSettings), false) as LocalizationSettings;
                if (EditorGUI.EndChangeCheck())
                {
                    LocalizationPlayerSettings.ActiveLocalizationSettings = obj;

                    // Trigger the activate so it generates a new Editor
                    base.OnActivate(m_SearchContext, m_RootElement);
                }

                EditorGUILayout.HelpBox(s_Texts.noSettingsMsg.text, MessageType.Info, true);
                if (GUILayout.Button("Create", GUILayout.Width(100)))
                {
                    var created = LocalizationSettingsMenuItems.CreateLocalizationAsset();
                    if (created != null)
                    {
                        LocalizationPlayerSettings.ActiveLocalizationSettings = created;

                        // Trigger the activate so it generates a new Editor
                        base.OnActivate(m_SearchContext, m_RootElement);
                    }
                }
            }
            else
            {
                base.OnGUI(searchContext);
            }
        }
コード例 #2
0
 static void ShowActive()
 {
     if (LocalizationPlayerSettings.ActiveLocalizationSettings == null)
     {
         if (EditorUtility.DisplayDialog("Create Localization Settings", "You have no active Localization Settings. Would you like to create one?", "Create", "Cancel"))
         {
             LocalizationPlayerSettings.ActiveLocalizationSettings = LocalizationSettingsMenuItems.CreateLocalizationAsset();
         }
     }
     else
     {
         Selection.activeObject = LocalizationPlayerSettings.ActiveLocalizationSettings;
     }
 }