使用 Unity 3d 和 C# 我正在尝试创建一个按钮,在 .onTouchUpInside 上将触发动画以隐藏 2 个按钮,截取屏幕截图并再次显示按钮。动画和截屏方法都独立工作。他们一起工作能够隐藏一个按钮。
但是当我尝试将辅助按钮放在它提出的方法中时
当前上下文中不存在名称“”
var touchable = UIButton.create( "CameraUp.png", "CameraUp.png", 0, 0 );
//touchable.onTouchUpInside += ( sender ) => StartCoroutine( TakeScreenshot(this) );
touchable.onTouchUpInside += ( sender ) => StartCoroutine( hidebuttonani(touchable, info) );
touchable.onTouchUpInside += ( sender ) => Debug.Log( "Camera button pressed " );
var info = UIButton.create ("FacebookIcon.png", "FacebookIcon.png", 0, 0);
var alertTitle = new string[] { "testing" };
info.onTouchUpInside += ( sender ) => EtceteraBinding.showAlertWithTitleMessageAndButtons( "hi ", "yest ", alertTitle );
// UIObjects 可以像面板一样组合在一起使用 var panel = new UIObject(); info.parentUIObject = 面板;touchable.parentUIObject = 面板;
StartCoroutine( hidebuttonani( panel ) );
}
private IEnumerator hidebuttonani ( UIObject sprite )
//private IEnumerator hidebuttonani (UIButton touchable, UIButton Info)
{
if ( true )
{
var ani = sprite.alphaTo( 0.01f, 0f, Easing.Linear.easeIn );
StartCoroutine( TakeScreenshot(this) );
yield return new WaitForSeconds (1);
ani.autoreverse = true;
yield return ani.chain();
ani = sprite.alphaTo( 01f, 0f, Easing.Linear.easeOut );
yield return ani.chain();
ani = sprite.alphaTo( 0.7f, 1.0f, Easing.Linear.easeOut );
yield return ani.chain();
}
}