private void Awake() { canvasGroup.alpha = 0; collapseButton.onPointerClick.AddListener(_ => { if (!isCollapsed) { isCollapsed = true; collapseIcon.sprite = expandSprite; contentHolder.Leave(); } else { isCollapsed = false; collapseIcon.sprite = compressSprite; contentHolder.Enter(); } }); autoplayRadioGroup.onSelect.AddListener(it => { var value = bool.Parse(it); if (value) { game.State.Mods.Add(Mod.Auto); } else { game.State.Mods.Remove(Mod.Auto); } }); decreaseMoreButton.onPointerClick.AddListener(it => ChangeGameNoteOffset(-0.05f)); decreaseButton.onPointerClick.AddListener(it => ChangeGameNoteOffset(-0.01f)); increaseButton.onPointerClick.AddListener(it => ChangeGameNoteOffset(+0.01f)); increaseMoreButton.onPointerClick.AddListener(it => ChangeGameNoteOffset(+0.05f)); game.onGameLoaded.AddListener(it => { if (game.State.Mode != GameMode.Calibration) { Destroy(gameObject); } else { offset = game.Level.Record.RelativeNoteOffset; UpdateOffsetText(); canvasGroup.alpha = 1; transitionElement.UseCurrentStateAsDefault(); transitionElement.Enter(); contentHolder.UseCurrentStateAsDefault(); contentHolder.Enter(); game.onGameCompleted.AddListener(_ => transitionElement.Leave()); game.onGameAborted.AddListener(_ => transitionElement.Leave()); game.onGameRetried.AddListener(_ => transitionElement.Leave()); autoplayRadioGroup.Select("true", false); game.State.Mods.Add(Mod.Auto); transform.RebuildLayout(); } }); }
public void UpdateMods(HashSet <Mod> mods) { foreach (Transform child in layoutGroup.transform) { var pill = child.GetComponent <ModPill>(); pill.isStatic = true; child.gameObject.SetActive(mods.Contains(pill.mod)); } layoutGroup.transform.RebuildLayout(); parentTransitionElement.UseCurrentStateAsDefault(); }