internal override void onFocus(Action focusAction, Direction d) { TVBehaviour v = findNexTVBehaviour(d); TVSystem.getInstance().changeFocus(d, v); base.onFocus(focusAction, d); }
public void setInitTvView(TVBehaviour t = null) { currentItem = t == null ? currentItem : t; if (currentItem != null) { setAllUnFocus(); currentItem.focus(true); } }
public void changeFocus(Direction d, TVBehaviour nextF) { currentItem.onLeaveFocus(() => { currentItem.focus(false); }); currentItem = nextF; nextF.onFocus(() => { nextF.focus(true); }, d); }
public TVBehaviour getByDirection(Direction d) { if (onDirection(d)) { TVBehaviour ans = getNextTVBehaviourByDirection(d); if (ans == null) { return(findCustomTVBehaviour(d)); } else { return(ans); } } else { return(null); } }
private void move(float h, float v) { if (Mathf.Abs(h) > 0 || Mathf.Abs(v) > 0) { if (!_moveing) { _moveing = true; Direction d = getDirection(h, v); TVBehaviour nextF = currentItem.getByDirection(d); if (nextF != null) { changeFocus(d, nextF); } } } else { _moveing = false; } }