コード例 #1
0
 public VersionWatermark(D3DEngine engine)
 {
     _engine       = engine;
     WatermarkText = Assembly.GetEntryAssembly().GetName().Version.ToString();
     _update       = true;
     DrawOrders.UpdateIndex(0, 100000);
 }
コード例 #2
0
        public FirstPersonToolRenderer(
            D3DEngine d3DEngine,
            CameraManager <ICameraFocused> camManager,
            PlayerEntityManager playerEntityManager,
            VoxelModelManager voxelModelManager,
            VisualWorldParameters visualWorldParameters,
            SingleArrayChunkContainer chunkContainer,
            ISkyDome skyDome)
        {
            _d3dEngine = d3DEngine;

            _camManager        = camManager;
            _voxelModelManager = voxelModelManager;
            _chunkContainer    = chunkContainer;
            _skyDome           = skyDome;

            PlayerCharacter = playerEntityManager.PlayerCharacter;
            playerEntityManager.PlayerEntityChanged += _player_PlayerEntityChanged;

            _cubeRenderer = new CubeRenderer(d3DEngine, visualWorldParameters);

            _animationRotation = Quaternion.Identity;

            DrawOrders.UpdateIndex(0, 5000);

            this.IsDefferedLoadContent = true;
        }
コード例 #3
0
        protected SandboxMenuComponent(D3DEngine engine, MainScreen screen, SandboxCommonResources commonResources)
        {
            _engine                     = engine;
            _screen                     = screen;
            _commonResources            = commonResources;
            _engine.ScreenSize_Updated += EngineViewPortUpdated;

            _linen = new ImageControl {
                Image = _commonResources.StLinenPattern
            };
            _cubes = new ImageControl {
                Image = _commonResources.StCubesPattern
            };
            _shadow = new ImageControl {
                Image = _commonResources.StShadow
            };
            _logo = new ImageControl {
                Image = _commonResources.StLogo
            };
            _version = new ImageControl {
                Image = _commonResources.StGameName
            };


            DrawOrders.UpdateIndex(0, int.MaxValue - 1);
        }
コード例 #4
0
        public FadeSwitchComponent(D3DEngine engine)
        {
            IsDefferedLoadContent = true;

            _engine = engine;

            DrawOrders.UpdateIndex(0, int.MaxValue); //Must ne draw the last
        }
コード例 #5
0
        public ParticuleEngine(D3DEngine d3dEngine,
                               iCBuffer sharedFrameBuffer)
        {
            _d3dEngine         = d3dEngine;
            _sharedFrameBuffer = sharedFrameBuffer;
            _liveEmitter       = new List <IEmitter>();

            DrawOrders.UpdateIndex(0, 1059, "ParticuleEngine");
        }
コード例 #6
0
        public SharedFrameCB(D3DEngine engine,
                             CameraManager <ICamera> cameraManager)
        {
            _engine        = engine;
            _cameraManager = cameraManager;

            DrawOrders.UpdateIndex(0, 0); //Force the Draw call order to maximum priority, because its draw call must be done before everything else ! (As its used by all other components)

            CBPerFrame = ToDispose(new CBuffer <CBPerFrame_Struct>(_engine.Device, "PerFrameShared"));
        }
コード例 #7
0
        public GhostedEntityRenderer(
            PlayerEntityManager playerEntityManager,
            VoxelModelManager voxelModelManager,
            CameraManager <ICameraFocused> cameraManager
            )
        {
            _playerEntityManager = playerEntityManager;
            _voxelModelManager   = voxelModelManager;
            _cameraManager       = cameraManager;
            Transform            = Matrix.Identity;
            Display = true;

            DrawOrders.UpdateIndex(0, 1070);
        }
コード例 #8
0
        public WorldShadowMap(
            CameraManager <ICameraFocused> camManager,
            D3DEngine d3dEngine,
            WorldFocusManager worldFocusManager,
            IClock clock
            )
        {
            DrawOrders.UpdateIndex(0, 99, "SM_CREATION");

            _smDrawID = DrawOrders.AddIndex(10000, "SM_DRAW");


            _d3dEngine         = d3dEngine;
            _camManager        = camManager;
            _worldFocusManager = worldFocusManager;
            _clock             = clock;
        }
