-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'darkademic/dev'
- Loading branch information
Showing
57 changed files
with
2,025 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#region Copyright & License Information | ||
/** | ||
* Copyright (c) The OpenRA Combined Arms Developers (see CREDITS). | ||
* This file is part of OpenRA Combined Arms, 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, either version 3 of the License, | ||
* or (at your option) any later version. For more information, see COPYING. | ||
*/ | ||
#endregion | ||
|
||
using System.Collections.Generic; | ||
using OpenRA.Traits; | ||
|
||
namespace OpenRA.Mods.CA.Traits | ||
{ | ||
[Desc("Keeps track of player's initial build order for observer stats.")] | ||
public class BuildOrderTrackerInfo : TraitInfo | ||
{ | ||
[Desc("Maximum number of items to track.")] | ||
public readonly int MaxItems = 12; | ||
|
||
public override object Create(ActorInitializer init) { return new BuildOrderTracker(init.Self, this); } | ||
} | ||
|
||
public class BuildOrderTracker | ||
{ | ||
readonly BuildOrderTrackerInfo info; | ||
List<string> buildOrder; | ||
public int Count { get; private set; } | ||
public List<string> BuildOrder => buildOrder; | ||
|
||
public BuildOrderTracker(Actor self, BuildOrderTrackerInfo info) | ||
{ | ||
this.info = info; | ||
buildOrder = new List<string>(); | ||
Count = 0; | ||
} | ||
|
||
public void BuildingCreated(string type) | ||
{ | ||
if (Count >= info.MaxItems) | ||
return; | ||
|
||
Count++; | ||
buildOrder.Add(type); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#region Copyright & License Information | ||
/** | ||
* Copyright (c) The OpenRA Combined Arms Developers (see CREDITS). | ||
* This file is part of OpenRA Combined Arms, 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, either version 3 of the License, | ||
* or (at your option) any later version. For more information, see COPYING. | ||
*/ | ||
#endregion | ||
|
||
using OpenRA.Traits; | ||
|
||
namespace OpenRA.Mods.CA.Traits | ||
{ | ||
[Desc("Added to build order when the actor is created.")] | ||
public class UpdatesBuildOrderInfo : TraitInfo | ||
{ | ||
public override object Create(ActorInitializer init) { return new UpdatesBuildOrder(init, this); } | ||
} | ||
|
||
public class UpdatesBuildOrder : INotifyCreated | ||
{ | ||
public readonly UpdatesBuildOrderInfo Info; | ||
readonly BuildOrderTracker buildOrderTracker; | ||
|
||
public UpdatesBuildOrder(ActorInitializer init, UpdatesBuildOrderInfo info) | ||
{ | ||
Info = info; | ||
buildOrderTracker = init.Self.Owner.PlayerActor.Trait<BuildOrderTracker>(); | ||
} | ||
|
||
void INotifyCreated.Created(Actor self) | ||
{ | ||
buildOrderTracker.BuildingCreated(self.Info.Name); | ||
} | ||
} | ||
} |
Oops, something went wrong.