public override void UserJoined(NonobaGameUser <MyPlayer> user) { var FromPlayer = new SharedClass1.RemoteEvents { BroadcastRouter = new SharedClass1.RemoteEvents.WithUserArgumentsRouter_Broadcast { user = user.UserId, }, SinglecastRouter = new SharedClass1.RemoteEvents.WithUserArgumentsRouter_Singlecast { user = user.UserId, } }; user.Virtual = new MyPlayer { ToOthers = new SharedClass1.RemoteMessages { Send = q => this.SendOthers(user.UserId, q.i, q.args) }, ToPlayer = new SharedClass1.RemoteMessages { Send = e => this.Send(user, e.i, e.args) }, FromPlayer = FromPlayer, FromPlayerDispatch = FromPlayer, UserId = user.UserId, Username = user.Username, AddScore = user.SubmitRankingDelta, AwardAchievement = user.AwardAchievement, }; FromPlayer.BroadcastRouter.Target = user.Virtual.ToOthers; Virtual.Users.Add(user.Virtual); Virtual.UserJoined(user.Virtual); }
public override void GotMessage(NonobaGameUser <MyPlayer> user, Message message) { var e = /*(SharedClass1.Messages)*/ int.Parse(message.Type); var p = user.Virtual; if (p.FromPlayerDispatch.DispatchInt32(e, new SharedClass1.RemoteEvents.DispatchHelper { GetLength = i => (int)message.Count, GetInt32 = message.GetInt, GetDouble = message.GetDouble, GetString = message.GetString } )) { return; } Console.WriteLine("Not on dispatch: " + message.Type); }
private void Send(NonobaGameUser <MyPlayer> v, SharedClass1.Messages type, params object[] e) { v.Send(((int)type).ToString(), e); }
public override void UserLeft(NonobaGameUser <MyPlayer> user) { this.Virtual.Users.Remove(user.Virtual); this.Virtual.UserLeft(user.Virtual); user.Virtual = null; }