public SetDragAmount ( float x, float y, bool updateScrollbars ) : void | ||
x | float | |
y | float | |
updateScrollbars | bool | |
Résultat | void |
public void ToTop() { UIScrollView dp = content.transform.parent.GetComponent <UIScrollView>(); dp.ResetPosition(); dp.SetDragAmount(0f, 0f, false); }
/// <summary> /// 滑动条置底 /// </summary> /// <param name="forcibly">在不够滑动的情况下是否强制置底</param> public void ScrollToEnd(bool forcibly) { Update(); scrollView.ResetPosition(); if (!horizontal && scrollView.shouldMoveVertically || horizontal && scrollView.shouldMoveHorizontally) { scrollView.SetDragAmount(horizontal ? 1 : 0, horizontal ? 0 : 1, false); } }
private void ResetUIScrollView(int count, int limit = 4) { if (m_ScrollView == null) { return; } m_ScrollView.enabled = count >= limit; m_ScrollView.SetDragAmount(0, 0, false); }
static int SetDragAmount(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 4); UIScrollView obj = (UIScrollView)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIScrollView"); float arg0 = (float)LuaScriptMgr.GetNumber(L, 2); float arg1 = (float)LuaScriptMgr.GetNumber(L, 3); bool arg2 = LuaScriptMgr.GetBoolean(L, 4); obj.SetDragAmount(arg0, arg1, arg2); return(0); }
private static int SetDragAmount(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 4); UIScrollView uIScrollView = (UIScrollView)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UIScrollView"); float x = (float)LuaScriptMgr.GetNumber(L, 2); float y = (float)LuaScriptMgr.GetNumber(L, 3); bool boolean = LuaScriptMgr.GetBoolean(L, 4); uIScrollView.SetDragAmount(x, y, boolean); return(0); }
protected override void OnUpdate() { base.OnUpdate(); if (writingLabel != null && lastHeight != writingLabel.height) { writingScrollView.ResetPosition(); if (writingLabel.height < 180f) { writingScrollView.SetDragAmount(0f, 0f, false); } else { writingScrollView.SetDragAmount(0f, 1f, false); } lastHeight = writingLabel.height; } }
private void ResetUIScrollView(UIGrid grid, int count, int limit = 12) { UIScrollView scrollView = grid.transform.parent.GetComponent <UIScrollView>(); scrollView.enabled = count >= limit; if (isFirstEnter) { return; } scrollView.SetDragAmount(0, 0, false); }
//在注册数据更新回调函数之后执行 protected override void HandleAfterOpenView() { base.HandleAfterOpenView(); float centerY = worlds.FindChild("btn_world_" + MeVo.instance.mapId).position.y; // centerY = centerY < 0 ? centerY : 0; // centerY = centerY > -0.1f ? centerY : -0.1f; centerOnGameObj.position = new Vector3(0, centerY, 0); center.CenterOn(centerOnGameObj); if (MeVo.instance.mapId < 10003) { scrollPannel.SetDragAmount(0.0f, 0.0f, false); } else if (MeVo.instance.mapId == 10005) { scrollPannel.SetDragAmount(0.0f, 1.0f, false); } Singleton <CopyMode> .Instance.ApplyWorldMapInfo(); }
void RepositionList() { table.Reposition(); // make sure we have a correct poistion sequence draggablePanel.SetDragAmount(0, 0, false); for (int i = 0; i < itemsPool.Count; i++) { Transform item = itemsPool[i]; item.localPosition = new Vector3(item.localPosition.x, -((cellHeight / 2) + i * cellHeight), item.localPosition.z); } }
void EndTypewriting() { if (writingEffect == null) { return; } UIScrollView tempScrollView = writingScrollView; UILabel tempLabel = writingLabel; writingEffect.Finish(); tempScrollView.ResetPosition(); if (tempLabel.height < 180f) { tempScrollView.SetDragAmount(0f, 0f, false); } else { tempScrollView.SetDragAmount(0f, 1f, false); } btnMask.SetActive(false); //OnEndTypewriting(); }
private void Reposition() { Bounds bs = NGUIMath.CalculateRelativeWidgetBounds(previewTable.transform); //Vector2 panelSize = mPanel.GetViewSize(); float width = bs.size.x; //float height = Mathf.Max(bs.size.y, panelSize.y); float height = bs.size.y; var pos = placeholder.transform.localPosition; placeholder.SetRect(0, 0, width, height); placeholder.transform.localPosition = pos; //pos.x = 0; //pos.y = panelSize.y / 2 + mPanel.baseClipRegion.y; scrollView.InvalidateBounds(); if (scrollView.canMoveVertically) { float target = 0.0f; if (height > 1314f) { target = 1.0f; } if (Mathf.Abs(target - scrollView.verticalScrollBar.value) < 0.01f) { scrollView.SetDragAmount(1f, target, false); } else { scrollView.SetDragAmount(1f, target, false); scrollView.SetDragAmount(1f, target, true); } scrollView.UpdatePosition(); } }
private void SetItemsPositions() { for (var i = 0; i < _itemsPool.Size; i++) { var item = _itemsPool[i]; var newPosition = item.transform.localPosition; newPosition.y = -(_itemHeight / 2 + i * _itemHeight); item.transform.localPosition = newPosition; } _table.Reposition(); _scrollView.SetDragAmount(0, 0, false); }
static int SetDragAmount(IntPtr L) { try { ToLua.CheckArgsCount(L, 4); UIScrollView obj = (UIScrollView)ToLua.CheckObject <UIScrollView>(L, 1); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); float arg1 = (float)LuaDLL.luaL_checknumber(L, 3); bool arg2 = LuaDLL.luaL_checkboolean(L, 4); obj.SetDragAmount(arg0, arg1, arg2); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static public int SetDragAmount(IntPtr l) { try { UIScrollView self = (UIScrollView)checkSelf(l); System.Single a1; checkType(l, 2, out a1); System.Single a2; checkType(l, 3, out a2); System.Boolean a3; checkType(l, 4, out a3); self.SetDragAmount(a1, a2, a3); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
protected void DragToOwn() { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) if (isOwn) { if (scrollView == null) { scrollView = GetCtrl(UI.SCR_LIST).GetComponent <UIScrollView>(); scrollPanel = GetCtrl(UI.SCR_LIST).GetComponent <UIPanel>(); } int num = -1; int i = 0; for (int count = rankingDataList.Count; i < count; i++) { if (rankingDataList[i].friendCharaInfo.userId == MonoBehaviourSingleton <UserInfoManager> .I.userInfo.id) { num = i; break; } } if (num <= -1) { DispatchEvent("OUT_OF_RANK", null); } else if (rankingDataList.Count > 3 && num > 3) { int count2 = rankingDataList.Count; float num2 = (float)num / (float)count2; if (num2 >= 0.6f) { num += 2; num2 = (float)num / (float)count2; } scrollView.SetDragAmount(num2, num2, true); Vector2 clipOffset = scrollPanel.clipOffset; scrollView.get_transform().set_localPosition(Vector2.op_Implicit(-clipOffset)); } } }
public void addChat(string name, string mess, bool isMe) { string txt = name + ": " + mess; listChat.Add(txt + "\n\n"); lb_chat.text = ""; if (listChat.Count >= 20) { listChat.RemoveAt(0); } for (int i = 0; i < listChat.Count; i++) { lb_chat.text = lb_chat.text + listChat[i]; } lb_chat.ResizeCollider(); scrollView.ResetPosition(); scrollView.SetDragAmount(1, 1, false); }
private IEnumerator WaitReset() { yield return(null); grid.repositionNow = true; yield return(new WaitForSeconds(0.2f)); Log.GUI("ScrollView: " + sv.bounds); //sv.SetDragAmount(1, 0, true); //sv.MoveRelative(new Vector3(0, 1000, 0)); //sv.RestrictWithinBounds(); var pivot = UIWidget.Pivot.BottomLeft; Vector2 pv = NGUIMath.GetPivotOffset(pivot); sv.SetDragAmount(pv.x, 1f - pv.y, false); }
void Awake() { if (itemPrefab == null || scrollView == null || itemParent == null) { Debug.LogError("Lzh_LoopScrollView.Awake() 有属性没有在inspector中赋值"); } // 设置scrollview的movement if (arrangeDirection == ArrangeDirection.Up_to_Down || arrangeDirection == ArrangeDirection.Down_to_Up) { scrollView.movement = UIScrollView.Movement.Vertical; } else { scrollView.movement = UIScrollView.Movement.Horizontal; } scrollView.SetDragAmount(0, 0, false); }
private void Reposition() { Bounds bs = NGUIMath.CalculateRelativeWidgetBounds(previewTable.transform); Vector2 panelSize = mPanel.GetViewSize(); float width = bs.size.x; float height = Mathf.Max(bs.size.y, panelSize.y); placeholder.SetRect(0, 0, width, height); var pos = placeholder.transform.localPosition; pos.x = 0; pos.y = panelSize.y / 2 + mPanel.baseClipRegion.y; placeholder.transform.localPosition = pos; scrollView.SetDragAmount(1f, 0f, false); //scrollView.SetDragAmount(1f, 0f, true); scrollView.ResetPosition(); }
void RepositionList() { if (m_bGrid) { m_Grid.Reposition(); } else { if (m_bSelfCaculateItemHeight == false) { if (m_Table) { m_Table.SetInit(m_UIPanel); } m_Table.Reposition(); } } // make sure we have a correct poistion sequence if (m_bFirstItemBottom) { if (m_nTotalDataCount > 0) { ///uitable进行初始化,不然初始位置不正确 ///i /// //m_table一开始禁用,不然等到start后会修改为位置, if (m_Table) { m_Table.SetInit(m_UIPanel); m_Table.Reposition(); } SetFirstItemBottom(); } } else { m_ScrollView.SetDragAmount(0, 0, false); } }
private static int SetDragAmount(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 4); UIScrollView uIScrollView = (UIScrollView)ToLua.CheckObject(L, 1, typeof(UIScrollView)); float x = (float)LuaDLL.luaL_checknumber(L, 2); float y = (float)LuaDLL.luaL_checknumber(L, 3); bool updateScrollbars = LuaDLL.luaL_checkboolean(L, 4); uIScrollView.SetDragAmount(x, y, updateScrollbars); result = 0; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
public void LocateToItem(Transform item) { if (_scrollView != null && _scrollView.shouldMoveVertically) { var childs = new List <Transform>(); for (var i = 0; i < _uiGrid.transform.childCount - 1; i++) { var t = _uiGrid.transform.GetChild(i); if (t.gameObject.activeSelf) { childs.Add(t); } } var rowCount = Mathf.CeilToInt(childs.Count / 2f); var index = childs.IndexOf(item); var y = ((float)(index / 2)) / (rowCount - 1); _scrollView.SetDragAmount(0, y, false); } }
public static int SetDragAmount(IntPtr l) { int result; try { UIScrollView uIScrollView = (UIScrollView)LuaObject.checkSelf(l); float x; LuaObject.checkType(l, 2, out x); float y; LuaObject.checkType(l, 3, out y); bool updateScrollbars; LuaObject.checkType(l, 4, out updateScrollbars); uIScrollView.SetDragAmount(x, y, updateScrollbars); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return(result); }
public void FillRef(int _day) { sevenDaysTaskList = ConfigMng.Instance.GetSevenChallengeTaskListRef(_day); for (int i = 0, length = singleItemList.Count; i < length; i++) { if (singleItemList[i] != null) { singleItemList[i].gameObject.SetActive(false); } } for (int i = 0, length = sevenDaysTaskList.Count; i < length; i++) { SevenDaysTaskRef data = sevenDaysTaskList[i]; if (i >= singleItemList.Count) { SevenChallengeSingleUI single = SevenChallengeSingleUI.CreateNew(grid.transform, singleItem.gameObject); if (single != null) { singleItemList.Add(single); } } SevenChallengeSingleUI item = singleItemList[i]; if (item != null && data != null) { item.gameObject.SetActive(true); item.FillInfo(data); } } if (grid != null) { grid.repositionNow = true; } if (scrollView != null) { scrollView.SetDragAmount(0, 1, false); } }
private IEnumerator Show(int item_idx) { // Alter the itemSprite and reminderContent here! // Alter the itemSprite and reminderContent here! yield return(new WaitForEndOfFrame()); yield return(new WaitForSeconds(waitTime)); InstantiateNewComment(out currentSprite, out currentLabel, true); while (currentIndex < comments.Length) { if (currentLabel.text == comments[currentIndex]) { currentIndex++; if (currentIndex >= comments.Length) { break; } UISprite newSprite = null; UILabel newLabel = null; InstantiateNewComment(out newSprite, out newLabel, currentIndex % 2 == 0); currentSprite = newSprite; currentLabel = newLabel; yield return(null); } else { currentLabel.text += comments[currentIndex][currentLabel.text.Length]; yield return(new WaitForSeconds(typingSpeed)); } commentTable.Reposition(); scrollView.SetDragAmount(0f, 1.0f, false); } escapeButton.isEnabled = true; }
void UITogOnChange() { for (int i = 0, len = uiTog.Count; i < len; i++) { if (uiTog[i] != null && uiTog[i].value) { page = i; if (page != (int)FriendType.COMMEND) { if (page == (int)FriendType.MANAGEFRIEND) { panel.SetRect(42, 1, 886, 336); } else { panel.SetRect(42, -44, 886, 410); } Scro.SetDragAmount(0, 0, false); } else { ComendScro.SetDragAmount(0, 0, false); } if (page <= 4) { GameCenter.friendsMng.C2S_ReqFriendsList(page + 1); } else { GameCenter.friendsMng.C2S_ReqFriendsList(1); } break; } } OnFriendListUpdate(); }
void ShowRankItems(List <guild_liveness_member_info> itemList) { for (int i = 0; i < rankItemList.Count; i++) { rankItemList[i].gameObject.SetActive(false); } for (int i = 0, max = itemList.Count; i < max; i++) { if (rankItemList.Count < i + 1) { rankItemList.Add(rankItem.CreateNew(rankParent.transform)); } rankItemList[i].gameObject.SetActive(true); rankItemList[i].SetData(itemList[i]); } if (rankParent != null) { rankParent.repositionNow = true; } if (rankScrollView != null) { rankScrollView.SetDragAmount(0, 0, false); } }
void ShowMustDoItems(List <GuildLivelyInfo> itemList) { for (int i = 0; i < mustDoItemList.Count; i++) { mustDoItemList[i].gameObject.SetActive(false); } for (int i = 0, max = itemList.Count; i < max; i++) { if (mustDoItemList.Count < i + 1) { mustDoItemList.Add(dailyMustDoItemUI.CreateNew(itemParent.transform)); } mustDoItemList[i].gameObject.SetActive(true); mustDoItemList[i].SetData(itemList[i]); } if (itemParent != null) { itemParent.repositionNow = true; } if (scrollView != null) { scrollView.SetDragAmount(0, 0, false); } }
private IEnumerator InitDelayed() { List <GameObject> children = new List <GameObject>(); for (int index = 1; index < mKeepNum; ++index) { GameObject obj = (GameObject)Instantiate(listItemPrefab); obj.AddComponent <PTPUIDragScrollViewLoop>(); if (bDragDrop) { obj.AddComponent <UIDragDropItem>(); obj.AddComponent <UIDragDropItem>().cloneOnDrag = true; } obj.transform.parent = gameObject.transform; obj.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); // obj.GetComponent< ScrollViewItemBase >().Id = IdCounter++; PTPUIDragScrollViewLoop item = obj.GetComponent <PTPUIDragScrollViewLoop>(); item.InitGrid(this); obj.SendMessage("SetupListItem", index); children.Add(obj); } // Wait for next frame if (delayedUpdate) { yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); } // Following code will be executed in the next frame // mChildren[0].transform.localPosition = itemFirstPos; mChildren[0].GetComponent <PTPUIDragScrollViewLoop>().UpdateBounds(); while (children.Count > 0) { Vector3 lastPos = GetLastPosition(); GameObject obj = children[0]; children.RemoveAt(0); PTPUIDragScrollViewLoop item = obj.GetComponent <PTPUIDragScrollViewLoop>(); item.UpdateBounds(); Vector3 pos = new Vector3(0.0f, 0.0f, 0.0f); if (reverseArrangement) { if (arrangement == Arrangement.Horizontal) { pos.x = lastPos.x - padding - (item.bounds.size.x * 0.5f) - item.bounds.center.x; } else { pos.y = lastPos.y + padding + (item.bounds.size.y * 0.5f) - item.bounds.center.y; } } else { if (arrangement == Arrangement.Horizontal) { pos.x = lastPos.x + padding + (item.bounds.size.x * 0.5f) - item.bounds.center.x; } else { pos.y = lastPos.y - padding - (item.bounds.size.y * 0.5f) - item.bounds.center.y; } } obj.transform.localPosition = pos; //print( "pos " + pos.ToString() ); mChildren.Add(obj); } UpdateMargin(); // Wait for next frame yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); // Reset scroll position instead of calling ResetPosition() if (reverseArrangement) { mDrag.SetDragAmount(1.0f, 1.0f, false); mDrag.SetDragAmount(1.0f, 1.0f, true); } else { mDrag.SetDragAmount(0.0f, 0.0f, false); mDrag.SetDragAmount(0.0f, 0.0f, true); } }
void ShowCopyItem() { for (int j = 0; j < inItemList.Count; j++) { inItemList[j].gameObject.SetActive(false); } GameObject go = null; CopyInItemUI endLess = null; List <CopyGroupRef> dataList = ConfigMng.Instance.GetCopyGroupRefTable((int)GameCenter.duplicateMng.CopyType); int i = 0; UIToggle uitog = null; dataList.Sort(CopySortType); foreach (CopyGroupRef eData in dataList) { if (IsCopyOpen(eData)) { if (inItemList.Count <= i) { go = (GameObject)GameObject.Instantiate(copyItemety); go.transform.parent = copyItemety.transform.parent; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; go.name = "copyItemety" + (eData.id); endLess = go.GetComponent <CopyInItemUI>(); if (endLess != null) { endLess.ShowCopyData = eData; endLess.target.SetActive(false); inItemList.Add(endLess); } uitog = go.GetComponent <UIToggle>(); if (uitog != null) { uitog.startsActive = false; uitog.value = false; EventDelegate.Add(uitog.onChange, CopyInItemUITog); } go.SetActive(true); } else { inItemList[i].ShowCopyData = eData; uitog = inItemList[i].GetComponent <UIToggle>(); if (uitog != null) { uitog.startsActive = false; uitog.value = false; } inItemList[i].target.SetActive(false); inItemList[i].gameObject.SetActive(true); } i++; //跳转到选中的某个副本 if (GameCenter.duplicateMng.CurSelectOneCopyType != OneCopySType.NONE && GameCenter.duplicateMng.CurSelectOneCopyType == (OneCopySType)eData.id) { uitog.value = true; } } } for (; i < inItemList.Count; i++) { uitog = inItemList[i].GetComponent <UIToggle>(); if (uitog != null) { uitog.startsActive = false; uitog.value = false; } inItemList[i].gameObject.SetActive(false); } if (table != null) { table.repositionNow = true; } // UIScrollView view = table.transform.parent.GetComponent<UIScrollView>(); if (view != null) { view.ResetPosition(); view.SetDragAmount(0, 0, false); } }