示例#1
0
        static void Main()
        {
            Console.Title = "[Guild Wars 2] {Gate Server}";

            log4net.Config.XmlConfigurator.Configure();


            #region Load engines & services

            AuthEngine =
                (IGtSAuthEngine)
                Assembly.LoadFrom("Engines//GateServer.AuthEngine.dll").CreateInstance(
                    "GateServer.AuthEngine.AuthEngine");

            NetworkEngine =
                (IGtSNetworkEngine)
                Assembly.LoadFrom("Engines//GateServer.NetworkEngine.dll").CreateInstance(
                    "GateServer.NetworkEngine.NetworkEngine");

            //DatabaseService = new DatabaseService(Database.Default.MySql_User, Database.Default.MySql_Password,
            //                                      Database.Default.MySql_Host, Database.Default.MySql_Database,
            //                                      Database.Default.MySql_Port);

            #endregion

// ReSharper disable PossibleNullReferenceException
            NetworkEngine.StartTcpServer(6600);
// ReSharper restore PossibleNullReferenceException



            ShutdownSemaphore.WaitOne();
        }
示例#2
0
 public static void finishCast(bool result)
 {
     if (result)
     {
         log("You cast " + GAME.curCast.name);
         if (GAME.curCast is CreatureCard)
         {
             GAME.addToHistory(GAME.curCast, CARD_OWN.FRIENDLY);
         }
         else
         {
             GAME.addToHistory(GAME.curCast, CARD_OWN.NEUTRAL);
         }
         GAME.activePlayer.cast(GAME.curCast);
         NetworkEngine.send(GAME.curCast.getCastNetworkMessage());
         GAME.curCast.endCast();
     }
     else
     {
         GAME.curCast.cancelCast();
     }
     GAME.cardHandler.endCast(result);
     GAME.currentRequest   = TARGET_TYPE.NONE;
     GAME.currentValidator = null;
     GAME.curCast          = null;
     GAME.cardHandler      = null;
     GAME.uiManager.zeroFields();
 }
示例#3
0
    /// <summary>
    /// Initialize this instance.
    /// We must follow special sequnce.
    /// </summary>
    public static void Initialize()
    {
        //Initial sequnce

        //DataPersisteManager should be initialize first. and tell the non-account path
        Core.DPM = DataPersistManager.getInstance(DeviceInfo.PersistRootPath);
        //Timer should run.
        Core.TimerEng = new TimerMaster();
        //Sound manager.
        Core.SoundEng = SoundEngine.GetSingleton();
        //EventCenter must initialize later than Network Engine
        Core.NetEng = new NetworkEngine();
        //EventCenter also must initialize later than Aysnc Engine
        Core.AsyncEng = AsyncTask.Current;

        Core.EVC = new EventCenter();
        Core.EVC.RegisterToHttpEngine(Core.NetEng.httpEngine);
        Core.EVC.RegisterToSockEngine(Core.NetEng.SockEngine);

        ResEng = new ResourceManager();
        ResEng.RegisterAM(ManagerType.ModelManager, new SplitModelLoader());
        Core.Data = new DataCore();

        //registe some vars.
        HttpRequestFactory.swInfo     = SoftwareInfo.VersionCode;
        HttpRequestFactory.platformId = SoftwareInfo.PlatformId;
    }
示例#4
0
        public bool Start(ushort port)
        {
            if (NetworkEngine.Start("0.0.0.0", port) == false)
            {
                return(false);
            }

            return(true);
        }
示例#5
0
        public bool Start(string IP, ushort port)
        {
            if (NetworkEngine.Start(IP, port) == false)
            {
                return(false);
            }

            return(true);
        }
示例#6
0
        public bool Start(IPAddress IP, ushort port)
        {
            if (NetworkEngine.Start(IP.ToString(), port) == false)
            {
                return(false);
            }

            return(true);
        }
示例#7
0
        public bool SendRequest(BasePacket packet)
        {
            if (NetworkEngine == null)
            {
                return(false);
            }

            NetworkEngine.SendRequest(packet);

            return(true);
        }
示例#8
0
        static void Main()
        {
            Console.Title = "GateServer";

            NetworkEngine engine = new NetworkEngine();

            engine.StartTcpServer(6600);

            Console.WriteLine("Server started on port 6600");

            ShutdownSemaphore.WaitOne();
        }
