Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - briangibson

Pages: [1]
1
NGUI 3 Support / Reset scrollview containing a UIGrid to top left
« on: August 10, 2014, 01:20:18 PM »
I instantiate a bunch of UIGrid items on application start. I want to make sure that it scrolls immediately to the top left of the scrollview as soon as the app starts. what is the best way to do this? I tried all these things, and they don't seem to do it:
      scrollView.ResetPosition();
      scrollView.restrictWithinPanel = true;
      scrollView.RestrictWithinBounds(true);
      grid.repositionNow = true;



2
NGUI 3 Support / Atlas Switching / generation
« on: August 04, 2014, 03:00:50 PM »
Hey there- I've designed my atlas / interface at 2048x1536, designed to be pixel perfect. is there an easy way to halve the resolution / atlas dimensions for non-retina displays and retaining pixel perfect sizing, or do i need to actually re-generate an atlas? I understand the concept of using a 'reference' atlas and swapping the uiatlas there, but this question is more about if there is a quick way of regenerating the atlas itself.

3
NGUI 3 Support / multitouch with a scrollview
« on: May 07, 2014, 01:07:47 AM »
I've got a scrollview that basically fills the entire screen. I want to make it so that if I do a multitouch gesture like a pinch-to-zoom via TouchKit, the NGUI touch doesn't happen. How can I effectively 'block' touches to NGUI if I get a 2 finger touch? I can't let the scrollview inadvertently scroll from 1 finger of a pinch gesture.

4
NGUI 3 Support / clipping a panel with a non-square rect
« on: April 28, 2014, 10:39:40 AM »
Hey there- I would like to clip a scrollview panel contents via rounded clipping corners or another sort of clipping mask around the edges. How would you recommend going about this?

I was thinking maybe my grid contents could use a particular material that clips with a 2nd texture input or something... but I'm not entirely sure about the rendering pipeline involved in a scrollview contents + the ngui-generated meshes.

Would be a killer feature to add- being able to use a Sliced uisprite as a clipping mask for a UIPanel.

I saw this: but it isn't quite what I'm looking for. I need to sort of sample the texcoords in world space to use as a mask, more or less.
http://nickithansen.dk/masking-and-clipping-textures-using-shaders-in-ngui/

5
Potential bug: Today I noticed that if I have scrollbars attached to a UIScrollView, if i call TweenPosition, TweenWidth or TweenHeight on the master widget that the scrollview's panel is anchored to, on the first call to update during the tween, the grid items in the scrollview will jump. If i don't have the scrollbars attached to a scrollview, i don't have this problem.

Potential feature request: I also had to modify one of the tween scripts to add scrollView.RestrictWithinBounds(true); so that when I tween a scrollview, the contents stay within the view bounds. I wonder if it'd be useful to have an onUpdate callback delegate in these tweens so that the user doesn't need to modify the scripts to add additional functionality during the Tween OnUpdate calls.

6
got a weird freeze here when playing with some of the 'border' stuff in the sprite inspector-
clicked AddClampedBorder and it froze during "Updating the Atlas, please wait..."
Just thought you might want to know.

Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.023968 seconds (Nothing changed)
IndexOutOfRangeException: Array index is out of range.
  at UIAtlasInspector.AddClampedBorder (.UISpriteData sprite) [0x0010b] in /Users/bc/Unity/xxx/xxx/Assets/NGUI/Scripts/Editor/UIAtlasInspector.cs:443
  at UIAtlasInspector.OnInspectorGUI () [0x007c7] in /Users/bc/Unity/xxx/xxx/Assets/NGUI/Scripts/Editor/UIAtlasInspector.cs:297
  at UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) [0x00000] in <filename unknown>:0
UnityEngine.Debug:Internal_LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEditor.InspectorWindow:DrawEditor(Editor, Int32, Boolean, Boolean&, Rect&, Boolean)
UnityEditor.InspectorWindow:DrawEditors(Editor[])
UnityEditor.InspectorWindow:OnGUI()
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
System.Reflection.MethodBase:Invoke(Object, Object[]) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
UnityEditor.HostView:Invoke(String, Object)
UnityEditor.HostView:Invoke(String)
UnityEditor.DockArea:OnGUI()

7
UIButton's 'Normal Color' is coupled to the UIWidget's 'alpha' property.
This means that if I do a TweenAlpha on a UIWidget that has a button on it, it uses whatever the color that was set before I hit play.
This is counterintuitive and seems an awful lot like a bug- but perhaps the suggested workaround is to not have a UIWidget and a UIButton on the same gameobject?

