Example #1
0
        protected override void Initialize()
        {
            // UIManager を初期化して登録します。
            uiManager = new UIManager(this);
            uiManager.ScreenFactory = CreateScreenFactory();
            Components.Add(uiManager);

            var fpsCounter = new FpsCounter(this);
            fpsCounter.Content.RootDirectory = "Content";
            fpsCounter.HorizontalAlignment = DebugHorizontalAlignment.Right;
            fpsCounter.SampleSpan = TimeSpan.FromSeconds(2);
            Components.Add(fpsCounter);

            timeRuler = new TimeRuler(this);
            Components.Add(timeRuler);

            updateMarker = timeRuler.CreateMarker();
            updateMarker.Name = "Update";
            updateMarker.BarIndex = 0;
            updateMarker.Color = Color.Cyan;

            drawMarker = timeRuler.CreateMarker();
            drawMarker.Name = "Draw";
            drawMarker.BarIndex = 1;
            drawMarker.Color = Color.Yellow;

            // StorageManager を登録します。
            storageManager = new StorageManager(this);
            storageManager.ContainerSelected += (s, c) =>
            {
                // IBoxService が登録されているならば BoxIntegration を初期化します。
                if (boxManager != null) BoxIntegration.Initialize();
            };
            Components.Add(storageManager);

            // StorageBlockManager を登録します。
            storageBlockManager = new StorageBlockManager(this);

            // AsyncTaskManager を登録します。
            asyncTaskManager = new AsyncTaskManager(this);
            Components.Add(asyncTaskManager);

            // IBoxService を登録します。
            var assemblyFile = "Willcraftia.Net.Box.BlockViewer.ApiKey.dll";
            var apiKeyClassName = "Willcraftia.Net.Box.BlockViewer.ApiKey";
            try
            {
                boxManager = new BoxManager(assemblyFile, apiKeyClassName);
                Services.AddService(typeof(IBoxService), boxManager);

                BoxIntegration = new BoxIntegration(this);
            }
            catch
            {
                // IBoxService を無効とします。
            }

            // マウス カーソルを可視にします。
            IsMouseVisible = true;

            base.Initialize();
        }
Example #2
0
        protected override void Initialize()
        {
            // マウス カーソルを可視にします。
            IsMouseVisible = true;

            // UIManager を初期化して登録します。
            uiManager = new UIManager(this);
            uiManager.ScreenFactory = CreateScreenFactory();
            Components.Add(uiManager);

            // StorageManager を登録します。
            storageManager = new StorageManager(this);
            Components.Add(storageManager);

            // StorageBlockManager を登録します。
            storageBlockManager = new StorageBlockManager(this);

            #region Debug

            var fpsCounter = new FpsCounter(this);
            fpsCounter.Content.RootDirectory = "Content";
            fpsCounter.HorizontalAlignment = DebugHorizontalAlignment.Left;
            fpsCounter.SampleSpan = TimeSpan.FromSeconds(2);
            Components.Add(fpsCounter);

            timeRuler = new TimeRuler(this);
            Components.Add(timeRuler);

            updateMarker = timeRuler.CreateMarker();
            updateMarker.Name = "Update";
            updateMarker.BarIndex = 0;
            updateMarker.Color = Color.Cyan;

            drawMarker = timeRuler.CreateMarker();
            drawMarker.Name = "Draw";
            drawMarker.BarIndex = 1;
            drawMarker.Color = Color.Yellow;

            #endregion

            base.Initialize();
        }