/// <summary>
        /// 初始化
        /// </summary>
        public void Initialize(LuaEnv lua)
        {
            _onLoadAssetCompleted = lua.Global.GetInPath <OnLoadAssetCompletedDelegate>("AssetService.OnCsLoadAssetCompleted");
            _onChangeUIState      = lua.Global.GetInPath <OnChangeUIStateDelegate>("MVCService.OnCsChangeUIState");

            _onNativeCallBack = lua.Global.GetInPath <NativeServiceBaseDelegate>("NativeService.OnCommonCallback");

            _appEnterBackGroundCallBack = lua.Global.GetInPath <System.Action>("AppMoniter.OnCSAppEnterBackGround");
            _appEnterForeGroundCallBack = lua.Global.GetInPath <System.Action>("AppMoniter.OnCSAppEnterForeGround");

            //
            _arcadeInputOkCallBack      = lua.Global.GetInPath <ArcadeInputPressDelegate>("ArcadeInputService.OnCsOkInput");
            _arcadeInputRefreshCallBack = lua.Global.GetInPath <ArcadeInputRefreshDelegate>("ArcadeInputService.OnCsRefreshInput");
            _arcadeInputRotateCallBack  = lua.Global.GetInPath <ArcadeInputRotateDelegate>("ArcadeInputService.OnCsRotateInput");
            _arcadeInputRockerCallBack  = lua.Global.GetInPath <ArcadeInputRockerDelegate>("ArcadeInputService.OnCsRockerInput");
            //
            _gcCallBack = lua.Global.GetInPath <System.Action <bool> >("GCService.CollectGarbage");

            //挂接
            UIStateService.GetInstance().Hook    = this.ChangeUIState;
            AssetService.GetInstance().LuaGCHook = this.OnAssetServiceGC;
            //
            NativeService.GetInstance().RegisterBaseHandler(OnNativeBaseCallBackHook);
            //硬件输入
            ArcadeInputService.GetInstance().RockerHandler  = this.DealArcadeInputRockerInput;
            ArcadeInputService.GetInstance().RotateHandler  = this.DealArcadeInputRotateInput;
            ArcadeInputService.GetInstance().RefreshHandler = this.DealArcadeInputRefreshInput;
            ArcadeInputService.GetInstance().PressHandler   = this.DealArcadeInputOkInput;
            //
            _uiEventBridge = new LuaUIEventBridge();
            _uiEventBridge.Initialize(lua);
        }
Exemplo n.º 2
0
    //网络检查
    private void DoNetworkCheck()
    {
        if (NativeService.GetInstance().GetIsNetEnable())
        {
            JW.Common.Log.LogD("Net OK");
            _isNetCheck = false;
            ScheduleService.GetInstance().RemoveFrame(this);
            //版本检查
#if UNITY_EDITOR
            DoMainResCheck();
#else
            DoForceVersionCheck();
#endif
        }
        else
        {
            JW.Common.Log.LogD("Net Not Ok");
            if (_isNetCheck == false)
            {
                _isNetCheck         = true;
                _stateArg.Progress  = 0f;
                _stateArg.StateInfo = "...等待检查网络...";
                JW.Framework.UGUI.UICommonService.GetInstance().ShowBubble("当前无网络等待!");
                EventService.GetInstance().SendEvent((uint)EventId.UpdateStateChange, _stateArg);
            }
            _netCheckCnt--;
            if (_netCheckCnt <= 0)
            {
                _stateArg.Progress  = 0f;
                _stateArg.StateInfo = "...网络检查失败即将重启设备...";
                EventService.GetInstance().SendEvent((uint)EventId.UpdateStateChange, _stateArg);
                ScheduleService.GetInstance().RemoveFrame(this);
                ScheduleService.GetInstance().AddTimer(2000, false, this);
            }
            else
            {
                ScheduleService.GetInstance().RemoveFrame(this);
                _netCheckSId = ScheduleService.GetInstance().AddFrame(60, false, this);
            }
        }
    }
Exemplo n.º 3
0
 /// <summary>
 /// 初始化框架层
 /// </summary>
 /// <param name="initialize">初始化/反初始化</param>
 public static void InitFramework(bool initialize)
 {
     if (initialize)
     {
         NativeService.GetInstance();
         IFSService.GetInstance();
         AssetService.GetInstance();
         ScheduleService.GetInstance();
         EventService.GetInstance();
         StateService.GetInstance();
         HttpService.GetInstance();
         UGUIRoot.GetInstance();
         UIStateService.GetInstance();
         SceneService.GetInstance();
         UICommonService.GetInstance();
         AudioService.GetInstance();
         QualityService.GetInstance();
         NetworkService.GetInstance();
         NetAssetService.GetInstance();
     }
     else
     {
         IFSService.DestroyInstance();
         EventService.DestroyInstance();
         StateService.DestroyInstance();
         HttpService.DestroyInstance();
         UIStateService.DestroyInstance();
         SceneService.DestroyInstance();
         UICommonService.DestroyInstance();
         UGUIRoot.DestroyInstance();
         AudioService.DestroyInstance();
         NetworkService.DestroyInstance();
         NativeService.DestroyInstance();
         NetAssetService.DestroyInstance();
         QualityService.DestroyInstance();
         //最后
         ScheduleService.DestroyInstance();
         AssetService.GetInstance().Destroy();
         AssetService.DestroyInstance();
     }
 }
Exemplo n.º 4
0
    //网络检查时钟 重启时钟
    public void OnScheduleHandle(ScheduleType type, uint id)
    {
        if (type == ScheduleType.Frame)
        {
            if (id == _netCheckSId)
            {
                DoNetworkCheck();
                return;
            }
            if (id == _versionCheckSId)
            {
                DoForceVersionCheck();
                return;
            }
        }
        //重启时钟
        if (type == ScheduleType.Timer)
        {
#if !UNITY_EDITOR
            NativeService.GetInstance().RebootDevice();
#endif
            return;
        }
    }
Exemplo n.º 5
0
 public static NativeService GetNativeService()
 {
     return(NativeService.GetInstance());
 }