FairyGui中按鈕單擊和雙擊點擊傳遞數據

通過控件的 data 傳遞

1、單擊事件

this.fui.playerOperCodeComp.btnGai.self.onClick.Set(OnPlayerOperCodeClick);
this.fui.playerOperCodeComp.btnGai.self.data = TexasPokerOperateType.PASS;

private void OnPreOperCodeClick(EventContext context)
{
	int typeId = (int) (context.sender as GObject).data;
	Log.Info( "OnPreOperCodeClick code->"+typeId );
}

2、雙擊事件

/// <summary>
/// 列表雙擊事件
/// </summary>
/// <param name="context"></param>
void onClickItem(EventContext context)
{
	if (context.inputEvent.isDoubleClick)
	{
		GComponent obj = (GComponent) context.data;
		BaseRoomInfo baseRoomInfo = obj.data as BaseRoomInfo;
	}

}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章