Exemplo n.º 1
0
        public BuildingPanel(Game game)
            : base(game) {

            frame = new Sprite(game, GraphicsCollection.GetPack("building-frame"));
            frame.StackOrder = 0;

            upArrow = new PanelButton(game, PanelButtonType.UpArrow);
            upArrow.XRelative = 55;
            upArrow.YRelative = 254;
            upArrow.StackOrder = 1;

            downArrow = new PanelButton(game, PanelButtonType.DownArrow);
            downArrow.XRelative = 92;
            downArrow.YRelative = 255;
            downArrow.StackOrder = 1;

            tooltip = new Tooltip(game, 3);
            tooltip.XRelative = 23;
            tooltip.StackOrder = 2;
            tooltip.Visible = false;

            AddChild(frame);
            AddChild(upArrow);
            AddChild(downArrow);
            AddChild(tooltip);
          
            direction = 0;
            speed = 15;

            CreateIcons();
        }
 public void Button_OnMouseOver(object sender, ButtonEventArgs args)
 {
     if (tooltip == null)
     {
         tooltip = new Tooltip(this.Game, 1);
         tooltip.XRelative = buttonsXposition + 8;
         tooltip.YRelative = 5;
         tooltip.StackOrder = 3;
         tooltip.Visible = true;
         AddChild(tooltip);
     }
     tooltip.Text = " " + ((ConstructionPanelButton)sender).ButtonType.ToString();
     tooltip.YRelative = ((ConstructionPanelButton)sender).YRelative + 40;
     tooltip.IsVisible = true;
 }
Exemplo n.º 3
0
        public LeftMenu(Game game)
            : base(game) {
            frame = new Sprite(game, GraphicsCollection.GetPack("left-menu-frame"));
            frame.StackOrder = 1;

            AddChild(frame);

            minimize = new PanelButton(game, PanelButtonType.ResourcesMinimize);
            minimize.StackOrder = 2;
            minimize.XRelative = 60;
            minimize.YRelative = 11;
            minimize.OnMousePress += new EventHandler<Operation_Cronos.Input.MouseEventArgs>(minimize_OnMousePress);
            AddChild(minimize);

            parameters = new ParametersPanel(game);
            parameters.XRelative = ParametersPanel.ClosedPosition;
            parameters.YRelative = 15;
            parameters.StackOrder = 0;
            AddChild(parameters);

            alert = new PanelButton(game, PanelButtonType.ResourcesAlert);
            alert.XRelative = buttonsX;
            alert.YRelative = 25;
            alert.StackOrder = 3;
            alert.OnMouseOver += new EventHandler<ButtonEventArgs>(LeftButton_OnMouseOver);
            alert.OnMouseLeave += new EventHandler<ButtonEventArgs>(LeftButton_OnMouseLeave);
            alert.OnRelease += new EventHandler<ButtonEventArgs>(button_OnRelease);
            AddChild(alert);

            mission = new PanelButton(game, PanelButtonType.ResourcesMission);
            mission.StackOrder = 3;
            mission.XRelative = buttonsX;
            mission.YRelative = 60;
            mission.OnMouseOver += new EventHandler<ButtonEventArgs>(LeftButton_OnMouseOver);
            mission.OnMouseLeave += new EventHandler<ButtonEventArgs>(LeftButton_OnMouseLeave);
            mission.OnRelease += new EventHandler<ButtonEventArgs>(button_OnRelease);
            AddChild(mission);

            control = new PanelButton(game, PanelButtonType.ResourcesControl);
            control.StackOrder = 3;
            control.XRelative = buttonsX;
            control.YRelative = 89;
            control.OnMouseOver += new EventHandler<ButtonEventArgs>(LeftButton_OnMouseOver);
            control.OnMouseLeave += new EventHandler<ButtonEventArgs>(LeftButton_OnMouseLeave);
            control.OnRelease += new EventHandler<ButtonEventArgs>(button_OnRelease);
            AddChild(control);

            save = new PanelButton(game, PanelButtonType.ResourcesSave);
            save.StackOrder = 3;
            save.XRelative = buttonsX + 3;
            save.YRelative = 123;
            save.OnMouseOver += new EventHandler<ButtonEventArgs>(LeftButton_OnMouseOver);
            save.OnMouseLeave += new EventHandler<ButtonEventArgs>(LeftButton_OnMouseLeave);
            save.OnRelease += new EventHandler<ButtonEventArgs>(button_OnRelease);
            AddChild(save);

            exit = new PanelButton(game, PanelButtonType.ResourcesExit);
            exit.StackOrder = 3;
            exit.XRelative = buttonsX+2;
            exit.YRelative = 155;
            exit.OnMouseOver += new EventHandler<ButtonEventArgs>(LeftButton_OnMouseOver);
            exit.OnMouseLeave += new EventHandler<ButtonEventArgs>(LeftButton_OnMouseLeave);
            exit.OnRelease+=new EventHandler<ButtonEventArgs>(button_OnRelease);
            AddChild(exit);

            #region ControlPanel
            controlPanel = new ControlPanel(game);
            controlPanel.StackOrder = 3;
            controlPanel.Visible = false;
            controlPanel.Enabled = false;
            AddChild(controlPanel);
            #endregion

            #region MissionPannel
            missionPanel = new MissionPanel(game);
            missionPanel.StackOrder = 3;
            missionPanel.XRelative = 300;
            missionPanel.YRelative = 200;
            missionPanel.Visible = false;
            missionPanel.Enabled = false;
            AddChild(missionPanel);
            #endregion

            #region AlertPannel
            alertPanel = new AlertPanel(game);
            alertPanel.StackOrder = 3;
            alertPanel.XRelative = 300;
            alertPanel.YRelative = 200;
            alertPanel.Visible = false;
            alertPanel.Enabled = false;
            alertPanel.On_Blink += new EventHandler(alertPanel_On_Blink);
            AddChild(alertPanel);
            #endregion

            tooltip = new Tooltip(game, 2);
            tooltip.XRelative = buttonsX + exit.Width + 5;
            tooltip.StackOrder = 2;
            tooltip.YRelative = 0;
            AddChild(tooltip);
            tooltip.Visible = false;
        }
