【酷熊科技】工作积累 ----------- Unity3D button 回调事件

通过 UIButton.current.name 获取当前点击的按钮的名字

 1     public void OnClickBtnBuy()
 2     {
 3         int costRmb = 0;
 4         int itemId = 0;
 5         int actPaymentId = 50; // 这个是固定写死的,前后端商量好的,
 6         switch (UIButton.current.name)
 7         {
 8             case "btnBuyLeft":
 9                 {
10                     costRmb = this.listDailyRechargeItem[0].rmb_cost;
11                     itemId = this.listDailyRechargeItem[0].id;
12                 }
13                 break;
14 
15             case "btnBuyRight":
16                 {
17                     costRmb = this.listDailyRechargeItem[1].rmb_cost;
18                     itemId = this.listDailyRechargeItem[1].id;
19                 }
20                 break;
21         }
原文地址:https://www.cnblogs.com/dudu580231/p/5949748.html