예제 #1
0
 public virtual void LoadTextures()
 {
     this.menusCaller          = this.game.Components.OfType <MenusCaller>().ElementAt(0);
     this.pickingService       = this.game.GetService <PickingService>();
     this.menu.EnabledChanged += new EventHandler <EventArgs>(menu_EnabledChanged);
     this.personTex            = this.stopTex;
     this.frustum              = new BoundingFrustum(this.view * this.projection);
 }
예제 #2
0
 /// <summary>
 /// Retrievs all services and components needed to start the game
 /// </summary>
 private void GetComponentsServicesToEnable()
 {
     this.cameraService   = this.Game.GetService <CameraService>();
     this.pickingService  = this.Game.GetService <PickingService>();
     this.gameScreen      = this.Game.Components.OfType <GameScreen>().ElementAt(0);
     this.gameField       = this.Game.Components.OfType <GameField>().ElementAt(0);
     this.humansParent    = this.Game.Components.OfType <HumansParent>().ElementAt(0);
     this.buildingsParent = this.Game.Components.OfType <BuildingsParent>().ElementAt(0);
     this.resourcesParent = this.Game.Components.OfType <ResourcesParent>().ElementAt(0);
     this.menuCaller      = this.Game.Components.OfType <MenusCaller>().ElementAt(0);
     this.resourcesHUD    = this.Game.Components.OfType <ResourcesHUD>().ElementAt(0);
 }
예제 #3
0
        private MessageBox(Game game) : base(game)
        {
            try
            {
                this.pickingService              = game.GetService <PickingService>();
                this.pickingService.Enabled      = false;
                this.buildingsMenuCaller         = game.Components.OfType <MenusCaller>().ElementAt(0);
                this.buildingsMenuCaller.Enabled = false;
                this.buildingsMenuCaller.Visible = false;
            }
            catch (Exception)
            { }

            this.lsBtns         = new List <Button <MessageBox> >();
            this.backgroundRect = new Rectangle(0, 0, game.GraphicsDevice.Viewport.Width, game.GraphicsDevice.Viewport.Height);
            this.iconRect       = new Rectangle(10, ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT);
            this.titlePos       = new Vector2(25 + ICON_WIDTH, ICON_HEIGHT);
            this.txtPos         = new Vector2(10, 2 * ICON_HEIGHT + 40);
        }
예제 #4
0
        private void gameField_OnPersonClicked(Object o, CellState role)
        {
            if (this.PersonSelected)
            {
                var result = from target in this.listOfPersons
                             where target.Role == role
                             select target;
                this.selectedPerson = result.ElementAt(0);
                this.SelectedRole   = role;

                if (this.menusCaller == null)
                {
                    this.menusCaller = this.Game.Components.OfType <MenusCaller>().ElementAt(0);
                    this.menusCaller.OnCallerButtonPressed += new MenusCaller.CallerButtonPressed(menusCaller_OnCallerButtonPressed);
                    this.menusCaller.OnPersonButtonPressed += new MenusCaller.PersonButtonPressed(menusCaller_OnPersonButtonPressed);
                }
                this.menusCaller.SetShowPersonOnBar(this.selectedPerson.FaceTex, selectedPerson.Role);
            }
            else
            {
                this.menusCaller.SetShowPersonOnBar(null, CellState.Forbidden);
                this.selectedPerson = null;
            }
        }
예제 #5
0
 public HumansParent(Game game) : base(game)
 {
     this.listOfPersons         = new List <HumansBase>();
     this.menusCaller           = null;
     this.listOfPersonsToCreate = HumansParentHelper.GetList(this.CreatePersonsObject);
 }