Files
OpenRA/OpenRA.Mods.Common/Widgets/Logic/Editor/MapEditorTabsLogic.cs
2015-05-15 17:09:27 +01:00

54 lines
1.8 KiB
C#

#region Copyright & License Information
/*
* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.GameRules;
using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic
{
public class MapEditorTabsLogic
{
protected enum MenuType { Tiles, Layers, Actors }
protected MenuType menuType = MenuType.Tiles;
[ObjectCreator.UseCtor]
public MapEditorTabsLogic(Widget widget, WorldRenderer worldRenderer)
{
var tabContainer = widget.Get("MAP_EDITOR_TAB_CONTAINER");
var tilesTab = tabContainer.Get<ButtonWidget>("TILES_TAB");
tilesTab.IsHighlighted = () => menuType == MenuType.Tiles;
tilesTab.OnClick = () => { menuType = MenuType.Tiles; };
var overlaysTab = tabContainer.Get<ButtonWidget>("OVERLAYS_TAB");
overlaysTab.IsHighlighted = () => menuType == MenuType.Layers;
overlaysTab.OnClick = () => { menuType = MenuType.Layers; };
var actorsTab = tabContainer.Get<ButtonWidget>("ACTORS_TAB");
actorsTab.IsHighlighted = () => menuType == MenuType.Actors;
actorsTab.OnClick = () => { menuType = MenuType.Actors; };
var tileContainer = widget.Parent.Get<ContainerWidget>("TILE_WIDGETS");
tileContainer.IsVisible = () => menuType == MenuType.Tiles;
var layerContainer = widget.Parent.Get<ContainerWidget>("LAYER_WIDGETS");
layerContainer.IsVisible = () => menuType == MenuType.Layers;
var actorContainer = widget.Parent.Get<ContainerWidget>("ACTOR_WIDGETS");
actorContainer.IsVisible = () => menuType == MenuType.Actors;
}
}
}