/// <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); }
/// <summary> /// 反初始化 /// </summary> public void UnInitialize() { _onLoadAssetCompleted = null; _onChangeUIState = null; _uiEventBridge.UnInitialize(); _uiEventBridge = null; _onNativeCallBack = null; _appEnterBackGroundCallBack = null; _appEnterForeGroundCallBack = null; _arcadeInputOkCallBack = null; _arcadeInputRefreshCallBack = null; _arcadeInputRockerCallBack = null; _arcadeInputRotateCallBack = null; _gcCallBack = null; }