public void OnGUI()
        {
            if (newGameWindow == null || openGameWindow == null)
            {
                newGameWindow  = new NewGameWindow(windowRect, new GUIContent("New"), "Window");
                openGameWindow = new OpenGameWindow(windowRect, new GUIContent("Open"), "Window");
            }

            windowWidth  = position.width;
            windowHeight = position.height;

            logoRect    = new Rect(0.01f * windowWidth, 0.01f * windowHeight, windowWidth * 0.98f, windowHeight * 0.25f);
            buttonsRect = new Rect(0.01f * windowWidth, 0.27f * windowHeight, windowWidth * 0.98f, windowHeight * 0.28f);
            windowRect  = new Rect(0.01f * windowWidth, 0.32f * windowHeight, 0.98f * windowWidth, 0.67f * windowHeight);

            GUI.DrawTexture(logoRect, logo);

            GUILayout.BeginArea(buttonsRect);
            GUILayout.BeginHorizontal();

            if (GUILayout.Button("New"))
            {
                OnWindowTypeChanged(WelcomeWindowType.New);
            }
            if (GUILayout.Button("Open"))
            {
                OnWindowTypeChanged(WelcomeWindowType.Open);
                openGameWindow.OpenFileDialog();
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();

            BeginWindows();

            switch (openedWindow)
            {
            case WelcomeWindowType.New:
                m_Window1 = newGameWindow;
                break;

            case WelcomeWindowType.Open:
                m_Window1 = openGameWindow;
                break;
            }

            if (m_Window1 != null)
            {
                m_Window1.Rect = windowRect;
                m_Window1.OnGUI();
            }
            EndWindows();
        }
Beispiel #2
0
        static void Init()
        {
            Controller.resetInstance();
            openedWindow = WelcomeWindowType.New;

            Language.Initialize();
            thisWindowReference = EditorWindow.GetWindow(typeof(WelcomeWindow));
            windowWidth         = EditorWindow.focusedWindow.position.width;
            windowHeight        = EditorWindow.focusedWindow.position.height;
            logo = (Texture2D)Resources.Load("EAdventureData/img/logo-editor", typeof(Texture2D));

            logoRect    = new Rect(0.01f * windowWidth, 0.01f * windowHeight, windowWidth * 0.98f, windowHeight * 0.25f);
            buttonsRect = new Rect(0.01f * windowWidth, 0.27f * windowHeight, windowWidth * 0.98f, windowHeight * 0.28f);
            windowRect  = new Rect(0.01f * windowWidth, 0.32f * windowHeight, 0.98f * windowWidth, 0.67f * windowHeight);

            //newGameWindow = new NewGameWindow(windowRect, new GUIContent(TC.get("GeneralText.New")), "Window");
            //openGameWindow = new OpenGameWindow(windowRect, new GUIContent(TC.get("GeneralText.Open")), "Window");
            newGameWindow  = new NewGameWindow(windowRect, new GUIContent("New"), "Window");
            openGameWindow = new OpenGameWindow(windowRect, new GUIContent("Open"), "Window");
            //recentGameWindow = new RecentGameWindow(windowRect, new GUIContent(Language.GetText("RECENT_GAME")), "Window");
        }