// ReSharper disable MemberCanBeMadeStatic.Global
        public void Process()
// ReSharper restore MemberCanBeMadeStatic.Global
        {
            if (!string.IsNullOrEmpty(FontMapperPath))
            {
                Debug.Log("Creating font mapper...");
                var command = new CreateFontMapperCommand {FontMapperPath = FontMapperPath};
                command.Run();

                FontMapperPath = null;

                ///**
                // * 3. Re-scan the hierarchy
                // * */
                //HierarchyViewDecorator.Instance.ReScan(/*adapter.GetInstanceID()*/);
            }
        }
Exemplo n.º 2
0
        private static void InitFont()
        {
            _fontInitialized = false;

            MapperInfo info;
            FontMapper mapper = GetFontMapper(out info);

            //Debug.Log("_fontInitialized: " + _fontInitialized);

            bool result;
            switch (info)
            {
                case MapperInfo.NotFound:
                    string text = @"eDriven.Gui needs a default font mapper for its components to work.

No default font mapper found in the scene.

Would you like to create it?";

                    if (EditorApplication.isPlaying)
                        text += @"

(Play mode will be stopped)";

                    result = EditorUtility.DisplayDialog("eDriven.Gui Info", text, "Yes", "No");
                    if (result)
                    {
#if DEBUG
                        if (DebugMode)
                        {
                            Debug.Log("Creating font mapper");
                        }
#endif

                        if (EditorApplication.isPlaying)
                        {
                            FontMapperAdditionProcessor.FontMapperPath = FontMapperPath;
                            Debug.Log("Stopping the application");
                            EditorApplication.isPlaying = false;
                            return;
                        }

                        CreateFontMapperCommand cmd = new CreateFontMapperCommand {FontMapperPath = FontMapperPath};
                        cmd.Run();
                    }
                    else
                    {
                        _fontInitialized = true;
                    }
                    break;
                case MapperInfo.MapperNotEnabled:
                    result = EditorUtility.DisplayDialog("Info", @"Default font mapper found but not enabled.

Would you like to enable it?", "Yes", "No");
                    if (result)
                    {
                        Debug.Log("Enabling default font mapper");
                        if (null == mapper)
                            throw new Exception("Error: default font mapper is null");
                        mapper.enabled = true;
                    }
                    _fontInitialized = true;
                    break;
                case MapperInfo.FontNotAttached:
                    EditorUtility.DisplayDialog("Info", @"Default font mapper found but no font attached.

Please attach the font.", "OK");
                    Selection.activeGameObject = mapper.gameObject;
                    EditorGUIUtility.PingObject(mapper);
                    break;
                default:
#if DEBUG
                    if (DebugMode)
                    {
                        Debug.Log("Font OK");
                    }
#endif
                    _fontInitialized = true;
                    break;
            }
        }