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

Pages: [1] 2 3
1
NGUI 3 Support / Re: Unity 4.5.5p3 Weirdness
« on: November 10, 2014, 02:18:55 AM »
Looked into this. It seems what Unity broke is that before, the call order was:

Awake
OnEnable
OnValidate

Now it's

OnValidate
Awake
OnEnable

Has anyone reported this to Unity? Because if it's in pX that's ok because it's not fully stable and tested but that can't be landed in 4.5.6 or 4.6 stable.

2
NGUI 3 Support / Re: NGUI and Unity 5.0 Upgradable APIs
« on: October 29, 2014, 06:44:18 AM »
After you import the NGUI's update, Unity 5 will automatically auto-upgrade everything for you. I've made NGUI Unity 5 compatible more than a month ago.

And everytime we want to start a new project we have to import NGUI and "auto upgrade"?? That doesn't make any sense.

There could be places in NGUI where you use some "shortcut" in Update/LateUpdate/FixedUpdate and it's going to replace it to "GetComponent<T>()" and it's not being cached with "mComponent = GetComponent<T>()" in Awake/Start

3
NGUI 3 Support / Re: NGUI and Unity 5.0 Upgradable APIs
« on: October 28, 2014, 10:00:35 AM »
Changing whatever shortcuts are used should be a simple change, but removing cachedTransform will likely slow things down for everything but 5.0 where it doesn't cache properly and performs a getcomponent every time.

In "SCRIPTING FEATURES"

"“transform” is now cached on the C# side, no more need to cache it yourself."

http://unity3d.com/unity/beta/5.0/release-notes

4
NGUI 3 Support / Re: Why this error occur after update to 3.7.3?
« on: September 24, 2014, 04:13:31 AM »
Same problem here, it appears sometimes.

5
NGUI 3 Support / Get ScrollView drag amount
« on: September 23, 2014, 08:42:41 AM »
It's there any way? There is a "SetDragAmount" but there is no "GetDragAmount".

The code inside of it it's really hard to understand so I don't know how to do it.

Can you help me Aren?

Thanks!

6
NGUI 3 Support / Re: How to use UIWrapContent programatically?
« on: July 01, 2014, 05:59:10 AM »
Suppose you have a collection of items.

public class Test : MonoBehaviour
{

    List<string> letters = new List<string>() { "A", "B", "C", "D" };

    void Awake()
    {
        GetComponent<UIWrapContent>().onInitializeItem = SetItemData;
    }

    void SetItemData (GameObject go, int wrapIndex, int realIndex)
    {
// THIS IS THE CODE TO CALCULATE THE INTERESTING INDEX
        int index = 0;

        if (realIndex > 0) {
            int loop = 1 + (realIndex / count);
            index = (loop * count) - realIndex;
            index = index == count ? 0 : index;
        } else {
            index = -realIndex % count;
        }
// END
 
   string letter = letters[index];

   Debug.Log(letter);

        go.GetComponent<UILabel>().text = letter;
    }
}

7
NGUI 3 Support / Re: How to use UIWrapContent programatically?
« on: July 01, 2014, 03:32:28 AM »
What does UIGrid have to do with UIWrapContent? The two are very different scripts that both reposition children, and should never be used together.

You can achieve repeating indices quite easily. In the SetItemData callback just wrap the real index. You will need more items in the list than can fit into the visible space as expected (so that they wrap around properly), but what data you visualize on those items is completely up to your SetItemData callback.

UIWrapContent's purpose is not to copy the functionality of an Android control. Its purpose is to show you how you can use NGUI to create a simple unlimited scroll view. The script is 241 lines including comments, and easily derivable from, or modifiable just by setting the callback. Even if that's not good enough, the code should be short enough to be used as a template for your own custom component.

But if you can improve it why not do it? I have posted you code to improve it.

And it's not easily derivable from, I had to changed to protected virtual some methods and properties modifying NGUI code.

I don't understand why you are opposed to improve some scripts when your users are helping you to do it.

If you can make a better UIWrapContent script why not? I'm sure that there are more people that has the same problem and want to virtualize lists like in Android or almost any UI system.

8
NGUI 3 Support / Clamped UILabel with three dots at the end
« on: June 30, 2014, 05:53:07 AM »
I have a clamped label where I want to append "..." at the end if it doesn't fit.

How can I achieve that? Because now I don't know how to know if certain text fits in the area of the label and also how to append "..." characters without clamping them too.

"Lorem ipsum dolor sit amet, consectetur adipiscing elit"

To this:

"Lorem ipsum dolor sit amet..."

