/// <summary> /// 按格子播放 /// </summary> /// <param name="index">在整个表格中的序列,从0开始</param> /// <param name="item"></param> /// <param name="pos"></param> protected virtual void PlayCellTween(int index, QuickGridItemBase item, Vector2 pos, bool isLast) { Tweener t = item.localTsf.DOLocalMove(GetFormPos(item, pos), interval).OnPlay(() => { item.localGo.SetActive(true); DoTweenAlpha(item, alpha, interval); }).From().SetDelay(index * cellDelay).SetEase(easeType); OnTweenComplete(t, item, isLast); }
private static QuickGridItemBase CreateItem(GameObject parent) { int layer = parent.gameObject.layer; GameObject go = new GameObject("Item"); go.E_SetParentAndReset(parent); go.layer = layer; QuickGridItemBase item = go.AddComponent <QuickGridItemBase>(); return(item); }
/// <summary> /// 透明渐变 /// </summary> /// <param name="item"></param> /// <param name="alpha"></param> /// <param name="interval"></param> protected void DoTweenAlpha(QuickGridItemBase item, float alpha, float interval) { if (alpha < 1) { CanvasGroup cg = item.GetComponent <CanvasGroup>(); if (!cg) { cg = item.localGo.AddComponent <CanvasGroup>(); } cg.DOFade(alpha, interval).From(); } }
static int QPYX_OnDataChange_YXQP(IntPtr L_YXQP) { try { ToLua.CheckArgsCount(L_YXQP, 1); littlerbird.UI.QuickGridItemBase QPYX_obj_YXQP = (littlerbird.UI.QuickGridItemBase)ToLua.CheckObject <littlerbird.UI.QuickGridItemBase>(L_YXQP, 1); QPYX_obj_YXQP.OnDataChange(); return(0); } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
/// <summary> /// 刷新item /// </summary> /// <param name="data"></param> public void RefreshItem(object data) { QuickGridItemBase item = content.GetShowItem(data); if (item) { item.OnDataChange(); item.OnSelectChange(); } if (needItemPanel && itemPanel.data == data && itemPanel.isShow) { itemPanel.Refresh(); } }
static int OnDataChange(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); littlerbird.UI.QuickGridItemBase obj = (littlerbird.UI.QuickGridItemBase)ToLua.CheckObject <littlerbird.UI.QuickGridItemBase>(L, 1); obj.OnDataChange(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void Bind(QuickGridItemBase item) { if (index == item.index) { Hide(); } else { this.data = item.data; m_index = item.index; line = item.line; Refresh(true); } }
static int QPYX_OnPointerClick_YXQP(IntPtr L_YXQP) { try { ToLua.CheckArgsCount(L_YXQP, 2); littlerbird.UI.QuickGridItemBase QPYX_obj_YXQP = (littlerbird.UI.QuickGridItemBase)ToLua.CheckObject <littlerbird.UI.QuickGridItemBase>(L_YXQP, 1); UnityEngine.EventSystems.PointerEventData QPYX_arg0_YXQP = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject <UnityEngine.EventSystems.PointerEventData>(L_YXQP, 2); QPYX_obj_YXQP.OnPointerClick(QPYX_arg0_YXQP); return(0); } catch (Exception e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP)); } }
static int OnPointerClick(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); littlerbird.UI.QuickGridItemBase obj = (littlerbird.UI.QuickGridItemBase)ToLua.CheckObject <littlerbird.UI.QuickGridItemBase>(L, 1); UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject <UnityEngine.EventSystems.PointerEventData>(L, 2); obj.OnPointerClick(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_line(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); littlerbird.UI.QuickGridItemBase obj = (littlerbird.UI.QuickGridItemBase)o; int ret = obj.line; LuaDLL.lua_pushinteger(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index line on a nil value")); } }
static int get_selected(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); littlerbird.UI.QuickGridItemBase obj = (littlerbird.UI.QuickGridItemBase)o; bool ret = obj.selected; LuaDLL.lua_pushboolean(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index selected on a nil value")); } }
static int get_localGo(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); littlerbird.UI.QuickGridItemBase obj = (littlerbird.UI.QuickGridItemBase)o; UnityEngine.GameObject ret = obj.localGo; ToLua.PushSealed(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index localGo on a nil value")); } }
static int get_itemName(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); littlerbird.UI.QuickGridItemBase obj = (littlerbird.UI.QuickGridItemBase)o; string ret = obj.itemName; LuaDLL.lua_pushstring(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index itemName on a nil value")); } }
static int set_config(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); littlerbird.UI.QuickGridItemBase obj = (littlerbird.UI.QuickGridItemBase)o; littlerbird.UI.QuickGrid arg0 = (littlerbird.UI.QuickGrid)ToLua.CheckObject <littlerbird.UI.QuickGrid>(L, 2); obj.config = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index config on a nil value")); } }
static int set_line(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); littlerbird.UI.QuickGridItemBase obj = (littlerbird.UI.QuickGridItemBase)o; int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); obj.line = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index line on a nil value")); } }
static int set_data(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); littlerbird.UI.QuickGridItemBase obj = (littlerbird.UI.QuickGridItemBase)o; object arg0 = ToLua.ToVarObject(L, 2); obj.data = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index data on a nil value")); } }
static int get_data(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); littlerbird.UI.QuickGridItemBase obj = (littlerbird.UI.QuickGridItemBase)o; object ret = obj.data; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index data on a nil value")); } }
/// <summary> /// 获取出发点位置 /// </summary> /// <param name="item"></param> /// <param name="pos"></param> /// <returns></returns> protected Vector2 GetFormPos(QuickGridItemBase item, Vector2 pos) { switch (posType) { case PosType.Pos: return(offset); case PosType.Offset: return(offset + pos); case PosType.OffsetX: return(new Vector2(offset.x + pos.x, offset.y)); case PosType.OffsetY: return(new Vector2(offset.x, offset.y + pos.y)); } return(pos); }
protected void OnEnable() { grid = target as QuickGrid; grid.needItemEvent = true; grid.needItemPanelMask = false; mask = grid.GetComponent <Image>(); //sv = GetAndAdd<ScrollRect>(grid); content = FindComponentInChildren <QuickGridContent>(grid.transform); //grid.GetComponentInChildren<QuickGridContent>(); if (!content) { content = CreateContent(grid.gameObject); } tsfWidget = content.transform; item = FindComponentInChildren <QuickGridItemBase>(tsfWidget);// content.GetComponentInChildren<QuickGirdItemConfig>(); if (!item) { item = CreateItem(content.gameObject); } }
/// <summary> /// 动画播放完成,触发回调并移除CanvasGroup /// </summary> /// <param name="t"></param> /// <param name="item"></param> /// <param name="isLast"></param> protected void OnTweenComplete(Tweener t, QuickGridItemBase item, bool isLast) { if (isLast) { t.OnComplete(() => { item.OnItemTweenComplete(); var items = config.items; for (int i = 0; i < items.Count; i++) { if (items[i].localGo.activeSelf) { items[i].OnAllTweenComplete(); } } isTweening = false; if (alpha < 1) { CanvasGroup cg = item.GetComponent <CanvasGroup>(); if (cg) { GameObject.Destroy(cg, 0.1f); } } }); } else { t.OnComplete(() => { item.OnItemTweenComplete(); if (alpha < 1) { CanvasGroup cg = item.GetComponent <CanvasGroup>(); if (cg) { GameObject.Destroy(cg, 0.1f); } } }); } }
internal void Play(int index, QuickGridItemBase item, Vector2 pos, bool isLast) { isTweening = true; item.localTsf.DOKill(true); item.localGo.SetActive(false); switch (config.tweenType) { case QuickGrid.GridTweenType.Line: PlayLineTween(index % config.pageCells, item, pos, isLast); break; case QuickGrid.GridTweenType.Row: PlayRowTween(index % config.pageCells, item, pos, isLast); break; case QuickGrid.GridTweenType.Cell: PlayCellTween(index, item, pos, isLast); break; case QuickGrid.GridTweenType.Custom: PlayCustom(index, item, pos, isLast); break; default: break; } //if (config.movement == QuickGrid.Movement.Vertical) //{ // //v.y = GetPosY(item.line); //} //else //{ // //v.x = GetPosX(item.line); //} }
static int QPYX_get_selected_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); littlerbird.UI.QuickGridItemBase QPYX_obj_YXQP = (littlerbird.UI.QuickGridItemBase)QPYX_o_YXQP; bool QPYX_ret_YXQP = QPYX_obj_YXQP.selected; LuaDLL.lua_pushboolean(L_YXQP, QPYX_ret_YXQP); return(1); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index selected on a nil value")); } }
static int QPYX_get_itemName_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); littlerbird.UI.QuickGridItemBase QPYX_obj_YXQP = (littlerbird.UI.QuickGridItemBase)QPYX_o_YXQP; string QPYX_ret_YXQP = QPYX_obj_YXQP.itemName; LuaDLL.lua_pushstring(L_YXQP, QPYX_ret_YXQP); return(1); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index itemName on a nil value")); } }
static int QPYX_get_localGo_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); littlerbird.UI.QuickGridItemBase QPYX_obj_YXQP = (littlerbird.UI.QuickGridItemBase)QPYX_o_YXQP; UnityEngine.GameObject QPYX_ret_YXQP = QPYX_obj_YXQP.localGo; ToLua.PushSealed(L_YXQP, QPYX_ret_YXQP); return(1); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index localGo on a nil value")); } }
static int QPYX_set_config_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); littlerbird.UI.QuickGridItemBase QPYX_obj_YXQP = (littlerbird.UI.QuickGridItemBase)QPYX_o_YXQP; littlerbird.UI.QuickGrid QPYX_arg0_YXQP = (littlerbird.UI.QuickGrid)ToLua.CheckObject <littlerbird.UI.QuickGrid>(L_YXQP, 2); QPYX_obj_YXQP.config = QPYX_arg0_YXQP; return(0); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index config on a nil value")); } }
static int QPYX_set_line_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); littlerbird.UI.QuickGridItemBase QPYX_obj_YXQP = (littlerbird.UI.QuickGridItemBase)QPYX_o_YXQP; int QPYX_arg0_YXQP = (int)LuaDLL.luaL_checknumber(L_YXQP, 2); QPYX_obj_YXQP.line = QPYX_arg0_YXQP; return(0); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index line on a nil value")); } }
static int QPYX_set_data_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); littlerbird.UI.QuickGridItemBase QPYX_obj_YXQP = (littlerbird.UI.QuickGridItemBase)QPYX_o_YXQP; object QPYX_arg0_YXQP = ToLua.ToVarObject(L_YXQP, 2); QPYX_obj_YXQP.data = QPYX_arg0_YXQP; return(0); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index data on a nil value")); } }
protected virtual void PlayCustom(int index, QuickGridItemBase item, Vector2 pos, bool isLast) { }
static int QPYX_get_config_YXQP(IntPtr L_YXQP) { object QPYX_o_YXQP = null; try { QPYX_o_YXQP = ToLua.ToObject(L_YXQP, 1); littlerbird.UI.QuickGridItemBase QPYX_obj_YXQP = (littlerbird.UI.QuickGridItemBase)QPYX_o_YXQP; littlerbird.UI.QuickGrid QPYX_ret_YXQP = QPYX_obj_YXQP.config; ToLua.Push(L_YXQP, QPYX_ret_YXQP); return(1); } catch (Exception QPYX_e_YXQP) { return(LuaDLL.toluaL_exception(L_YXQP, QPYX_e_YXQP, QPYX_o_YXQP, "attempt to index config on a nil value")); } }