Пример #1
0
    public static void Load()
    {
        // load prefab if not exists
        if (instance == null)
        {
            instance = GameObject.FindObjectOfType <DebugLogWindow>();

            if (instance == null)
            {
                var go = Resources.Load("UI/DebugLogWindow") as GameObject;

                if (go != null)
                {
                    var inst = GameObject.Instantiate <GameObject>(go);
                    inst.name = "DebugLogWindow";
                    instance  = inst.GetComponent <DebugLogWindow>();
                }
            }

            if (!dontDestroy)
            {
                if (instance != null)
                {
                    DontDestroyOnLoad(instance.gameObject);
                    dontDestroy = true;
                }
            }
        }
    }
Пример #2
0
        /// <inheritdoc />
        public override void OnInit()
        {
            Assert.IsNull(MainWindow);

            _windowsLayoutPath = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "WindowsLayout.xml");

            // Create main window
            var dpiScale = Platform.DpiScale;
            var settings = CreateWindowSettings.Default;

            settings.Title         = "Flax Editor";
            settings.Size          = new Vector2(1300 * dpiScale, 900 * dpiScale);
            settings.StartPosition = WindowStartPosition.CenterScreen;

            if (!Editor.Instance.Options.Options.Interface.UseNativeWindowSystem)
            {
                settings.HasBorder      = false;
                settings.HasSizingFrame = false;
            }

            MainWindow = Window.Create(settings);

            if (MainWindow == null)
            {
                // Error
                Editor.LogError("Failed to create editor main window!");
                return;
            }
            UpdateWindowTitle();

            // Link for main window events
            MainWindow.Closing += MainWindow_OnClosing;
            MainWindow.Closed  += MainWindow_OnClosed;

            // Create default editor windows
            ContentWin         = new ContentWindow(Editor);
            EditWin            = new EditGameWindow(Editor);
            GameWin            = new GameWindow(Editor);
            PropertiesWin      = new PropertiesWindow(Editor);
            SceneWin           = new SceneTreeWindow(Editor);
            DebugLogWin        = new DebugLogWindow(Editor);
            OutputLogWin       = new OutputLogWindow(Editor);
            ToolboxWin         = new ToolboxWindow(Editor);
            GraphicsQualityWin = new GraphicsQualityWindow(Editor);
            GameCookerWin      = new GameCookerWindow(Editor);
            ProfilerWin        = new ProfilerWindow(Editor);
            EditorOptionsWin   = new EditorOptionsWindow(Editor);
            PluginsWin         = new PluginsWindow(Editor);

            // Bind events
            SceneManager.SceneSaveError     += OnSceneSaveError;
            SceneManager.SceneLoaded        += OnSceneLoaded;
            SceneManager.SceneLoadError     += OnSceneLoadError;
            SceneManager.SceneLoading       += OnSceneLoading;
            SceneManager.SceneSaved         += OnSceneSaved;
            SceneManager.SceneSaving        += OnSceneSaving;
            SceneManager.SceneUnloaded      += OnSceneUnloaded;
            SceneManager.SceneUnloading     += OnSceneUnloading;
            ScriptsBuilder.ScriptsReloadEnd += OnScriptsReloadEnd;
        }
Пример #3
0
        /// <inheritdoc />
        public override void OnInit()
        {
            Assert.IsNull(MainWindow);

            _windowsLayoutPath = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "WindowsLayout.xml");

            // Create main window
            var settings = CreateWindowSettings.Default;

            settings.Title         = "Flax Editor";
            settings.Size          = new Vector2(1300, 900);
            settings.StartPosition = WindowStartPosition.CenterScreen;
            MainWindow             = Window.Create(settings);
            if (MainWindow == null)
            {
                // Error
                Debug.LogError("Failed to create editor main window!");
                return;
            }
            UpdateWindowTitle();

            // Link for main window events
            MainWindow.OnClosing += MainWindow_OnClosing;
            MainWindow.OnClosed  += MainWindow_OnClosed;

            // Create default editor windows
            ContentWin         = new ContentWindow(Editor);
            EditWin            = new EditGameWindow(Editor);
            GameWin            = new GameWindow(Editor);
            PropertiesWin      = new PropertiesWindow(Editor);
            SceneWin           = new SceneTreeWindow(Editor);
            DebugWin           = new DebugLogWindow(Editor);
            ToolboxWin         = new ToolboxWindow(Editor);
            GraphicsQualityWin = new GraphicsQualityWindow(Editor);
            GameCookerWin      = new GameCookerWindow(Editor);
            ProfilerWin        = new ProfilerWindow(Editor);
            EditorOptionsWin   = new EditorOptionsWindow(Editor);

            // Bind events
            SceneManager.SceneSaveError += OnSceneSaveError;
            SceneManager.SceneLoaded    += OnSceneLoaded;
            SceneManager.SceneLoadError += OnSceneLoadError;
            SceneManager.SceneLoading   += OnSceneLoading;
            SceneManager.SceneSaved     += OnSceneSaved;
            SceneManager.SceneSaving    += OnSceneSaving;
            SceneManager.SceneUnloaded  += OnSceneUnloaded;
            SceneManager.SceneUnloading += OnSceneUnloading;
        }