示例#9
0
        public bool ShutDown()
        {
            if (Dispatcher != null)
            {
                Dispatcher.ShutDownLogicSystem();
            }

            if (NetworkEngine == null || NetworkEngine.Shutdown() == false)
            {
                return(false);
            }

            return(true);
        }
示例#10
0
        public bool Disconnect(int serial)
        {
            if (NetworkEngine == null)
            {
                return(false);
            }

            if (NetworkEngine.Disconnect(serial) == false)
            {
                return(false);
            }

            return(true);
        }
示例#11
0
        public bool SendRequest(BasePacket packet, int[] serialArr)
        {
            if (NetworkEngine == null)
            {
                return(false);
            }

            foreach (int serial in serialArr)
            {
                packet.Serial = serial;
                NetworkEngine.SendRequest(packet);
            }

            return(true);
        }
示例#12
0
    /// <summary>
    /// Initialize this instance.
    /// We must follow special sequnce.
    /// 仅且仅初始化一次
    /// </summary>
    public static void Initialize(EngineCfg cfg)
    {
        ConsoleEx.DebugLog("Core Engine is initializing ....", ConsoleEx.YELLOW);
        //Initial sequnce
        DevFSM  = DeviceFSM.Instance;
        GameFSM = GamePlayFSM.Instance;
        EngCfg  = cfg;

        if (GameFSM.InitOK == Consts.FAILURE)
        {
            //Have one NetMQContext ONLY. This will be used to created ALL sockets within the process.
            ZeroMQ = NetMQContext.Create();

            //DataPersisteManager should be initialize first. and tell the non-account path
            DPM = LocalIOManager.getInstance(DeviceInfo.PersistRootPath);
            //Unity UI Basically Manager
            EntityMgr = new EntityManager();
            //Timer should run.
            TimerEng = new TimerMaster();
            //Sound manager.
            SoundEng = SoundEngine.GetSingleton();
            //EventCenter must initialize later than Network Engine
            NetEng = new NetworkEngine();
            //EventCenter also must initialize later than Aysnc Engine
            AsyncEng = AsyncTask.Current;
            //Coroutine
            Coroutine = CoroutineProvider.Instance();

            EVC    = new EventCenter(NetEng.httpEngine, NetEng.SockEngine, EntityMgr);
            ResEng = new Loader();

            Data = new DataCore();

            //register some vars.
            CoreParam();
        }
        else
        {
            //TODO: 此分支是初始化一次OK后,注销之后进入的分支情况
        }

        RegisterInterface();
        ConsoleEx.DebugLog("Core Engine is initialized ....", ConsoleEx.YELLOW);
        GameFSM.OnInitOk();
    }
示例#13
0
 // Update is called once per frame
 void Update()
 {
     lock (dcFlagLock)
     {
         if (dcFlag)
         {
             dcFlag = false;
             if (GameEngine.listener != null && GameEngine.listener.IsAlive)
             {
                 GameEngine.listener.Abort();
             }
             lock (GameEngine.clientLock)
             {
                 if (GameEngine.client != null)
                 {
                     GameEngine.client.Close();
                 }
             }
             endGameManager.message = "[ERROR] Server has closed connection.";
             SceneManager.LoadScene("endGameScene");
         }
     }
     if (Input.GetKeyDown(KeyCode.Return))
     {
         if (writing)
         {
             string message = inputField.text;
             if (message != "")
             {
                 NetworkEngine.send("msg#" + message);
                 log("You say: " + message);
                 inputField.text = "";
                 writing         = false;
             }
         }
         else
         {
             inputField.ActivateInputField();
             writing = true;
         }
     }
 }
示例#14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="frameId"></param>
        /// <param name="prevFrameId"></param>
        /// <param name="snapshot"></param>
        /// <returns></returns>
        public byte[] Decompress(uint prevFrameId, byte[] snapshot)
        {
                        #if DONT_USE_DELTA
            return(NetworkEngine.Decompress(snapshot));
                        #endif


            if (prevFrameId == 0)
            {
                return(NetDeflate.Decompress(snapshot));
            }

            var prevSnapshot = queue.SingleOrDefault(s => s.Frame == prevFrameId);

            if (prevSnapshot == null)
            {
                Log.Warning("Missing snapshot #{0}. Waiting for full snapshot.", prevFrameId);
                return(null);
            }


            var delta   = NetDeflate.Decompress(snapshot);
            var minSize = Math.Min(delta.Length, prevSnapshot.Data.Length);

            var newSnapshot = new byte[delta.Length];

            for (int i = 0; i < minSize; i++)
            {
                newSnapshot[i] = (byte)(delta[i] ^ prevSnapshot.Data[i]);
            }

            if (delta.Length > prevSnapshot.Data.Length)
            {
                for (int i = minSize; i < delta.Length; i++)
                {
                    newSnapshot[i] = delta[i];
                }
            }

            return(newSnapshot);
        }
