private void FindLevelCreationInfo() { LevelCreationInfo[] levelCreationInfos = FindObjectsOfType<LevelCreationInfo>(); for (int i = 0; i < levelCreationInfos.Length; i++) { if (i > 0) Destroy(levelCreationInfos[i].gameObject); else _levelCreationInfoGO = levelCreationInfos[i]; } }
//Return to the Level Select window public void ReturnToLevelSelection() { if (returnButton != null) { ResetCharacterSelection(); createButton.SetActive(false); SetVisibleLevelSelect(true); levelSelect = 0; currentLevelInfo = null; modeSelect = ModeSelect.LEVELSELECT; } }
// Use this for initialization void Start() { buttonDistance = 1024;//Screen.width; prevButton.SetActive(false); nextButton.SetActive(true); List<DBLevel> dbLevels = MainDatabase.Instance.GetLevelsInfo(); levelNames.Clear(); Transform currentTransform = transform; CustomLevel customLevel = GameObject.FindObjectOfType(typeof(CustomLevel)) as CustomLevel; int i = 1; foreach (DBLevel level in dbLevels) { LevelCreationInfo levelInfo = new LevelCreationInfo(); levelInfo.levelId = level.levelId; levelInfo.levelIdx = level.levelIdx; levelInfo.levelName = level.levelName; levelNames.Add(level.levelName); levelInfo.levelScreenshot = ResourceManager.LoadTexture("Levels/" + level.levelTexture); GameObject newLevelButton = Instantiate(levelButton, currentTransform.position, Quaternion.identity) as GameObject; newLevelButton.name = levelInfo.levelName; newLevelButton.transform.parent = transform; newLevelButton.transform.localPosition = new Vector3(buttonDistance * (i - 1), 0, 0); CustomLevelButton button = newLevelButton.gameObject.GetComponent(typeof(CustomLevelButton)) as CustomLevelButton; button.levelInfo = levelInfo; button.levelTexture.mainTexture = levelInfo.levelScreenshot; button.levelStretch.initialSize = new Vector2(levelInfo.levelScreenshot.width, levelInfo.levelScreenshot.height); button.customLevel = customLevel; button.lvlSelect = this; button.GetComponent<UIButtonScale>().SendMessage("OnHover", false); i++; } UpdateLevelLabel(); }
public void SetupCharacterSelection(LevelCreationInfo levelInfo) { currentLevelInfo = levelInfo; currentLevelInfo.LoadCharacters(); SetVisibleLevelSelect(false); modeSelect = ModeSelect.CHARACTERSELECT; charactersTable.SetCharactersList(currentLevelInfo.levelCharacters); charactersTable.CreateTable(currentLevelInfo.levelCharacters); }