void Start() { this.GameButton = new GameButtonType[3]; GameButtonType g = new GameButtonType(); g.Button = OneOnOne; g.index = 0; this.GameButton[0] = g; GameButtonType g1 = new GameButtonType(); g1.Button = friends; g1.index = 1; this.GameButton[1] = g1; GameButtonType g2 = new GameButtonType(); g2.Button = practice; g2.index = 1; this.GameButton[2] = g2; foreach (GameButtonType te in this.GameButton) { this.DirectMove(te); } UnSelectedGame(); SelectedGame(this.getCurrentCenterIndex()); }
int getCurrentCenterIndex() { for (int i = 0; i < 3; i++) { GameButtonType g = GameButton[i]; if (g.index == 0) { return(i); } } return(-1); }
void DirectMove(GameButtonType button) { switch (button.index) { case 0: button.Button.transform.position = Mid.position; break; case 1: button.Button.transform.position = Rignt.position; break; case -1: button.Button.transform.position = Left.position; break; } }