private UpdateScrollbars ( UIScrollBar, sb, float contentMin, float contentMax, float contentSize, float viewSize, bool inverted ) : void | ||
sb | UIScrollBar, | |
contentMin | float | |
contentMax | float | |
contentSize | float | |
viewSize | float | |
inverted | bool | |
return | void |
public void ConstrainWithinPanel() { if (this.mPanel != (UnityEngine.Object)null) { this.mPanel.ConstrainTargetToBounds(base.transform, true); UIScrollView component = this.mPanel.GetComponent <UIScrollView>(); if (component != (UnityEngine.Object)null) { component.UpdateScrollbars(true); } } }
/// <summary> /// Constrain the grid's content to be within the panel's bounds. /// </summary> public void ConstrainWithinPanel() { if (mPanel != null) { mPanel.ConstrainTargetToBounds(transform, true); UIScrollView sv = mPanel.GetComponent <UIScrollView>(); if (sv != null) { sv.UpdateScrollbars(true); } } }
public void ConstrainWithinPanel() { if (this.mPanel != null) { this.mPanel.ConstrainTargetToBounds(base.get_transform(), true); UIScrollView component = this.mPanel.GetComponent <UIScrollView>(); if (component != null) { component.UpdateScrollbars(true); } } }
protected virtual void AdvanceTowardsPosition() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) float deltaTime = RealTime.deltaTime; bool flag = false; Vector3 localPosition = mTrans.get_localPosition(); Vector3 val = NGUIMath.SpringLerp(mTrans.get_localPosition(), target, strength, deltaTime); Vector3 val2 = val - target; if (val2.get_sqrMagnitude() < 0.01f) { val = target; this.set_enabled(false); flag = true; } mTrans.set_localPosition(val); Vector3 val3 = val - localPosition; Vector2 clipOffset = mPanel.clipOffset; clipOffset.x -= val3.x; clipOffset.y -= val3.y; mPanel.clipOffset = clipOffset; if (mDrag != null) { mDrag.UpdateScrollbars(false); } if (flag && onFinished != null) { current = this; onFinished(); current = null; } }
/// <summary> /// Advance toward the target position. /// </summary> protected virtual void AdvanceTowardsPosition() { mDelta += RealTime.deltaTime; var trigger = false; var before = mTrans.localPosition; var after = NGUIMath.SpringLerp(before, target, strength, mDelta); if ((before - target).sqrMagnitude < 0.01f) { after = target; enabled = false; trigger = true; mDelta = 0f; } else { after.x = Mathf.Round(after.x); after.y = Mathf.Round(after.y); after.z = Mathf.Round(after.z); if ((after - before).sqrMagnitude < 0.01f) { return; } else { mDelta = 0f; } } mTrans.localPosition = after; var offset = after - before; var cr = mPanel.clipOffset; cr.x -= offset.x; cr.y -= offset.y; mPanel.clipOffset = cr; if (mDrag != null) { mDrag.UpdateScrollbars(false); } if (trigger && onFinished != null) { current = this; onFinished(); current = null; } }
/// <summary> /// Advance toward the target position. /// </summary> protected virtual void AdvanceTowardsPosition() { float delta = RealTime.deltaTime; bool trigger = false; Vector3 before = mTrans.localPosition; Vector3 after = NGUIMath.SpringLerp(mTrans.localPosition, target, strength, delta); if ((after - target).sqrMagnitude < 0.01f) { //print ("after="+after); //print ("g.mapItems[i].transform.localPosition.y="+g.mapItems[19].transform.localPosition.y); //print ("g.mapItems[i].transform.localPosition.y/10-1)*320="+(g.mapItems[19].transform.localPosition.y/10-1)*320); //print ("(int)after.y="+(int)after.y); // for(int i=1;i < g.maxStage-1;i++){ // // if (Mathf.Abs(g.mapItems[i].transform.localPosition.y) == (int)after.y) { // g.mapItems[i].transform.localScale = Vector3.one; // } else { // g.mapItems[i].transform.localScale = Vector3.one * 0.7f; // } // } after = target; enabled = false; trigger = true; } //print ("after="+after); mTrans.localPosition = after; Vector3 offset = after - before; Vector2 cr = mPanel.clipOffset; cr.x -= offset.x; cr.y -= offset.y; mPanel.clipOffset = cr; if (mDrag != null) { mDrag.UpdateScrollbars(false); } if (trigger && onFinished != null) { current = this; onFinished(); current = null; } }
private void OnDragFinished() { ScrollView.UpdateScrollbars(true); var constraint = ScrollView.panel.CalculateConstrainOffset(ScrollView.bounds.min, ScrollView.bounds.min); if (constraint.y <= 1f && GroupRoomGrid.transform.childCount == 20) { var dic = new Dictionary <string, object>(); dic["tea_id"] = TeahouseController.Instance.CurrentTeaId; dic["p"] = ++_curPageNum; Facade.Instance <TwManager>().SendAction("friends.getGroupRooms", dic, GroupRoomData); } }
private void OnDragFinished() { ScrollView.UpdateScrollbars(true); var constraint = ScrollView.panel.CalculateConstrainOffset(ScrollView.bounds.min, ScrollView.bounds.min); if (constraint.y <= 1f) { var dic = new Dictionary <string, object>(); dic["game_key"] = ""; dic["p"] = ++_curPageNum; Facade.Instance <TwManager>().SendAction("historyrequest", dic, AddItems); } }
private void updateScrollBar() { scrollView.UpdatePosition(); scrollView.UpdateScrollbars(true); if (scrollView.panel.GetViewSize().y > grid.transform.localScale.y) { scrollBar.value = 0; } else { scrollBar.value = 1; } }
public static void UpdateScrollBar(UIScrollView scroll) { var backgroundWidget = scroll.verticalScrollBar.backgroundWidget; var foregroundWidget = scroll.verticalScrollBar.foregroundWidget; if (backgroundWidget) { foregroundWidget.height = backgroundWidget.height; } scroll.UpdateScrollbars(true); scroll.UpdatePosition(); }
private void OnDragFinished() { ScrollView.UpdateScrollbars(true); var constraint = ScrollView.panel.CalculateConstrainOffset(ScrollView.bounds.min, ScrollView.bounds.min); if (constraint.y <= 1f && itemIndex < 30) { var dic = new Dictionary <string, object>(); dic["game_key_c"] = gk; dic["p"] = ++_curPageNum; Facade.Instance <TwManager>().SendAction("gameHistoryReplay", dic, OnGetRecordInfo); } }
private void OnDragFinished() { ScrollView.UpdateScrollbars(true); var constraint = ScrollView.panel.CalculateConstrainOffset(ScrollView.bounds.min, ScrollView.bounds.min); if (constraint.y <= 1f) { if (!_request) { SendGetRecords(); _request = true; } } }
/// <summary> /// Move the dragged object by the specified amount. /// </summary> void Move(Vector3 worldDelta) { if (panelRegion != null) { mTargetPos += worldDelta; Transform parent = target.parent; Rigidbody rb = target.GetComponent <Rigidbody>(); if (parent != null) { Vector3 after = parent.worldToLocalMatrix.MultiplyPoint3x4(mTargetPos); after.x = Mathf.Round(after.x); after.y = Mathf.Round(after.y); if (rb != null) { // With a lot of colliders under the rigidbody, moving the transform causes some crazy overhead. // Moving the rigidbody is much cheaper, but it does seem to have a side effect of causing // widgets to detect movement relative to the panel, when in fact they should not be moving. // This is why it's best to keep the panel as 'static' if at all possible. after = parent.localToWorldMatrix.MultiplyPoint3x4(after); rb.position = after; } else { target.localPosition = after; } } else if (rb != null) { rb.position = mTargetPos; } else { target.position = mTargetPos; } UIScrollView ds = panelRegion.GetComponent <UIScrollView>(); if (ds != null) { ds.UpdateScrollbars(true); } } else { target.position += worldDelta; } }
private void OnDragFinished() { if (TeaListGrid.transform.childCount == _totalCount && _totalCount != -1) { return; } ScrollView.UpdateScrollbars(true); var constraint = ScrollView.panel.CalculateConstrainOffset(ScrollView.bounds.min, ScrollView.bounds.min); if (constraint.y <= 1f) { var dic = new Dictionary <string, object>(); dic["p"] = ++_curPageNum; Facade.Instance <TwManager>().SendAction("group.getGroupList", dic, AddItems); } }
protected virtual void AdvanceTowardsPosition() { float delta = RealTime.deltaTime; bool trigger = false; before = mTrans.localPosition; after = NGUIMath.SpringLerp(mTrans.localPosition, target, strength, delta); if ((after - target).sqrMagnitude < 0.01f) { //By Zsy : 增加一个弹回原来位置的回调 if ((lastPos - target).sqrMagnitude < 0.01f) { if (mDrag.onMoveBackToLastPosition != null) { mDrag.onMoveBackToLastPosition(); } } lastPos = target; after = target; enabled = false; trigger = true; } mTrans.localPosition = after; //Vector3 offset = after - before; Vector2 cr = mPanel.clipOffset; cr.x -= (after - before).x; cr.y -= (after - before).y; mPanel.clipOffset = cr; if (mDrag != null) { mDrag.UpdateScrollbars(false); } if (trigger && onFinished != null) { current = this; onFinished(); current = null; } }
/// <summary> /// 初始化树形菜单,树形节点层级数量,所有父节点包含数据信息,子节点信息含义 /// </summary> public void init() { parents = new Dictionary <string, TreeMenuItem>(); leafNodes = new Dictionary <string, TreeMenuItem>(); nodes = new Dictionary <string, TreeMenuItem>(); rootNodes = new Dictionary <string, TreeMenuItem>(); clearChildren(treeGrid.transform); treeGrid.onCustomSort = treeSort; treeGrid.sorting = UIGrid.Sorting.Custom; treeGrid.animateSmoothly = true; EventDelegate.Add(scrollBar.onChange, scrollBarChange); scrollView.UpdateScrollbars(false); //临时创建列表 //createItem(); }
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 virtual void Reposition() { if (Application.isPlaying && !mInitDone && NGUITools.GetActive(this)) { mReposition = true; return; } if (!mInitDone) { Init(); } mReposition = false; Transform myTrans = transform; mChildren.Clear(); List <Transform> ch = children; if (ch.Count > 0) { RepositionVariableSize(ch); } if (keepWithinPanel && mPanel != null) { mPanel.ConstrainTargetToBounds(myTrans, true); UIScrollView sv = mPanel.GetComponent <UIScrollView>(); if (sv != null) { sv.UpdateScrollbars(true); } } if (onReposition != null) { onReposition(); } if (onRepositionFinish != null) { onRepositionFinish(this); } }
/// <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); }
private void Move(Vector3 worldDelta) { if (this.panelRegion != null) { this.mTargetPos += worldDelta; Transform parent = this.target.parent; Rigidbody component = this.target.GetComponent <Rigidbody>(); if (parent != null) { Vector3 vector = parent.worldToLocalMatrix.MultiplyPoint3x4(this.mTargetPos); vector.x = Mathf.Round(vector.x); vector.y = Mathf.Round(vector.y); if (component != null) { vector = parent.localToWorldMatrix.MultiplyPoint3x4(vector); component.position = vector; } else { this.target.localPosition = vector; } } else { if (component != null) { component.position = this.mTargetPos; } else { this.target.position = this.mTargetPos; } } UIScrollView component2 = this.panelRegion.GetComponent <UIScrollView>(); if (component2 != null) { component2.UpdateScrollbars(true); } } else { this.target.position += worldDelta; } }
/// <summary> /// Advance toward the target position. /// </summary> protected virtual void AdvanceTowardsPosition() { float delta = RealTime.deltaTime; bool trigger = false; Vector3 before = mTrans.localPosition; Vector3 after = NGUIMath.SpringLerp(mTrans.localPosition, target, strength, delta); if (m_isAnimate) { if ((after - target).sqrMagnitude < 0.01f) { after = target; enabled = false; trigger = true; } } else { after = target; enabled = false; trigger = true; } mTrans.localPosition = after; Vector3 offset = after - before; Vector2 cr = mPanel.clipOffset; cr.x -= offset.x; cr.y -= offset.y; mPanel.clipOffset = cr; if (mDrag != null) { mDrag.UpdateScrollbars(false); } if (trigger && onFinished != null) { current = this; onFinished(); current = null; } }
/// <summary> /// Advance toward the target position. /// </summary> void Update() { //float delta = ignoreTimeScale ? RealTime.deltaTime : Time.deltaTime; float delta = Time.deltaTime; if (worldSpace) { if (mThreshold == 0f) { mThreshold = (target - mTrans.position).sqrMagnitude * 0.001f; } mTrans.position = NGUIMath.SpringLerp(mTrans.position, target, strength, delta); if (mThreshold >= (target - mTrans.position).sqrMagnitude) { mTrans.position = target; NotifyListeners(); enabled = false; } } else { if (mThreshold == 0f) { mThreshold = (target - mTrans.localPosition).sqrMagnitude * 0.00001f; } mTrans.localPosition = NGUIMath.SpringLerp(mTrans.localPosition, target, strength, delta); if (mThreshold >= (target - mTrans.localPosition).sqrMagnitude) { mTrans.localPosition = target; NotifyListeners(); enabled = false; } } // Ensure that the scroll bars remain in sync if (mSv != null) { mSv.UpdateScrollbars(true); } }
private void OnDragFinished() { ScrollView.UpdateScrollbars(true); var constraint = ScrollView.panel.CalculateConstrainOffset(ScrollView.bounds.min, ScrollView.bounds.min); if (constraint.y <= 1f) { if (!_request) { var currentCount = _curItemParent.transform.childCount; if (_totalCount == currentCount) { return; } SendAction(); _request = true; } } }
/// <summary> /// Advance toward the target position. /// </summary> protected virtual void AdvanceTowardsPosition() { float delta = RealTime.deltaTime; if (mThreshold == 0f) { mThreshold = (target - mTrans.localPosition).magnitude * 0.005f; mThreshold = Mathf.Max(mThreshold, 0.00001f); mThreshold *= mThreshold; } bool trigger = false; Vector3 before = mTrans.localPosition; Vector3 after = NGUIMath.SpringLerp(mTrans.localPosition, target, strength, delta); if (mThreshold >= (after - target).sqrMagnitude) { after = target; enabled = false; trigger = true; } mTrans.localPosition = after; Vector3 offset = after - before; Vector2 cr = mPanel.clipOffset; cr.x -= offset.x; cr.y -= offset.y; mPanel.clipOffset = cr; if (mDrag != null) { mDrag.UpdateScrollbars(false); } if (trigger && onFinished != null) { current = this; onFinished(); current = null; } }
/// <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); }
private static int UpdateScrollbars(IntPtr L) { int num = LuaDLL.lua_gettop(L); if (num == 1) { UIScrollView uIScrollView = (UIScrollView)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIScrollView"); uIScrollView.UpdateScrollbars(); return(0); } if (num == 2) { UIScrollView uIScrollView2 = (UIScrollView)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIScrollView"); bool boolean = LuaScriptMgr.GetBoolean(L, 2); uIScrollView2.UpdateScrollbars(boolean); return(0); } LuaDLL.luaL_error(L, "invalid arguments to method: UIScrollView.UpdateScrollbars"); return(0); }
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); }
private void Move(Vector3 worldDelta) { if (panelRegion != null) { mTargetPos += worldDelta; target.position = mTargetPos; Vector3 localPosition = target.localPosition; localPosition.x = Mathf.Round(localPosition.x); localPosition.y = Mathf.Round(localPosition.y); target.localPosition = localPosition; UIScrollView component = panelRegion.GetComponent <UIScrollView>(); if (component != null) { component.UpdateScrollbars(recalculateBounds: true); } } else { target.position += worldDelta; } }
private void Move(Vector3 worldDelta) { if (this.mPanel != null) { this.mTargetPos += worldDelta; this.target.position = this.mTargetPos; Vector3 localPosition = this.target.localPosition; localPosition.x = Mathf.Round(localPosition.x); localPosition.y = Mathf.Round(localPosition.y); this.target.localPosition = localPosition; UIScrollView component = this.mPanel.GetComponent <UIScrollView>(); if (component != null) { component.UpdateScrollbars(true); } } else { this.target.position += worldDelta; } }
// 特殊处理的,慎用 public bool MoveOtherScrollView(UIScrollView scrollView) { float newPosX; Vector3 relative; if (movement == Movement.Horizontal) { newPosX = scrollView.bounds.size.x * mTrans.localPosition.x / bounds.size.x; relative = new Vector3(newPosX - scrollView.mTrans.localPosition.x, 0, 0); } else { return(false); } if (relative == Vector3.zero) { return(false); } scrollView.mTrans.localPosition = new Vector3(newPosX, scrollView.mTrans.localPosition.y, scrollView.mTrans.localPosition.z); Vector2 co = scrollView.mPanel.clipOffset; co.x -= relative.x; co.y -= relative.y; scrollView.mPanel.clipOffset = co; if (scrollView.centerOnChild) { scrollView.centerOnChild.Recenter(); } // Update the scroll bars scrollView.UpdateScrollbars(false); return(true); }