摘要: 假如我们需要实现一个用 Toggle 控制 Button 是否可点击的功能,简单情况下我们可以直接实现一个 ToggleableButton,代码如下 public class TogglableButton : MonoBehaviour { public Button button; publi 阅读全文
posted @ 2020-07-13 22:33 forhot2000 阅读(139) 评论(1) 推荐(1)
摘要: Unity 中的事件一般都是回调 UnityAction 或者 UnityAction 的,下面示例代码中的几个事件都调用了 commandPanel.Walk(Direction direction) 方法,仅参数不同,可以抽取函数 UnityAction Walk(Direction direc 阅读全文
posted @ 2020-07-13 22:24 forhot2000 阅读(115) 评论(1) 推荐(1)