1. Tooltip on mobile (OnTooltip )
tne OnTooltip is designed for mouse.
could you add a new trigger type which is called by press?
that is for mobile platform
2. UISwitch
the UIToggle only active/deactive the foreground sprite,
could you add UISwitch which is inheritance UIToggle, which switch the sprites instead of set foreground sprite active state?
UIToggle: on-> sprite active, background active, off-> sprite deactive, background active
UISwitch: on-> sprite active, background deactive, off-> sprite deactive, background active
3. Tweens by multi inputs
here is a example for TweenPosition => TweenPositions
using UnityEngine;
public class TweenPositions : UITweener
{
// change 1
//public Vector3 from;
//public Vector3 to;
// --
public Vector3[] toPositions;
// --change 1
[HideInInspector]
public bool worldSpace = false;
Transform mTrans;
UIRect mRect;
public Transform cachedTransform { get { if (mTrans == null) mTrans = transform; return mTrans; } }
public Vector3 value
{
get
{
return worldSpace ? cachedTransform.position : cachedTransform.localPosition;
}
set
{
if (mRect == null || !mRect.isAnchored || worldSpace)
{
if (worldSpace) cachedTransform.position = value;
else cachedTransform.localPosition = value;
}
else
{
value -= cachedTransform.localPosition;
NGUIMath.MoveRect(mRect, value.x, value.y);
}
}
}
void Awake () { mRect = GetComponent<UIRect>(); }
// chage 2
//protected override void OnUpdate (float factor, bool isFinished) { value = from * (1f - factor) + to * factor; }
// --
protected override void OnUpdate (float factor, bool isFinished)
{
float blockSize = 1f / ( toPositions.Length - 1 );
int index = (int)( factor / blockSize );
float realFactor = factor % blockSize;
if( index == toPositions.Length - 1 )
{
index -= 1;
realFactor = blockSize;
}
value = toPositions[index] * (blockSize - realFactor) / blockSize + toPositions[index+1] * realFactor / blockSize ;
}
// --chage 2
// change 3
// static public TweenPosition Begin (GameObject go, float duration, Vector3 pos)
// {
// TweenPosition comp = UITweener.Begin<TweenPosition>(go, duration);
// comp.from = comp.value;
// comp.to = pos;
// --
static public TweenPositions Begin (GameObject go, float duration, Vector3 pos, params Vector3[] extraPos)
{
TweenPositions comp = UITweener.Begin<TweenPositions>(go, duration);
System.Collections.Generic.List<Vector3
> temp
= new System.Collections.Generic.List<Vector3
>( extraPos
); temp.Insert( 0, pos );
temp.Insert( 0, comp.value );
comp.toPositions = temp.ToArray();
// --change 3
if (duration <= 0f)
{
comp.Sample(1f, true);
comp.enabled = false;
}
return comp;
}
}
4. Note for scripting
some use of NGUI of me are wrong.i found that when i asked some question or browsed the NGUI forum.
e.g. i should call NGUITools.AddChild instead of Instantiate the prefab by myself.
the fact is , users don't know the rules (and sometimes the rules were changed after version update ), could you add a scripting note page and list the roles for users?