// Start and Update #region Start and Update, On Enable/Diable, On Screen Loaded, etc. void Start() { myCamera = GameObject.FindGameObjectWithTag("MainCamera").transform; camZoom = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraZoom>(); audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioManager>(); gm = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster>(); fadeMaskController = fadeMask.GetComponent <MaskController>(); introTextController = IntroTextScreen.GetComponent <IntroTextController>(); levelSelectionController = levelSelection.GetComponent <LevelSelectionController>(); string diff = PlayerPrefs.GetString("GameDifficulty", "Goddess"); if (diff == "LittleGirl") { gm.goalDifficulty = GameMaster.GameDifficulty.littlegirl; } else if (diff == "Goddess") { gm.goalDifficulty = GameMaster.GameDifficulty.goddess; } gm.gameDifficulty = gm.goalDifficulty; if (gm.goalDifficulty == GameMaster.GameDifficulty.littlegirl) { SetDifficultyToLittleGirl(); } else if (gm.goalDifficulty == GameMaster.GameDifficulty.goddess) { SetDifficultyToGoddess(); } basicSettings(); SetPlayerPrefs(); }
void Start() { lockImage = transform.GetChild(0).gameObject; lockButton = transform.GetChild(1).gameObject; levelSelection = FindObjectOfType <LevelSelectionController>(); unlockMat = levelSelection.defaultMat; lockMat = levelSelection.lockMat; }
void Start() { levelSelection = FindObjectOfType <LevelSelectionController>(); meshRenderer = gameObject.GetComponent <MeshRenderer>(); currentScale = transform.localScale; defaultMat = levelSelection.defaultMat; activeMat = levelSelection.activeMat; }
static bool Prefix(LevelSelectionController __instance, IndexPath index) { if (CustomLevelManager.Instance.LastSelectedTime != 0d && Time.realtimeSinceStartup - CustomLevelManager.Instance.LastSelectedTime < 0.25f) { return(false); } CustomLevelManager.Instance.LastSelectedTime = Time.realtimeSinceStartup; var level = Traverse.Create(__instance).Method("GetLevelForIndex", index).GetValue <LevelInfo>(); if (level is CustomLevelFolderInfo selectedFolder) { selectedFolder.FolderInfo.Children = CustomLevelManager.Instance.SortList(selectedFolder.FolderInfo.Children); var currentIndexPath = Traverse.Create(__instance.listView).Property <IndexPath>("currentIndexPath"); if (selectedFolder.FolderInfo.GetName() == "..\\") { CustomLevelManager.Instance.CurrentFolder = selectedFolder.FolderInfo.Parent; currentIndexPath.Value = __instance.listView.currentIndexPath.Up(); __instance.listView.UpdateList(); __instance.listView.SetHighlighted(currentIndexPath.Value, true); } else { CustomLevelManager.Instance.CurrentFolder = selectedFolder.FolderInfo; if (CustomLevelManager.Instance.CurrentFolder.Parent != null) { currentIndexPath.Value = __instance.listView.currentIndexPath.Sub(CustomLevelManager.Instance.CurrentFolder.Parent.Children.IndexOf(CustomLevelManager.Instance.CurrentFolder)); } else { currentIndexPath.Value = __instance.listView.currentIndexPath.Sub(CustomLevelManager.Instance.NestedItems.IndexOf(CustomLevelManager.Instance.CurrentFolder)); } __instance.listView.UpdateList(); EventSystem.current.SetSelectedGameObject(null); } return(false); } else if (level is CustomLevelInfo selectedLevel) { level = selectedLevel; return(true); } else { CustomLevelManager.Instance.CurrentFolder = null; return(true); } }
static void Postfix(LevelSelectionController __instance, MVCListHeaderView header) { CustomLevelManager.Instance.SortLabel.gameObject.SetActive(__instance.showCustom); UserInterfaceHelper.Instance.UpdateLabelColor(CustomLevelManager.Instance.SortLabel, Main.Settings.EnableDarkMode ? UserInterfaceHelper.DarkModeText : UserInterfaceHelper.DefaultText); if (CustomLevelManager.Instance.CurrentFolder != null && SpriteHelper.MenuIcons != null) { var isEasyDay = CustomLevelManager.Instance.CurrentFolder.GetName().Equals("\\Easy Day"); var isModIo = CustomLevelManager.Instance.CurrentFolder.GetName().Equals("\\mod.io"); header.Label.spriteAsset = isEasyDay || isModIo ? SpriteHelper.BrandIcons : SpriteHelper.MenuIcons; header.SetText(CustomLevelManager.Instance.CurrentFolder.GetName().Replace("\\", $"<sprite name=\"{(isEasyDay || isModIo ? CustomLevelManager.Instance.CurrentFolder.GetName().Replace("\\", string.Empty).ToLower() : "folder_outline")}\" tint>")); } }
public IEnumerator LoadMap(string path) { while (!sendingUpdates) { yield return(new WaitForEndOfFrame()); } //Load map with path LevelSelectionController levelSelectionController = GameManagement.GameStateMachine.Instance.LevelSelectionObject.GetComponentInChildren <LevelSelectionController>(); GameManagement.GameStateMachine.Instance.LevelSelectionObject.SetActive(true); LevelInfo target = LevelManager.Instance.Levels.Find(level => level.path.Equals(path)); if (target == null) { target = LevelManager.Instance.CustomLevels.Find(level => level.path.Equals(path)); } LevelManager.Instance.LoadLevel(target); StartCoroutine(CloseAfterLoad()); yield break; }
public IEnumerator LoadMap(string path) { while (!sendingUpdates) { yield return new WaitForEndOfFrame(); } LevelInfo target = LevelManager.Instance.Levels.Find(level => level.path.Trim().Equals(path.Trim(), StringComparison.CurrentCultureIgnoreCase)); if (target == null) { target = LevelManager.Instance.ModLevels.Find(level => level.path.Trim().Equals(path.Trim(), StringComparison.CurrentCultureIgnoreCase));; } if (target == null) { target = LevelManager.Instance.CommunityLevels.Find(level => level.path.Trim().Equals(path.Trim(), StringComparison.CurrentCultureIgnoreCase)); ; } yield return new WaitWhile(() => GameStateMachine.Instance.IsLoading); if (!target.Equals(LevelManager.Instance.currentLevel)) { //Load map with path LevelSelectionController levelSelectionController = GameStateMachine.Instance.LevelSelectionObject.GetComponentInChildren<LevelSelectionController>(); IndexPath targetIndex = Traverse.Create(levelSelectionController).Method("GetIndexForLevel", target).GetValue<IndexPath>(); Traverse.Create(levelSelectionController).Method("OnLevelHighlighted", targetIndex).GetValue(); string texturePath = Path.ChangeExtension(target.path, "png"); if (!File.Exists(texturePath)) { texturePath = Path.ChangeExtension(target.path, "jpg"); } if (!File.Exists(texturePath)) { texturePath = Path.ChangeExtension(target.path, "jpeg"); } if (File.Exists(texturePath)) { yield return new WaitWhile(() => target.previewImage == null); } levelSelectionController.OnItemSelected(targetIndex); yield return new WaitWhile(() => GameStateMachine.Instance.IsLoading); PlayerController.Instance.respawn.ForceRespawn(); } yield break; }
public IEnumerator LoadMap(string path) { while (!IsInvoking("SendUpdate")) { yield return(new WaitForEndOfFrame()); } //Load map with path LevelSelectionController levelSelectionController = GameManagement.GameStateMachine.Instance.LevelSelectionObject.GetComponentInChildren <LevelSelectionController>(); GameManagement.GameStateMachine.Instance.LevelSelectionObject.SetActive(true); LevelInfo target = levelSelectionController.Levels.Find(level => level.path.Equals(path)); if (target == null) { target = levelSelectionController.CustomLevels.Find(level => level.path.Equals(path)); } if (target == null) { Main.statusMenu.DisplayNoMap(path); } levelSelectionController.StartCoroutine(levelSelectionController.LoadLevel(target)); StartCoroutine(CloseAfterLoad()); yield break; }
private void BuildMenu() { LevelSelectionController controller = target as LevelSelectionController; for (int i = controller.ItemsGrid.childCount - 1; i >= 0; i--) { DestroyImmediate(controller.ItemsGrid.GetChild(i).gameObject); } string[] fileEntries = Directory.GetFiles(Application.dataPath + "/_TurningTallulha/Levels"); for (int i = 0; i < fileEntries.Length; i++) { if (fileEntries[i].EndsWith("meta")) { continue; } LevelSelectionItem item = (PrefabUtility.InstantiatePrefab(controller.LevelItem) as GameObject).GetComponent <LevelSelectionItem>(); item.transform.SetParent(controller.ItemsGrid, false); item.Init(Path.GetFileName(fileEntries[i].Split('.')[0]), null, i < 4); } }
static void Postfix(LevelSelectionController __instance) { CustomLevelManager.Instance.SortLabel = UserInterfaceHelper.Instance.CreateSortLabel(Main.Settings.EnableDarkMode, __instance.listView.HeaderView.Label, __instance.listView.HeaderView.transform, ((LevelSortMethod)CustomLevelManager.Instance.CurrentSort).ToString()); }
public void NextLevel(int i) { LevelSelectionController.NextLevel(i - 1); }
public void ResetGame() { CheckPoint.CleanCheckPoint(); LevelSelectionController.Reset(); }
private async void InitLevelSelector() { await LevelSelectionController.Create(_levelSelectorContentRoot) .SpecifyAsync(() => "Cannot create level selector") .ThrowIfErrorAsync(); }