Example #1
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);
        }
Example #2
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);
        }
 public override void Initialize(ScreenManager screenManager)
 {
     base.Initialize(screenManager);
     //inventoryScreen.Initialize(screenManager);
     network.Initialize();
 }