コード例 #9
0
ファイル: DisplayInfo.cs プロジェクト: ErtyHackward/utopia
        public DisplayInfo(D3DEngine d3dEngine, Game game)
        {
            _game = game;
            _game.GameComponents.ComponentAdded   += GameComponents_ComponentAdded;
            _game.GameComponents.ComponentRemoved += GameComponents_ComponentRemoved;

            _d3dEngine = d3dEngine;
            DrawOrders.UpdateIndex(0, 10000);

            //Add all exiting components
            foreach (var components in _game.GameComponents)
            {
                if (components is IDebugInfo)
                {
                    AddComponants((IDebugInfo)components);
                }
            }
        }
コード例 #10
0
ファイル: SharedFrameCB.cs プロジェクト: ErtyHackward/utopia
        public SharedFrameCB(D3DEngine engine,
                             CameraManager <ICameraFocused> cameraManager,
                             ISkyDome skydome,
                             VisualWorldParameters visualWorldParam,
                             IPlayerManager playerManager,
                             IWeather weather,
                             [Named("SkyBuffer")] StaggingBackBuffer backBuffer)

        {
            _engine           = engine;
            _cameraManager    = cameraManager;
            _skydome          = skydome;
            _visualWorldParam = visualWorldParam;
            _playerManager    = playerManager;
            _backBuffer       = backBuffer;
            _weather          = weather;

            DrawOrders.UpdateIndex(0, 0);

            CBPerFrame = new CBuffer <CBPerFrame_Struct>(_engine.Device, "PerFrame");
        }
コード例 #11
0
        public DynamicEntityManager(D3DEngine d3DEngine,
                                    VoxelModelManager voxelModelManager,
                                    CameraManager <ICameraFocused> camManager,
                                    WorldFocusManager worldFocusManager,
                                    VisualWorldParameters visualWorldParameters,
                                    SingleArrayChunkContainer chunkContainer,
                                    IPlayerManager playerEntityManager,
                                    ISkyDome skyDome,
                                    SharedFrameCB sharedFrameCB,
                                    IWorldChunks worldChunks,
                                    ISoundEngine soundEngine,
                                    UtopiaParticuleEngine utopiaParticuleEngine
                                    )
        {
            _d3DEngine             = d3DEngine;
            _voxelModelManager     = voxelModelManager;
            _camManager            = camManager;
            _chunkContainer        = chunkContainer;
            _soundEngine           = soundEngine;
            _worldFocusManager     = worldFocusManager;
            _visualWorldParameters = visualWorldParameters;
            _playerEntityManager   = playerEntityManager;
            _playerEntityManager.UtopiaParticuleEngine = utopiaParticuleEngine;
            _skyDome               = skyDome;
            _sharedFrameCB         = sharedFrameCB;
            _worldChunks           = worldChunks;
            _utopiaParticuleEngine = utopiaParticuleEngine;

            _voxelModelManager.VoxelModelAvailable += VoxelModelManagerVoxelModelReceived;
            _camManager.ActiveCameraChanged        += CamManagerActiveCameraChanged;

            _playerEntityManager.PlayerEntityChanged += _playerEntityManager_PlayerEntityChanged;

            DynamicEntities = new List <VisualVoxelEntity>();

            DrawOrders.UpdateIndex(VOXEL_DRAW, 99, "VOXEL_DRAW");
            SPRITENAME_DRAW = DrawOrders.AddIndex(1060, "NAME_DRAW");

            this.IsDefferedLoadContent = true;
        }