示例#15
0
        public bool CreateEngine(bool server = false)
        {
            IsServer = server;

            if (IsServer)
            {
                NetworkEngine = new MTCPServerEngine(this);
            }
            else
            {
                NetworkEngine = new MTCPClientEngine(this);
            }

            if (NetworkEngine.Initialize() == false)
            {
                Debug.ErrorLog(MethodBase.GetCurrentMethod(), "Failed - NetworkEngine.Initialize Failed");
                return(false);
            }

            return(true);
        }
        public GameplayScreen()
        {
            Viewport            = new Rectangle(0, 0, 1920, 1080);
            centerScreen        = Viewport.Center;
            CenterScreenVector2 = centerScreen.ToVector2();

            world = new ClientWorldState();
            world.CharacterAdded += World_CharacterAdded;
            network            = NetworkEngine.Instance; //networkEngine;
            network.WorldState = world;
            worldPump          = new WorldPump();
            worldPump.State    = world;

            effectManager = new EffectManager();
            effectManager.UseDayNightCycle = true;
            effectManager.DayColor         = Color.White;
            effectManager.NightColor       = new Color(.2f, .2f, .4f);//Color.DarkBlue;

            //inventoryScreen = new InventoryScreen();
            //inventoryScreen.ItemUsed += InventoryScreen_ItemUsed;
            //inventoryScreen.Player = world.PlayerCharacter;
        }
示例#17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="prevFrame"></param>
        /// <returns></returns>
        public byte[] Compress(ref uint prevFrame, out int size)
        {
                        #if DONT_USE_DELTA
            size = queue.Last().Data.Length;
            return(NetworkEngine.Compress(queue.Last().Data));
                        #endif

            var lastSnapshot = queue.Last();
            size = lastSnapshot.Data.Length;

            var prevFrameLocal = prevFrame;

            var prevSnapshot = queue.SingleOrDefault(s => s.Frame == prevFrameLocal);

            if (prevSnapshot == null)
            {
                prevFrame = 0;
                return(NetDeflate.Compress(lastSnapshot.Data));
            }


            var delta   = new byte[lastSnapshot.Data.Length];
            var minSize = Math.Min(delta.Length, prevSnapshot.Data.Length);

            for (int i = 0; i < minSize; i++)
            {
                delta[i] = (byte)(lastSnapshot.Data[i] ^ prevSnapshot.Data[i]);
            }

            if (delta.Length > prevSnapshot.Data.Length)
            {
                for (int i = minSize; i < delta.Length; i++)
                {
                    delta[i] = lastSnapshot.Data[i];
                }
            }

            return(NetDeflate.Compress(delta));
        }
示例#18
0
    public void endTurnClick()
    {
        if (activePlayer == localPlayer)
        {
            if (curCast != null)
            {
                finishCast(false);
            }
            if (selectedField != null)
            {
                selectedField    = null;
                selectedCreature = null;
                switched         = false;
            }

            uiManager.zeroFields();
            gmsg("");
            switched = false;

            NetworkEngine.send("endTurn");
            log("Your turn has ended");
        }
    }
示例#19
0
        /// <summary>
        /// MEngine 객체를 초기화합니다.
        /// </summary>
        /// <param name="logicEntry"> 로직 처리를 담당하는 객체입니다. </param>
        /// <param name="translater"> 패킷을 구별해주는 객체입니다. </param>
        /// <param name="dispatcher"> 로직을 처리해주는 객체입니다. [기본값 : MLogicDispatcher] </param>
        /// <returns></returns>
        public bool Intialize(LogicEntry logicEntry, PacketTranslater translater, LogicDispatcher dispatcher = null)
        {
            if (logicEntry == null)
            {
                throw new NullReferenceException("MEngine Initialize Failed - logicEntry is null.");
            }

            if (dispatcher == null)
            {
                dispatcher = new MLogicDispatcher();
            }

            if (translater == null)
            {
                throw new NullReferenceException("MEngine Initialize Failed - distinctioner is null.");
            }

            if (NetworkEngine == null)
            {
                CreateEngine(true);
            }

            Dispatcher          = dispatcher;
            packetDistinctioner = translater;

            if (Dispatcher.CreateLogicSystem(logicEntry) == false)
            {
                throw new Exceptions.InitializeException("MEngine Initialize Failed - Dispatcher.CreateLogicSystem() Failed");
            }

            if (NetworkEngine.Initialize() == false)
            {
                throw new Exceptions.InitializeException("MEngine Initialize Failed - NetworkEngine.Initialize() Failed");
            }

            return(true);
        }
