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.


Messages - briangibson

Pages: [1] 2
1
NGUI 3 Support / Re: Reset scrollview containing a UIGrid to top left
« on: August 17, 2014, 11:18:41 PM »
false alarm... this doesn't always work. =/ i'm baffled.

3
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;



4
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.

5
NGUI 3 Support / Re: UIPanel Soft Clipping
« on: May 08, 2014, 03:24:32 PM »
I did something like this by writing stencil buffer shaders.

6
NGUI 3 Support / Re: multitouch with a scrollview
« on: May 08, 2014, 02:08:55 PM »
@Aren: One of the biggest difficulties I've been having in NGUI's touch system is its global touch drag threshold. Oftentimes, I need to have a global touch sensitivity to be lower (about 0) for sensitive interactions, higher for interacting with things like zoom gestures, etc. It would be amazing if there was a way to override the touch sensitivity per-widget. What I've been doing lately is setting the global touch sensitivity to 0, but doing Vector2.Distance() checks OnPress() per widget. this is cumbersome and doesn't always work well for all widget types.

7
NGUI 3 Support / Re: multitouch with a scrollview
« on: May 08, 2014, 01:35:02 PM »
This worked:
  1.         public bool CustomZoomEvent(){
  2.                 if(isTwoFingered){
  3.                         //do a custom thing with 2 finger touch instead, blocking ngui
  4.                         UICamera.current = null;
  5.                         UICamera.currentTouch = null;
  6.                         UICamera.mTouches.Clear();
  7.                         Debug.Log ("doing a thing!");
  8.                         return true;
  9.                 }
  10.                 else{
  11.                         return false;
  12.                         Debug.Log ("not doing a thing.");
  13.                 }
  14.         }

if i modified line 970 of UICamera to this:
  1.                 if (onCustomInput != null && onCustomInput()){ }
  2.                 else if (useTouch) ProcessTouches ();
  3.                 else if (useMouse) ProcessMouse();
  4.  

changed the delegate to return a bool, and made mTouches in UICamera public so that I could clear out any remaining accidental touches when I switch to the zoom event.

8
NGUI 3 Support / Re: multitouch with a scrollview
« on: May 08, 2014, 01:29:30 PM »
That's useful, but it still seems to be processing the touch events along with the custom events. wouldn't I need to bail out early, as per the suggestion here: http://www.tasharen.com/forum/index.php?topic=6615.msg32559#msg32559   ? Or, is there a static I would I need to nullify to prevent the touch event continuing down the chain? I tried this, but it didnt work:

  1.         public void CustomZoomEvent(){
  2.                 if(isTwoFingered){
  3.                         //do a custom thing with 2 finger touch instead, blocking ngui
  4.                         UICamera.current = null;
  5.                         UICamera.currentTouch = null;
  6.                         Debug.Log ("doing a thing!");
  7.                 }
  8.                 else{
  9.                         Debug.Log ("not doing a thing.");
  10.                 }
  11.         }
  12.  




9
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.

10
NGUI 3 Support / Re: clipping a panel with a non-square rect
« on: April 29, 2014, 02:54:12 PM »
I understand that 9 sliced masking would be a complicated feature. Let's say for simplicity's sake, I just want to clip a panel via a 'mask' sprite placed somewhere in the scene. In theory, I could make a solid image with an alpha background...and use the solid color as a mask for the scrollview contents (or for other content)

Is that out of the realm of possibility? "Involving texture sampling is doable" gives me hope... I poked at the shader that does the clipping, but I'm not sure how I'd go about this with NGUI. Perhaps writing to the stencil buffer? *ponder*

11
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/

12
the whole point is that i _dont_ want it to reset the position, but it was doing it without me asking it to, when I start a tween, if i have scrollbars attached.

Why would I want it to reset the scrollview contents when I start a tween? If I understand correctly, that'll just force it to cause an ugly glitch every time i tween. My solution of modifying the Tween script to call RestrictWithinBounds every frame during a tween allows me to not call ResetPosition but smoothly keep the scrollview contents within the rect.

13
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.

14
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()

15
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.

Pages: [1] 2