Exemplo n.º 4
0
        public Minimap(Game game)
            : base(game) {
            frame = new Sprite(game, GraphicsCollection.GetPack("minimap-frame"));
            frame.StackOrder = 0;
            AddChild(frame);

            buttons = new List<BuildingTypeButton>(6);

            #region Buttons
            population = new BuildingTypeButton(game, ConstructionType.Population);
            population.StackOrder = 1;
            population.XRelative = 31;
            population.YRelative = buttonsY;
            population.OnMouseOver += new EventHandler<ButtonEventArgs>(Button_OnMouseOver);
            population.OnMouseLeave += new EventHandler<ButtonEventArgs>(Button_OnMouseLeave);

            
            economy = new BuildingTypeButton(game, ConstructionType.Economy);
            economy.StackOrder = 1;
            economy.XRelative = 65;
            economy.YRelative = buttonsY;
            economy.OnMouseOver += new EventHandler<ButtonEventArgs>(Button_OnMouseOver);
            economy.OnMouseLeave += new EventHandler<ButtonEventArgs>(Button_OnMouseLeave);

            health = new BuildingTypeButton(game, ConstructionType.Health);
            health.StackOrder = 1;
            health.XRelative = 94;
            health.YRelative = buttonsY+1;
            health.OnMouseOver += new EventHandler<ButtonEventArgs>(Button_OnMouseOver);
            health.OnMouseLeave += new EventHandler<ButtonEventArgs>(Button_OnMouseLeave);

            education = new BuildingTypeButton(game, ConstructionType.Education);
            education.StackOrder = 1;
            education.XRelative = 125;
            education.YRelative = buttonsY+2;
            education.OnMouseOver += new EventHandler<ButtonEventArgs>(Button_OnMouseOver);
            education.OnMouseLeave += new EventHandler<ButtonEventArgs>(Button_OnMouseLeave);

            power = new BuildingTypeButton(game, ConstructionType.Energy);
            power.StackOrder = 1;
            power.XRelative = 160;
            power.YRelative = buttonsY;
            power.OnMouseOver += new EventHandler<ButtonEventArgs>(Button_OnMouseOver);
            power.OnMouseLeave += new EventHandler<ButtonEventArgs>(Button_OnMouseLeave);

            food = new BuildingTypeButton(game, ConstructionType.Food);
            food.StackOrder = 1;
            food.XRelative = 187;
            food.YRelative = buttonsY-1;
            food.OnMouseOver += new EventHandler<ButtonEventArgs>(Button_OnMouseOver);
            food.OnMouseLeave += new EventHandler<ButtonEventArgs>(Button_OnMouseLeave);

            environment = new BuildingTypeButton(game, ConstructionType.Environment);
            environment.StackOrder = 1;
            environment.XRelative = 218;
            environment.YRelative = buttonsY;
            environment.OnMouseOver += new EventHandler<ButtonEventArgs>(Button_OnMouseOver);
            environment.OnMouseLeave += new EventHandler<ButtonEventArgs>(Button_OnMouseLeave);

            buttons.Add(population);
            buttons.Add(environment);
            buttons.Add(health);
            buttons.Add(education);
            buttons.Add(power);
            buttons.Add(food);
            buttons.Add(economy);

            foreach (BuildingTypeButton  button in buttons) {
                button.OnRelease += new EventHandler<ButtonEventArgs>(button_OnRelease);
                AddChild(button);
            }
            #endregion

            minimize = new PanelButton(game, PanelButtonType.Minimize);
            minimize.XRelative = 38;
            minimize.YRelative = 148;
            minimize.StackOrder = 2;
            minimize.OnPress += new EventHandler<ButtonEventArgs>(minimize_OnPress);

            AddChild(minimize);

            map = new Map(game);
            map.YRelative = 19;
            map.XRelative = 25;
            AddChild(map);

            tooltip = new Tooltip(game, 2);
            tooltip.XRelative = 0;
            tooltip.StackOrder = 2;
            tooltip.YRelative = buttonsY + 20;
            tooltip.Visible = false;
            AddChild(tooltip);
        }