示例#20
0
 public static void fieldClick(Field f)
 {
     gmsg("");
     if (GAME.activePlayer == GAME.localPlayer)
     {
         if (GAME.curCast != null)
         {
             if (GAME.currentRequest == TARGET_TYPE.FIELD)
             {
                 if (!f.invalidTarget && GAME.currentValidator.validate(f))
                 {
                     if (GAME.curCast.continueCast(f) == CAST_EFFECT.SUCCESS)
                     {
                         finishCast(true);
                     }
                 }
                 else
                 {
                     GAME.curCast.cancelCast();
                     finishCast(false);
                 }
             }
             else if (GAME.currentRequest == TARGET_TYPE.SET_OF_FIELDS)
             {
                 if (!f.invalidTarget && GAME.currentValidator.validate(f))
                 {
                     if (GAME.curCast.continueCast(f) == CAST_EFFECT.SUCCESS)
                     {
                         finishCast(true);
                     }
                 }
                 else
                 {
                     GAME.curCast.cancelCast();
                     finishCast(false);
                 }
             }
         }
         else
         {
             if (GAME.selectedField == null)
             {
                 if (f.content != null && f.content is Creature && ((Creature)f.content).owner == GAME.localPlayer)
                 {
                     GAME.selectedCreature = (Creature)f.content;
                     GAME.selectedField    = f;
                     generateMovePaths(f);
                     updateRange();
                     gmsg("Select target to attack, or field to move");
                 }
             }
             else
             {
                 if (switched)
                 {
                     if (GAME.selectedCreature.canSpecial())
                     {
                         if (GAME.selectedCreature.parentCard.specialValidator.validate(f) && validateSpecialPath(GAME.selectedField, f))
                         {
                             GAME.selectedCreature.special(f);
                             NetworkEngine.send("rclick#" + GAME.selectedField.x + "#" + GAME.selectedField.y + "#" + f.x + "#" + f.y);
                         }
                     }
                     GAME.selectedField    = null;
                     GAME.selectedCreature = null;
                     GAME.uiManager.zeroFields();
                     switched = false;
                 }
                 else if (f.content != null)
                 {
                     if (GAME.selectedCreature.canAttack())
                     {
                         if (f.content.owner != GAME.localPlayer && validateAttackPath(GAME.selectedField, f))
                         {
                             GAME.selectedCreature.attack(f.content);
                             NetworkEngine.send("lclick#" + GAME.selectedField.x + "#" + GAME.selectedField.y + "#" + f.x + "#" + f.y);
                         }
                     }
                     GAME.selectedField    = null;
                     GAME.selectedCreature = null;
                     GAME.uiManager.zeroFields();
                 }
                 else
                 {
                     if (GAME.selectedCreature.canMove())
                     {
                         if (GAME.selectedCreature.stats.speed >= GAME.moveDistances[f])
                         {
                             log("moving");
                             List <Field> path   = new List <Field>();
                             Field        parent = f;
                             while (parent != GAME.selectedField)
                             {
                                 path.Add(parent);
                                 parent = GAME.movePaths[parent];
                             }
                             List <Field> invokedPath = new List <Field>();
                             for (int i = path.Count - 1; i >= 0; i--)
                             {
                                 bool interrupt = path[i].onMoveThrough(GAME.selectedCreature);
                                 invokedPath.Add(path[i]);
                                 if (interrupt)
                                 {
                                     log("interrupt at field " + path[i].x + " " + path[i].y);
                                     f = path[i];
                                     break;
                                 }
                             }
                             GAME.StartCoroutine(GAME.selectedCreature.MovementAnimation(invokedPath, GAME.selectedField.contentObject));
                             GAME.selectedCreature.move(f);
                             NetworkEngine.send("lclick#" + GAME.selectedField.x + "#" + GAME.selectedField.y + "#" + f.x + "#" + f.y);
                         }
                     }
                     GAME.selectedField    = null;
                     GAME.selectedCreature = null;
                     GAME.uiManager.zeroFields();
                 }
             }
         }
     }
     updateColors();
 }
