Exemple #1
0
        private void Send(NonobaGameUser <MyPlayer> v, SharedClass1.Messages type, params object[] e)
        {
            var MessageType = ((int)type).ToString();


            v.Send(MessageType, e);
        }
Exemple #2
0
        public override void GotMessage(NonobaGameUser <MyPlayer> user, Message message)
        {
            var e = /*(SharedClass1.Messages)*/ int.Parse(message.Type);

            var p = user.Virtual;

            Converter <uint, byte[]> GetMemoryStream =
                index => message.GetByteArray(index);

            if (p.FromPlayerDispatch.DispatchInt32(e,
                                                   new SharedClass1.RemoteEvents.DispatchHelper
            {
                GetLength = i => (int)message.Count,
                GetInt32 = message.GetInt,
                GetDouble = message.GetDouble,
                GetString = message.GetString,
                GetMemoryStream = GetMemoryStream
            }
                                                   ))
            {
                return;
            }

            Console.WriteLine("Not on dispatch: " + message.Type);
        }
Exemple #3
0
        public override void UserJoined(NonobaGameUser <MyPlayer> user)
        {
            var FromPlayer =
                new SharedClass1.RemoteEvents
            {
                BroadcastRouter = new SharedClass1.RemoteEvents.WithUserArgumentsRouter_Broadcast
                {
                    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,
                SetScore = user.SetRankingScore,

                AddHighscore = user.SubmitHighscore,

                AwardAchievement = user.AwardAchievement,
            };
            FromPlayer.BroadcastRouter.Target = user.Virtual.ToOthers;

            Virtual.Users.Add(user.Virtual);

            Virtual.UserJoined(user.Virtual);
        }
Exemple #4
0
 public override void UserLeft(NonobaGameUser <MyPlayer> user)
 {
     this.Virtual.Users.Remove(user.Virtual);
     this.Virtual.UserLeft(user.Virtual);
     user.Virtual = null;
 }