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

Pages: [1]
1
Unchecking that checkbox will make it draggable even if it fits.

It already is unchecked (see the video), it's dragging fine. The issue is that it's just not Springing Back to the right place when it exceeds the lower bound (when the lower bound is moved / despite the bound being invalidated).

Video Link: https://www.dropbox.com/s/3hlo04c9zezfp73/scrollview_spring_not_updating.m4v?dl=0

To clarify what I mean:
- In the video I pull down a list between 0:02-0:04 seconds in.
- I switch to the "Education" list (in which the scrollviews contents wouldn't fill the full scroll view area).
- The scroll bar's lower bounds have moved as is shown in the scene view to compensate for this.
- The bounds have been invalidated (viewable at the end of the video in script).
- At 0:09 I try pull the content of the scroller below the lower bound of the UIScrollView.
- It doesn't bounce back.
- Notice it does bounce back then it exceeds the upper bound (as this bound hasn't moved).
- Despite "InvalidateBounds" being called, the SpringPosition component isn't being re-enabled / triggered at the correct point when the contents exceeds the lower bound.

2
Hey, as mentioned; I need it to be draggable (even if it fits) as I have a pull-down-to-refresh style system in place as mentioned in the initial post.

Additionally I've tried calling InvalidateBounds (See the end of the video where I have tried InvaliteBounds and lots of other things) and it's not working / it doesn't appear to be actually updating the bounds.

(The "UpdateScrollerSize" function is called immediately after new content is put into the ScrollView.)

3
Hey,
So I've got a scroll view with some content inside. Sometimes the content doesn't fill the full height of the scrollview, however I need it to still be draggable (as I have it then updating content on pull-down in a similar way to the facebook app etc). So I'm re-sizing the scrollview to the size/height of the content in instances where the content is smaller than the height.

The issue is that once the lower-anchor has been moved to reduce the height down to the size of the content, the position at which the "Spring Panel" kicks in appears to not be updated.

This video highlights the issue in a way that's likely clearer than my (admittedly shit) attempt at an explanation: https://www.dropbox.com/s/3hlo04c9zezfp73/scrollview_spring_not_updating.m4v?dl=0

You'll notice when the content over-flows it all bounces back fine, but when the content is smaller than the scroll view and I adjust the scrollviews anchor to suit, I can drag the content below the lower bound of the scroll view and it doesn't bounce back.

I've tried forcing updates / resets on everything I can think of to no avail (as seen at the end of the clip). So really I could just use some guidance as to how to go about getting the Spring Panel trigger to also be updated to suit the new scrollview anchors?

Many thanks!

4
NGUI 3 Support / Re: Optimisation Question - UIPanel.LateUpdate
« on: June 25, 2015, 10:02:01 PM »
That did the trick!

Awesome, thanks :).

5
NGUI 3 Support / Re: Optimisation Question - UIPanel.LateUpdate
« on: June 23, 2015, 09:24:33 PM »
This is where I'm at now... All the UIRect.Update costs are negligible / most things are only updated when needed.

The issue I'm running into is UIPanel.LateUpdate sucking up a lot of performance both:
- When moving the parent transform of all the "screens" in order to show the side bar.
- When re-populating a UIScrollList (with items that are already in the scene; just swapping them in/out and repositioning the table).

So basically I could just do with some tips as to scene structure in terms of ensuring UIPanel.LateUpdate doesn't have quite so much to do when a single parent / few transforms are just being moved or tweened.

6
NGUI 3 Support / Re: Optimisation Question - UIPanel.LateUpdate
« on: June 23, 2015, 10:48:47 AM »
I have anchored elements, however in terms of trying to minimize impact on UIPanel.LateUpdate I'm anchoring only within a given panel and (now) the majority of anchoring is done only on start / triggered in code as a one-off only when needed.

However I'm still getting a serious UIPanel.LateUpdate performance hit when tweening the UIPanel that's the parent of all the others.

7
NGUI 3 Support / Optimisation Question - UIPanel.LateUpdate
« on: June 19, 2015, 06:19:18 AM »
Hey,
so; first off thanks for all the help in the previous threads ArenMook, it's been really helpful in getting me up to speed with NGUI.

Now onto the new question... I'm running into one small optimisation issue with UIPanel.LateUpdate in that my structure is as follows:

Parent(UIPanel)
-- Side Bar(UIPanel)
--- Lots of items here (UI Widgets and some Panels)
-- Main Screen(UIPanel)
--- Some Page(UIPanel)
---- Lots of items here (UI Widgets and some Panels)
--- Some Page(UIPanel)
---- Lots of items here (UI Widgets and some Panels)
--- Some Page(UIPanel)
---- Lots of items here (UI Widgets and some Panels)

This basically is a mobile sidebar whereby it comes in from the left, with the main screen moving right to accommodate. Anyway I'm tweening the Parent UIPanel to move it all over when the side bar is toggled.

Having searched the forum it seemed to suggest that each UIPanel would batch it's child objects into a mesh / single drawcall, so I structured it with lots of UI panels where by I accepted the increased drawcall count assuming if I moved the "Parent" UIPanel, it would only have to move the child UIPanels without really needing to update anything / much of a performance cost.

Unfortunately when I'm tweening the Parent, despite this structure, I'm still getting some a noticeable performance hit... All that's happening during this hike in UIPanel.LateUpdate is that the single parent object is being tweened; so it leads me to assume I'm doing something wrong in terms of the structure.

My question being - what should I be doing differently?

(p.s. I know I have more in UIRect.Update than I need to / am in the process of going thru and turning all the ones suitable to OnEnable).

8
NGUI 3 Support / Re: Anchors issue - background encompass content
« on: June 17, 2015, 08:47:25 AM »
Ok it looks like -(event_description.GetSides(transform)[1].y - event_description.height) but only if I wait 1 frame between changing the "event_description" text.

Is there anyway to force the text update and GetSides update instantly without having to wait a frame?

I also appear to be having similar issues with some of the other text items anchored to text items they're anchored to. The bottom isn't anchored reported correctly in all instances when I call UpdateAnchors(), despite having updated the text of the given UILabel prior to this and having called Update() on the label prior to calling GetSides.

Full Code:


  1.        
  2. public void Init (SomeClass evt)
  3.         {
  4.                 the_thing = evt;
  5.                 time_label.text = the_thing.event_time.ToString();
  6.                 distance_label.text = the_thing.Distance();
  7.                 description.text = the_thing.description;
  8.  
  9. // time_label is anchored to the top of background_sprite
  10.                 time_label.UpdateAnchors();
  11.                 time_label.Update();
  12.  
  13. // distance_label is anchored to the bottom of time_label
  14.                 distance_label.UpdateAnchors();
  15.                 distance_label.Update();
  16.  
  17. // description is anchored to the bottom of distance_label
  18.                 description.UpdateAnchors();
  19.                 description.Update();
  20.  
  21.                 StartCoroutine(ResizeBG());
  22.         }
  23.  
  24.         IEnumerator ResizeBG()
  25.         {
  26.                 yield return new WaitForEndOfFrame();
  27. // Gets the local position at the bottom of the final text item to determine the background height.
  28.                 int height_val = Mathf.RoundToInt(-description.GetSides(transform)[3].y);
  29.                 background_sprite.height = height_val;
  30.         }
  31.  

Edit: I've also attempted calling ProcessText () and UpdateNGUIText (); on the labels ahead of calling the anchor functions in the hope it was just that the text was updating after the anchors were updated, however this didn't change anything / the background sprite still ended up the wrong size is a 1 frame wait wasn't included.

I should also mention at this point that this "group of text items" forms part of an item to be placed in a UITable list, so I need all of the height and stuff updated immediately so that I can Reposition the table holding them once Init on all the items is complete.

9
NGUI 3 Support / Re: Anchors issue - background encompass content
« on: June 17, 2015, 07:24:29 AM »
So I think the issue is that it is circular.

I have the background anchored to the top of the first item.

I then have the background also anchored to the bottom of the last item (so as to encompass a few items all anchored together). I've get the pivot point of the background to the top center thinking it would just scale the height via the anchor, but I guess this won't work.

If circular anchors aren't suitable then what would be the idea way to implement this instance where by I have a background that needs to scale to cover the backing of multiple anchored elements?

Essentially my structure is:

Top of background (anchored to the top of the first text item).
-- Text.
-- Text anchored to the bottom of the above.
-- Text anchored to the bottom of the above.
Bottom of background (anchored to the bottom of the last text item).

Is there a way of figuring out the height from the top of the first item to the bottom of the last and just setting the background height to that? I've attempted finding the difference between top_text.GetSides(transform)[1].y and bottom_text.GetSides(transform)[3].y but that doesn't appear to return the correct height value?

10
NGUI 3 Support / Anchors issue - background encompass content
« on: June 16, 2015, 09:44:48 AM »
Ok so I'm trying to use anchors to position some items essentially my structure is this:

Background of the prompt.

 -- A texture that is anchored to the top of the background at 0, left of the background at 0, right of the background at 0 and has no bottom anchor, with an aspect of 2.
 --Some text, anchored to the left of the background at 0, right of the background at 0 and the top anchor is set to the bottom of the texture (aka should be right below it.)
-- Some more text anchored to the bottom of the previous text, with left and right anchored to the background.
-- Finally I anchor the bottom of the background to the bottom of the text (so it encompases the full text / images).

(Basically I want everything to stick to the background width, be arranged below the previous item regardless of size, and for the background to encompass the lot). At this point I should note that the text is being updated at runtime, but before the item is enabled (although in the same frame).

Now, after trying OnEnable with the anchors that hasn't worked; I presumed because the anchoring happened in the wrong order.

I've now tried to include anchor updating in my script:

  1.         public UISprite background_sprite;
  2.         public UITexture header_image;
  3.         public UILabel time_label;
  4.         public UILabel event_description;
  5.  

  1.        
  2.  
  3. background_sprite.UpdateAnchors();
  4.  
  5. header_image.aspectRatio = 1.0f / orca_event.cover_image_ratio;
  6. time_label.text = orca_event.event_time.ToString();
  7. event_description.text = orca_event.event_description;
  8.  
  9. header_image.UpdateAnchors();  
  10. time_label.UpdateAnchors();
  11. event_description.UpdateAnchors();
  12. background_sprite.UpdateAnchors();
  13.  
  14.  

Most of this all works as expected; apart from the background which is still over-sized / has a height higher than that of the content (loads of space a the bottom). It'd be great to know what I'm doing wrong as for the life of me I don't know what I'm doing wrong.

11
NGUI 3 Support / UITable Reposition not working correctly?
« on: June 13, 2015, 01:28:04 PM »
Hi,
So basically I have a scrollview, utilising a UITable.

Within this table I have some items, some of which are dynamically updated once I get a list of items from the server.

I have the following code which positions the items as children of an item in the table, and then expands the table item (the background of the list) to match the height... I then call reposition on the table.

  1.                 foreach(GameObject obj in spawned_catagory_items)
  2.                 {
  3.                         NGUITools.Destroy(obj);
  4.                 }
  5.                 spawned_catagory_items.Clear();
  6.                 create_event_table_page1.Reposition();
  7.                 bool left_side = true;
  8.                 int position = 0;
  9.                 for(int i=1; i< UserSettings.catagories.Count; i++)
  10.                 {
  11.                         if(left_side)
  12.                         {
  13.                                 left_side = false;
  14.                                 GameObject cat_item = NGUITools.AddChild(catagory_segment, catagory_toggle_prefab_left);
  15.                                 NGUITools.SetActive     (cat_item,true);       
  16.                                 cat_item.GetComponent<CatagoryToggler>().UpdateCat(UserSettings.catagories[i]);
  17.                                 spawned_catagory_items.Add(cat_item);
  18.                                 cat_item.transform.localPosition = new Vector2(0,-85 - (position * 70));
  19.                         }
  20.                         else
  21.                         {
  22.                                 left_side = true;
  23.                                 GameObject cat_item = NGUITools.AddChild(catagory_segment, catagory_toggle_prefab_right);
  24.                                 NGUITools.SetActive     (cat_item,true);       
  25.                                 cat_item.GetComponent<CatagoryToggler>().UpdateCat(UserSettings.catagories[i]);
  26.                                 spawned_catagory_items.Add(cat_item);
  27.                                 cat_item.transform.localPosition = new Vector2(0,-85 - (position * 70));
  28.                                 position++;
  29.                         }
  30.                 }
  31.  
  32.                 catagory_segment_sprite.height = 85 + (position * 70);
  33.                 create_event_table_page1.Reposition();
  34.  

The issue being that it's not actually repositioning the items and I end up with items overlaying each other.

Attached are screenshots of what I'm getting as a result, and a screenshots of the intended result (repositioned in the editor).

I guess the method I'm using to add items doesn't work with NGUI, but it would be great to get some indication as to how I should go about doing this.

Many thanks.




Pages: [1]