void OnScrollValueChanged(KScrollView scrollView_, Vector2 position) { if (!m_isRecyle) { return; } //Log.Debug("scroll:" + position, this); ShowItems(false); }
static public int JumpToBottom(IntPtr l) { try { mg.org.KUI.KScrollView self = (mg.org.KUI.KScrollView)checkSelf(l); self.JumpToBottom(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int StopMovement(IntPtr l) { try { mg.org.KUI.KScrollView self = (mg.org.KUI.KScrollView)checkSelf(l); self.StopMovement(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int ResetContentPosition(IntPtr l) { try { mg.org.KUI.KScrollView self = (mg.org.KUI.KScrollView)checkSelf(l); self.ResetContentPosition(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int get_maskTrans(IntPtr l) { try { mg.org.KUI.KScrollView self = (mg.org.KUI.KScrollView)checkSelf(l); pushValue(l, true); pushValue(l, self.maskTrans); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int get_direction(IntPtr l) { try { mg.org.KUI.KScrollView self = (mg.org.KUI.KScrollView)checkSelf(l); pushValue(l, true); pushEnum(l, (int)self.direction); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int NeedScroll(IntPtr l) { try { mg.org.KUI.KScrollView self = (mg.org.KUI.KScrollView)checkSelf(l); var ret = self.NeedScroll(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int SetScrollable(IntPtr l) { try { mg.org.KUI.KScrollView self = (mg.org.KUI.KScrollView)checkSelf(l); System.Boolean a1; checkType(l, 2, out a1); self.SetScrollable(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int set_direction(IntPtr l) { try { mg.org.KUI.KScrollView self = (mg.org.KUI.KScrollView)checkSelf(l); mg.org.KUI.KScrollView.ScrollDir v; checkEnum(l, 2, out v); self.direction = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static List <int> __delList = new List <int>(); //需要删除的序号 protected override void __Initialize() { m_scrollView = ComponentUtil.EnsureComponent <KScrollView>(this.gameObject); m_maskTrans = m_scrollView.maskTrans; m_contentTrans = m_scrollView.contentTrans; m_contentSizeDefault = m_contentTrans.sizeDelta; //content的默认尺寸(实际size不能比这个小) m_contentGo = m_contentTrans.gameObject; m_itemTemp = GameObjUtil.FuzzySearchChild(m_contentGo, "item"); //只查找一层 m_itemTemp.SetActive(false); //隐藏掉模板 //KListView a1 = gameObject.GetComponent<KListView>(); //Component a2 = gameObject.GetComponent("mg.org.KUI.KListView"); RectTransform rectTrans = m_itemTemp.GetComponent <RectTransform>(); m_layoutParam.itemSize = rectTrans.sizeDelta; m_layoutParam.pivot = rectTrans.pivot; }
public void Refresh(Vector2 scrollPosition, KScrollView view) { bool prevVisible = false; bool nextVisible = false; //Log.Debug("scrollPosition " + scrollPosition, this); bool needScroll = view.NeedScroll(); KScrollView.ScrollDir direction = view.direction; if (needScroll) { if (direction == KScrollView.ScrollDir.vertical) { if (scrollPosition.y > 0) { nextVisible = true; } if (scrollPosition.y < 1) { prevVisible = true; } } else { if (scrollPosition.x > 0) { prevVisible = true; } if (scrollPosition.x < 1) { nextVisible = true; } } } else { //内容比遮罩短时, 除非强行拽否则不显示箭头 //需要配合scrollrect的修改 if (direction == KScrollView.ScrollDir.vertical) { if (scrollPosition.y > 1) //强行往下拽, 显示下箭头 { nextVisible = true; } if (scrollPosition.y < 0) //强行往上拽, 显示上箭头 { prevVisible = true; } } else { if (scrollPosition.x > 1) { prevVisible = true; } if (scrollPosition.x < 0) { nextVisible = true; } } } if (m_prevImage) { m_prevImage.Visible = prevVisible; } if (m_nextImage) { m_nextImage.Visible = nextVisible; } }