I.e.: there are two possible scenarios, and each behaves differently:
1) I set the Alpha property of the widget to 0, and hit play.
Run a TweenAlpha from code to trigger to a value of 1.
Hover over the button, and then hover away - the button will fade away to invisible.

2) I set the Alpha property of the widget to 1, and hit play.
Run a TweenAlpha from code to trigger a tween from 0 to a value of 1.
Hover over the button, hover away, nothing happens. this is to be expected.

8
NGUI 3 Support / updating a scrollview at runtime
« on: April 14, 2014, 05:56:45 PM »
I've got a Scrollview that whenever I update it from a script, some of the time (not always), the grid contents are offset by a couple pixels. Basically, I have code to update the anchors differently based on if you're holding the device portrait or landscape.

My hierarchy looks like this:

>Main Navigation Panel
--> OtherContent
--> SomethingElseContent
--> Scrollview Master UIWidget (I resize this widget to resize everything)
---->Background Image (inset by a few pixels so if you drag on the edges of the scrollview, it'll still scroll)
----> UIPanel (Anchored to the Master Widget) / UIScrollView / SpringPanel
------>UIGrid
-------> square content1
-------> square content2
-------> square content3, etc

My code looks like this when I rotate the device:
  1.        
  2. void EnterViewLandscape(){
  3.                 panelGrid.leftAnchor.Set(0.0f, -9.0f); //this is the panel anchored to the master widget
  4.                 panelGrid.rightAnchor.Set(1.0f, 9.0f);
  5.                 panelGrid.bottomAnchor.Set(0.0f, 12.0f); //this adjusts the clipping size at runtime to be appropriate to the orientation of the device
  6.                 panelGrid.topAnchor.Set(1.0f, -12.0f);
  7.                 panelGrid.UpdateAnchors();
  8.  
  9.                 backgroundImage.leftAnchor.Set(0, 9); //this is the background image, inset by a few pixels
  10.                 backgroundImage.rightAnchor.Set(1, -9);
  11.                 backgroundImage.bottomAnchor.Set(0, 0);
  12.                 backgroundImage.topAnchor.Set(1, 0);
  13.                 backgroundImage.UpdateAnchors();
  14.  
  15.  
  16.                 foreach(UIWidget widget in gridWidgets)
  17.                 { //this is the UIGrid contents
  18.                         BoxCollider collider = (BoxCollider)widget.collider;
  19.                         collider.size = new Vector3( 160, 115, 0);
  20.                         widget.SetDimensions(160, 115);
  21.                         widget.UpdateAnchors();
  22.                 }
  23.  
  24.                 panelGrid.RebuildAllDrawCalls();
  25.                 panelGrid.Refresh();
  26. // i have no idea if any of this is is necessary or in the right order...
  27.                 scrollView.RestrictWithinBounds(true);
  28.                 scrollView.ResetPosition();
  29.                 grid.repositionNow = true;
  30.                 grid.Reposition();
  31. }
  32.  

9
NGUI 3 Support / UICenterOnChild and momentum
« on: April 06, 2014, 02:24:47 PM »
Is there an easy way to get UICenterOnChild to respect the scrollview's original momentum? This is subtle, but UICenterOnChild just feels wrong- and that's because it's using a SpringPanel instead of just lerping towards a new target. I tried to modify some of these scripts but I'm not totally sure what is doing what. Basically, instead of (or similar to) a SpringPanel, I want it to simply lerp towards the target that is defined by the UICenterOnChild script, but also taking the original momentum into account. This would make it feel 'looser' instead of snapping so tightly, but still 'land' on the right child.

10
NGUI 3 Support / UICenterOnChild limits on either end
« on: April 05, 2014, 04:42:15 PM »
I've got a horizontal draggable panel that has 5 visible slots, and 10 items from a UIGrid in it.
If I put the UICenterOnChild script on it, and drag all the way to the right, it will center on the first item. In this case, it SHOULD be centering on the 3rd item.
Similarly, if i drag all the way to the left, it centers on the last item. it SHOULD be centering on the 3rd from the last item.

What changes would I need to make to make sure that UICenterOnChild respects the draggable range properly at the extents? If you need an illustration of what I'm talking about, I can take screenshots.

11
NGUI 3 Support / adjust by DPI option
« on: March 30, 2014, 09:42:47 PM »
I just had a chance to test this out- I'm not sure what it's supposed to be doing, but I think it's not doing the right thing. I've been designing my app with minimum/maximum height as 640x1136 (testing on an iphone5), with PixelPerfect mode. I've got things anchored relative to the top/left/sides etc. When I click 'adjust by DPI' and build to an iPad 2 (the non HD iPad), all my ui elements are offscreen. What should I expect to have happen- is this just a bug?

Pages: [1]