public override void onStageStart() { base.onStageStart(); microgamePool = MicrogameHelper.getMicrogames(restriction); roundsCompleted = roundStartIndex = 0; shuffleGames(); }
public override void onStageStart() { microgamePool = (from microgame in MicrogameHelper.getMicrogames(restriction) select new Microgame(microgame.microgameId)) .ToList(); roundsCompleted = roundStartIndex = 0; shuffleRandom = new System.Random(seed == 0 ? (int)System.DateTime.Now.Ticks : seed); shuffleGames(); base.onStageStart(); }
void Start() { // Create microgames standardMicrogamePool = MicrogameHelper.getMicrogames(restriction: MicrogameTraits.Milestone.StageReady); microgameBossPool = MicrogameHelper.getMicrogames(restriction: MicrogameTraits.Milestone.StageReady, includeBosses: true) .Where(a => a.difficultyTraits[0].isBossMicrogame()).ToList(); int maxYIndex = 0; spawnedMicrogames = new List <MenuPracticeMicrogame>(); var standardCount = standardMicrogamePool.Count; var totalCount = standardCount + microgameBossPool.Count(); for (int i = 0; i < totalCount; i++) { bool isBoss = i >= standardCount; var xIndex = i % columnCount; var yIndex = (i - (i % columnCount)) / columnCount; if (isBoss) { var bossIndex = i - standardCount; yIndex = (((standardCount - 1) - ((standardCount - 1) % columnCount)) / columnCount) + 1; // Set to one row below last standard microgame yIndex += ((bossIndex - (bossIndex % columnCount)) / columnCount); // Plus however many rows down it is in bosses xIndex = bossIndex % columnCount; } maxYIndex = yIndex; var xPos = topLeftPos.x + (xIndex * separationDistance); var yPos = topLeftPos.y - (yIndex * separationDistance); if (isBoss) { yPos -= bossSeparation; } spawnPrefab(xPos, yPos, isBoss ? i - standardCount : i, isBoss); } // Expand scroll area and cheat some scroll view values var scrollAreaShift = separationDistance * maxYIndex; scrollAreaShift += bossSeparation; contentTransform.sizeDelta += Vector2.up * scrollAreaShift; collectionTransform.anchoredPosition += Vector2.up * scrollAreaShift / 2f; if (GameMenu.subMenu == GameMenu.SubMenu.Practice || GameMenu.subMenu == GameMenu.SubMenu.PracticeSelect) { contentTransform.anchoredPosition += Vector2.up * savedYPosition; } }
#pragma warning restore 0649 void Start() { var microgames = MicrogameHelper.getMicrogames(restriction); for (int i = 0; i < microgames.Count; i++) { int column = i % buttonsPerRow, row = (i - column) / buttonsPerRow; Vector2 position = topLeftPosition + new Vector2(column * xSeparation, row * -ySeparation); RectTransform rectTransform = Instantiate(buttonPrefab, transform).GetComponent <RectTransform>(); rectTransform.anchoredPosition = position; rectTransform.name = microgames[i].microgameId; } }
public override void onStageStart() { microgamePool = (from microgame in MicrogameHelper.getMicrogames(restriction) select new Microgame(microgame.microgameId)) .ToList(); if (!string.IsNullOrEmpty(overrideCollection)) { var overriddenGames = overrideCollection.Split('\n').Select(a => a.ToUpper().Trim((char)13)).ToList(); microgamePool = microgamePool.Where(a => overriddenGames.Contains(a.microgameId.ToUpper())).ToList(); } roundsCompleted = roundStartIndex = 0; shuffleRandom = new System.Random(seed == 0 ? (int)System.DateTime.Now.Ticks : seed); shuffleGames(); base.onStageStart(); }
void Start() { selectedInstance = null; if (microgamePool == null) { microgamePool = MicrogameHelper.getMicrogames(MicrogameTraits.Milestone.StageReady); } if (name.Contains("Boss")) { //TODO multiple boss microgame support microgame = MicrogameHelper.getMicrogames(MicrogameTraits.Milestone.StageReady, true) .FirstOrDefault(a => a.difficultyTraits[0].isBossMicrogame()); } else { int microgameNumber = int.Parse(name.Split('(')[1].Split(')')[0]); if (microgameNumber >= microgamePool.Count) { gameObject.SetActive(false); return; } else { microgame = microgamePool[microgameNumber]; } } initialScale = transform.localScale; initialPosition = transform.localPosition; initialSiblingIndex = transform.GetSiblingIndex(); Sprite iconSprite = microgame.menuIcon; if (iconSprite != null) { icon.sprite = iconSprite; } }
void Awake() { instance = this; //Find traits string microgameID = gameObject.scene.name; int difficulty = int.Parse(microgameID.Substring(microgameID.Length - 1, 1)); if (microgameID.Equals("Template")) { microgameID = "_Template1"; } microgameID = microgameID.Substring(0, microgameID.Length - 1); //Get traits from collection if available if (GameController.instance != null) { var collectionMicrogame = MicrogameHelper.getMicrogames(includeBosses: true).FirstOrDefault(a => a.microgameId.Equals(microgameID)); if (collectionMicrogame != null) { traits = collectionMicrogame.difficultyTraits[difficulty - 1]; } } //Get traits from project file if necessary if (traits == null) { traits = MicrogameTraits.findMicrogameTraits(microgameID, difficulty); } debugMode = GameController.instance == null || GameController.instance.getStartScene() == "Microgame Debug"; if (debugMode) { //Debug Mode Awake (scene open by itself) if (MicrogameDebugObjects.instance == null) { SceneManager.LoadScene("Microgame Debug", LoadSceneMode.Additive); } else { MicrogameDebugObjects.instance.Reset(); } if (preserveDebugSpeed > -1) { Debug.Log("Debugging at speed " + preserveDebugSpeed); debugSettings.speed = preserveDebugSpeed; preserveDebugSpeed = -1; } StageController.beatLength = 60f / 130f; Time.timeScale = StageController.getSpeedMult(debugSettings.speed); victory = traits.defaultVictory; victoryDetermined = false; traits.onAccessInStage(microgameID, difficulty); } else if (!isBeingDiscarded()) { //Normal Awake StageController.instance.stageCamera.tag = "Camera"; //Camera.main.GetComponent<AudioListener>().enabled = false; StageController.instance.microgameMusicSource.clip = traits.musicClip; if (traits.hideCursor) { Cursor.visible = false; } commandDisplay = StageController.instance.transform.root.Find("UI").Find("Command").GetComponent <CommandDisplay>(); StageController.instance.resetVictory(); StageController.instance.onMicrogameAwake(); } }