Skip to content

Commit

Permalink
Add the ability to see all game names of hosted games.
Browse files Browse the repository at this point in the history
  • Loading branch information
kellyelton committed Sep 9, 2013
1 parent a623ac1 commit ede8dbd
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion octgnFX/Octgn.LobbyServer/Gaming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static void StartGame(int port)
Games.Select(
g =>
new Lobby.HostedGameData(g.Value.GameGuid, (Version)g.Value.GameVersion.Clone(), g.Value.Port,
(string)g.Value.Name.Clone(), (User)g.Value.Hoster, g.Value.TimeStarted, !String.IsNullOrWhiteSpace(g.Value.Password)) { GameStatus = g.Value.Status }).ToList();
(string)g.Value.Name.Clone(), (User)g.Value.Hoster, g.Value.TimeStarted,g.Value.GameName, !String.IsNullOrWhiteSpace(g.Value.Password)) { GameStatus = g.Value.Status }).ToList();
Locker.ExitReadLock();
return sendgames;
}
Expand Down
2 changes: 1 addition & 1 deletion octgnFX/Octgn/Controls/CustomGames.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void RefreshGameList()

if (HideUninstalledGames)
{
list = list.Where(game => game.GameName != "{Unknown Game}").ToList();
list = list.Where(game => game.CanPlay).ToList();
}

var removeList = HostedGameList.Where(i => list.All(x => x.Port != i.Port)).ToList();
Expand Down
4 changes: 1 addition & 3 deletions octgnFX/Octgn/ViewModels/HostedGameViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public HostedGameViewModel(HostedGameData data)
this.Port = data.Port;
this.Status = data.GameStatus;
this.StartTime = data.TimeStarted;
this.GameName = "{Unknown Game}";
this.GameName = data.GameName;
this.HasPassword = data.HasPassword;
if (game == null) return;
this.CanPlay = true;
Expand All @@ -222,12 +222,10 @@ public void Update()
var game = GameManager.Get().GetById(this.gameId);
if (game == null)
{
this.GameName = "{Unknown Game}";
this.CanPlay = false;
return;
}
this.CanPlay = true;
this.GameName = game.Name;

}

Expand Down
6 changes: 6 additions & 0 deletions octgnFX/Skylabs.Lobby/HostedGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public HostedGame(int port, Guid gameguid, Version gameversion, string gameName,
Port = port;
TimeStarted = new DateTime(0);
LocalGame = localGame;
GameName = gameName;

var atemp = new List<string>();
atemp.Add("-id=" + Guid.NewGuid().ToString());
Expand Down Expand Up @@ -136,6 +137,11 @@ private void StandAloneAppOnErrorDataReceived(object sender, DataReceivedEventAr
/// </summary>
public String Name { get; private set; }

/// <summary>
/// Name of the actual game
/// </summary>
public string GameName { get; private set; }

/// <summary>
/// Password for the hosted game.
/// </summary>
Expand Down
16 changes: 15 additions & 1 deletion octgnFX/Skylabs.Lobby/HostedGameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public HostedGameData()
}

public HostedGameData(Guid gameguid, Version gameversion, int port, string name, User huser,
DateTime startTime,bool hasPassword)
DateTime startTime,string gameName, bool hasPassword)
: base("gameitem", "gameitem", "octgn:gameitem")
{
GameGuid = gameguid;
Expand All @@ -36,6 +36,7 @@ public HostedGameData(Guid gameguid, Version gameversion, int port, string name,
GameStatus = EHostedGame.StartedHosting;
TimeStarted = startTime;
HasPassword = hasPassword;
GameName = gameName;
}

public HostedGameData(SocketMessage sm)
Expand All @@ -49,6 +50,7 @@ public HostedGameData(SocketMessage sm)
HasPassword = (bool)sm["haspassword"];
GameStatus = EHostedGame.StartedHosting;
TimeStarted = new DateTime(DateTime.Now.ToUniversalTime().Ticks);
GameName = (string)sm["gamename"];
}

public Guid GameGuid
Expand Down Expand Up @@ -84,6 +86,18 @@ public String Name
get { return GetTag("name"); }
set { SetTag("name", value); }
}

public string GameName
{
get
{
return GetTag("gamename");
}
set
{
SetTag("gamename", value);
}
}
public User UserHosting
{
get { return new User(GetTagJid("userhosting")); }
Expand Down
3 changes: 2 additions & 1 deletion recentchanges.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Super fast deck loads - Kelly
Fixed looking at library slowness and shuffling slowness https://github.com/kellyelton/OCTGN/issues/820 https://github.com/kellyelton/OCTGN/issues/843- Kelly
Added remote calling for game devs - Kelly
Added remote calling for game devs - Kelly
Can see the name of games that you don't have - Kelly

0 comments on commit ede8dbd

Please sign in to comment.