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

Pages: [1]
1
Understood, thank you

2
And I made a class derived from UIButton, and methods OnEnable(), OnClick() are overrided now. I don't understand how does void OnClick() work, when class inherited not from UIButton, but from MonoBehaviour?

3
SetState(State.Disabled, false); cause an error: "The variable tweenTarget of buttonClick has not been assigned". What am I doing wrong?

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4.  
  5. public class buttonClick : UIButton
  6. {
  7.     protected override void OnClick()
  8.     {
  9.         Debug.Log("Super Effect!");
  10.     }
  11.  
  12.     protected override void OnEnable()
  13.     {
  14.    
  15.         StartCoroutine(wait(0));
  16.         Debug.Log("OnEnable()");
  17.     }
  18.    
  19.  
  20.     public void Init(Vector3 indent, System.Action action, EventDelegate.Callback callback)
  21.     {
  22.         this.indent = indent;
  23.        
  24.         this.Clicked = action;
  25.         this.callback = callback;
  26.  
  27.         UIEventTrigger trigger = GetComponent<UIEventTrigger>();
  28.         EventDelegate.Add(trigger.onHoverOut, callback);
  29.     }
  30.  
  31.     IEnumerator wait(float waitTime)
  32.     {
  33.         yield return new WaitForSeconds(waitTime);
  34.  
  35.         transform.localPosition += this.indent;
  36.         SetState(State.Disabled, false); // Error
  37.     }}
  38.  

4
NGUI 3 Support / UIEventTrigger access
« on: March 28, 2014, 03:17:59 AM »
How should i set from the script?:
onHoverOut
onPress
onRelease
in UIEventTrigger added to the UIButton

5
NGUI 3 Support / NGUI UIButton transform.localPosition
« on: March 28, 2014, 02:44:54 AM »
I created prefab via code, and then i trying to change position of this button. I add this script to the button

  1. public class buttonClick : MonoBehaviour
  2. {
  3.     public System.Action Clicked;
  4.     public Vector3 indent;
  5.  
  6.     void OnClick()
  7.     {
  8.         Debug.Log("Super Effect!");
  9.         Clicked();
  10.     }
  11.  
  12.     // I invoked this method from ButtonsManager
  13.     public void Init(Vector3 indent, System.Action action)
  14.     {
  15.         this.indent = indent;
  16.         this.Clicked = action;
  17.  
  18.         StartCoroutine(wait(0));
  19.     }
  20.  
  21.     // translation works only in Coroutine
  22.     IEnumerator wait(float waitTime)
  23.     {
  24.         yield return new WaitForSeconds(waitTime);
  25.         transform.localPosition += this.indent;
  26.     }
  27.  
  28.     void OnEnable()
  29.     {
  30.         Debug.Log("OnEnable" );
  31.     }
  32. }
  33.  

transform.localPosition changes take effect only after this frame. Simple transform.localPosition += this.indent; without StartCouroutine() doesn't effect on button position! I guess this is because of NGUI change this position in this frame.

So how should i properly change button position right after initialization!

6
NGUI 3 Support / Re: Error occurs when i import NDATA after NGUI
« on: March 26, 2014, 05:09:50 AM »
but i trying to solve this.

Localization.instance.Get(key);

we need to replace it with

output += Localization.Get(key);

and what should i do with

protected override void ApplyNewValue (string newValue)
{
      _localize.key = newValue;
      _localize.Localize();
}

7
NGUI 3 Support / Re: Error occurs when i import NDATA after NGUI
« on: March 26, 2014, 04:37:53 AM »
How should i properly import NDATA to Unity?

8
NGUI 3 Support / Error occurs when i import NDATA after NGUI
« on: March 26, 2014, 04:36:06 AM »
Hello, i am new to NGUI. I imported NGUI 3.5.5 package in Unity, it works fine. All examples are working, and i don't receive any errors. But when i import NDATA package, errors appear:

In Unity Console
Assets/NData/NGUI/NData/NguiLocalizationKeyBinding.cs(18,27): error CS1061: Type `UILocalize' does not contain a definition for `Localize' and no extension method `Localize' of type `UILocalize' could be found (are you missing a using directive or an assembly reference?)   

So error appear at
protected override void ApplyNewValue (string newValue)
{
      _localize.key = newValue;
      _localize.Localize(); // ERROR
}

and in NguiUtils.cs
output += Localization.instance.Get(key);

When I comment this two lines, errors disappear!

Pages: [1]