You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
605 B
25 lines
605 B
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
|
|
public class ToggleClick : Toggle |
|
{ |
|
public Toggle toggle; |
|
[OnlyRead] |
|
public int idx; |
|
System.Action<int> OnClick; |
|
public void OnInitialized(int idx, System.Action<int> OnClick) |
|
{ |
|
if (toggle != null) |
|
toggle = GetComponent<Toggle>(); |
|
|
|
this.idx = idx; |
|
this.OnClick = OnClick; |
|
} |
|
public override void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData) |
|
{ |
|
if (OnClick != null) |
|
OnClick(idx); |
|
} |
|
}
|
|
|