コード例 #1
0
 public static void RegisterNotDragEvent(GameObject obj, object kLuaFunc)
 {
     DragEventListener.Get(obj).onNotDrag = delegate(GameObject sender, BaseEventData kEvtData, bool canClick)
     {
         LuaPerformer.Call(kLuaFunc, sender, kEvtData, canClick);
     };
 }
コード例 #2
0
    public override void RegisterEvent()
    {
        {
            DragEventListener listener = view.StartGame.gameObject.GetComponent <DragEventListener>();
            if (listener == null)
            {
                listener = view.StartGame.gameObject.AddComponent <DragEventListener>();
                listener.OnClickEvent += delegate(PointerEventData eventData) {
                    mUIMgr.CloseCertainPanel(this);
                    AdjustInitCtrl ctrl = mUIMgr.ShowPanel("AdjustPanel") as AdjustInitCtrl;
                    ctrl.SetRoleId(nowIdx);
                };
            }
        }

        foreach (RoleItemView vv in view.roleList)
        {
            ClickEventListerner listener = vv.clickArea.gameObject.GetComponent <ClickEventListerner>();
            if (listener == null)
            {
                listener = vv.clickArea.gameObject.AddComponent <ClickEventListerner>();
                listener.OnClickEvent += delegate(PointerEventData eventData) {
                    switchSelectedStory(view.roleList.IndexOf(vv));
                };
            }
        }
    }
コード例 #3
0
    static int set_onForwardDrag(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            DragEventListener obj = (DragEventListener)o;
            DragEventListener.Vector2Delegate arg0 = null;
            LuaTypes funcType2 = LuaDLL.lua_type(L, 2);

            if (funcType2 != LuaTypes.LUA_TFUNCTION)
            {
                arg0 = (DragEventListener.Vector2Delegate)ToLua.CheckObject(L, 2, typeof(DragEventListener.Vector2Delegate));
            }
            else
            {
                LuaFunction func = ToLua.ToLuaFunction(L, 2);
                arg0 = DelegateFactory.CreateDelegate(typeof(DragEventListener.Vector2Delegate), func) as DragEventListener.Vector2Delegate;
            }

            obj.onForwardDrag = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onForwardDrag on a nil value" : e.Message));
        }
    }
