“名称''在当前上下文中不存在”

时间:2013-07-23 13:17:27

标签: c# unity3d

使用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 = panel;     touchable.parentUIObject = panel;

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();
}
}

0 个答案:

没有答案