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 - Oinobareion

Pages: [1]
1
NGUI 3 Support / Re: 'OnDragFinished' fired on simple tap
« on: November 21, 2013, 03:12:10 AM »
Thanks, works fine!

2
NGUI 3 Support / 'OnDragFinished' fired on simple tap
« on: November 20, 2013, 03:58:50 AM »
Hi,

I am using the UIDraggablePanel event 'OnDragFinished' to fire events as soon as i have finished dragging the panel. Unfortunately, the event also gets fired when i simply tap the panel ( = when there has been no offset between my touches). How can I fix that? 

  1.         void Start ()
  2.         {      
  3.                 draggablePanel.onDragFinished = new UIDraggablePanel.OnDragFinished(OnDragFinished);
  4.         }
  5.        
  6.         void OnDragFinished()
  7.         {      
  8.                 // Do something
  9.         }
  10.  

Thanks for help!

3
NGUI 3 Support / Re: Check, if GameObject is inside UIPanel
« on: November 19, 2013, 09:24:08 AM »
Thanks for the answer. I simply used the "isVisible" function to check, if a certain GameObject is inside the panel's bounds. I am sure there are more elaborate ways to achieve this, but at least it works :-) Here is my code:

  1.         private bool CheckVisibility (Transform t)
  2.         {
  3.                 if (panel.IsVisible(t.position) == true)
  4.                 {
  5.                         return true;
  6.                        
  7.                 }
  8.                 else return false;
  9.         }
  10.  

4
NGUI 3 Support / Re: UIDraggblePanel: event when it comes to a halt
« on: November 19, 2013, 09:04:41 AM »
Yes, that's how it works. Thanks for help. I did it like this:

  1.         void OnDragFinished()
  2.         {      
  3.                 isMoving = true;
  4.                 StartCoroutine(CheckIfPanelStandsStill());
  5.         }
  6.        
  7.         private IEnumerator CheckIfPanelStandsStill ()
  8.         {
  9.                 while (isMoving)
  10.                 {
  11.                         // the current drag momentum
  12.                         float currentDragMomentum = panel.clipRange.y;
  13.                
  14.                         // wait some time
  15.                         yield return new WaitForSeconds(0.1f);
  16.                        
  17.                         // the drag momentum after some time
  18.                         float dragMomentumAfterSomeTime = panel.clipRange.y;
  19.                        
  20.                         // this means that our panel stands still
  21.                         if (currentDragMomentum == dragMomentumAfterSomeTime)
  22.                         {
  23.                                 CheckListElements();
  24.                                 isMoving = false;
  25.                         }
  26.                 }
  27.         }
  28.  
  29.  

5
NGUI 3 Support / UIDraggblePanel: event when it comes to a halt
« on: November 19, 2013, 07:41:34 AM »
Hey guys,

I use the "OnDragFinished" Event Listener to detect when I have finished dragging a UIDraggblePanel. This works fine but what I actually want to know is when the UIPanel comes to a halt after being dragged and the momentum being applied. So how can I figure out, when the UIPanel stops after being dragged?

Thanks for your help!

6
NGUI 3 Support / Re: Draggable Panel Optimization
« on: November 15, 2013, 11:28:31 AM »
The UIpanel has a built in culling now that you can enable on it...

Which version of nGUI integrated the culling feature? Sounds very promising to me.

7
NGUI 3 Support / Check, if GameObject is inside UIPanel
« on: November 13, 2013, 08:28:15 AM »
Hello everyone,

May be a simple question: Can I somehow check, if a GameObject is inside a UIPanel? I want to do something with the GameObject, as soon as it enters the panel. Is this possible?

Otherwise I would have to make a collider box as trigger and work with onTriggerEnter and onTriggerExit. I am wondering, if there's an easier way to do this.

Thanks for help!

8
NGUI 3 Support / Re: Define minimum value for UIScrollBar.cs
« on: November 08, 2013, 10:38:53 AM »
For example, if I want to prevent the foreground element of my scrollbar from getting smaller than 100px. I (experimentally) changed line 349 of UIScrollBar.cs to the following:

  1. if (mFG.cachedTransform.localScale.x > 100)
  2. {
  3.         // this is the original line   
  4.         mFG.cachedTransform.localScale = new Vector3(fgs.x + fg.x + fg.z, fgs.y + fg.y + fg.w, 1f);
  5. }
  6.         else mFG.cachedTransform.localScale = new Vector3(100, fgs.y + fg.y + fg.w, 1f);
  7.  
  8.  

