public override void Enter(Dictionary<string, object> data) { var localPlayer = Storage.NetworkSession.LocalGamers[0].Tag as LocalPlayer; if(localPlayer != null) { localPlayer.Phase = GamePhases.Phase1; } _tutorialSound = Storage.Sound("Tutorial").CreateInstance(); Storage.InTutorial = true; Storage.TutorialLevel = 0; Cursor.Hide(); _crosshair = new Crosshair(Game); Game.Components.Add(_crosshair); foreach(var gamer in Storage.NetworkSession.AllGamers) { Game.Components.Add((Player)gamer.Tag); } Game.Components.Add(Game.GameMap); if(localPlayer != null) { var centerSidebar = (Game.GameMap.Width + Game.BaseScreenSize.X) / 2.0f; _mobilityIcon = AddToolIconForTool(localPlayer.Mobility, centerSidebar - 20.0f - 148.0f, 10.0f + 148.0f); _weaponIcon = AddToolIconForTool(localPlayer.Weapon, centerSidebar, 10.0f + 148.0f); _utilityIcon = AddToolIconForTool(localPlayer.Utility, centerSidebar + 20.0f + 148.0f, 10.0f + 148.0f); _primaryAIcon = AddToolIconForTool(localPlayer.PrimaryA, centerSidebar - 10.0f - 74.0f, (10.0f + 148.0f) * 2.0f); _primaryBIcon = AddToolIconForTool(localPlayer.PrimaryB, centerSidebar + 20.0f + 74.0f, (10.0f + 148.0f) * 2.0f); _keyBindingIcon = new Billboard(Game, (int)centerSidebar, 400, Storage.Sprite("blank")) { PositionGravity = Gravity.Center }; Game.Components.Add(_keyBindingIcon); if(_primaryBIcon != null) { _primaryBIcon.Disabled = true; } _nameLabel = new Label(Game, centerSidebar, 2.0f, localPlayer.Gamer.Gamertag, "Calibri48Bold") { PositionGravity = new Tuple<Gravity.Vertical, Gravity.Horizontal>(Gravity.Vertical.Top, Gravity.Horizontal.Center) }; Game.Components.Add(_nameLabel); } Game.Components.Add(Storage.SandParticles); StartTimer(); }
/// <summary> /// Tool icon texture given tool icon type. /// </summary> /// <param name="toolIcon">Tool icon type.</param> /// <returns>Tool icon texture for given type.</returns> public static Texture2D GetIcon(ToolIcon toolIcon) { if (m_toolIcons == null) { LoadToolIconContent(); } return(m_toolIcons[(int)toolIcon]); }
/// <summary> /// Initializes a new instance of the <see cref="GisToolAttribute"/> class. /// </summary> public GisToolAttribute(string groupKey, ToolIcon icon = ToolIcon.ToolDefault, Type presenter = null) { if (string.IsNullOrWhiteSpace(groupKey)) { throw new ArgumentNullException("groupKey"); } GroupKey = groupKey; Icon = icon; PresenterType = presenter; }
/// <summary> /// Initializes a new instance of the <see cref="GisToolAttribute"/> class. /// </summary> public GisToolAttribute( string groupKey, ToolIcon icon = ToolIcon.ToolDefault, Type presenter = null, string groupName = "", string groupDescription = "", bool onlyGroup = false, string parentGroupKey = "") { if (string.IsNullOrWhiteSpace(groupKey)) { throw new ArgumentNullException(nameof(groupKey)); } GroupKey = groupKey; GroupName = string.IsNullOrEmpty(groupName) ? groupKey : groupName; GroupDescription = string.IsNullOrEmpty(groupDescription) ? groupKey : groupDescription; Icon = icon; PresenterType = presenter; OnlyGroup = onlyGroup; ParentGroupKey = parentGroupKey; }
private ToolIcon AddToolIconForTool(Tool tool, float x, float y) { if(tool == null) { return null; } var icon = new ToolIcon(Game, tool) { X = x, Y = y }; Game.Components.Add(icon); return icon; }
public override void Enter(Dictionary<string, object> data) { var localPlayer = Storage.NetworkSession.LocalGamers[0].Tag as LocalPlayer; if(localPlayer != null) { localPlayer.Phase = GamePhases.Phase1; } Cursor.Hide(); _crosshair = new Crosshair(Game); Game.Components.Add(_crosshair); foreach(var gamer in Storage.NetworkSession.AllGamers) { Game.Components.Add((Player)gamer.Tag); } Game.Components.Add(Game.GameMap); if(localPlayer != null) { var centerSidebar = (Game.GameMap.Width + Game.BaseScreenSize.X) / 2.0f; _mobilityIcon = AddToolIconForTool(localPlayer.Mobility, centerSidebar - 20.0f - 148.0f, 10.0f + 148.0f); _weaponIcon = AddToolIconForTool(localPlayer.Weapon, centerSidebar, 10.0f + 148.0f); _utilityIcon = AddToolIconForTool(localPlayer.Utility, centerSidebar + 20.0f + 148.0f, 10.0f + 148.0f); _primaryAIcon = AddToolIconForTool(localPlayer.PrimaryA, centerSidebar - 10.0f - 74.0f, (10.0f + 148.0f) * 2.0f); _primaryBIcon = AddToolIconForTool(localPlayer.PrimaryB, centerSidebar + 20.0f + 74.0f, (10.0f + 148.0f) * 2.0f); if(_primaryBIcon != null) { _primaryBIcon.Disabled = true; } _nameLabel = new Label(Game, centerSidebar, 2.0f, localPlayer.Gamer.Gamertag, "Calibri48Bold") { PositionGravity = new Tuple<Gravity.Vertical, Gravity.Horizontal>(Gravity.Vertical.Top, Gravity.Horizontal.Center) }; Game.Components.Add(_nameLabel); } Game.Components.Add(Storage.SandParticles); _redSandMeter = new SandMeter(Game, Team.Red) { X = _primaryAIcon.X, Y = _primaryAIcon.Y + 430 }; _blueSandMeter = new SandMeter(Game, Team.Blue) { X = _primaryBIcon.X, Y = _primaryBIcon.Y + 430 }; Game.Components.Add(_redSandMeter); Game.Components.Add(_blueSandMeter); _redScoreMeter = new ScoreMeter(Game, Team.Red) { X = _redSandMeter.X, Y = _redSandMeter.Y + (_redSandMeter.Height / 2.0f) + 85 }; _blueScoreMeter = new ScoreMeter(Game, Team.Blue) { X = _blueSandMeter.X, Y = _blueSandMeter.Y + (_blueSandMeter.Height / 2.0f) + 85 }; Game.Components.Add(_redScoreMeter); Game.Components.Add(_blueScoreMeter); StartTimer(); }