コード例 #12
0
        public Hud(MainScreen screen,
                   D3DEngine d3DEngine,
                   ToolBarUi toolbar,
                   InputsManager inputManager,
                   CameraManager <ICameraFocused> camManager,
                   PlayerEntityManager playerEntityManager,
                   IWeather weather,
                   IWorldChunks worldChunks)
        {
            IsDefferedLoadContent = true;

            _screen              = screen;
            _inputManager        = inputManager;
            _playerEntityManager = playerEntityManager;

            _d3DEngine = d3DEngine;
            DrawOrders.UpdateIndex(0, 10000);
            _d3DEngine.ScreenSize_Updated += D3DEngineViewPortUpdated;
            ToolbarUi           = toolbar;
            toolbar.LayoutFlags = ControlLayoutFlags.Skip;
            _camManager         = camManager;

            _inputManager.KeyboardManager.IsRunning = true;
            IsHidden = false;

            _tooltip                   = new TooltipControl();
            _energyBar                 = new EnergyBarsContainer(d3DEngine, playerEntityManager);
            _energyBar.LayoutFlags     = ControlLayoutFlags.Skip;
            _energyBar.Bounds.Location = new UniVector(0, 0); //Always bound to top left location of the screen !

            _weatherContainer                 = new WeatherContainer(d3DEngine, weather, worldChunks, playerEntityManager);
            _weatherContainer.LayoutFlags     = ControlLayoutFlags.Skip;
            _weatherContainer.Bounds.Location = new UniVector(0, 0); //Always bound to top left location of the screen !

            _screen.ToolTipShow += _screen_ToolTipShow;
            _screen.ToolTipHide += _screen_ToolTipHide;
        }
コード例 #13
0
ファイル: ChatComponent.cs プロジェクト: ErtyHackward/utopia
        public ChatComponent(D3DEngine engine, InputsManager imanager, ServerComponent server)
        {
            IsDefferedLoadContent = true;

            _d3dEngine = engine;
            _imanager  = imanager;
            _server    = server;

            _server.MessageChat        += ServerConnectionMessageChat;
            _server.MessagePing        += _server_MessagePing;
            _server.MessageUseFeedback += _server_MessageUseFeedback;

            ChatLineLimit = 30;
            //For 5 seconds =
            _hideChatInTick = 15 * Stopwatch.Frequency;

            _d3dEngine.ScreenSize_Updated += LocateChat;

            LocateChat(_d3dEngine.ViewPort, _d3dEngine.BackBufferTex.Description);
            IsHided = false;

            // make it drawn on top
            DrawOrders.UpdateIndex(0, 10000);
        }
コード例 #14
0
 public BlackBgComponent(D3DEngine engine)
 {
     _engine = engine;
     DrawOrders.UpdateIndex(0, 0);
 }
コード例 #15
0
        public GuiManager(Screen screen,
                          D3DEngine d3DEngine,
                          InputsManager inputManager,
                          string skinPath = @"GUI\Skins\Default\Default.skin.xml",
                          List <Assembly> plugInComponentAssemblies = null
                          )
        {
            _plugInComponentAssemblies = plugInComponentAssemblies;
            _screen       = screen;
            _d3DEngine    = d3DEngine;
            _inputManager = inputManager;
            _skinPath     = skinPath;

            _d3DEngine.GameWindow.KeyPress += GameWindowKeyPress;
            _d3DEngine.GameWindow.KeyDown  += GameWindowKeyDown;
            _d3DEngine.GameWindow.KeyUp    += GameWindowKeyUp;

            _d3DEngine.ScreenSize_Updated += _d3DEngine_ScreenSize_Updated;

            _screen.Width  = _d3DEngine.ViewPort.Width;
            _screen.Height = _d3DEngine.ViewPort.Height;
            _screen.Desktop.ChildsAlignment = VerticalAlignment.Center;

            DrawOrders.UpdateIndex(0, 10001);
            UpdateOrder = _inputManager.UpdateOrder + 1;

            this.IsSystemComponent = true;

            //Register Action Manager for mouse click handling.
            _inputManager.ActionsManager.AddActions(new MouseTriggeredAction()
            {
                ActionId    = Actions.LeftMousePressed,
                TriggerType = MouseTriggerMode.ButtonPressed,
                Binding     = MouseButton.LeftButton
            });

            _inputManager.ActionsManager.AddActions(new MouseTriggeredAction()
            {
                ActionId    = Actions.LeftMouseRelease,
                TriggerType = MouseTriggerMode.ButtonReleased,
                Binding     = MouseButton.LeftButton
            });

            _inputManager.ActionsManager.AddActions(new MouseTriggeredAction()
            {
                ActionId    = Actions.RightMousePressed,
                TriggerType = MouseTriggerMode.ButtonPressed,
                Binding     = MouseButton.RightButton
            });

            _inputManager.ActionsManager.AddActions(new MouseTriggeredAction()
            {
                ActionId    = Actions.RightMouseRelease,
                TriggerType = MouseTriggerMode.ButtonReleased,
                Binding     = MouseButton.RightButton
            });

            _inputManager.ActionsManager.AddActions(new MouseTriggeredAction()
            {
                ActionId    = Actions.ScrollWheelForward,
                TriggerType = MouseTriggerMode.ScrollWheelForward,
                Binding     = MouseButton.ScrollWheel
            });

            _inputManager.ActionsManager.AddActions(new MouseTriggeredAction()
            {
                ActionId    = Actions.ScrollWheelBackward,
                TriggerType = MouseTriggerMode.ScrollWheelBackWard,
                Binding     = MouseButton.ScrollWheel
            });
        }
