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

Pages: [1] 2 3
1
NGUI 3 Support / 364 -> 368 upgrade messes up anchors
« on: August 01, 2014, 06:24:23 AM »
I have upgraded NGUI until now without any big issues

However, after making the update from 3.6.4 to the latest 275c7bb51c8d9d50f3d620c1f028c558aee61bcf commit (version 3.6.8) the anchors and widgets went crazy

I have 2 UIRoots in 2 different scenes -> preloader + game

Preloader loads the game scene

Now, it appears that all the anchors from the game scene went crazy..

Content is my panel that is the first child of the UICamera which is the child of UIRoot

This is how an anchor looks in editor: https://www.dropbox.com/s/do1wvwt8lcy78an/Screenshot%202014-08-01%2014.18.38.png

In the editor, after the scene is loaded: https://www.dropbox.com/s/vpz918sdv848rgk/Screenshot%202014-08-01%2014.21.50.png
In the editor, after the scene is loaded(zoomed out a lot): https://www.dropbox.com/s/68sqnrr9kzfewp6/Screenshot%202014-08-01%2014.21.31.png

If I remove the anchor reference and add it again, the anchors appear to have recovered(pointing to the middle of the screen): https://www.dropbox.com/s/623pl8rxl2rw5wc/Screenshot%202014-08-01%2014.22.54.png

Can you please let me know at how I should try and deal with the problem?

Thanks

2
NGUI 3 Support / Re: Offset widget
« on: February 26, 2014, 03:59:30 AM »
Ok.. for anyone else having the same issue, the workaround is to create an empty GameObject as parent of the second Tweened element.

3
NGUI 3 Support / Re: Offset widget
« on: February 24, 2014, 06:25:19 AM »
I think this should be a toggle, so I can choose the default behaviour.. I do not always want this behaviour to happen

4
NGUI 3 Support / Re: Offset widget
« on: February 22, 2014, 11:28:39 AM »
Makes sense, your suggestion.. Will try

Now, regarding the bug I am describing above, here is the repro case https://www.dropbox.com/s/nzay2tvxvspiszo/tween_constraints.zip

the X sprite is anchored to the left of the button sprite..
i change the width of the button sprite with a tween width
if a tween is playing in the same time on X, X will not update its position based on the anchor constraints, but instead changes the constraints
if no tween is playing on X, the behaviour is as expected, with X moving along with the button

5
NGUI 3 Support / translucent / blurred sprite like ios7
« on: February 21, 2014, 07:44:59 AM »
Is there any way to achieve this with NGUI?

Would anyone be able to share a shader that does something similar to this?

Cheers

6
NGUI 3 Support / Offset widget
« on: February 21, 2014, 07:43:53 AM »
Until now, if I had a width W widget, i used to offset from rights target for left and right:
for left: OFFSET
for right: OFFSET + W

I think this is not an elegant way of dealing with offseting widgets and I would be grateful for a better solution. I simply want the right edge of my widget to be at an OFFSET distance of a target, even if the widget width changes. Is there a simple way to do this without calculating the left and right offsets based on the widget width?

Since upgrading to 3.5.0b I am not sure the way I use still works

