Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public override void UserJoined(NonobaGameUser <MyPlayer> user)
        {
            var FromPlayer =
                new SharedClass1.RemoteEvents
            {
                Router = new SharedClass1.RemoteEvents.WithUserArgumentsRouter
                {
                    user = user.UserId,
                }
            };

            user.Virtual = new LightsOut.ActionScript.Shared.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.Router.Target = user.Virtual.ToOthers;

            Virtual.Users.Add(user.Virtual);

            Virtual.UserJoined(user.Virtual);
        }
Esempio n. 3
0
 private void Send(NonobaGameUser <MyPlayer> v, LightsOut.ActionScript.Shared.SharedClass1.Messages type, params object[] e)
 {
     v.Send(((int)type).ToString(), e);
 }
Esempio n. 4
0
 public override void UserLeft(NonobaGameUser <MyPlayer> user)
 {
     this.Virtual.Users.Remove(user.Virtual);
     this.Virtual.UserLeft(user.Virtual);
     user.Virtual = null;
 }