Пример #1
0
        internal static void Check()
        {
            MapperInfo info;

            //SceneInitializer.Init();

            FontMapper mapper = SceneInitializer.GetFontMapper(out info);

            if (!mapper)
            {
                EditorSettings.InspectorEnabled = false;
                EditorUtility.DisplayDialog("eDriven.Gui Info", @"Inspector overlay needs a default font for drawing, but no default font mapper found in the scene.

Inspector overlay will be disabled until the mapper is created in the scene.", "OK");

                EditorSettings.InspectorEnabled = false;
                return;
            }

            if (null == mapper.Font)
            {
                Selection.activeGameObject = mapper.gameObject;
                EditorGUIUtility.PingObject(mapper);

                EditorSettings.InspectorEnabled = false;
                EditorUtility.DisplayDialog("eDriven.Gui Info", string.Format(@"Inspector overlay needs a default font for drawing.

The default mapper has been found, but with no font attached.

Inspector overlay will be disabled until the font is attached."), "OK");
                //The mapper ""{0}"" has been found, but with no font attached. // , CreateFontMapperCommand.FontMapperId

                EditorSettings.InspectorEnabled = false;
            }
        }
Пример #2
0
 void Start()
 {
     instance    = this;
     manager     = SceneManager.GetInstance();
     terrainGrid = TerrainGrid.GetInstance();
     ui          = InterfaceManager.GetInstance();
 }
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     if (sceneInitializer == null)
     {
         sceneInitializer = this;
     }
     else if (sceneInitializer != this)
     {
         Destroy(gameObject);
     }
 }
Пример #4
0
    private void Awake()
    {
        Localization.SwapToLocalizedFont();
        string environmentVariable = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process);
        string text = Application.dataPath + Path.DirectorySeparatorChar + "Plugins";

        if (!environmentVariable.Contains(text))
        {
            Environment.SetEnvironmentVariable("PATH", environmentVariable + Path.PathSeparator + text, EnvironmentVariableTarget.Process);
        }
        Instance = this;
        PreLoadPrefabs();
    }
Пример #5
0
 void Start()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         Destroy(this);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(gameObject);
 }
Пример #6
0
 void Start()
 {
     eventSystem     = FindObjectOfType <EventSystem>();
     initializer     = GameObject.FindObjectOfType <SceneInitializer>();
     marblesFinished = 0;
     raceOverCheck   = true;
     //Throw all players in a list
     MarbleRank[] tempList = FindObjectsOfType <MarbleRank>();
     foreach (MarbleRank rank in tempList)
     {
         if (rank.isActiveAndEnabled)
         {
             players.Add(rank);
         }
     }
 }
 void Awake()
 {
     sceneInitializer = GameObject.Find("GameManager").GetComponent <SceneInitializer>();
     sceneInitializer.SceneChanged();
 }
Пример #8
0
 public void Start()
 {
     scenes = FindObjectOfType <SceneInitializer>();
     FirstSelectedButton.Select();
 }
Пример #9
0
 // Use this for initialization
 void Start()
 {
     _player = FindObjectOfType <StablePlayerMovement>().gameObject;
     _scenes = FindObjectOfType <SceneInitializer>();
 }
Пример #10
0
 private void OnDestroy()
 {
     Instance = null;
 }
Пример #11
0
 private void Awake()
 {
     instance = this;
 }
