static public int OnBeginDrag(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.EventSystems.IBeginDragHandler self = (UnityEngine.EventSystems.IBeginDragHandler)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData  a1;
         checkType(l, 2, out a1);
         self.OnBeginDrag(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int OnBeginDrag(IntPtr l)
 {
     try {
         UnityEngine.EventSystems.IBeginDragHandler self = (UnityEngine.EventSystems.IBeginDragHandler)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData  a1;
         checkType(l, 2, out a1);
         self.OnBeginDrag(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #3
0
        static StackObject *OnBeginDrag_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.EventSystems.PointerEventData @eventData = (UnityEngine.EventSystems.PointerEventData) typeof(UnityEngine.EventSystems.PointerEventData).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.EventSystems.IBeginDragHandler instance_of_this_method = (UnityEngine.EventSystems.IBeginDragHandler) typeof(UnityEngine.EventSystems.IBeginDragHandler).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.OnBeginDrag(@eventData);

            return(__ret);
        }
        static int _m_OnBeginDrag(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.EventSystems.IBeginDragHandler __cl_gen_to_be_invoked = (UnityEngine.EventSystems.IBeginDragHandler)translator.FastGetCSObj(L, 1);


            try {
                {
                    UnityEngine.EventSystems.PointerEventData eventData = (UnityEngine.EventSystems.PointerEventData)translator.GetObject(L, 2, typeof(UnityEngine.EventSystems.PointerEventData));

                    __cl_gen_to_be_invoked.OnBeginDrag(eventData);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
        static internal void Lua_UnityEngine_EventSystems_ExecuteEvents_EventFunction_1_UnityEngine_EventSystems_IBeginDragHandler(LuaFunction ld, UnityEngine.EventSystems.IBeginDragHandler a1, UnityEngine.EventSystems.BaseEventData a2)
        {
            IntPtr l     = ld.L;
            int    error = pushTry(l);

            pushValue(l, a1);
            pushValue(l, a2);
            ld.pcall(2, error);
            LuaDLL.lua_settop(l, error - 1);
        }
Exemple #6
0
        /// <summary>
        /// Retrieve a cached TabAssets for a specific window in the tab system - or
        /// create and store a new one if none currently exist.
        /// </summary>
        /// <param name="tabbedWin">The window to retrive the assets for.</param>
        /// <param name="rt">The RectTransform to put parent the assets in if they're being created. </param>
        /// <param name="props">The properties used to give the assets if they're being created.</param>
        /// <returns></returns>
        public TabsAssets GetTabAssets(Dock tabbedWin, RectTransform parent, DockProps props)
        {
            TabsAssets ret;

            if (this.assetLookup.TryGetValue(tabbedWin, out ret) == true)
            {
                return(ret);
            }

            ret = new TabsAssets();

            GameObject goTab = new GameObject("Tab asset");

            goTab.transform.SetParent(parent);
            ret.notebookTab        = goTab.AddComponent <UnityEngine.UI.Image>();
            ret.notebookTab.sprite = props.tabs.tabPlate;
            ret.notebookTab.type   = UnityEngine.UI.Image.Type.Sliced;
            RectTransform rtTab = ret.notebookTab.rectTransform;

            rtTab.anchorMin = new Vector2(0.0f, 1.0f);
            rtTab.anchorMax = new Vector2(0.0f, 1.0f);
            rtTab.pivot     = new Vector2(0.0f, 1.0f);
            goTab.AddComponent <UnityEngine.UI.Mask>();

            ret.notebookButton = goTab.AddComponent <UnityEngine.UI.Button>();
            ret.notebookButton.onClick.AddListener(
                () =>
            {
                this.dock.activeTab = tabbedWin;
                this.HandleDock();
            });

            // Prevent locked windows from being ripped from the tab system. The issue here is
            // that if it's ripped, then it should turn to a floating window, which locked windows
            // can't.
            if (tabbedWin.window.Locked == false)
            {
                // If the tag is being dragged, redirect it to the window to
                // initiate a pull-off.
                UnityEngine.EventSystems.EventTrigger etTab = goTab.AddComponent <UnityEngine.EventSystems.EventTrigger>();
                etTab.triggers = new List <UnityEngine.EventSystems.EventTrigger.Entry>();
                UnityEngine.EventSystems.EventTrigger.Entry dragEnt = new UnityEngine.EventSystems.EventTrigger.Entry();
                dragEnt.eventID = UnityEngine.EventSystems.EventTriggerType.BeginDrag;
                dragEnt.callback.AddListener(
                    (x) =>
                {
                    UnityEngine.EventSystems.PointerEventData evt =
                        x as UnityEngine.EventSystems.PointerEventData;

                    // Transform the point from the tab, to the window about to be ripped.
                    Vector2 mouseInTab = goTab.transform.worldToLocalMatrix.MultiplyPoint(evt.position);
                    evt.position       = tabbedWin.window.transform.localToWorldMatrix.MultiplyPoint(mouseInTab);

                    // Make sure it's active before handoff. Will be inactive if not the main tab.
                    tabbedWin.window.gameObject.SetActive(true);

                    // Do handoff
                    evt.dragging    = true;
                    evt.pointerDrag = tabbedWin.window.gameObject;

                    // Force titlebar drag state
                    Window._StartOutsideDrag(Window.FrameDrag.Position, tabbedWin.window, Vector2.zero);

                    // Make sure it handles OnBeginDrag - certain important drag things are
                    // initialized there.
                    UnityEngine.EventSystems.IBeginDragHandler dragBegin = tabbedWin.window;
                    dragBegin.OnBeginDrag(evt);
                    // Reset styles + shadow
                    this.root.UndockWindow(tabbedWin.window);
                });
                etTab.triggers.Add(dragEnt);
            }

            if (tabbedWin.window.Closable == true &&
                tabbedWin.window.Locked == false)
            {
                GameObject goCloseBtn = new GameObject("CloseButton");
                goCloseBtn.transform.SetParent(rtTab);
                ret.closeButton        = goCloseBtn.AddComponent <UnityEngine.UI.Image>();
                ret.closeButton.sprite = props.tabs.innerTabBtn;
                ret.closeButton.type   = UnityEngine.UI.Image.Type.Sliced;
                RectTransform rtCloseBtn = ret.closeButton.rectTransform;
                rtCloseBtn.anchorMin = new Vector2(1.0f, 0.0f);
                rtCloseBtn.anchorMax = new Vector2(1.0f, 1.0f);
                rtCloseBtn.offsetMin =
                    new Vector2(
                        -this.root.props.tabs.closeBorderRight - this.root.props.tabs.closeWidth,
                        this.root.props.tabs.closeBorderVert);
                rtCloseBtn.offsetMax =
                    new Vector2(
                        -this.root.props.tabs.closeBorderRight,
                        -this.root.props.tabs.closeBorderVert);

                UnityEngine.UI.Button closeBtn = goCloseBtn.AddComponent <UnityEngine.UI.Button>();
                closeBtn.onClick.AddListener(
                    () =>
                {
                    this.root.CloseWindow(tabbedWin.window);
                });

                if (props.tabs.closeWindowIcon != null)
                {
                    GameObject goCloseIco = new GameObject("Close");
                    goCloseIco.transform.SetParent(rtCloseBtn);
                    UnityEngine.UI.Image imgCloseIco = goCloseIco.AddComponent <UnityEngine.UI.Image>();
                    RectTransform        rtClIco     = imgCloseIco.rectTransform;
                    imgCloseIco.sprite       = props.tabs.closeWindowIcon;
                    rtClIco.anchorMin        = new Vector2(0.5f, 0.5f);
                    rtClIco.anchorMax        = new Vector2(0.5f, 0.5f);
                    rtClIco.pivot            = new Vector2(0.5f, 0.5f);
                    rtClIco.anchoredPosition = Vector2.zero;
                    rtClIco.sizeDelta        = props.tabs.closeWindowIcon.rect.size;
                }
            }

            GameObject goText = new GameObject("Text");

            goText.transform.SetParent(rtTab);
            ret.label                    = goText.AddComponent <UnityEngine.UI.Text>();
            ret.label.text               = tabbedWin.window.TitlebarText;
            ret.label.color              = props.tabs.tabFontColor;
            ret.label.fontSize           = props.tabs.tabFontSize;
            ret.label.verticalOverflow   = VerticalWrapMode.Truncate;
            ret.label.horizontalOverflow = HorizontalWrapMode.Wrap;
            ret.label.alignment          = TextAnchor.MiddleCenter;
            ret.label.font               = props.tabs.tabFont;
            RectTransform rtLabel = ret.label.rectTransform;

            rtLabel.anchorMin = Vector2.zero;
            rtLabel.anchorMax = Vector2.one;
            rtLabel.offsetMin = Vector2.zero;
            rtLabel.offsetMax = new Vector2(-this.root.props.tabs.closeBorderRight - this.root.props.tabs.closeWidth, 0.0f);
            rtLabel.pivot     = new Vector2(0.5f, 0.5f);

            this.assetLookup.Add(tabbedWin, ret);
            return(ret);
        }