Esempio n. 1
0
        public override void Initialize()
        {
            base.Initialize();

            _extraPanelToggle = new TogglableButton(Context, "minimap_realm_mode",
                                                    new UniRectangle(),
                                                    "Data/UI/MinimapIcons/extra_button_plus.dds",
                                                    "Data/UI/MinimapIcons/extra_button_minus.dds");

            TogglableButton politicalButton = new TogglableButton(Context, "minimap_policial_mode",
                                                                  new UniRectangle(),
                                                                  "Data/UI/MinimapIcons/political_map.dds",
                                                                  "Data/UI/MinimapIcons/political_map_toggled.dds");

            politicalButton.Toggled += () => _terrain.CurrentRenderingMode = Terrain.RenderingMode.Province;

            TogglableButton realmButton = new TogglableButton(Context, "minimap_realm_mode",
                                                              new UniRectangle(),
                                                              "Data/UI/MinimapIcons/realm_map.dds",
                                                              "Data/UI/MinimapIcons/realm_map_toggled.dds");

            realmButton.Toggled += () => _terrain.CurrentRenderingMode = Terrain.RenderingMode.Realm;

            TogglableButton foodButton = new TogglableButton(Context, "minimap_food_mode",
                                                             new UniRectangle(),
                                                             "Data/UI/MinimapIcons/food_map.dds",
                                                             "Data/UI/MinimapIcons/food_map_toggled.dds");

            foodButton.Toggled += () => _terrain.CurrentRenderingMode = Terrain.RenderingMode.FoodAvailability;

            TogglableButton terrainButton = new TogglableButton(Context, "minimap_terrain_mode",
                                                                new UniRectangle(),
                                                                "Data/UI/MinimapIcons/terrain_map.dds",
                                                                "Data/UI/MinimapIcons/terrain_map_toggled.dds");

            TogglableButtonGroup mapButtonGroup = new TogglableButtonGroup(politicalButton);

            politicalButton.Group = mapButtonGroup;
            realmButton.Group     = mapButtonGroup;
            terrainButton.Group   = mapButtonGroup;
            foodButton.Group      = mapButtonGroup;

            Register(new Minimap(Context,
                                 new UniRectangle(10, 50, new UniScalar(1.0f, -20), new UniScalar(1.0f, -60))));

            new HorizontalLayout(this, 10, 30, 20, 20)
            .AddControl(_extraPanelToggle, 40)
            .AddControl(politicalButton, 40)
            .AddControl(realmButton, 40)
            .AddControl(foodButton, 40)
            .AddControl(terrainButton, 40)
            .Create();
        }
Esempio n. 2
0
        public override void Initialize()
        {
            base.Initialize();

            _extraPanelToggle = new TogglableButton(Context, "minimap_realm_mode",
                new UniRectangle(),
                "Data/UI/MinimapIcons/extra_button_plus.dds",
                "Data/UI/MinimapIcons/extra_button_minus.dds");

            TogglableButton politicalButton = new TogglableButton(Context, "minimap_policial_mode",
                new UniRectangle(),
                "Data/UI/MinimapIcons/political_map.dds",
                "Data/UI/MinimapIcons/political_map_toggled.dds");
            politicalButton.Toggled += () => _terrain.CurrentRenderingMode = Terrain.RenderingMode.Province;

            TogglableButton realmButton = new TogglableButton(Context, "minimap_realm_mode",
                new UniRectangle(),
                "Data/UI/MinimapIcons/realm_map.dds",
                "Data/UI/MinimapIcons/realm_map_toggled.dds");
            realmButton.Toggled += () => _terrain.CurrentRenderingMode = Terrain.RenderingMode.Realm;

            TogglableButton foodButton = new TogglableButton(Context, "minimap_food_mode",
                new UniRectangle(),
                "Data/UI/MinimapIcons/food_map.dds",
                "Data/UI/MinimapIcons/food_map_toggled.dds");
            foodButton.Toggled += () => _terrain.CurrentRenderingMode = Terrain.RenderingMode.FoodAvailability;

            TogglableButton terrainButton = new TogglableButton(Context, "minimap_terrain_mode",
                new UniRectangle(),
                "Data/UI/MinimapIcons/terrain_map.dds",
                "Data/UI/MinimapIcons/terrain_map_toggled.dds");

            TogglableButtonGroup mapButtonGroup = new TogglableButtonGroup(politicalButton);
            politicalButton.Group = mapButtonGroup;
            realmButton.Group = mapButtonGroup;
            terrainButton.Group = mapButtonGroup;
            foodButton.Group = mapButtonGroup;

            Register(new Minimap(Context,
                new UniRectangle(10, 50, new UniScalar(1.0f, -20), new UniScalar(1.0f, -60))));

            new HorizontalLayout(this, 10, 30, 20, 20)
                .AddControl(_extraPanelToggle,40)
                .AddControl(politicalButton, 40)
                .AddControl(realmButton,40)
                .AddControl(foodButton, 40)
                .AddControl(terrainButton,40)
                .Create();
        }
Esempio n. 3
0
 public TogglableButtonGroup(TogglableButton defaultButton)
 {
     Default = defaultButton;
     CurrentButton = defaultButton;
     defaultButton.Toggle();
 }
Esempio n. 4
0
 public void SetActiveButton(TogglableButton togglableButton)
 {
     CurrentButton.Untoggle();
     CurrentButton = togglableButton;
     CurrentButton.Toggle();
 }
Esempio n. 5
0
 public void SetActiveButton(TogglableButton togglableButton)
 {
     CurrentButton.Untoggle();
     CurrentButton = togglableButton;
     CurrentButton.Toggle();
 }
Esempio n. 6
0
 public TogglableButtonGroup(TogglableButton defaultButton)
 {
     Default       = defaultButton;
     CurrentButton = defaultButton;
     defaultButton.Toggle();
 }