Пример #12
0
        internal void Render()
        {
            //GUI.backgroundColor = RgbColor.FromHex(0x335fd8).ToColor();

            //GUI.backgroundColor = Color.white;

            //EditorGUILayout.BeginVertical(StyleCache.Instance.PanelContent, GUILayout.ExpandWidth(true));
            // panel content

            if (ToolboxDialog.Instance.ShowHelp)
            {
                EditorGUILayout.HelpBox(Help.Toolbox, MessageType.Info, true);
            }

            /**
             * Breadcrumbs
             * */
            if (null != Selection.activeGameObject)
            {
                BreadcrumbsMain.Instance.Render();
                GUILayout.Space(5);
            }

            if (EditorSettings.ShowAddChildOptions)
            {
                EditorGUILayout.BeginVertical(StyleCache.Instance.Fieldset, GUILayout.ExpandWidth(true));
                GUILayout.Label(GuiContentCache.Instance.OptionsFieldsetTitle, StyleCache.Instance.Label,
                                GUILayout.ExpandWidth(false));

                EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));

                EditorSettings.SelectUponCreation = GUILayout.Toggle(EditorSettings.SelectUponCreation,
                                                                     GuiContentCache.Instance.SelectContent,
                                                                     StyleCache.Instance.Button,
                                                                     GUILayout.ExpandWidth(false));
                EditorSettings.ExpandWidthUponCreation = GUILayout.Toggle(EditorSettings.ExpandWidthUponCreation,
                                                                          GuiContentCache.Instance.
                                                                          ExpandWidthContent,
                                                                          StyleCache.Instance.Button,
                                                                          GUILayout.ExpandWidth(false));
                EditorSettings.ExpandHeightUponCreation = GUILayout.Toggle(EditorSettings.ExpandHeightUponCreation,
                                                                           GuiContentCache.Instance.
                                                                           ExpandHeightContent,
                                                                           StyleCache.Instance.Button,
                                                                           GUILayout.ExpandWidth(false));
                EditorSettings.FactoryModeUponCreation = GUILayout.Toggle(EditorSettings.FactoryModeUponCreation,
                                                                          GuiContentCache.Instance.FactoryModeContent,
                                                                          StyleCache.Instance.Button,
                                                                          GUILayout.ExpandWidth(false));

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));

                EditorSettings.ApplyLastUsedSkinUponCreation = GUILayout.Toggle(EditorSettings.ApplyLastUsedSkinUponCreation,
                                                                                GuiContentCache.Instance.ApplyLastUsedSkinUponCreationContent,
                                                                                StyleCache.Instance.Button,
                                                                                GUILayout.ExpandWidth(false));

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();

                GUILayout.Space(5);
            }

            _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition, GUILayout.ExpandHeight(true));

            /**
             * 1. Stage
             * */
            _oldEnabled = GUI.enabled;
            GUI.enabled = ToolboxInitializer.ControlCouldBeInstantiated(Selection.activeTransform,
                                                                        _stageDescriptorType);

            if (GUILayout.Button(StageContent, StyleCache.Instance.ControlButton, GUILayout.ExpandWidth(false)))
            {
                /**
                 * 1. Initialize prerequisites for this scene
                 * */
                if (!SceneInitializer.Init())
                {
                    return;
                }

                //Debug.Log("*** INITIALIZED ***");

                /**
                 * 2. Create stage
                 * */
                CreateChild(new ComponentTypeDesc("Stage", typeof(StageAdapter)),
                            Event.current.control || EditorSettings.SelectUponCreation);
            }
            GUI.enabled = _oldEnabled;

            EditorGUILayout.Space();

            /**
             * 2. Other controls
             * */
            foreach (var group in Groups)
            {
                group.Expanded = EditorPrefs.GetBool("eDrivenGuiEditorControlGroup_" + group.Name);

                bool newExpanded = EditorGUILayout.Foldout(group.Expanded, group.Name);
                if (newExpanded != group.Expanded)
                {
                    EditorPrefs.SetBool("eDrivenGuiEditorControlGroup_" + group.Name, newExpanded);
                    group.Expanded = newExpanded;
                }

                if (group.Expanded)
                {
                    _oldEnabled = GUI.enabled;
                    GUI.enabled = ToolboxInitializer.ControlCouldBeInstantiated(Selection.activeTransform,
                                                                                _componentDescriptorType);

                    var columnCount = Math.Max((int)Mathf.Floor((Screen.width - 40) / DipSwitches.ControlButtonMinWidth), 1);
                    //Debug.Log("Screen.width: " + Screen.width);
                    //Debug.Log("columnCount: " + columnCount);
                    // against dividing by zero
                    _selectedIndex = GUILayout.SelectionGrid(_selectedIndex, group.Contents, columnCount,
                                                             StyleCache.Instance.ControlButton,
                                                             GUILayout.Width(columnCount * DipSwitches.ControlButtonMinWidth));
                    if (_selectedIndex > -1)
                    {
                        //Debug.Log("Click: " + _selectedIndex);
                        CreateChild(group.Components[_selectedIndex],
                                    Event.current.control || EditorSettings.SelectUponCreation);

                        //OrderDisplay.Instance.Refresh();

                        _selectedIndex = -1;
                    }

                    GUI.enabled = _oldEnabled;
                }
            }

            EditorGUILayout.EndScrollView();

            GUILayout.Space(1);
        }
Пример #13
0
 private void Start()
 {
     scene = SceneInitializer.GetInstance();
     ui    = InterfaceManager.GetInstance();
 }