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

Pages: [1]
1
Problem: The problem was that I did not let any update happen between adding the items to the grid, and starting the Tweener.
Solution: Now that I trigger the Tweener during an Update. Everthing works as expected.

2
Hi,

thank you for the fast reply.

Yes, I have looked at your example but but it uses animations which would be to much overhead for my project.

Using TweenPosition.Begin results in the same strange behavior. (The animation itself works as expected, but parts of the menu disapears)

Below the important parts.
  1.         public void doFadeOut(){
  2.                 TweenPosition.Begin(this.gameObject, 1f, new Vector3(-432, -48, 0));
  3.                 currentState = State.FADE_OUT;
  4.         }
  5.  
  6.         public void doFadeIn(){
  7.                 transform.position = transform.parent.TransformPoint(new Vector3(432, -48, 0));
  8.                 NGUITools.SetActive(gameObject, true);
  9.                 TweenPosition.Begin(this.gameObject, 1f, new Vector3(0, -48, 0));
  10.                 currentState = State.FADE_IN;
  11.         }
  12.  
  13.         // Started after the animation ends
  14.         public void performStateAfterFade(){
  15.                 if(currentState == State.FADE_IN){
  16.                         currentState = State.VISIBLE;
  17.                 }else{
  18.                         currentState = State.HIDDEN;
  19.                         NGUITools.SetActive(gameObject, false);
  20.                 }
  21.         }
  22.  
  23.  

Attached few images to makes it more clear.

Initial state first menu(1) is Active, 2nd menu(2) is Inactive.

[init.png] Initial screen after start.
[item_clicked.png] If an item was selected the method "doFadeOut" is started on the current menu(1) and "doFadeIn" on the next menu(2).
[back_toOverview.png] Pressing "Overview" Button triggers "doFadeOut" for the current one menu(2) and "doFadeIn" for the menu(1).
[item_clicked_again.png] Selcting another item from menu(1) does the same like in [item_clicked.png]. Starts method fadeOut on menu(1) and fadeIn on menu(2)

I had the same behavior in menu(1) also.

If I do not change the "from" or "to" of the current Tween items does not dissapear.

Thank you very much.



3
Hi,  (I use 3.6.6)

i have a menu where a new menu fades in from right to center. When another menu is selected the current menu fades out from center to left while the new menu fades in from right to center.

I have tried different approaches for hours. The most promising was after the menu is triggered to fade out, I first manupulate the "to" values and simply play reverse. Like "transform.GetComponent<TweenPosition>().from = new Vector3(0, -48, 0);"
=> This results in very strange things like dissapearing parts of the menu. Clicking somewhere does make them appear again. When i remove the changes in TweenerPosition.to they does not dissapear.

Btw. I do use NGUITools.SetActive(gObj, true/false) after a menu is triggered to appear and to dissapear.

A hint would be very kind. If it helps I will try to seperate this behavior into an example file.

Thank you very much.

4
NGUI 3 Support / Re: Passing Instance References Via EventDelegate
« on: June 22, 2014, 07:03:59 PM »
I got a working example its all in one class called MyClass

  1. public class MyClass: MonoBehaviour {
  2. ...
  3.     // Used to make a reference to the value of the parameter for the method you want to call.
  4.     // Used for EventDelegate.Parameter.Set(...
  5.     public string ITEM_VALUE = "XXX";
  6. ...
  7.  
  8.     public void init(){
  9.        
  10.         //EventDelegate to call method test in the same class with a given parameter where the value is ITEM_VALUE
  11.         EventDelegate eventDel = new EventDelegate();
  12.         //Target object
  13.         eventDel.target = this;
  14.         //Method name
  15.         eventDel.methodName = "test";
  16.        
  17.         //EventDelegate.Parameter for the parameter in the methode defined before
  18.         //First parameter is the object which contains the attribute wich has the name of the second parameter
  19.         EventDelegate.Parameter p = new EventDelegate.Parameter(this, "ITEM_VALUE");
  20.         eventDel.parameters.SetValue(p, 0);
  21.         EventDelegate.Set(isbn.GetComponentInChildren<UIButton>().onClick, eventDel);
  22. ...
  23.     public void test(string panelName){
  24.         Debug.Log("Test was pressed: " + panelName);
  25.     }
  26. ...
  27.  

Output after a click on the button:
Test was pressed: XXX

Drop a comment if you cant to adjust it to your exsample.

Have fun.

Edit: comments

Pages: [1]