コード例 #1
0
ファイル: Protocol.cs プロジェクト: MyEyes/Igorr
        private IgorrMessage NewMessage(MessageTypes type, NetOutgoingMessage outgoing)
        {
            IgorrMessage message = null;
            switch (type)
            {
                case MessageTypes.Chat: message = new Messages.ChatMessage(outgoing, _timeStamp); break;
                case MessageTypes.Position: message = new Messages.PositionMessage(outgoing, _timeStamp); break;
                case MessageTypes.Leave: message = new Messages.LeaveMessage(outgoing, _timeStamp); break;
                case MessageTypes.Join: message = new Messages.JoinMessage(outgoing, _timeStamp); break;
                case MessageTypes.Spawn: message = new Messages.SpawnMessage(outgoing, _timeStamp); break;
                case MessageTypes.SpawnAttack: message = new Messages.SpawnAttackMessage(outgoing, _timeStamp); break;
                case MessageTypes.AssignPlayer: message = new Messages.AssignPlayerMessage(outgoing, _timeStamp); break;
                case MessageTypes.DeSpawn: message = new Messages.DeSpawnMessage(outgoing, _timeStamp); break;
                case MessageTypes.Pickup: message = new Messages.PickupMessage(outgoing, _timeStamp); break;
                case MessageTypes.Kill: message = new Messages.KillMessage(outgoing, _timeStamp); break;
                case MessageTypes.Damage: message = new Messages.DamageMessage(outgoing, _timeStamp); break;
                case MessageTypes.Attack: message = new Messages.AttackMessage(outgoing, _timeStamp); break;
                case MessageTypes.SetAnimation: message = new Messages.SetAnimationMessage(outgoing, _timeStamp); break;
                case MessageTypes.ChangeTile: message = new Messages.ChangeTileMessage(outgoing, _timeStamp); break;
                case MessageTypes.ChangeMap: message = new Messages.ChangeMapMessage(outgoing, _timeStamp); break;
                case MessageTypes.Container: message = new Messages.ContainerMessage(outgoing, _timeStamp); break;
                case MessageTypes.Play: message = new Messages.PlayMessage(outgoing, _timeStamp); break;
                case MessageTypes.SetGlow: message = new Messages.SetGlowMessage(outgoing, _timeStamp); break;
                case MessageTypes.Shadow: message = new Messages.ShadowMessage(outgoing, _timeStamp); break;
                case MessageTypes.SetHP: message = new Messages.SetPlayerStatusMessage(outgoing, _timeStamp); break;
                case MessageTypes.PlayerInfo: message = new Messages.PlayerInfoMessage(outgoing, _timeStamp); break;
                case MessageTypes.ExpMessage: message = new Messages.ExpMessage(outgoing, _timeStamp); break;
                case MessageTypes.Knockback: message = new Messages.KnockbackMessage(outgoing, _timeStamp); break;
                case MessageTypes.ObjectInfo: message = new Messages.ObjectInfoMessage(outgoing, _timeStamp); break;
                case MessageTypes.Interact: message = new Messages.InteractMessage(outgoing, _timeStamp); break;
                case MessageTypes.DoEffect: message = new Messages.DoEffectMessage(outgoing, _timeStamp); break;
                case MessageTypes.MoveItem: message = new Messages.MoveItemMessage(outgoing, _timeStamp); break;
                case MessageTypes.BodyConfiguration: message = new Messages.BodyConfigurationMessage(outgoing, _timeStamp); break;
                case MessageTypes.AttachAnimation: message = new Messages.AttachAnimationMessage(outgoing, _timeStamp); break;
                case MessageTypes.Stun: message = new Messages.StunMessage(outgoing, _timeStamp); break;
            }

            return message;
        }
コード例 #2
0
ファイル: Protocol.cs プロジェクト: MyEyes/Igorr
 public static IgorrMessage DecodeMessage(IgorrMessage m)
 {
     IgorrMessage message = null;
     switch (m.MessageType)
     {
         case MessageTypes.Chat: message = new Messages.ChatMessage(m); break;
         case MessageTypes.Position: message = new Messages.PositionMessage(m); break;
         case MessageTypes.Leave: message = new Messages.LeaveMessage(m); break;
         case MessageTypes.Join: message = new Messages.JoinMessage(m); break;
         case MessageTypes.Spawn: message = new Messages.SpawnMessage(m); break;
         case MessageTypes.SpawnAttack: message = new Messages.SpawnAttackMessage(m); break;
         case MessageTypes.AssignPlayer: message = new Messages.AssignPlayerMessage(m); break;
         case MessageTypes.DeSpawn: message = new Messages.DeSpawnMessage(m); break;
         case MessageTypes.Pickup: message = new Messages.PickupMessage(m); break;
         case MessageTypes.Kill: message = new Messages.KillMessage(m); break;
         case MessageTypes.Damage: message = new Messages.DamageMessage(m); break;
         case MessageTypes.Attack: message = new Messages.AttackMessage(m); break;
         case MessageTypes.SetAnimation: message = new Messages.SetAnimationMessage(m); break;
         case MessageTypes.ChangeTile: message = new Messages.ChangeTileMessage(m); break;
         case MessageTypes.ChangeMap: message = new Messages.ChangeMapMessage(m); break;
         case MessageTypes.Container: message = new Messages.ContainerMessage(m); break;
         case MessageTypes.Play: message = new Messages.PlayMessage(m); break;
         case MessageTypes.SetGlow: message = new Messages.SetGlowMessage(m); break;
         case MessageTypes.Shadow: message = new Messages.ShadowMessage(m); break;
         case MessageTypes.SetHP: message = new Messages.SetPlayerStatusMessage(m); break;
         case MessageTypes.PlayerInfo: message = new Messages.PlayerInfoMessage(m); break;
         case MessageTypes.ExpMessage: message = new Messages.ExpMessage(m); break;
         case MessageTypes.Knockback: message = new Messages.KnockbackMessage(m); break;
         case MessageTypes.ObjectInfo: message = new Messages.ObjectInfoMessage(m); break;
         case MessageTypes.Interact: message = new Messages.InteractMessage(m); break;
         case MessageTypes.DoEffect: message = new Messages.DoEffectMessage(m); break;
         case MessageTypes.BodyConfiguration: message = new Messages.BodyConfigurationMessage(m); break;
         case MessageTypes.MoveItem: message = new Messages.MoveItemMessage(m); break;
         case MessageTypes.AttachAnimation: message = new Messages.AttachAnimationMessage(m); break;
         case MessageTypes.Stun: message = new Messages.StunMessage(m); break;
     }
     return message;
 }