9
NGUI 3 Support / Re: How to use UIWrapContent programatically?
« on: June 30, 2014, 05:07:22 AM »
You need to do this and you also should save previous "restrictWithinPanel" value set by user.

  1. void OnEnable() {
  2.         if (mScroll) {
  3.             mScroll.restrictWithinPanel = false;
  4.         }
  5.     }
  6.  
  7.     void OnDisable() {
  8.         if (mScroll) {
  9.             mScroll.restrictWithinPanel = true;
  10.         }
  11.     }
  12.  
  13.     protected override void OnMove(UIPanel panel) {
  14.         if (enabled) {
  15.             base.OnMove(panel);
  16.         }
  17.     }
  18.  

And finally it would be nice if we could "close" one end or two ends.

As you can see, this script needs some work on it.

10
NGUI 3 Support / Re: How to use UIWrapContent programatically?
« on: June 30, 2014, 04:41:56 AM »
Also there is no way to disable this script. Because of this:

  1. mScroll.GetComponent<UIPanel>().onClipMove = OnMove;
  2.  

There should be a way to disable it because if you have dynamic contents you can have 100 elements or 5. When you have 5 you don't want a this behaviour because it's within panel.

And this is no way to tell to not include inactive items. I had to change it:

  1. mChildren.Clear();
  2.         for (int i = 0; i < mTrans.childCount; ++i) {
  3.             if (hideInactive && !mTrans.GetChild(i).gameObject.activeSelf) continue;
  4.  

11
NGUI 3 Support / Re: How to use UIWrapContent programatically?
« on: June 30, 2014, 04:35:25 AM »
I have two problems:

1. It doesn't work when you use a list with a UIGrid with a PIVOT in TOP (each element has it's pivot in top also). When it removes one item from bottom an puts on top it does later.

  1. float distance = t.localPosition.y - center.y;
  2.  

It expects that localPosition.y it's the center but sometimes it's not.

2. realIndex variable should be other thing.

See this:

http://developer.android.com/reference/android/widget/ArrayAdapter.html

It's a class where you provide your data and it uses with the list (MVC).

Constructor:

  1. ArrayAdapter(Context context, int resource, T[] objects)
  2.  

Method:

  1. getView(int position, View convertView, ViewGroup parent)
  2.  

Where you override it and you fill your data. "int position" it's the index within your data list.

Suppose you have a list of 3 items, indexes should be values like:

0
1
2
0
1
2

And not:

0
1
2
3
4
5

Or:

-5
-4
-3
-2
-1

So for that case you should provide something to tell how many items you have. Here you have the code i used to achieve this:

  1. int index = 0;
  2.  
  3.         if (realIndex > 0) {
  4.             int loop = 1 + (realIndex / count);
  5.             index = (loop * count) - realIndex;
  6.             index = index == count ? 0 : index;
  7.         } else {
  8.             index = -realIndex % count;
  9.         }
  10.  

12
NGUI 3 Support / Re: Drawcalls / Widgets in wrong position - BUG
« on: June 27, 2014, 01:57:40 AM »
Don't hide your Game view behind your Scene view. This is mentioned in the NGUI tutorials a few times. When the game view is hidden it's not possible to determine its size properly.

My problems occurs also in runtime.

That's why I reported it.

13
NGUI 3 Support / Drawcalls / Widgets in wrong position - BUG
« on: June 26, 2014, 11:22:08 AM »
I have a problem that sometimes in editor I see the Widget gizmos in the correct position but what it draws it's in another position.

It looks like a bug.


14
NGUI 3 Support / Re: AnchorUpdate OnEnable and Unity Editor
« on: May 13, 2014, 01:08:03 AM »
Hmm? That if statement is "if not UnityEditor". Update Anchors should only be executed if the condition is set to "OnUpdate", and not "OnEnable". It behaves differently in the editor because changes must be reflected while you are not playing the game. Although it's probably best if that statement reads:
  1. #if UNITY_EDITOR
  2.                         if (updateAnchors == AnchorUpdate.OnUpdate || mUpdateAnchors || !Application.isPlaying)
  3. #else
  4.                         if (updateAnchors == AnchorUpdate.OnUpdate || mUpdateAnchors)
  5. #endif

That's my problem.

So are you going to change that in next version? Thanks!

15
NGUI 3 Support / AnchorUpdate OnEnable and Unity Editor
« on: May 12, 2014, 06:54:24 AM »
Why you always use "OnUpdate" behaviour in Unity Editor despite of setting "OnEnable"?

UIRect.cs line 410 ( NGUI 3.5.8 )

Quote
#if !UNITY_EDITOR
         if (updateAnchors == AnchorUpdate.OnUpdate || mUpdateAnchors)
#endif

It's really confussing and I can't test anything correctly in editor.

Example:

- You set a Widget to "OnEnable" because later you want to move it.

Pages: [1] 2 3