void OnScroll(tk2dUIScrollableArea scrollableArea) { if (scrollableAreaDelegate != null) { UpdateListGraphics(); } }
public void OnSceneGUI() { bool wasChange = false; tk2dUIScrollableArea scrollableArea = (tk2dUIScrollableArea)target; bool isYAxis = scrollableArea.scrollAxes == tk2dUIScrollableArea.Axes.YAxis; // Get rescaled transforms Matrix4x4 m = scrollableArea.transform.localToWorldMatrix; Vector3 up = m.MultiplyVector(Vector3.up); Vector3 right = m.MultiplyVector(Vector3.right); float newVisibleAreaLength = tk2dUIControlsHelperEditor.DrawLengthHandles("Visible Area Length", scrollableArea.VisibleAreaLength, scrollableArea.contentContainer.transform.position, isYAxis? -up:right, Color.red, isYAxis?.2f : -.2f, 0, .05f); if (newVisibleAreaLength != scrollableArea.VisibleAreaLength) { Undo.RegisterUndo(scrollableArea, "Visible area changed"); scrollableArea.VisibleAreaLength = newVisibleAreaLength; wasChange = true; } float newContentLength = tk2dUIControlsHelperEditor.DrawLengthHandles("Content Length", scrollableArea.ContentLength, scrollableArea.contentContainer.transform.position, isYAxis ? -up : right, Color.blue, isYAxis ? .2f : -.2f, isYAxis?.4f : -.4f, .1f); if (newContentLength != scrollableArea.ContentLength) { Undo.RegisterUndo(scrollableArea, "Content length changed"); scrollableArea.ContentLength = newContentLength; wasChange = true; } if (wasChange) { EditorUtility.SetDirty(scrollableArea); } }
public override void OnInspectorGUI() { EditorGUIUtility.LookLikeInspector(); base.OnInspectorGUI(); tk2dUIScrollableArea scrollableArea = (tk2dUIScrollableArea)target; scrollableArea.BackgroundLayoutItem = EditorGUILayout.ObjectField("Background LayoutItem", scrollableArea.BackgroundLayoutItem, typeof(tk2dUILayout), true) as tk2dUILayout; scrollableArea.ContentLayoutContainer = EditorGUILayout.ObjectField("Content LayoutContainer", scrollableArea.ContentLayoutContainer, typeof(tk2dUILayoutContainer), true) as tk2dUILayoutContainer; GUILayout.Label("Tools", EditorStyles.boldLabel); if (GUILayout.Button("Calculate content length")) { Undo.RegisterUndo(scrollableArea, "Content length changed"); Bounds b = tk2dUIItemBoundsHelper.GetRendererBoundsInChildren(scrollableArea.contentContainer.transform, scrollableArea.contentContainer.transform); b.Encapsulate(Vector3.zero); float contentSize = (scrollableArea.scrollAxes == tk2dUIScrollableArea.Axes.XAxis) ? b.size.x : b.size.y; scrollableArea.ContentLength = contentSize * 1.02f; // 5% more EditorUtility.SetDirty(scrollableArea); } tk2dUIMethodBindingHelper methodBindingUtil = new tk2dUIMethodBindingHelper(); scrollableArea.SendMessageTarget = methodBindingUtil.BeginMessageGUI(scrollableArea.SendMessageTarget); methodBindingUtil.MethodBinding("On Scroll", typeof(tk2dUIScrollableArea), scrollableArea.SendMessageTarget, ref scrollableArea.SendMessageOnScrollMethodName); methodBindingUtil.EndMessageGUI(); if (GUI.changed) { EditorUtility.SetDirty(scrollableArea); } }
public void OnSceneGUI() { bool wasChange = false; tk2dUIScrollableArea scrollableArea = (tk2dUIScrollableArea)target; bool isYAxis = scrollableArea.scrollAxes == tk2dUIScrollableArea.Axes.YAxis; // Get rescaled transforms Matrix4x4 m = scrollableArea.transform.localToWorldMatrix; Vector3 up = m.MultiplyVector(Vector3.up); Vector3 right = m.MultiplyVector(Vector3.right); //??? DrawLengthHandles( string labelText, float currentLength, Vector3 startPos, Vector3 dir, Color handleColor, float smallBarLength, float offset, float textOffset) // float newVisibleAreaLength = tk2dUIControlsHelperEditor.DrawLengthHandles("Visible Area Length", scrollableArea.VisibleAreaLength,scrollableArea.contentContainer.transform.position, isYAxis? -up:right, Color.red, isYAxis?.2f:-.2f, 0, .05f); Vector3 dirRW = up; float smallBarLengthRW = .2f; float offsetRW = .4f; if (!isYAxis) { dirRW = right; smallBarLengthRW = -.2f; offsetRW = -.4f; } float newVisibleAreaLength = tk2dUIControlsHelperEditor.DrawLengthHandles("Visible Area Length", scrollableArea.VisibleAreaLength, scrollableArea.contentContainer.transform.position, dirRW, Color.red, smallBarLengthRW, 0, .05f); if (newVisibleAreaLength != scrollableArea.VisibleAreaLength) { tk2dUndo.RecordObject(scrollableArea, "Visible area changed"); scrollableArea.VisibleAreaLength = newVisibleAreaLength; wasChange = true; } //??? DrawLengthHandles(string labelText, float currentLength, Vector3 startPos, Vector3 dir,Color handleColor, float smallBarLength, float offset, float textOffset) // float newContentLength = tk2dUIControlsHelperEditor.DrawLengthHandles("Content Length", scrollableArea.ContentLength, scrollableArea.contentContainer.transform.position, isYAxis ? -up : right, Color.blue, isYAxis ? .2f : -.2f, isYAxis?.4f:-.4f, .1f); float newContentLength = tk2dUIControlsHelperEditor.DrawLengthHandles("Content Length", scrollableArea.ContentLength, scrollableArea.contentContainer.transform.position, dirRW, Color.blue, smallBarLengthRW, offsetRW, .1f); if (newContentLength != scrollableArea.ContentLength) { tk2dUndo.RecordObject(scrollableArea, "Content length changed"); scrollableArea.ContentLength = newContentLength; wasChange = true; } if (wasChange) { EditorUtility.SetDirty(scrollableArea); } }
void OnScroll(tk2dUIScrollableArea scrollableArea) { scrollRate = (1.0f / (float)testItemSelected.Count); //Debug.Log(scrollRate); for (int i = 0; i < testItemSelected.Count; i++) { if (((scrollRate * i) <= ScrollableArea.Value) && ((scrollRate * (i + 1)) > ScrollableArea.Value)){ //Debug.Log(ScrollableArea.Value); testItemSelected[i].localScale = new Vector3(enlargeRate,enlargeRate,1); } else{ //Debug.Log(block.enlarged); testItemSelected[i].localScale = new Vector3(1, 1, 1); } } }
public override void OnInspectorGUI() { EditorGUIUtility.LookLikeInspector(); base.OnInspectorGUI(); GUILayout.Label("Tools", EditorStyles.boldLabel); if (GUILayout.Button("Calculate content length")) { tk2dUIScrollableArea scrollableArea = (tk2dUIScrollableArea)target; Undo.RegisterUndo(scrollableArea, "Content length changed"); Bounds b = tk2dUIItemBoundsHelper.GetRendererBoundsInChildren(scrollableArea.contentContainer.transform, scrollableArea.contentContainer.transform); float contentSize = (scrollableArea.scrollAxes == tk2dUIScrollableArea.Axes.XAxis) ? b.size.x : b.size.y; scrollableArea.ContentLength = contentSize * 1.02f; // 5% more EditorUtility.SetDirty(scrollableArea); } }
private void OnScroll(tk2dUIScrollableArea scrollableArea) { this.UpdateListGraphics(); }
void OnScroll(tk2dUIScrollableArea scrollableArea) { UpdateListGraphics(); }
void OnScroll(tk2dUIScrollableArea scrollableArea) { // UpdateListGraphics(); }
void ScrollViewDidScroll(tk2dUIScrollableArea scrollView) { tk2dUIGridPos start, end; Vector3 offset = ContentContainerOffset; start = GridPosFromOffset (offset); if(scrollAxes == Axes.YAxis) { offset.y += VisibleAreaLength; end = GridPosFromOffset (offset); } else { offset.x += VisibleAreaLength; end = GridPosFromOffset (offset); } if(end.row == -1 || end.col == -1) { end.row = numberOfRows -1; end.col = numberOfCols -1; } ResetUnuseStartAndEnd (start, end); UpdateGridItemInRange (start, end); //Utility.Log (" cell count : " + m_CellsUsed.Count + " free count : " + m_CellsFreed.Count); }