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

Pages: 1 [2] 3 4 5
16
NGUI 3 Support / Re: My Big List of Anchor Complaints
« on: February 14, 2014, 05:46:36 PM »
1) This is definitely an issue. A prime example is if I have a label that I want to sit next to a button. If I use advanced anchors to set the label's anchor left to the button's right, then suddenly the width of the label is no longer settable *despite* the fact there's no anchor right set. This also disables the resize freely, forcing the label to be a specific width (whatever it is before I set the left anchor).
I've mentioned it before, the dimensions of a widget should only be disabled if BOTH achors on that axis are used. anchoring to the right side shouldn't require me to anchor the left side to rightside+desired width, I should just be able to set the right anchor and set the dimension.x.

2) I think what you're looking for is Unity's fixed game view size, not changing how anchors work with window size. Anchors *should* adapt to whatever resolution you're using, as they do.
If you want to have a fixed window size, look at game view, in the top left you can set a fixed aspect ratio or resolution, then if you resize it won't change the ratio of the gui.
However, in the Scene view, it'll keep jumping back to some default value defined by who-knows-what. For example I have a background that stretches to fill UIRoot (fill screen), that keeps jumping to a 4:3 ratio in scene view and 16:9 in game view. which is somewhat annoying... if UIRoot looked at the Gameview dimensions as a reference when sizing the GUI that might stop?

17
NGUI 3 Support / Only one tweenPosition plays at a time
« on: February 14, 2014, 05:30:22 PM »
And I've run into yet another problem trying to implement tweens.
I've got a "ticker" on the bottom, with headlines form left to right. what's supposed to happen is it adds a new item off screen to the left, then tweens all the headlines to the right based on the new items width (putting the new item in the bottom left corner).

This only works for the FIRST item, though, as every other item just jumps to the new position.

On a related note, is there a way to force the anchor resizing? the headline background/button is supposed to be the width of the label which works, but when I'm adding the item and tweening everything, the headline background width hasn't resized according to its anchors yet, so the width is wrong (uses the default prefab size). I got it to work by looking at the label's width and manually adding the sum of spacing around it, but that's not ideal.
(int width = 40 + 6 + uipLine.Label.width + 10;//icon+spacing+label+spacing)
  1. void AddActiveHeadline(Headline headline)
  2.         {
  3.                 Debug.Log("Adding Headline:" + headline.Title);
  4.                 //create GUI element
  5.                 UIPHeadlineButton uipLine = UIPHeadlineButton.Create(this.TickerBar, headline);
  6.                 //get width for positioning, tweens
  7.                 int width = uipLine.Background.width;//TODO returns INCORRECT WIDTH, not yet resized according to anchors
  8.                 //move new headline to bottomleft, off screen by width
  9.                 Vector3 offPos = uipLine.transform.localPosition;
  10.                 offPos.x -= width;
  11.                 uipLine.transform.localPosition = offPos;//move offscreen by width
  12.                 //add to active headlines
  13.                 this.ActiveHeadlines.Add(uipLine);             
  14.                 //slide headlines
  15.                 Debug.Log("Tweening Headlines");
  16.                 foreach (UIPHeadlineButton hdln in ActiveHeadlines)
  17.                 {
  18.                         hdln.TweenPos.SetStartToCurrentValue();
  19.                         //get "to" pos
  20.                         Vector3 pos = hdln.transform.localPosition;
  21.                         pos.x += width;
  22.                         hdln.TweenPos.to = pos;
  23.                         //play
  24.                         hdln.TweenPos.PlayForward();
  25.                 }
  26.         }
  27.  

EDIT: I've tried this with a for loop instead in case that was the problem, but same issue: only the first tween executes, and the other items just "jump" to the "to" position.
I also noticed a strange thing... If I click on the object in the inspector and activate the tween component, it stays active for as long as the tween *would* take to play, then jump to the end position and turns off. so it's acting like it's playing, but it's not actually animating out the tween.

  1. for (int i = ActiveHeadlines.Count-1; i>=0; i--)
  2.                 {
  3.                         UIPHeadlineButton hdln = ActiveHeadlines [i];
  4.                         hdln.TweenPos.SetStartToCurrentValue();
  5.                         //get "to" pos
  6.                         Vector3 pos = hdln.transform.localPosition;
  7.                         pos.x += width;
  8.                         hdln.TweenPos.to = pos;
  9.                         //play
  10.                         hdln.TweenPos.PlayForward();
  11.                 }
  12.  

18
NGUI 3 Support / Re: TweenPosition misaligning sprites at random?
« on: February 12, 2014, 07:56:32 PM »
Actually I am tweening the scrollview's parent. The base object is the menu's script and a panel which holds the window's gui bits, the top two buttons, and the two scrollviews (which in turn hold their own buttons). the tween is applied to the base menu/panel object.

It's frustratingly inconsistent with when it happens... perhaps it has something to do with the activation? the menus are stored deactivated, then when they're called, they activate (Menu.SetActive(true)), then the tween is set up, then its activated and slides onto the screen.

19
NGUI 3 Documentation / Re: UIButton
« on: February 09, 2014, 09:31:55 PM »
Thanks for clarifying! I wasn't sure why the difference was there, helpful to know.

20
NGUI 3 Support / Re: TweenPosition misaligning sprites at random?
« on: February 09, 2014, 09:28:56 PM »
Yeah, the two columns in the window are scroll views with buttons in them. Do tweens not work with scroll views? is there a way around this problem?

21
NGUI 3 Support / TweenPosition misaligning sprites at random?
« on: February 07, 2014, 04:38:55 PM »
Tweens in NGUI seem to always give me the most hassle... the latest problem:
I'm using TweenPosition.Begin(target, duration, to) to move a menu onto the screen; in the picture below, the Agency menu slides in from the right. The problem is it comes in looking like it does in tween2.png with misaligned sprites! if I refresh that window, alt+Tab out and into Unity, mouse over the buttons (adjusts the sprite UIButton's tweencolor.hover is pointing at) or basically do anything to make the logic update, it corrects the contents. Ideally, it looks right the entire time.

