public void Awake() { BtDef activeBt = null; if (m_btDef.FirstOrDefault((_p) => _p.isFocused) == null) { if (m_btDef.Count > 0) { activeBt = m_btDef[0]; } } if (activeBt != null) { activeBt.isFocused = true; m_focusTf.anchoredPosition = activeBt.focusPos; } }
public void OnClickHandler(int idx) { if ((idx < 0) || (idx >= m_btDef.Count)) { return; } BtDef activeBt = m_btDef[idx]; if (activeBt.isFocused) { return; } var prevFocued = m_btDef.FirstOrDefault((_p) => _p.isFocused); if (prevFocued != null) { prevFocued.isFocused = false; } activeBt.isFocused = true; m_focusTf.anchoredPosition = activeBt.focusPos; }