Пример #4
0
        /// <inheritdoc />
        public override void OnInit()
        {
            Assert.IsNull(MainWindow);

            _windowsLayoutPath = StringUtils.CombinePaths(Globals.ProjectCacheFolder, "WindowsLayout.xml");

            // Create main window
            var dpiScale = Platform.DpiScale;
            var settings = CreateWindowSettings.Default;

            settings.Title               = "Flax Editor";
            settings.Size                = Platform.DesktopSize;
            settings.StartPosition       = WindowStartPosition.CenterScreen;
            settings.ShowAfterFirstPaint = true;

#if PLATFORM_WINDOWS
            if (!Editor.Instance.Options.Options.Interface.UseNativeWindowSystem)
#endif
            {
                settings.HasBorder = false;
#if PLATFORM_WINDOWS
                // Skip OS sizing frame and implement it using LeftButtonHit
                settings.HasSizingFrame = false;
#endif
            }

            MainWindow = Platform.CreateWindow(ref settings);

            if (MainWindow == null)
            {
                // Error
                Editor.LogError("Failed to create editor main window!");
                return;
            }
            UpdateWindowTitle();

            // Link for main window events
            MainWindow.Closing += MainWindow_OnClosing;
            MainWindow.Closed  += MainWindow_OnClosed;

            // Create default editor windows
            ContentWin              = new ContentWindow(Editor);
            EditWin                 = new EditGameWindow(Editor);
            GameWin                 = new GameWindow(Editor);
            PropertiesWin           = new PropertiesWindow(Editor);
            SceneWin                = new SceneTreeWindow(Editor);
            DebugLogWin             = new DebugLogWindow(Editor);
            OutputLogWin            = new OutputLogWindow(Editor);
            ToolboxWin              = new ToolboxWindow(Editor);
            GraphicsQualityWin      = new GraphicsQualityWindow(Editor);
            GameCookerWin           = new GameCookerWindow(Editor);
            ProfilerWin             = new ProfilerWindow(Editor);
            EditorOptionsWin        = new EditorOptionsWindow(Editor);
            PluginsWin              = new PluginsWindow(Editor);
            VisualScriptDebuggerWin = new VisualScriptDebuggerWindow(Editor);

            // Bind events
            Level.SceneSaveError             += OnSceneSaveError;
            Level.SceneLoaded                += OnSceneLoaded;
            Level.SceneLoadError             += OnSceneLoadError;
            Level.SceneLoading               += OnSceneLoading;
            Level.SceneSaved                 += OnSceneSaved;
            Level.SceneSaving                += OnSceneSaving;
            Level.SceneUnloaded              += OnSceneUnloaded;
            Level.SceneUnloading             += OnSceneUnloading;
            ScriptsBuilder.ScriptsReloadEnd  += OnScriptsReloadEnd;
            Editor.StateMachine.StateChanged += OnEditorStateChanged;
        }
Пример #5
0
        protected IEnumerator Initialize()
        {
            if (initializeCompleted)
            {
                // 初期化済みでもプレイヤー情報は再取得する
                // yield return GameServer.Instance.RetrievePlayerInfoCoroutine();
                yield break;
            }

            if (Debug.isDebugBuild)
            {
                // デバッグログウインドウ起動
                DebugLogWindow.Load();
            }
            else
            {
                // Debug.Logの抑止
                Debug.unityLogger.logEnabled = false;
            }

            bool newUser = false;

            // 新規ユーザーが作成された場合のコールバック
            Network.GameServer.Instance.Requests.OnCreateAuth = (id) =>
            {
                newUser = true;
            };
            // boot処理
            yield return(Network.GameServer.Instance.Boot(r =>
            {
                /// TODO : AssetBundleUrlを保存する
                //Tsl.Asset.AssetBundleManager.ServerUrl = r.AssetBundleUrl;
                Debug.Log("マスターデータのダウンロード完了: " + r.AssetBundleUrl);

                foreach (var x in Masterdata.Test.Test.All())
                {
                    Debug.Log(string.Format("name:{0} relation:{1}", x.Name, x.Relation.Name));
                }

                //StartHello();
            }));

            Network.GameServer.Instance.Requests.OnCreateAuth = null; // コールバックは解除しておく

            if (this.hasFatalError)
            {
                // 開発ビルドの場合、スルー
                if (!Debug.isDebugBuild)
                {
                    yield return(new WaitForSeconds(100000.0f));
                }
                else
                {
                    Debug.LogError("致命的なエラーが発生しました");
                }
            }

            // 新規ユーザーの場合名前入力
            //yield return nameInput();
            /// TODO : ユーザ名の入力UIを作成する
            /// TODO : Liverに依存しているので別の場所に持っていく
            Liver.PlayerDataManager.Load();
            yield return(Network.GameServer.Instance.SignUpCoroutine(Liver.PlayerDataManager.PlayerData, (r) =>
            {
                Debug.Log(string.Format("SignUp Accepted? ({0})", r.Accepted));
            }));

            // プレイヤー情報の取得
            // 新規プレイヤーは、currentNationがUnKnownになるため、そこで判断する
#if flase
            yield return(GameServer.Instance.RetrievePlayerInfoCoroutine());

            // プレイヤー名をセット
            if (MyApplication.Instance.PlayerInfo != null)
            {
                GrandMenu.TopBar.SetTitleText(MyApplication.Instance.PlayerInfo.PlayerName);

                if (MyApplication.Instance.PlayerInfo.CurrentCampaignType == 0 && !newUser)
                {
                    // 国選択していない場合は、名前入力から
                    yield return(nameInput());
                }
            }

            // アセットバンドル初期化
            yield return(Tsl.Asset.AssetBundleManager.DownloadCRC());
#endif
            initializeCompleted = true;
        }