コード例 #4
0
 static public int OnEndDrag(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
         DragEventListener self = (DragEventListener)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData a1;
         checkType(l, 2, out a1);
         self.OnEndDrag(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
 }
コード例 #5
0
 public static void RegisterDropEvent(GameObject obj, object kLuaFunc)
 {
     DragEventListener.Get(obj).onDrop = delegate(GameObject sender, BaseEventData kEvtData)
     {
         PointerEventData kData    = kEvtData as PointerEventData;
         GameObject       kDragger = kData.pointerDrag;
         UICallback       kDropCb  = null;
         if (null != kDragger)
         {
             kDropCb = kDragger.GetComponent <UICallback>();
         }
         LuaFunction kFunc = kLuaFunc as LuaFunction;
         if (null != kFunc)
         {
             if (kDropCb != null)
             {
                 kFunc.Call(sender, kDragger, kEvtData, kDropCb.DropCallback);
             }
             else
             {
                 kFunc.Call(sender, kDragger, kEvtData);
             }
         }
         else
         {
             Log.W("Call Drop Failed");
         }
     };
 }
コード例 #6
0
    public override void BindView()
    {
        view.Close = root.Find("Close").GetComponent <Button>();

        view.ItemContainer = root.Find("ItemContainer");
        view.DetailPanel   = root.Find("DetailPanel");

        view.DetailDesp       = view.DetailPanel.Find("DetailDesp").GetComponent <Text>();
        view.DetailName       = view.DetailPanel.Find("DetailName").GetComponent <Text>();
        view.DetailEffectDesp = view.DetailPanel.Find("DetailEffectDesp").GetComponent <Text>();

        view.NextPage = root.Find("Next").GetComponent <Button>();
        view.PrePage  = root.Find("Pre").GetComponent <Button>();
        view.PageNum  = root.Find("PageNum").GetComponent <Text>();

        view.ConfirmBuyView = root.Find("确认购买").GetComponent <Image>();
        view.ConfirmBuy     = view.ConfirmBuyView.transform.Find("Confirm").GetComponent <Button>();
        view.ConfirmCancel  = view.ConfirmBuyView.transform.Find("Cancel").GetComponent <Button>();

        //view.Buy = root.Find("Buy").GetComponent<Button>();


        foreach (TaobaoItemView vv in view.ItemList)
        {
            pResLoader.ReleaseGO("UI/Apps/TaobaoItem", vv.root.gameObject);
        }

        view.ItemList.Clear();

        for (int i = 0; i < PageFixItemNum; i++)
        {
            GameObject     go = pResLoader.Instantiate("UI/Apps/TaobaoItem", view.ItemContainer);
            TaobaoItemView vv = new TaobaoItemView();
            vv.BindView(go.transform);
            view.ItemList.Add(vv);
            vv.Hint.gameObject.SetActive(false);
            int idx = i;
            vv.root.gameObject.SetActive(false);
            {
                DragEventListener listener = vv.ItemBG.gameObject.GetComponent <DragEventListener>();
                if (listener == null)
                {
                    listener = vv.ItemBG.gameObject.AddComponent <DragEventListener>();
                }

                listener.ClearClickEvent();
                listener.OnClickEvent += delegate {
                    //ChooseOne(vv);
                    BuyOne(vv);
                };
                listener.PointerEnterEvent += delegate {
                    ShowPopupInfo(idx);
                    //idx
                };
                listener.PointerExitEvent += delegate {
                    HidePopupInfo(idx);
                };
            }
        }
    }
コード例 #7
0
 void Start()
 {
     DragEventListener.Get(joyStickNood).onDrag    = OnDrag;
     DragEventListener.Get(joyStickNood).onEndDrag = OnEndDrag;
     joyStickNoodRT = joyStickNood.GetComponent <RectTransform>();
     initialPos     = joyStickNoodRT.anchoredPosition;
     cavas          = this.transform.parent.GetComponent <Canvas>();
 }
コード例 #8
0
        public static void RegisterDropEvent(GameObject obj, object kLuaFunc)
        {
            DragEventListener.Get(obj).onDrop = delegate(GameObject sender, BaseEventData kEvtData)
            {
                PointerEventData kData    = kEvtData as PointerEventData;
                GameObject       kDragger = kData.pointerDrag;

                LuaPerformer.Call(kLuaFunc, sender, kDragger, kEvtData);
            };
        }
コード例 #9
0
    static public new DragEventListener Get(GameObject go)
    {
        DragEventListener listener = go.GetComponent <DragEventListener>();

        if (listener == null)
        {
            listener = go.AddComponent <DragEventListener>();
        }
        return(listener);
    }
コード例 #10
0
ファイル: ZhiboUI.cs プロジェクト: DLBL0624/CSCI529
    private void AddClickFunc(GameObject target, DragEventListener.OnClickDlg func)
    {
        DragEventListener listener = target.GetComponent <DragEventListener>();

        if (listener == null)
        {
            listener = target.AddComponent <DragEventListener>();
            listener.OnClickEvent += func;
        }
    }
コード例 #11
0
 public void Clear()
 {
     DragParent = null;
     if (mClone != null)
     {
         Destroy(mClone);
     }
     cloneCanvasGroup   = null;
     mDragEventListener = null;
 }
コード例 #12
0
ファイル: DragEventListener.cs プロジェクト: daxingyou/-game
    static public DragEventListener Get(GameObject go, LuaTable target)
    {
        DragEventListener listener = go.GetComponent <DragEventListener>();

        if (listener == null)
        {
            listener = go.AddComponent <DragEventListener>();
        }
        listener.mTarget = target;
        return(listener);
    }
コード例 #13
0
    static public DragEventListener Get(GameObject go, object arg = null)
    {
        DragEventListener listener = go.GetComponent <DragEventListener>();

        if (listener == null)
        {
            listener = go.AddComponent <DragEventListener>();
        }
        listener.arg = arg;
        return(listener);
    }
コード例 #14
0
 public static void RegisterEndDragEvent(GameObject obj, object kLuaFunc)
 {
     DragEventListener.Get(obj).onEndDrag = delegate(GameObject sender, BaseEventData kEvtData)
     {
         CanvasGroup group = obj.GetComponent <CanvasGroup>();
         if (null != group)
         {
             GameObject.Destroy(group);
         }
         LuaPerformer.Call(kLuaFunc, sender, kEvtData);
     };
 }
コード例 #15
0
 public static void RegisterBeginDragEvent(GameObject obj, object kLuaFunc)
 {
     DragEventListener.Get(obj).onBeginDrag = delegate(GameObject sender, BaseEventData kEvtData)
     {
         CanvasGroup group = obj.GetComponent <CanvasGroup>();
         if (null == group)
         {
             group = obj.AddComponent <CanvasGroup>();
         }
         group.blocksRaycasts = false;
         LuaPerformer.Call(kLuaFunc, sender, kEvtData);
     };
 }
コード例 #16
0
 static int Get(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.GameObject arg0 = (UnityEngine.GameObject)ToLua.CheckUnityObject(L, 1, typeof(UnityEngine.GameObject));
         DragEventListener      o    = DragEventListener.Get(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #17
0
 public static void RegisterNotDragEvent(GameObject obj, object kLuaFunc)
 {
     DragEventListener.Get(obj).onNotDrag = delegate(GameObject sender, BaseEventData kEvtData, bool canClick)
     {
         LuaFunction kFunc = kLuaFunc as LuaFunction;
         if (null != kFunc)
         {
             kFunc.Call(sender, kEvtData, canClick);
         }
         else
         {
             Log.W("Call End Drag Failed");
         }
     };
 }
コード例 #18
0
 static int OnDrag(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         DragEventListener obj = (DragEventListener)ToLua.CheckObject(L, 1, typeof(DragEventListener));
         UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject(L, 2, typeof(UnityEngine.EventSystems.PointerEventData));
         obj.OnDrag(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #19
0
 public static void RegisterDragEvent(GameObject obj, object kLuaFunc)
 {
     DragEventListener.Get(obj).onDrag = delegate(GameObject sender, BaseEventData kEvtData)
     {
         RectTransform kTs = sender.GetComponent <RectTransform>();
         kTs.pivot.Set(0, 0);
         PointerEventData kData = kEvtData as PointerEventData;
         Vector3          globalMousePos;
         if (RectTransformUtility.ScreenPointToWorldPointInRectangle(kTs, kData.position, kData.pressEventCamera, out globalMousePos))
         {
             kTs.position = globalMousePos;
         }
         LuaPerformer.Call(kLuaFunc, sender, kEvtData);
     };
 }
コード例 #20
0
    public static DragEventListener Get(GameObject go)
    {
        DragEventListener listener = go.GetComponent <DragEventListener>();

        if (listener == null)
        {
            listener = go.AddComponent <DragEventListener>();
        }
        var g = go.GetComponent <Graphic>();

        if (g != null)
        {
            g.raycastTarget = true;
        }
        return(listener);
    }
コード例 #21
0
    private void RegisterEvent()
    {
        DragEventListener listener = view.Hengfu.gameObject.GetComponent <DragEventListener>();

        if (listener == null)
        {
            listener = view.Hengfu.gameObject.AddComponent <DragEventListener>();
        }
        listener.ClearClickEvent();
        listener.ClearPointerEvent();
        listener.OnClickEvent += delegate(PointerEventData eventData) {
            Clicked();
        };
        listener.PointerEnterEvent += delegate(PointerEventData eventData) {
            OnPointerEnter();
        };
    }
コード例 #22
0
    static int get_onForwardDrag(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            DragEventListener obj = (DragEventListener)o;
            DragEventListener.Vector2Delegate ret = obj.onForwardDrag;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index onForwardDrag on a nil value" : e.Message));
        }
    }
コード例 #23
0
ファイル: ZhiboBuff.cs プロジェクト: DLBL0624/CSCI529
    public void RegisterEvent()
    {
        //鼠标悬浮显示buff
        DragEventListener listener = gameObject.GetComponent <DragEventListener>();

        if (listener == null)
        {
            listener = gameObject.AddComponent <DragEventListener>();
            listener.PointerEnterEvent += delegate(PointerEventData eventData) {
                gameMode.mUICtrl.ShowBuffDetail(this);
            };

            listener.PointerExitEvent += delegate(PointerEventData eventData) {
                gameMode.mUICtrl.HideBuffDetail();
            };
        }
    }
コード例 #24
0
ファイル: AdjustInitCtrl.cs プロジェクト: DLBL0624/CSCI529
    public void RegisterAsAvailable(SpecilistView vv)
    {
        DragEventListener listener = vv.root.GetComponent <DragEventListener> ();

        if (listener == null)
        {
            Debug.Log("error");
            return;
        }
        listener.ClearDragEvent();
        listener.ClearClickEvent();

        listener.OnClickEvent += delegate(PointerEventData eventData) {
            ShowDetail(vv);
        };

        listener.OnBeginDragEvent += delegate(PointerEventData eventData) {
            vv.root.SetParent(root, true);
        };
        listener.OnDragEvent += delegate(PointerEventData eventData) {
            vv.root.position = mUIMgr.GetWorldPosition(eventData.position);
        };
        listener.OnEndDragEvent += delegate(PointerEventData eventData) {
            List <RaycastResult> results = new List <RaycastResult> ();
            bool used = false;
            EventSystem.current.RaycastAll(eventData, results);
            foreach (RaycastResult ret in results)
            {
                if (ret.gameObject != null)
                {
                    if (ret.gameObject == view.PosSkillContainer.gameObject)
                    {
                        vv.root.SetParent(view.PosSkillContainer, false);
                        used = true;
                        RegisterAsChoosed(vv);
                        model.selectedOne.Add(view.avalableList.IndexOf(vv));
                    }
                }
            }
            if (!used)
            {
                vv.root.SetParent(view.AvailableContainer, false);
            }
        };
    }
コード例 #25
0
ファイル: AdjustInitCtrl.cs プロジェクト: DLBL0624/CSCI529
    public void RegisterAsChoosed(SpecilistView vv)
    {
        DragEventListener listener = vv.root.GetComponent <DragEventListener> ();

        if (listener == null)
        {
            Debug.Log("error");
            return;
        }
        listener.ClearClickEvent();
        listener.ClearDragEvent();
        listener.OnClickEvent += delegate(PointerEventData eventData) {
            vv.root.SetParent(view.AvailableContainer, false);
            RegisterAsAvailable(vv);
            vv.selected = false;
            model.selectedOne.Remove(view.avalableList.IndexOf(vv));
        };
    }
コード例 #26
0
 public static void RegisterEndDragEvent(GameObject obj, object kLuaFunc)
 {
     DragEventListener.Get(obj).onEndDrag = delegate(GameObject sender, BaseEventData kEvtData)
     {
         CanvasGroup group = obj.GetComponent <CanvasGroup>();
         if (null != group)
         {
             GameObject.Destroy(group);
         }
         LuaFunction kFunc = kLuaFunc as LuaFunction;
         if (null != kFunc)
         {
             kFunc.Call(sender, kEvtData);
         }
         else
         {
             Log.W("Call End Drag Failed");
         }
     };
 }
コード例 #27
0
 public static void RegisterBeginDragEvent(GameObject obj, object kLuaFunc)
 {
     DragEventListener.Get(obj).onBeginDrag = delegate(GameObject sender, BaseEventData kEvtData)
     {
         CanvasGroup group = obj.GetComponent <CanvasGroup>();
         if (null == group)
         {
             group = obj.AddComponent <CanvasGroup>();
         }
         group.blocksRaycasts = false;
         LuaFunction kFunc = kLuaFunc as LuaFunction;
         if (null != kFunc)
         {
             kFunc.Call(sender, kEvtData);
         }
         else
         {
             Log.W("Call Begin Drag Failed");
         }
     };
 }
コード例 #28
0
ファイル: ZhiboLittleTV.cs プロジェクト: nmbswls/CSCI529
 private void RegisterEvents()
 {
     {
         DragEventListener listener = view.TokenInfo.GetComponent <DragEventListener>();
         if (listener == null)
         {
             listener = view.TokenInfo.AddComponent <DragEventListener>();
             listener.PointerEnterEvent += delegate {
                 audienceMgr.ShowTokenDetail(this);
             };
             listener.OnClickEvent += delegate {
                 Debug.Log("cnm");
             };
             listener.PointerExitEvent += delegate {
                 audienceMgr.HideTokenDetail();
             };
         }
     }
     {
         DragEventListener listener = view.Content.GetComponent <DragEventListener>();
         if (listener == null)
         {
             listener = view.Content.gameObject.AddComponent <DragEventListener>();
             listener.PointerEnterEvent += delegate {
                 if (TargetAudience == null)
                 {
                     return;
                 }
                 audienceMgr.gameMode.mUICtrl.MouseInputLittleTV(this);
             };
             listener.PointerExitEvent += delegate {
                 if (TargetAudience == null)
                 {
                     return;
                 }
                 audienceMgr.gameMode.mUICtrl.MouseOutLittleTV(this);
             };
         }
     }
 }
コード例 #29
0
    public override void RegisterEvent()
    {
        for (int i = 0; i < FightingDanmuGameMode.ActionNum; i++)
        {
            int               idx      = i;
            GameObject        toBind   = view.Actions[i].ActiveButton.gameObject;
            DragEventListener listener = toBind.GetComponent <DragEventListener>();
            if (listener == null)
            {
                listener = toBind.AddComponent <DragEventListener>();
                listener.OnClickEvent += delegate {
                    UseAbility(idx);
                };
                listener.PointerEnterEvent += delegate {
                    ShowSkillDetail(idx);
                };
                listener.PointerExitEvent += delegate {
                    HideSkillDetail();
                };
            }
        }

        {
            GameObject        toBind   = view.Passive.ActiveButton.gameObject;
            DragEventListener listener = toBind.GetComponent <DragEventListener>();
            if (listener == null)
            {
                listener = toBind.AddComponent <DragEventListener>();
                listener.PointerEnterEvent += delegate {
                    ShowSkillDetail(-1);
                };
                listener.PointerExitEvent += delegate {
                    HideSkillDetail();
                };
            }
        }
    }
コード例 #30
0
 public void SetListener(DragEventListener listener)
 {
     mDragEventListener = listener;
 }