Пример #1
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;
    }
Пример #2
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();
    }