Esempio n. 1
0
 public void ActionPerformed(ActionEvent evt)
 {
     if (evt.InvokingComponent == dayNightButton)
     {
         World.IsNight = !World.IsNight;
     }
     else
     {
         Console.WriteLine("Menu Triggered!");
     }
 }
Esempio n. 2
0
 public void ActionPerformed(ActionEvent evt)
 {
     if (evt.InvokingComponent == buttons[0]) {
         directionEventHandler(Entity.DirectionType.North);
     } else if (evt.InvokingComponent == buttons[1]) {
         directionEventHandler(Entity.DirectionType.South);
     } else if (evt.InvokingComponent == buttons[2]) {
         directionEventHandler(Entity.DirectionType.East);
     } else {
         directionEventHandler(Entity.DirectionType.West);
     }
 }
Esempio n. 3
0
        public void ActionPerformed(ActionEvent evt)
        {
            if (World.SelectedEntityType == World.EntityType.Person) {
                foreach (Entity e in World.SelectedEntities) {
                    Person thisPerson = (Person) e;

                    for (Person.ProfessionType profession = (Person.ProfessionType)1; profession < Person.ProfessionType.SIZE; profession++) {
                        if (evt.InvokingComponent == professionButtons[(int)profession - 1]) {
                            thisPerson.Profession = profession;
                            break;
                        }
                    }
                }
                Deactivate();
            }
        }
Esempio n. 4
0
 public void ActionPerformed(ActionEvent evt)
 {
 }
Esempio n. 5
0
        /*
         * Triggered when a user clicks on a button.
         */
        public void ActionPerformed(ActionEvent evt)
        {
            if (evt.InvokingComponent == demolishButton) {
                Deactivate();
                World.RemoveEntity((Building) World.SelectedEntities.First());
                World.ClearSelection();
            } else {
                int clickedEffect = 0;
                foreach (Button button in effectButtons) {
                    if (evt.InvokingComponent == button) {
                        break;
                    }
                    clickedEffect++;
                }

                Building building = (Building) World.SelectedEntities.First();
                building.ActivateEffect(clickedEffect);

                if (World.cheater) {
                    building.ForceActivate();
                }
                World.UpdateHighlight();
            }
        }
Esempio n. 6
0
 public void ActionPerformed(ActionEvent evt)
 {
     if (evt.InvokingComponent == demolishButton) {
         Deactivate();
         World.RemoveEntity((Building) World.SelectedEntities.First());
         World.ClearSelection();
     } else if (evt.InvokingComponent == schoolResearchButton_1) {
         thisResearch = World.GetResearch(0);
     } else if (evt.InvokingComponent == schoolResearchButton_2) {
         thisResearch = World.GetResearch(1);
     } else if (evt.InvokingComponent == activateButton) {
         thisCenter.InitiateResearch(thisResearch.Index);
     } else if (evt.InvokingComponent == abortButton) {
         thisCenter.AbortResearch();
     }
 }
Esempio n. 7
0
        public void ActionPerformed(ActionEvent evt)
        {
            if (evt.InvokingComponent == shopButton) {
                if (shopPanel.IsActive) {
                    CloseShopPanel();
                }
                else {
                    CloseItemsPanel();
                    shopPanel.ActivatePanel(true);
                    directionPanel.DeactivatePanel(true);
                    detailPanel.DeactivatePanel(true);
                    mapPanel.DeactivatePanel(true);

                    shopButton.Text = "Back";
                    shopButton.Color = new Color(150, 0, 0, 100);
                }
            } else if (evt.InvokingComponent == itemsButton) {
                if (itemsPanel.IsActive) {
                    CloseItemsPanel();
                } else {
                    CloseShopPanel();
                    itemsPanel.ActivatePanel(true);
                    directionPanel.DeactivatePanel(true);
                    detailPanel.DeactivatePanel(true);
                    mapPanel.DeactivatePanel(true);

                    itemsButton.Text = "Back";
                    itemsButton.Color = new Color(150, 0, 0, 100);
                }
            }
        }