12345678910111213141516171819202122232425262728293031323334353637 |
- using UnityEngine;
- using System.Collections;
- /// <summary>
- /// Fix scores buttons Y position for the Me/Top10/Facebook/Global buttons that are visible in the scores screen.
- /// Since we are using the same scores screen (and thus the buttons), we fix their positions accordingly.
- /// </summary>
- public class FixScoresButtonsYPosition : MonoBehaviour
- {
- const int POS_Y_BEFORE_GAME = 194;
- const int POS_Y_AFTER_GAME = 146;
- const int POS_Y_FOR_GLOBAL_LEADERBOARD = 50;
- void OnEnable()
- {
- switch (MenuManager.CurrentState)
- {
- case MenuManager.MenuState.ViewingScoresBeforeGame:
- FixYPosition(POS_Y_BEFORE_GAME);
- break;
- case MenuManager.MenuState.ViewingScoresAfterGame:
- FixYPosition(POS_Y_AFTER_GAME);
- break;
- case MenuManager.MenuState.ViewingGlobalLeaderboard:
- FixYPosition(POS_Y_FOR_GLOBAL_LEADERBOARD);
- break;
- }
- }
- void FixYPosition(int newY)
- {
- Vector3 p = transform.localPosition;
- p.y = newY;
- transform.localPosition = p;
- }
- }
|