If I change the width of the widget used as Unified Anchor(let's call it reference), to widgets that are anchored to it will no longer change their position. They simply stay in the same place and the Left and Right constraints change accordingly. However, if I change the widget dimensions from editor, it works :)

I think the change that broke the functionality is this: https://github.com/tasharen/ngui/commit/1618d32c3e63d00146746df77f8f8d0bead40b09#diff-89a3fb27e36824b406e234bfeb9dcda3

7
NGUI 3 Support / Re: Atlas maker problem
« on: January 28, 2014, 02:04:28 PM »
Turns out I left 1024 as max size for iOS on that specific texture..

However, bad things happen when I switch platform and there is a different max texture size specified..

I will try to make a more logical bug report once I have the time.. For now, I simply recreated the atlas, without the max size restriction and added the images one by one in order not to crash

8
NGUI 3 Support / Re: Atlas maker problem
« on: January 28, 2014, 03:14:05 AM »
So, I thought I managed to fix the problem by working with a windows machine.. the problem is that when I build for iOS on a mac, when the platform is switched in unity, it will mess up the atlas, reducing the size to 1024x512.. I have one atlas that is ok (multiple smaller images) that is 2048x2048 in size and the one with the big images simply refuses to work as it should..

I searched for a place to set the iOS device generation but I can only find iOS restriction.. do you happen to know where to set that restriction so my atlases won't be adjusted to fit 1024 ?


9
NGUI 3 Support / Re: 3.0.9f1 broke my tweens!
« on: January 20, 2014, 04:14:25 AM »
the 3.0.9f2 update is already on the asset store

10
NGUI 3 Support / Re: Atlas maker problem
« on: January 20, 2014, 03:47:46 AM »
I've tried to reproduce the problem on a windows machine:

- on iOS target:
correctly warns that the files won't fit in the atlas..

- on Standalone:
works great..

So, the problem is obviously on MacOS.. Is there any way I can help you try to correct the issue?

11
NGUI 3 Support / Re: Atlas maker problem
« on: January 20, 2014, 03:32:27 AM »
I am running ngui 3.0.9f1 on Mac OS Mavericks..

My flow is to create an initial atlas with fewer elements and then add them with Add/Update all..

I've identified 2 problems:

When selected platform is iOS:
- everything works fine up to an atlas size of 1024x1024.. whenever I add the extra sprite that would make the atlas increase the size to the next available option (which would be on iOS 2048x2048) the atlas will instead shrink to 1024x512, losing all the sprites
- the second problem, when creating a new atlas of 10 images at 750x1000, I select the sprites, I click the Create button to create a new atlas and when it's finished, there is no image added.. what I do, is select the images again and click Add/Update all.. then, this happens and unity hangs: https://www.dropbox.com/s/em4g7ovyjtsty6m/Screenshot%202014-01-20%2010.23.54.png


However, when I switch the platform back to Standalone:
- Adding small sprites in increments works fine
- When creating the atlas of 10 images of 750x100, it works fine.. however, the problem appears when I want to update it and select the 10 sprites again and another 5.. in this case, I have the same problem as above: https://www.dropbox.com/s/xbp4gv5nc7gn86d/Screenshot%202014-01-20%2010.31.56.png

12
NGUI 3 Support / Re: EventDelegate.Execute - order of operations
« on: January 19, 2014, 01:55:10 PM »
I managed to review the changes..

I saw you've chosen to keep a mTemp to the old onFinished list and reset the onFinished list..

I am not sure this is the best idea because:

- the onFinished list of delegates will clear, no matter if the EventDelegate is set to oneShot or not (this basically renders oneShot obsolete)
- this should fix the problem for the UITweener classes but not for the other classes that use EventDelegate.Execute
- I think the fix should be done in the EventDelegate.Execute method and the clone of the list should be done there

Please consider my arguments and let me know if I need to further explain the issue.

Here is a proposed solution for the EventDelegate.Execute method. This would eliminate the need of cloning the array in UITweener and the rest of the classes that use the Execute method. I think the performance decrease would be minimal since most of the time there are only 1 delegates added to the onFinished method.

  1. static public void Execute (List<EventDelegate> list)
  2.         {
  3.                 if (list != null)
  4.                 {
  5.             // Creates a clone of the event delegate list
  6.             List<EventDelegate> mTemp = new List<EventDelegate>();
  7.             mTemp.AddRange(list);
  8.  
  9.             for (int i = 0; i < mTemp.Count; i++)
  10.                         {
  11.                 EventDelegate del = mTemp[i];
  12.  
  13.                 if (del != null)
  14.                                 {
  15.                                         del.Execute();
  16.  
  17.                                         if (del.oneShot)
  18.                                         {
  19.                         list.Remove(del);
  20.                                         }
  21.                                 }
  22.                         }
  23.                 }
  24.         }

13
NGUI 3 Support / Re: Atlas maker problem
« on: January 19, 2014, 04:59:15 AM »
Well, the problem is that they actually fit :) 4096x4096/750x1000 = 22 -> but considering the images can't be split, this could fit 20 images

And they do fit if I add them one by one, but not all at once.. this is when the problem happens