示例#21
0
        static void Main(string[] args)
        {
            // Setup log
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Information()
                         .WriteTo.ColoredConsole()
                         .CreateLogger();

            Log.Information("Hi");

            var network = new NetworkEngine();

            network.Connect(new IPEndPoint(IPAddress.Loopback, 25565));

            /*network.SendPacket(new HandshakePacket
             * {
             *  ProtocolVersion = 47,
             *  ServerAddress = "localhost",
             *  ServerPort = 25565,
             *  NextState = NetworkState.Status,
             * });
             *
             * network.SendPacket(new StatusRequestPacket());
             *
             * var response = network.WaitForPacketAsync<StatusResponsePacket>().Result;
             *
             * Console.WriteLine(response.Response);
             *
             * network.SendPacket(new StatusTimePacket
             * {
             *  Time = DateTime.Now.Ticks,
             * });
             *
             * var pingResponse = network.WaitForPacketAsync<StatusTimePacket>().Result;
             *
             * Console.WriteLine(pingResponse.Time);
             *
             * Console.ReadLine();*/

            const string playerOfInterest = "compwhizii";
            PlayerUuid?  interestUuid     = null;
            int?         interestEid      = null;

            IObservable <IPacket> packetStream = network.PacketStream;


            Vector3?currentPosition = null;

            packetStream
            .OfType <KeepAlivePacket>()
            .Subscribe(k => network.SendPacket(new KeepAlivePacket {
                Id = k.Id
            }));

            packetStream
            .OfType <PlayerPositionAndLookPacket>()
            .Subscribe(p =>
            {
                Console.Title   = "Position: " + p.Position;
                currentPosition = p.Position;
                network.SendPacket(new PlayerPositionPacket
                {
                    Position = p.Position,
                    OnGround = true,
                });
            });

            packetStream
            .OfType <UpdateHealthPacket>()
            .Where(p => p.Health < 1)
            .Subscribe(p =>
            {
                Log.Fatal("Died! Respawning...");

                Observable.Timer(TimeSpan.FromSeconds(5))
                .Subscribe(
                    _ => network.SendPacket(new ClientStatusPacket {
                    Action = ClientStatusAction.PerformRespawn
                }));
            });

            packetStream
            .OfType <UpdateHealthPacket>()
            .Subscribe(p => Log.Error("Health: {Health}", p.Health));

            Observable.Interval(TimeSpan.FromMilliseconds(50))
            .Subscribe(_ =>
            {
                if (currentPosition.HasValue)
                {
                    network.SendPacket(new PlayerPositionPacket {
                        Position = currentPosition.Value, OnGround = true
                    });
                }
            });

            packetStream
            .OfType <EntityVelocityPacket>()
            .Subscribe(p => Log.Warning("Velocity: EID: {0}, X: {1}, Y: {2}, Z: {3}",
                                        p.EntityId, p.VelocityX, p.VelocityY, p.VelocityZ));

            packetStream
            .OfType <EntityRelativeMovePacket>()
            .Subscribe(p => Log.Warning("RelativeMove: EID: {0}, X: {1}, Y: {2}, Z: {3}",
                                        p.EntityId, p.DeltaPosition.X, p.DeltaPosition.Y, p.DeltaPosition.Z));

            packetStream
            .OfType <EntityLookAndRelativeMovePacket>()
            .Subscribe(p => Log.Warning("RelativeMove: EID: {0}, X: {1}, Y: {2}, Z: {3}",
                                        p.EntityId, p.DeltaPosition.X, p.DeltaPosition.Y, p.DeltaPosition.Z));

            packetStream
            .OfType <EntityTeleportPacket>()
            .Subscribe(p => Log.Warning("Teleport: EID: {0}, X: {1}, Y: {2}, Z: {3}",
                                        p.EntityId, p.Position.X, p.Position.Y, p.Position.Z));

            packetStream
            .OfType <PlayerListItemPacket>()
            .Where(p => p.Action == PlayerListAction.AddPlayer)
            .SelectMany(p => p.PlayerList.Cast <PlayerListItemActionAddPlayer>())
            .Subscribe(p =>
            {
                Log.Information("Player added. UUID: {UUID} Username: {Username} Ping: {Ping}", p.Uuid, p.Name, p.Ping);

                if (p.Name == playerOfInterest)
                {
                    Log.Error("Player is of interest!");
                    interestUuid = p.Uuid;
                }
            });

            packetStream
            .OfType <PlayerListItemPacket>()
            .Where(p => p.Action == PlayerListAction.RemovePlayer)
            .SelectMany(p => p.PlayerList.Cast <PlayerListItemActionRemovePlayer>())
            .Subscribe(p =>
            {
                Log.Information("Player removed. UUID: {UUID}", p.Uuid);
            });

            packetStream
            .OfType <SpawnPlayerPacket>()
            .Subscribe(p => Log.Information("Player spawned: {EID}, UUID: {UUID}", p.EntityId, p.PlayerUuid));

            packetStream
            .OfType <SpawnPlayerPacket>()
            .Where(p => p.PlayerUuid == interestUuid)
            .Subscribe(p =>
            {
                Log.Fatal("Interest user spawned. EID: {EID}", p.EntityId);
                interestEid = p.EntityId;
            });


            network.SendPacket(new HandshakePacket
            {
                ProtocolVersion = 47,
                ServerAddress   = "localhost",
                ServerPort      = 25565,
                NextState       = NetworkState.Login
            });
            network.SendPacket(new LoginStartPacket {
                Username = "******"
            });

            Console.ReadLine();
        }
 public SelectCharacterScreen() //ToDo: Create character option
 {
     NetworkEngine.CreateInstance();
     network = NetworkEngine.Instance;
 }
 public override void UnloadContent()
 {
     characterSpriteFont = null;
     network             = null;
     spriteBatch         = null;
 }
