public int Connect(string data) { Client c = new Client(); c.ClientId = Guid.Parse(Context.ClientId); //c.Ip = IPAddress.Parse(HttpContext.Current.Request.UserHostAddress); c.Properties = data.ToHashTable(); Guid gid = Guid.Empty; Guid.TryParse(Caller.gameId.ToString(), out gid); c.GameId = gid; Client.ConnectedClients.Add(c.ClientId, c); AddToGroup(c.GameId.ToString()); EnterGame(c); return -1; }
public override void EnterGame(Client c) { // Get User For Client. Attach User Subscribers to Client to present view. // Or, if user not has logged in make them do that then. if (c.Properties.ContainsKey("username") && c.Properties.ContainsKey("password")) { User u = User.GetUser(c.Properties["username"].ToString(), c.Properties["password"].ToString()); // Go to appropriate screen for user. if (u != null) { } } else { // Present Login Screen } }
public abstract void EnterGame(Client c);
public int EnterGame(Guid gameId, Client c) { if (!string.IsNullOrEmpty(serverPath)) { try { ChannelFactory<IEngineServer> pipeFactory = new ChannelFactory<IEngineServer>(new NetNamedPipeBinding(), new EndpointAddress(serverPath)); serverProxy = pipeFactory.CreateChannel(); return serverProxy.EnterGame(gameId, c); } catch (Exception ex) { Log.Error(ex); } } return -1; }
public int EnterGame(Guid gameId, Client c) { if (GameServer.Games.FirstOrDefault(e => e.Id == gameId) == null) return -1; GameServer.Games.First(e => e.Id == gameId).EnterGame(c); return 0; }
public int EnterGame(Client c) { Dispatcher.Instance.EnterGame(c.GameId, c); return 1; }