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); }; }
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)); }; } } }
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)); } }
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 }
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"); } }; }
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); }; } } }
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>(); }
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); }; }
static public new DragEventListener Get(GameObject go) { DragEventListener listener = go.GetComponent <DragEventListener>(); if (listener == null) { listener = go.AddComponent <DragEventListener>(); } return(listener); }
private void AddClickFunc(GameObject target, DragEventListener.OnClickDlg func) { DragEventListener listener = target.GetComponent <DragEventListener>(); if (listener == null) { listener = target.AddComponent <DragEventListener>(); listener.OnClickEvent += func; } }
public void Clear() { DragParent = null; if (mClone != null) { Destroy(mClone); } cloneCanvasGroup = null; mDragEventListener = null; }
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); }
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); }
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); }; }
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); }; }
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)); } }
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"); } }; }
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)); } }
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); }; }
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); }
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(); }; }
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)); } }
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(); }; } }
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); } }; }
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)); }; }
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"); } }; }
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"); } }; }
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); }; } } }
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(); }; } } }
public void SetListener(DragEventListener listener) { mDragEventListener = listener; }