It's doing this for all the menus, though the sprites that are incorrectly shifted seems to always be the same (tween2 is always how agencymenu looks when tweened in), even though there's no difference in the actual prefabs used to make those buttons. It looks like they have the right transforms in Inspector, but they just don't show it 'till refreshed.

22
NGUI 3 Documentation / Re: UIButton
« on: February 07, 2014, 01:22:04 PM »
If the collider is disabled, so is the button.

Button OnClick notification is an NGUI EventDelegate, which has a "void FuncName()" signature. To get the button that was clicked, use UIButton.current.

Hm, I've tried disabling the collider, and while the button was disabled in functionality, the color did not change to disabled unless I directly changed the "isEnabled" property on UIButton.

And I meant the UIEventListener.Get(btn).OnClick still uses the void method(Gameobject obj) format, while the *other* onclick on the button is the void method() with UIButton.current. Is there a reason these use different calls? is UIEventListener going to be updated to use the parameterless void method and UIButton.current as well, or is there a reason it still has the gameobject parameter?

23
Heyo! So I have a UIPLabel which is simply a label with a button behind it that expands to fit the label as it gets longer, and a title on top.


However, The actual dimensions of the base widget (shown in the picture below) *were* hardcoded to the size of the titlebox. The problem with this is when the widget's dimensions go off the scrollview, the REST of the widget (the expanding labelButton) is culled!


I tried setting the base widget's dimensions to anchor to the Buttons, ensuring it wont be prematurely culled when scrolling... except this makes the whole label box float up into the scrollview, wavering left and right seemingly at random.


If I remove the anchors from the base widget it stops floating away, but then the old problem of the label being prematurely culled is back.


Is this a bug with anchoring to a resizing label? Or something else?

24
NGUI 3 Documentation / Re: UIButton
« on: February 05, 2014, 02:35:24 PM »
What determines if the button should be set to the Disabled color?
Also, is the event system that needed "void MethodName(gameObject ClickedButton)" no longer being used?

25
NGUI 3 Support / Re: User-Selected Font?
« on: February 05, 2014, 01:54:30 PM »
This method does not support Dynamic fonts.
Yeah that's the problem... Can't seem to make a reference font for/with my dynamic font.

26
NGUI 3 Support / User-Selected Font?
« on: February 04, 2014, 02:10:04 PM »
Hi, I was wondering what the best way to implement a custom font selection on the user side with NGUI would be. This would entail changing the font selection in every label already in the scene, as well as the fonts on the prefabs (or at least, change them as soon as they're instantiated).

I don't know if this is something where I should be putting a script on everything with a label and have it check or subscribe to some FontSelectionChanged event, or have one script that finds all the labels and changes them (in the prefabs as well, or modify the prefab create methods to load the current font of choice).

Has anyone built something similar?

(Side note: It's hard to find useful posts about fonts, because most search terms just pull up the tons of dynamic and bitmap font problem threads, so sorry if this was asked before and I didn't see the thread)

27
NGUI 3 Support / Re: Run reposition method in editor for Table?
« on: January 22, 2014, 12:59:23 PM »
Right click on UITable/grid component in the inspector, select execute. it runs the code once and sorts them as it would on play!

28
NGUI 3 Support / Code design: updating the widgets in a scroll view
« on: January 22, 2014, 12:54:51 PM »
I figure someone on here's tried the same thing and hit the same problem, though this isn't a problem with NGUI specifically but rather a design issue that i think a lot of NGUI users have faced.

I have a scrollview that shows a list of widgets based on the contents of a list (i.e. a list of buttons for each character, or an inventory, etc. drawing from list<Character> or list<InventoryItem>). What's the best way to keep the list up to date with changes?

Ideally, I can give the UIPList.cs script a list<>, have it figure out the contents, make buttons, and post them. This all works so far, but if something is added or removed from the list, it won't update. I considered checking the list.count and updating if it changed, but worried the list might remove and add something in one process, missing the check and not updating. I've also tried adding a DestroyedEvent to an object which works for tracking when to remove things, but is a bit clunky to add to everything and doesn't catch for adding things (which would require another event in the create method, further clunkiness).

Has anyone made something to this effect? any clever solutions?

29
Based on your original question, I use this awkward workaround... all my grids/tables have UIWidgets (via invisible widget, then adding the uigrid/table) on them that are set to anchor to the scroll view, but are *disabled*. I enable them for a hot second when the game starts to "align" the tables/grids, then disable them again immediately. this puts the tabled in the right spot for the resolution resize. I disabled changing the window size during the game, but you could jsut as easily add a script that will check if the window size changes, enables the anchor widgets as long as it is, and disables them again once the window stops changing size.

But yeah, having pivot points for tables would be nice. There's a user's script on here somewhere that makes an attempt at it in a similar thread about tables/pivots, if the above hacky solution isn't what you want.

30
NGUI 3 Documentation / Re: UICamera
« on: January 20, 2014, 05:39:27 PM »
I have a clunk 'schedule' system that lets my various classes trigger after so much time, but is there a way to use NGUI's existing comprehensive event system for such things? I saw an example of using the event system somewhere but I can't seem to find it again (most of the links just point to very outdated posts), and this is the closest thing I can find to mentioning them at all, but it says nothing about how to use the event system to add or remove your own timers/delegates/etc.

Pages: 1 [2] 3 4 5