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

Pages: [1]
1
NGUI 3 Support / Re: Web Player - NGUI error
« on: June 16, 2014, 10:00:29 AM »
I had the same problem. I can happen if something sets "Manual Height" of UIRoot to zero. In our case we had a script that was doing that if it failed to detect editor screen size.

2
NGUI 3 Support / Re: Custom UITable Sorting not working on device
« on: May 13, 2013, 04:37:02 AM »
Thanks, ill try that. I'm just curious about why the behaviour differs in editor and on device.

3
NGUI 3 Support / Custom UITable Sorting not working on device
« on: May 08, 2013, 04:38:12 AM »
I had to implement sorting items by their price for one of my UITables. I named all of GameObjects in that table according to their price(like 5100), but because you can't compare strings as integers(2111 is bigger than 11111 string-style), I had to implement a comparison of strings as integers using int.TryParse. Here is the example methods(in class MiscTools, doesnt matter):

  1. public static int CompareTransformsByNames(Transform first, Transform second)
  2. {
  3.         return GetIntFromString(first.name).CompareTo(GetIntFromString(second.name));
  4. }
  5.  
  6. public static int GetIntFromString(string number)
  7. {
  8.         int output;
  9.  
  10.         if (!int.TryParse(number, out output))
  11.         {
  12.                 Debug.Log(string.Format("Unsupported string formant in sorting: {0}", number));
  13.                 return 0;
  14.         }
  15.                 return output;
  16. }

And this is how it is used:
  1. myTable.children.Sort(MiscTools.CompareTransformsByNames);
  2. myTable.Reposition();
  3.  

I also tried LINQ approach:
  1. myTable.children.OrderBy(x => MiscTools.GetIntFromString(x.name));
  2. myTable.Reposition();
  3.  

Both variants work like a charm in editor, table is sorted right, but on devices(both iOS and Android) it does no sorting at all, without any exceptions or anything. I know the only place the table gets sorted is line 66 of UITable.cs(
  1. if (sorted) mChildren.Sort(SortByName);
) but "sorted" flag is off on all tables.

What could possible be a reason of such strange behaviour on devices specifically?

4
NGUI 3 Support / Re: Atlas Max Sprite Quantity/Texture Size
« on: January 10, 2013, 04:32:51 AM »
Also I suggest eliminating long / narrow sprites. They don't pack well. Use sliced sprites wherever possible.

I'm using sliced sprites but there are some gradienty bacgrounds where I have to preserve designer's complex gradient. Maybe I should look into some solution to make it in code.

Can you please explain why long/narrow sprites don't pack well? (If it won't take long, I'm just curious)

Thanks.

5
NGUI 3 Support / Atlas Max Sprite Quantity/Texture Size
« on: January 09, 2013, 04:37:32 AM »
I'm having an issue with atlas maker, I couldn't find an appropriate topic for that.

I have texture atlas to which i've been adding stuff for a while and there is still a lot of space left(texture is 2048x2048 and about 1/3 is free) but now, when i try to add something new, every sprite becomes clipped from upper-right corner and sprite coordinates in atlast prefab become inconsistent, pointing to wrong sprites on texture.

I wonder if there is a limit to texture measurements/overall size or to number of elements in atlas(currently 130+ elements)? If there is no simple answer to this, i'll dig in atlas maker script myself later and I can attach some texture samples if needed. I wonder if I'm the only one with this issue.

Also, do texture import settings matter for sprite/atlas in this case?

6
NGUI 3 Support / Re: Mixing different atlases and UITexture
« on: November 30, 2012, 06:15:27 AM »
Also, when you add nested UIPanel, you have to switch the parent panel off and on so the nested panel will start handling its widgets' drawcalls instead of parent panel. Took me some time to realize.

7
NGUI 3 Support / Re: UILabel gets messed up on Android device
« on: November 30, 2012, 04:02:21 AM »
Thanks, I should really have read that before posting on the forum. Was solved by targeting ES 2.0.

8
NGUI 3 Support / UILabel gets messed up on Android device
« on: November 28, 2012, 04:14:40 AM »
This might be a known problem but I still can't find the solution. I have a clipped panel with UILabel in it. On standalone and iOS everything is normal, but when I switch the platform to Android, this particular label gets messed up. I think I has something to do with a shader that does the clipping. Maybe android hates it. Is there any workaround or a way to fix this?

Adding a pic to illustrate. This is the only label affected as you can see.


9
There is a whole list of functions that get called on everything that is parented to UICamera on top of UICamera.cs script.
 
  1. /// - OnHover (isOver) is sent when the mouse hovers over a collider or moves away.
  2. /// - OnPress (isDown) is sent when a mouse button gets pressed on the collider.
  3. /// - OnSelect (selected) is sent when a mouse button is released on the same object as it was pressed on.
  4. /// - OnClick (int button) is sent with the same conditions as OnSelect, with the added check to see if the mouse has not moved much.
  5. /// - OnDoubleClick (int button) is sent when the click happens twice within a fourth of a second.
  6. /// - OnDrag (delta) is sent when a mouse or touch gets pressed on a collider and starts dragging it.
  7. /// - OnDrop (gameObject) is sent when the mouse or touch get released on a different collider than the one that was being dragged.
  8. /// - OnInput (text) is sent when typing (after selecting a collider by clicking on it).
  9. /// - OnTooltip (show) is sent when the mouse hovers over a collider for some time without moving.
  10. /// - OnScroll (float delta) is sent out when the mouse scroll wheel is moved.
  11. /// - OnKey (KeyCode key) is sent when keyboard or controller input is used.

You can implement the said functions for objects to receive events.

10
Good day everyone! I suppose this question was already asked a hundred times but I couldn't find any solid info about it. Are there any guides about creating the interfaces for all the popular android aspect ratios as well as iOS devices. I tried using UIRoot autoscale to scale the interface but I can't find the optimal solution to rescaling other elements to match the aspect ratio. So what is the best practice? To develop the center-oriented interface and rescale side-panels to match the missing are when aspect ratio changes? What aspect ratio and resolution to choose as basic? I'd be glad to hear from your experience in creating scalable UIs and I want to apologize if I missed the similar discussion.

Pages: [1]