public MiscButton findNextBtn( MiscButton _btnSource) { MiscButton res = null; MiscButton lastBtn = menuButtons[menuButtons.Count-1]; int currBtn = menuButtons.FindIndex(_btn => _btn == _btnSource); if (menuButtons[currBtn] == lastBtn) { res = menuButtons[0]; } else { res = menuButtons[currBtn+1]; } return res; }
public void Setup(GameSetup.LevelList _set, bool _isLocked) { nameLv = _set; Locked = _isLocked; if (nameLv != GameSetup.LevelList.None) { Info = Instantiate(Resources.Load("Tuning/Levels/" + nameLv.ToString())) as LevelInfo; } gameObject.name = _set.ToString(); Locker = FETool.findWithinChildren(gameObject, "Lock").GetComponentInChildren<OTSprite>(); if (Locked == true) { Locker.alpha = 1f; } else { Locker.alpha = 0f; } linkedPlayBtn = GetComponentInChildren<MiscButton>(); }
// Use this for initialization void Start() { base.Setup(); if (GameObject.FindGameObjectWithTag("PlayerData") == null) { GameObject _dataplayer = Instantiate(Resources.Load("Presets/PlayerData")) as GameObject; _profile = _dataplayer.GetComponent<PlayerData>(); _profile.Launch(); } else { _profile = GameObject.FindGameObjectWithTag("PlayerData").GetComponent<PlayerData>(); _profile.Launch(); } BuyBtn = FETool.findWithinChildren(gameObject, "Buy").GetComponent<MiscButton>(); FeedBtn = FETool.findWithinChildren(gameObject, "Feedback").GetComponent<MiscButton>(); ReturnBtn = FETool.findWithinChildren(gameObject, "ReturnHome").GetComponent<MiscButton>(); EndAlpha = FETool.findWithinChildren(gameObject, "END_ALPHA").GetComponent<TextUI>(); EndDemo = FETool.findWithinChildren(gameObject, "END_DEMO").GetComponent<TextUI>(); if (_profile.SETUP.GameType == GameSetup.versionType.Alpha) { EndDemo.color = Color.clear; } if (_profile.SETUP.GameType == GameSetup.versionType.Demo) { EndAlpha.color = Color.clear; } SubMenu _sub = GetComponent<SubMenu>(); _sub.SetupSub(this); _sub.setupBtn(); currentActiveMenu = _sub; currFocusedbtn = _sub.menuButtons[0]; _sub.menuButtons[0].giveFocus(true); InvokeRepeating("checkPadMenu", 0f, 0.5f); TranslateAllInScene(); }
private int CompareListByName(MiscButton i1, MiscButton i2) { return i1.name.CompareTo(i2.name); }