Esempio n. 1
0
        public override IsoSettings getIsoSettings()
        {
            if (instance == null)
            {
                instance = Resources.Load <IsoSettings>("IsoSettings");

                if (instance == null)
                {
                    if (Application.isEditor)
                    {
#if UNITY_EDITOR
                        System.Reflection.MethodInfo mi = Type.GetType("IsoSettingsMenu").GetMethod("createSettings");
                        instance = mi.Invoke(null, null) as IsoSettings;
#endif
                    }
                    else
                    {
                        //To prevent crashing
                        Debug.LogWarning("Iso settings not found in /Resources. Runtime instance created. Consider to create the Asset.");
                        instance = ScriptableObject.CreateInstance <IsoSettings>();
                    }
                }
            }

#if UNITY_EDITOR
            if (!instance.Configured && Application.isEditor)
            {
                if (!ignore)
                {
                    if (UnityEditor.EditorUtility.DisplayDialog("IsoSettings not configured", "IsoSettings seems to be not configured properly. ¿Go to IsoSettings? (Ignoring can cause unexpected bugs...)", "Show", "Ignore"))
                    {
                        UnityEditor.Selection.activeObject = instance;
                    }
                    else
                    {
                        ignore = true;
                    }
                }

                /*Type isoSettingsPopup = Type.GetType("IsoSettingsPopup");
                 *
                 * if (isoSettingsPopup != null)
                 * {
                 *  System.Reflection.MethodInfo showAgain = isoSettingsPopup.GetMethod("IsShowAgain");
                 *  System.Reflection.MethodInfo createPopup = isoSettingsPopup.GetMethod("ShowIsoSettingsPopup");
                 *  // Only if called in OnGUI
                 *  if ((bool)showAgain.Invoke(null, null))
                 *  {
                 *      createPopup.Invoke(null, null);
                 *  }
                 * }*/
            }
#endif

            return(instance);
        }
Esempio n. 2
0
        public static void ShowIsoSettingsPopup(IsoSettings instance)
        {
            if (EditorUtility.DisplayDialog("IsoSettings not configured", "IsoSettings seems to be not configured properly. ¿Go to IsoSettings? (Ignoring can cause unexpected bugs...)", "Show", "Ignore"))
            {
                Selection.activeObject = instance;
            }

            if (showAgain)
            {
                if (popupActive != null)
                {
                    return;
                }

                popupActive          = EditorWindow.GetWindow(typeof(IsoSettingsPopup)) as IsoSettingsPopup;
                popupActive.instance = instance;
            }
        }
Esempio n. 3
0
        void OnEnable()
        {
            this.map = (Map)target;

            /*this.modules = new MapEditorModule[]{
             *  new NothingModule(),
             *  new EditModule(),
             *  new PaintModule(),
             *  new DecorateModule(),
             *  new EntityModule()
             * };*/
            List <MapEditorModule> modules = new List <MapEditorModule>();

            var type = typeof(MapEditorModule);

            Assembly[] assembly = AppDomain.CurrentDomain.GetAssemblies();
            foreach (Assembly a in assembly)
            {
                foreach (Type t in a.GetTypes())
                {
                    if (type.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract)
                    {
                        modules.Add(Activator.CreateInstance(t) as MapEditorModule);
                    }
                }
            }

            modules.Sort(new ModuleComparision());

            this.modules = modules.ToArray() as MapEditorModule[];

            this.selected = 0;

            toolBarStyle        = new GUIStyle();
            toolBarStyle.margin = new RectOffset(50, 50, 5, 10);

            IsoSettings iso = IsoSettingsManager.getInstance().getIsoSettings();

            if (!iso.Configured)
            {
                IsoSettingsPopup.ShowIsoSettingsPopup(iso);
            }
        }