//public const string FontMapperId = "default_font_mapper";

        public void Run()
        {
            GameObject go = GameObjectUtil.CreateGameObjectAtPath(FontMapperPath);

            /**
             * 1. FontMapper
             * */
            FontMapper m = (FontMapper)go.AddComponent(typeof(FontMapper));

            m.Id      = DipSwitches.DefaultFontMapperId;
            m.Default = true; // is the default font at the same time

            EditorUtility.DisplayDialog("Info", string.Format(@"Creating the default font mapper at ""{0}""

Please attach the default font to the font mapper.

Then create the Stage again.", FontMapperPath), "OK");

            EditorGUIUtility.PingObject(m);
            Selection.objects = new Object[] { m };

            /**
             * 3. Re-scan the hierarchy
             * */
            HierarchyViewDecorator.Instance.ReScan();
        }
Esempio n. 2
0
        internal static bool Init()
        {
            InitFont();
            if (!_fontInitialized)
            {
                return(false);
            }

            InitAudio();
            if (!_audioInitialized)
            {
                return(false);
            }

            // select the "GUI" node
            var go = GameObjectUtil.CreateGameObjectAtPath(GuiPath);

            Selection.objects = new Object[] { go };

            return(true);
        }
        public void Run()
        {
            GameObject go = GameObjectUtil.CreateGameObjectAtPath(AudioMapperPath);

            /**
             * 1. AudioPlayerMapper
             * */
            AudioPlayerMapper m = (AudioPlayerMapper)go.AddComponent(typeof(AudioPlayerMapper));

            m.Default = true; // set default

            /**
             * 2. N x AudioSource
             * */
            for (int i = 0; i < NumberOfAudioSources; i++)
            {
                AudioSource source = (AudioSource)go.AddComponent(typeof(AudioSource));
                source.playOnAwake = false; // do not play on awake
            }

            /**
             * 3. N x AudioToken
             * */
            for (int i = 0; i < NumberOfAudioTokens; i++)
            {
                go.AddComponent(typeof(AudioToken));
            }

            EditorUtility.DisplayDialog("Info", string.Format(@"Default audio mapper created at ""{0}""

You should drag this mapper to your camera.", AudioMapperPath), "OK");
            EditorGUIUtility.PingObject(m);
            Selection.objects = new Object[] { m };

            /**
             * 3. Re-scan the hierarchy
             * */
            HierarchyViewDecorator.Instance.ReScan(/*adapter.GetInstanceID()*/);
        }