public void MoveNext(int delta) { Debug.Log("delta:" + delta); m_scrollView.DisableSpring(); m_scrollView.MoveRelative(new Vector3(delta * cellWidth, 0)); m_scrollView.InvalidateBounds(); m_scrollView.RestrictWithinBounds(true); gameObject.SetActive(false); gameObject.SetActive(true); }
public void ResetContent(int iCount, bool bRePos = true) { // if (this.gameObject.GetComponent<DragPlaySound>() == null) // { // dragPlaySound = this.gameObject.AddComponent<DragPlaySound>(); // dragPlaySound.audioClip = UIManager.instance.ScrollViewDragSound; // dragPlaySound.volume = UIManager.instance.ScrollViewDragSoundVolume; // // } if (bRePos) { if (mScroll != null) { mScroll.transform.localPosition = mScrollBeginPos_Orignal; mScroll.restrictWithinPanel = false; mScroll.DisableSpring(); } } if (bRePos) { if (mPanel != null) { mPanel.clipOffset = mScrollBeginOffset_Orignal; } ResetChildPositions(); } bDirty = true; itemCount = iCount; mFirstTime = true; WrapContent(); mFirstTime = false; if (bRePos) { barValue = 0; } mIgnoreCallbacks = true; Processbar(); CheckBarEvent(barValue); mIgnoreCallbacks = false; }
public void reset() { usw.DisableSpring(); clipOffset = lastClipOffset; baseClipRegion = lastBaseClipRegion; transform.localPosition = lastlocalPosition; }
public void MoveToLastVertical() { Vector3[] corners = scroll.panel.worldCorners; Vector3 panelBottom = (corners[0] + corners[3]) * 0.5f; Transform panelTrans = scroll.panel.transform; Vector3 cp = panelTrans.InverseTransformPoint(grid.GetChildList()[0].transform.position); // UITable 中的条目根对象为 UISprite,居中对齐高度为 150,所以得到条目中心点在 Panel 中的坐标之后再加上其高度的一半,获得底端条目的底端坐标 cp = new Vector3(cp.x, cp.y + 75, cp.z); Vector3 cc = panelTrans.InverseTransformPoint(panelBottom); Vector3 localOffset = cp - cc; // Offset shouldn't occur if blocked if (!scroll.canMoveHorizontally) { localOffset.x = 0f; } if (!scroll.canMoveVertically) { localOffset.y = 0f; } localOffset.z = 0f; // SpringPanel.Begin (scrollView.panel.cachedGameObject, // panelTrans.localPosition - localOffset, 13); scroll.DisableSpring(); scroll.MoveRelative(new Vector3(localOffset.x, -localOffset.y, localOffset.z)); }
public void MoveRelative(int delta) { m_scrollView.DisableSpring(); if (m_scrollView.canMoveVertically) { m_scrollView.MoveRelative(new Vector3(0, (delta - m_lastDataIndex) * cellHeight)); } else { m_scrollView.MoveRelative(new Vector3((m_lastDataIndex - delta) * cellWidth, 0)); } m_scrollView.InvalidateBounds(); m_scrollView.RestrictWithinBounds(true); gameObject.SetActive(false); gameObject.SetActive(true); }
private void PanelReset() { UIScrollView uIScrollView = NGUITools.FindInParents <UIScrollView>(base.gameObject); if (uIScrollView == null) { return; } uIScrollView.DisableSpring(); if (this.mPanel != null) { this.mPanel.transform.localPosition = this.mPanelInitPos; this.mPanel.clipOffset = this.mPanelInitOffest; } uIScrollView.DisableSpring(); uIScrollView.UpdateScrollbars(true); }
public void ResetToBegin() { ResetPosition(); //CheckDragBack(); CheckLoopMove(); m_scrollView.DisableSpring(); AddItems(); }
/// <summary> /// 预制件重置 /// </summary> private void PanelReset() { UIScrollView view = NGUITools.FindInParents <UIScrollView>(gameObject); if (view == null) { return; } //禁用SpringPanel view.DisableSpring(); if (mPanel != null) { mPanel.transform.localPosition = mPanelInitPos; mPanel.clipOffset = mPanelInitOffest; } view.DisableSpring(); //刷新滚动条 view.UpdateScrollbars(true); }
public void MoveRelative(int delta) { m_scrollView.DisableSpring(); if (m_scrollView.canMoveVertically) { float maxHeight = m_dataArrangeNum * cellHeight - m_panel.height; float targetHeight = Mathf.Min(maxHeight, (delta - m_lastDataIndex) * cellHeight); m_scrollView.MoveRelative(new Vector3(0, targetHeight)); } else { float maxWidth = m_panel.width - m_dataArrangeNum * cellWidth; float targetWidth = Mathf.Max(maxWidth, (m_lastDataIndex - delta) * cellWidth); m_scrollView.MoveRelative(new Vector3(targetWidth, 0)); } gameObject.SetActive(false); gameObject.SetActive(true); }
static public int DisableSpring(IntPtr l) { try { UIScrollView self = (UIScrollView)checkSelf(l); self.DisableSpring(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
private static int DisableSpring(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 1); UIScrollView uIScrollView = (UIScrollView)ToLua.CheckObject(L, 1, typeof(UIScrollView)); uIScrollView.DisableSpring(); result = 0; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
public static int DisableSpring(IntPtr l) { int result; try { UIScrollView uIScrollView = (UIScrollView)LuaObject.checkSelf(l); uIScrollView.DisableSpring(); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
/// <summary> /// 定位 /// </summary> /// <param name="index"></param> public void GoToPosition(int index, int ofx = 0, int ofy = 0) { if (index < 0 || index >= mDataSource.Count) { return; } int actualIndex = index / maxPerLine; if (arrangement == Arrangement.Vertical) { float h = cellHeight * actualIndex; Vector3 vTemp = Vector3.zero; vTemp.x = mPanelInitPos.x; vTemp.y = mPanelInitPos.y + h; vTemp.z = mPanelInitPos.z; mPanel.transform.localPosition = vTemp; vTemp.x = mPanelInitOffest.x; vTemp.y = mPanelInitOffest.y - h; vTemp.z = 0; mPanel.clipOffset = vTemp; } else if (arrangement == Arrangement.Horizontal) { float w = cellWidth * actualIndex; Vector3 vTemp = Vector3.zero; vTemp.x = mPanelInitPos.x - w + ofx; vTemp.y = mPanelInitPos.y + ofy; vTemp.z = mPanelInitPos.z; mPanel.transform.localPosition = vTemp; vTemp.x = mPanelInitOffest.x + w + ofx; vTemp.y = mPanelInitOffest.y + ofy; vTemp.z = 0; mPanel.clipOffset = vTemp; } OnCustomDrag(); UIScrollView view = NGUITools.FindInParents <UIScrollView>(gameObject); view.DisableSpring(); view.UpdateScrollbars(true); view.RestrictWithinBounds(false, view.canMoveHorizontally, view.canMoveVertically); }
public void GoToPosition(int index) { if (index < 0 || index >= this.mDataSource.Count) { return; } int num = index / this.maxPerLine; if (this.arrangement == UIGrid.Arrangement.Vertical) { float num2 = this.cellHeight * (float)num; Vector3 zero = Vector3.zero; zero.x = this.mPanelInitPos.x; zero.y = this.mPanelInitPos.y + num2; zero.z = this.mPanelInitPos.z; this.mPanel.transform.localPosition = zero; zero.x = this.mPanelInitOffest.x; zero.y = this.mPanelInitOffest.y - num2; zero.z = 0f; this.mPanel.clipOffset = zero; } else if (this.arrangement == UIGrid.Arrangement.Horizontal) { float num3 = this.cellWidth * (float)num; Vector3 zero2 = Vector3.zero; zero2.x = this.mPanelInitPos.x - num3; zero2.y = this.mPanelInitPos.y; zero2.z = this.mPanelInitPos.z; this.mPanel.transform.localPosition = zero2; zero2.x = this.mPanelInitOffest.x + num3; zero2.y = this.mPanelInitOffest.y; zero2.z = 0f; this.mPanel.clipOffset = zero2; } this.OnCustomDrag(); UIScrollView uIScrollView = NGUITools.FindInParents <UIScrollView>(base.gameObject); uIScrollView.DisableSpring(); uIScrollView.UpdateScrollbars(true); uIScrollView.RestrictWithinBounds(false, uIScrollView.canMoveHorizontally, uIScrollView.canMoveVertically); }
static int _m_DisableSpring(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UIScrollView gen_to_be_invoked = (UIScrollView)translator.FastGetCSObj(L, 1); { gen_to_be_invoked.DisableSpring( ); return(0); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public void StopMove() { scrollView.DisableSpring(); }