14
NGUI 3 Documentation / Re: UI2DSprite
« on: January 18, 2014, 02:16:15 PM »
I see you talk a lot about 4.5.. Is it weeks away, months away or years away ? :)

15
NGUI 3 Documentation / Re: UIGrid
« on: January 18, 2014, 02:11:06 PM »
This is a modified script we use.. I took the original script from this forum somewhere and it's slightly modified

The problems that appear are with the children pivot point but if you use the same for all, you should be cool

  1. //----------------------------------------------
  2. //            NGUI: Next-Gen UI kit
  3. // Copyright © 2011-2013 Tasharen Entertainment
  4. //----------------------------------------------
  5.  
  6. using UnityEngine;
  7. using System.Collections.Generic;
  8.  
  9. /// <summary>
  10. /// All children added to the game object with this script will be repositioned to be on a grid of specified dimensions.
  11. /// If you want the cells to automatically set their scale based on the dimensions of their content, take a look at UITable.
  12. /// </summary>
  13. using System;
  14.  
  15. [AddComponentMenu("NGUI/Interaction/GridPivot")]
  16. public class UIGridPivot : UIWidgetContainer
  17. {
  18.     public enum Arrangement
  19.     {
  20.         Horizontal,
  21.         Vertical,
  22.     }
  23.    
  24.     public enum Pivot
  25.     {
  26.         TopLeft,
  27.         TopCenter,
  28.         TopRight,
  29.         MiddleLeft,
  30.         MiddleCenter,
  31.         MiddleRight,
  32.         BottomLeft,
  33.         BottomCenter,
  34.         BottomRight
  35.     }
  36.    
  37.     /// <summary>
  38.     /// Where should the Pivot point of the grid be?
  39.     /// </summary>
  40.    
  41.     public Pivot pivot;
  42.    
  43.     /// <summary>
  44.     /// Type of arrangement -- vertical or horizontal.
  45.     /// </summary>
  46.    
  47.     public Arrangement arrangement = Arrangement.Horizontal;
  48.    
  49.     /// <summary>
  50.     /// Maximum children per line.
  51.     /// If the arrangement is horizontal, this denotes the number of columns.
  52.     /// If the arrangement is vertical, this stands for the number of rows.
  53.     /// </summary>
  54.    
  55.     public int maxPerLine = 0;
  56.    
  57.     /// <summary>
  58.     /// The width of each of the cells.
  59.     /// </summary>
  60.    
  61.     public float cellWidth = 200f;
  62.    
  63.     /// <summary>
  64.     /// The height of each of the cells.
  65.     /// </summary>
  66.    
  67.     public float cellHeight = 200f;
  68.    
  69.     /// <summary>
  70.     /// Whether the grid will smoothly animate its children into the correct place.
  71.     /// </summary>
  72.    
  73.     public bool animateSmoothly = false;
  74.    
  75.     /// <summary>
  76.     /// Whether the children will be sorted alphabetically prior to repositioning.
  77.     /// </summary>
  78.    
  79.     public bool sorted = false;
  80.    
  81.     /// <summary>
  82.     /// Whether to ignore the disabled children or to treat them as being present.
  83.     /// </summary>
  84.    
  85.     public bool hideInactive = true;
  86.    
  87.     /// <summary>
  88.     /// Reposition the children on the next Update().
  89.     /// </summary>
  90.    
  91.     public bool repositionNow { set { if (value) { mReposition = true; enabled = true; } } }
  92.    
  93.     bool mStarted = false;
  94.     bool mReposition = false;
  95.    
  96.     void Start ()
  97.     {
  98.         mStarted = true;
  99.         bool smooth = animateSmoothly;
  100.         animateSmoothly = false;
  101.         Reposition();
  102.         animateSmoothly = smooth;
  103.         enabled = false;
  104.     }
  105.    
  106.     void Update ()
  107.     {
  108.         if (mReposition) Reposition();
  109.         enabled = false;
  110.     }
  111.    
  112.     static public int SortByName (Transform a, Transform b) { return string.Compare(a.name, b.name); }
  113.    
  114.     /// <summary>
  115.     /// Recalculate the position of all elements within the grid, sorting them alphabetically if necessary.
  116.     /// </summary>
  117.    
  118.     [ContextMenu("Execute")]
  119.     public void Reposition ()
  120.     {
  121.         if (Application.isPlaying && !mStarted)
  122.         {
  123.             mReposition = true;
  124.             return;
  125.         }
  126.        
  127.         mReposition = false;
  128.         Transform myTrans = transform;
  129.  
  130.         // Current column
  131.         int column = 0;
  132.  
  133.         // Current row
  134.         int row = 0;
  135.        
  136.         List<Transform> list = new List<Transform>();
  137.        
  138.         for (int i = 0; i < myTrans.childCount; ++i)
  139.         {
  140.             Transform t = myTrans.GetChild(i);
  141.             if (t && (!hideInactive || NGUITools.GetActive(t.gameObject))) list.Add(t);
  142.         }
  143.        
  144.         if (sorted)
  145.         {
  146.             list.Sort(SortByName);
  147.         }
  148.  
  149.         int columns = list.Count - 1;
  150.         if (maxPerLine > 0)
  151.         {
  152.             columns = list.Count > maxPerLine ? maxPerLine : list.Count - 1;
  153.         }
  154.        
  155.         int rows = 1;
  156.         if (maxPerLine > 0)
  157.         {
  158.             rows = (int)Math.Ceiling((double)list.Count / maxPerLine);
  159.         }
  160.        
  161.         for (int i = 0, imax = list.Count; i < imax; ++i)
  162.         {
  163.             Transform currentChild = list[i];
  164.            
  165.             if (!NGUITools.GetActive(currentChild.gameObject) && hideInactive) continue;
  166.            
  167.             float depth = currentChild.localPosition.z;
  168.             Vector3 pos = new Vector3(0, 0, depth);
  169.            
  170.             switch (pivot)
  171.             {
  172.                 case Pivot.TopLeft:
  173.                 case Pivot.TopCenter:
  174.                 case Pivot.TopRight:
  175.                     pos.y = -cellHeight * row;
  176.                     break;
  177.                 case Pivot.MiddleLeft:
  178.                 case Pivot.MiddleCenter:
  179.                 case Pivot.MiddleRight:
  180.                     pos.y = -cellHeight * (-rows / 2f + row + 0.5f);
  181.                     break;
  182.                 case Pivot.BottomLeft:
  183.                 case Pivot.BottomCenter:
  184.                 case Pivot.BottomRight:
  185.                     pos.y = -cellHeight * (row + 1 - rows);// -cellHeight * lines + cellHeight * y;
  186.                     break;
  187.                 default:
  188.                     break;
  189.             }
  190.            
  191.             switch (pivot)
  192.             {
  193.                 case Pivot.TopLeft:
  194.                 case Pivot.MiddleLeft:
  195.                 case Pivot.BottomLeft:
  196.                     pos.x = cellWidth * column;
  197.                     break;
  198.                 case Pivot.TopCenter:
  199.                 case Pivot.MiddleCenter:
  200.                 case Pivot.BottomCenter:
  201.                     pos.x = cellWidth * (-columns / 2f + column); // -cellWidth * (columns / 2f) + cellWidth * x;
  202.                     break;
  203.                 case Pivot.TopRight:
  204.                 case Pivot.MiddleRight:
  205.                 case Pivot.BottomRight:
  206.                     pos.x = cellWidth * (column - 1 - columns);
  207.                     break;
  208.                 default:
  209.                     break;
  210.             }
  211.            
  212.             if (animateSmoothly && Application.isPlaying)
  213.             {
  214.                 SpringPosition.Begin(currentChild.gameObject, pos, 15f);
  215.             }
  216.             else currentChild.localPosition = pos;
  217.            
  218.             if (++column >= maxPerLine && maxPerLine > 0)
  219.             {
  220.                 column = 0;
  221.                 ++row;
  222.             }
  223.         }
  224.        
  225.         //Debug.LogError(transform.localPosition + " total width : " + totalWidth);
  226.        
  227.         UIScrollView drag = NGUITools.FindInParents<UIScrollView>(gameObject);
  228.         if (drag != null) drag.UpdateScrollbars(true);
  229.     }
  230. }

Pages: [1] 2 3