But this leads to some flickering of the foreground sprite, swithcing between my defined size and the calculated ngui size. How can I fix that? 

9
NGUI 3 Support / Define minimum value for UIScrollBar.cs
« on: November 08, 2013, 08:55:21 AM »
Hi,

I am using a UIScrollBar for a list I am displaying. The problem is: when the list gets very long, the foreground element of the scrollbar gets very small. How can I define a minimum value for the foreground element size so that it does not fall below a certain value?

Thanky for your help.

10
NGUI 3 Support / UITable loading only visible elements
« on: October 18, 2013, 05:05:01 AM »
Hi,

I have a UITable that gets filled dynamically with much content (Prefabs). I am wondering if there is an easy way to implement an intelligent UITable that only loads those list elements that are actually visible to the user. The other elements (that are outside the visible area) are just dummy elements without content. These dummy elements get filled with content as soon as the user scrolls the list.

I have the following:

- UIPanel with SoftClip activated and UIDraggablePanel component

-- UITable that dynamically shows prefabs. This can be 100+ at a time with much content. If everything is loaded at once, the whole thing gets realy slow.

--- the Prefab Instances with UIDragPanelContents

Any ideas how to do that? Thanks for any help!

11
NGUI 3 Support / Re: UITexture.mainTexture causes problem on Android
« on: August 08, 2013, 09:34:52 AM »
I load the texture from my Ressources folder:

  1. Object[] photoTextures = Resources.LoadAll("Photos", typeof(Texture2D));
  2.  

and get the textures like this:

  1. foreach (Texture2D tex in photoTextures)
  2. {
  3.   GameObject go = new GameObject("picture" + someIndex);
  4.   go.AddComponent("UITexture");
  5.  
  6.   // this is where i try to assign the texture from the Resources folder. Everything after this line does not get executed.
  7.   go.GetComponent<UITexture>().mainTexture = tex;
  8.  
  9.   ...
  10. }
  11.  

12
NGUI 3 Support / UITexture.mainTexture causes problem on Android
« on: August 08, 2013, 09:27:17 AM »
Hi,

I am dynamically creating a GameObject and add a UITexture component to it. Like this:

  1. GameObject go = new GameObject("picture" + index);
  2. go.AddComponent("UITexture");
  3.  

Now I want to assign a texture to it like this:

  1. go.GetComponent<UITexture>().mainTexture = tex;
  2.  

where tex is some Texture2D. This works fine in the editor but as soon as I test it on an Android device, it gets stuck at this point. Any ideas why?

Thanks for any help!

13
NGUI 3 Support / Re: Drag & Drop from 2D to 3D Space
« on: June 06, 2013, 10:08:35 AM »
Hi,

Ok, I took a close look now and was able to recreate the scene. There is one thing, I am still struggling with. The instantiation of the prefab happens here in AddChild.

  1.         static public GameObject AddChild (GameObject parent, GameObject prefab)
  2.         {
  3.                 GameObject go = GameObject.Instantiate(prefab) as GameObject;
  4.  
  5.                 if (go != null && parent != null)
  6.                 {
  7.                         Transform t = go.transform;
  8.                         t.parent = parent.transform;
  9.                         t.localPosition = Vector3.zero;
  10.                         t.localRotation = Quaternion.identity;
  11.                         t.localScale = Vector3.one;
  12.                         go.layer = parent.layer;
  13.                 }
  14.                 return go;
  15.         }
  16.  

I am instantiating my prefabs on a plane, which actually works, but they are "inside" the plane. I'd like them a little bit above the plane. So I tried....

  1. t.localPosition = new Vector3(0, 1, 0);
  2.  

But it didn't change anything. Am I thinking in a completely wrong way?

Thank you!

14
NGUI 3 Support / Drag & Drop from 2D to 3D Space
« on: June 06, 2013, 05:17:08 AM »
Hello,

I am having big troubles to integrate the "Example 11 - Drag & Drop" functionality into my own project. I want to drag an object from the 2D UI and drop it on an object in the 3D space. Is there a step-by-step description on how to do it? I'll try to explain what I did so far:

- I have an Anchor that is positioned at the left side of the screen. Inside, I have a Panel and some Widgets that represent some kind of media library (= a collection of images). From this media library I want to drag 2D objects on the 3D canvas (a simple plane).

My questions: Where do i have to attach the following scripts to? DragDropItem.cs, DragDropRoot.cs, DragDropSurface.cs

Thanky for any help!

Pages: [1]