예제 #1
0
        private static OVRLay_JS_Wrapper SetCallbackSetters(OVRLay_JS_Wrapper ovrlay_js)
        {
            ovrlay_js.SetDashboardChangeCallback = (Func <object, Task <object> >)
                                                       (async(dynamic args) => ovrlay_js.onDashboardChange_JS = (Func <object, Task <object> >)args);

            ovrlay_js.SetFocusChangeCallback = (Func <object, Task <object> >)
                                                   (async(dynamic args) => ovrlay_js.onFocusChange_JS = (Func <object, Task <object> >)args);

            ovrlay_js.SetVisibilityChangeCallback = (Func <object, Task <object> >)
                                                        (async(dynamic args) => ovrlay_js.onVisibilityChange_JS = (Func <object, Task <object> >)args);

            ovrlay_js.SetKeyboardInputCallback = (Func <object, Task <object> >)
                                                     (async(dynamic args) => ovrlay_js.onKeyboardInput_JS = (Func <object, Task <object> >)args);

            ovrlay_js.SetKeyboardClosedCallback = (Func <object, Task <object> >)
                                                      (async(dynamic args) => ovrlay_js.onKeyboardClosed_JS = (Func <object, Task <object> >)args);

            ovrlay_js.SetKeyboardDoneCallback = (Func <object, Task <object> >)
                                                    (async(dynamic args) => ovrlay_js.onKeyboardDone_JS = (Func <object, Task <object> >)args);

            return(ovrlay_js);
        }
예제 #2
0
        public static OVRLay_JS_Wrapper WrapOVRLayForJS(OVRLay.OVRLay _overlay, int id)
        {
            var ovrlay_js = new OVRLay_JS_Wrapper()
            {
                _overlay    = _overlay,
                OVRLayJS_ID = id,

                CreateOverlay  = (Func <object, Task <object> >)(async(dynamic args) => _overlay.CreateOverlay()),
                DestroyOverlay = (Func <object, Task <object> >)(async(dynamic args) => _overlay.DestroyOverlay()),

                SetTextureType = (Func <object, Task <object> >)(async(dynamic args) => _overlay.SetTextureType((ETextureType)args)),
                SetTexture     = (Func <object, Task <object> >)(async(dynamic args) => _overlay.SetTexture(IntPtr.Zero)),

                SetDashboardIconType    = (Func <object, Task <object> >)(async(dynamic args) => _overlay.SetDashboardIconType((ETextureType)args)),
                SetDashboardIconTexture = (Func <object, Task <object> >)(async(dynamic args) => _overlay.SetTexture(IntPtr.Zero)),

                Hide = (Func <object, Task <object> >)(async(dynamic args) => _overlay.Hide()),
                Show = (Func <object, Task <object> >)(async(dynamic args) => _overlay.Show()),

                ShowKeyboard = (Func <object, Task <object> >)(async(dynamic args) => _overlay.ShowKeyboard((string)args.description, (string)args.placeHolder)),
                HideKeyboard = (Func <object, Task <object> >)(async(dynamic args) => _overlay.HideKeyboard()),

                SetOverlayOptions = (Func <object, Task <object> >)(async(dynamic args) => _overlay.SetOverlayOptions((OVRLayOptions)args)),
                PollForEvents     = (Func <object, Task <object> >)(async(dynamic args) => _overlay.PollForEvents())
            };

            SetCallbackSetters(ovrlay_js);

            _overlay.onDashboardChange  += delegate(bool open) { ovrlay_js.onDashboardChange_JS(open); };
            _overlay.onFocusChange      += delegate(bool hasFocus) { ovrlay_js.onFocusChange_JS(hasFocus); };
            _overlay.onVisibilityChange += delegate(bool visibility) { ovrlay_js.onVisibilityChange_JS(visibility); };
            _overlay.onKeyboardInput    += delegate(string input) { ovrlay_js.onKeyboardInput_JS(input); };
            _overlay.onKeyboardClosed   += delegate() { ovrlay_js.onKeyboardClosed_JS(null); };
            _overlay.onKeyboardDone     += delegate() { ovrlay_js.onKeyboardDone_JS(null); };

            return(ovrlay_js);
        }