示例#24
0
        //----------------------------------------------------------------------------------
        // The IsNetworkMessage being optional could make this open to abuse as it allows the consumer to send it.
        // maybe the flags should be made private?
        /// <summary>
        /// Send entity message. The message will get pushed across the network to all slaves if there any available.
        /// </summary>
        /// <param name="szMessageName">Name of message.</param>
        /// <param name="entity">The entity we are sending this message to.</param>
        /// <param name="msgData">Data to sent with the message. (optional)</param>
        /// <param name="IsNetworkMessage">Is this being sent as a network message. (optional)</param>
        /// <returns></returns>
        //----------------------------------------------------------------------------------
        public EntityMsgRslt SendMessage(String szMessageName, Entity entity, object msgData = null, bool IsNetworkMessage = false)
        {
            Rslt rslt = new Rslt();

            //set flags
            rslt |= DynamicStores.Enums.NonAuthoritative;
            rslt |= DynamicStores.Enums.Invalid_Sender;
            rslt |= DynamicStores.Enums.Invalid_Receiver;

            //check entity is valid and authoritative.
            if (IsValid && entity.IsValid && entity.IsAuthoritative())
            {
                //use reflection to get method call.
                MethodInfo methodInfo = null;
                Type       type       = entity.GetType();

                methodInfo = type.GetMethod(szMessageName);

                if (methodInfo == null)
                {
                    //If this method doesn't exist.
                    Console.WriteLine("Message '" + szMessageName + "' does not exist for entity type " + type.ToString());
                    rslt.ClearRslt();
                    rslt |= DynamicStores.Enums.Fail;
                }
                else
                {
                    //pack data into and message header in an object array.
                    Object[] aMsgData = msgData != null ? new Object[2] : new Object[1];
                    aMsgData[0] = this; //This is the sending entity.

                    if (msgData != null)
                    {
                        aMsgData[1] = msgData; //any data sent with it...this can be a struct etc.
                    }
                    methodInfo.Invoke(entity, aMsgData);

                    if (!IsNetworkMessage)
                    {
                        NetworkEngine network = EngineServices.GetSystem <IGameSystems>().Network;
                        //send this through the network.
                        if (network.IsNetworkActive)
                        {
                            //create network packet.
                            NetworkDataPacket packet = new NetworkDataPacket();

                            //set up packet.
                            packet.EntityIDs.SendingEntityID = this.EntityID;
                            packet.EntityIDs.ReceiveEntityID = entity.EntityID;
                            packet.MessageType = MessageType.EntityMessage;
                            packet.SendMethod  = NetworkSendMethod.InOrder;
                            packet.UserData    = msgData;

                            //push message.
                            network.SendMessage(packet);
                        }
                    }

                    rslt.ClearRslt();
                    rslt |= DynamicStores.Enums.Success;
                }
            }

            return(new EntityMsgRslt(this, entity, rslt));
        }