コード例 #16
0
ファイル: FadeComponent.cs プロジェクト: ErtyHackward/utopia
 public FadeComponent(D3DEngine engine)
 {
     _engine = engine;
     DrawOrders.UpdateIndex(0, 10000);
 }
コード例 #17
0
 public InventoryEventComponent()
 {
     DrawOrders.UpdateIndex(0, 10000);
 }
コード例 #18
0
ファイル: WorldChunks.cs プロジェクト: ErtyHackward/utopia
        public WorldChunks(D3DEngine d3dEngine,
                           CameraManager <ICameraFocused> camManager,
                           VisualWorldParameters visualWorldParameters,
                           WorldFocusManager worldFocusManager,
                           GameStatesManager gameStates,
                           IClock gameClock,
                           SingleArrayChunkContainer cubesHolder,
                           ILandscapeManager2D landscapeManager,
                           IChunkMeshManager chunkMeshManager,
                           IChunksWrapper chunkWrapper,
                           ILightingManager lightingManager,
                           IChunkStorageManager chunkstorage,
                           ServerComponent server,
                           IWeather weather,
                           [Named("SkyBuffer")] StaggingBackBuffer skyBackBuffer,
                           VoxelModelManager voxelModelManager,
                           IChunkEntityImpactManager chunkEntityImpactManager,
                           InputsManager inputsManager
                           )
        {
            _server                   = server;
            _chunkstorage             = chunkstorage;
            _d3dEngine                = d3dEngine;
            _worldFocusManager        = worldFocusManager;
            _gameStates               = gameStates;
            _camManager               = camManager;
            _gameClock                = gameClock;
            VisualWorldParameters     = visualWorldParameters;
            _cubesHolder              = cubesHolder;
            _chunkWrapper             = chunkWrapper;
            _landscapeManager         = landscapeManager;
            _chunkMeshManager         = chunkMeshManager;
            _lightingManager          = lightingManager;
            _weather                  = weather;
            _skyBackBuffer            = skyBackBuffer;
            _voxelModelManager        = voxelModelManager;
            _chunkEntityImpactManager = chunkEntityImpactManager;
            _inputsManager            = inputsManager;

            _skyBackBuffer.OnStaggingBackBufferChanged += _skyBackBuffer_OnStaggingBackBufferChanged;

            SliceViewChunks = 25;

            DrawStaticInstanced = true;

            if (visualWorldParameters.WorldParameters.Configuration is UtopiaWorldConfiguration)
            {
                _utopiaProcessorParam = ((UtopiaWorldConfiguration)visualWorldParameters.WorldParameters.Configuration).ProcessorParam;
            }

            //Self injecting inside components, to avoid circular dependency
            _chunkWrapper.WorldChunks     = this;
            lightingManager.WorldChunk    = this;
            _chunkMeshManager.WorldChunks = this;
            landscapeManager.WorldChunks  = this;

            DrawOrders.UpdateIndex(SOLID_DRAW, 100, "SOLID_DRAW");
            TRANSPARENT_DRAW = DrawOrders.AddIndex(1050, "TRANSPARENT_DRAW");
            ENTITIES_DRAW    = DrawOrders.AddIndex(101, "ENTITIES_DRAW");

            this.IsDefferedLoadContent = true;
        }