Improve replay metadata and the replay browser
List of changes: * Better and more filters with new layout, for both mods. * Rename/Delete/Detele all functionality. * Simplified ReplayMetadata class considerably by introducing a new GameInformation data object. The new GameInformation class contains more information than previously available so the new solution is not compatible with old replays, meaning it can't read old replays. * Better and cleaner game information gathering in order to be written at the end of the replay file. * Revert changes to ReplayConnection, no longer necessary. * Better exception message on missing sprites and fonts. * New "SpawnOccupant" class that holds all the information needed by the MapPreviewWidget to visualize a spawn point. It was using Session.Client before and it was necessary to separate it to be able to show information not available at lobby time. * Fix keyboard focus UI bug when closing a window would not remove focus.
This commit is contained in:
@@ -85,6 +85,7 @@ namespace OpenRA
|
||||
public readonly TileSet TileSet;
|
||||
public readonly ActorMap ActorMap;
|
||||
public readonly ScreenMap ScreenMap;
|
||||
readonly GameInformation gameInfo;
|
||||
|
||||
public void IssueOrder(Order o) { orderManager.IssueOrder(o); } /* avoid exposing the OM to mod code */
|
||||
|
||||
@@ -142,6 +143,12 @@ namespace OpenRA
|
||||
p.Stances[q] = Stance.Neutral;
|
||||
|
||||
Sound.SoundVolumeModifier = 1.0f;
|
||||
|
||||
gameInfo = new GameInformation
|
||||
{
|
||||
MapUid = Map.Uid,
|
||||
MapTitle = Map.Title
|
||||
};
|
||||
}
|
||||
|
||||
public void LoadComplete(WorldRenderer wr)
|
||||
@@ -151,6 +158,14 @@ namespace OpenRA
|
||||
using (new Support.PerfTimer(wlh.GetType().Name + ".WorldLoaded"))
|
||||
wlh.WorldLoaded(this, wr);
|
||||
}
|
||||
|
||||
gameInfo.StartTimeUtc = DateTime.UtcNow;
|
||||
foreach (var player in Players)
|
||||
gameInfo.AddPlayer(player, orderManager.LobbyInfo);
|
||||
|
||||
var rc = orderManager.Connection as ReplayRecorderConnection;
|
||||
if (rc != null)
|
||||
rc.Metadata = new ReplayMetadata(gameInfo);
|
||||
}
|
||||
|
||||
public Actor CreateActor(string name, TypeDictionary initDict)
|
||||
@@ -288,11 +303,16 @@ namespace OpenRA
|
||||
return traitDict.ActorsWithTraitMultiple<T>(this);
|
||||
}
|
||||
|
||||
public void OnLocalPlayerWinStateChanged()
|
||||
public void OnPlayerWinStateChanged(Player player)
|
||||
{
|
||||
var rc = orderManager.Connection as ReplayRecorderConnection;
|
||||
if (rc != null)
|
||||
rc.LocalGameState = LocalPlayer.WinState;
|
||||
var pi = gameInfo.GetPlayer(player);
|
||||
if (pi != null)
|
||||
{
|
||||
pi.Outcome = player.WinState == WinState.Lost ? GameInformation.GameOutcome.Defeat
|
||||
: player.WinState == WinState.Won ? GameInformation.GameOutcome.Victory
|
||||
: GameInformation.GameOutcome.Undefined;
|
||||
pi.OutcomeTimestampUtc = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user