void StartState(STATE pGameState) { switch (pGameState) { case STATE.MAINMENU: _mm = new MainMenu(this); _isLevel = false; AddChild(_mm); ShowMouse(true); break; case STATE.LEVELSELECTMENU: _lsm = new LevelSelectMenu(this); _isLevel = false; AddChild(_lsm); ShowMouse(true); break; case STATE.PAUSEMENU: _pm = new PauseMenu(this, _level); _isLevel = false; AddChild(_pm); ShowMouse(true); break; case STATE.LEVEL1: _level = new Level(this, 1); _currentLevel = 1; _isLevel = true; AddChild(_level); ShowMouse(false); break; case STATE.LEVEL2: _level = new Level(this, 2); _currentLevel = 2; _isLevel = true; AddChild(_level); ShowMouse(false); break; case STATE.LEVEL3: _level = new Level(this, 3); _currentLevel = 3; _isLevel = true; AddChild(_level); ShowMouse(false); break; case STATE.WINSCREEN: _ws = new WinScreen(this, AmountOfMovesByPlayer); _isLevel = false; AddChild(_ws); ShowMouse(true); break; default: break; } }
private void OnLevelWasLoaded() { //on levelselect menu, disable any locked level buttons using the menu interface if (SceneManager.GetActiveScene().name.Equals("LevelSelect")) { LevelSelectMenu lvlSelectMenu = GameObject.Find("LevelSelectCanvas").GetComponent <LevelSelectMenu>(); for (int i = 0; i < 15; i++) { if (levelUnlocks[i] == false) { lvlSelectMenu.DisableLevelButton(i + 1); } } Debug.Log("SaveData disabled locked levels."); } //on a level, find the player reference so we know when the level is completed else if (SceneManager.GetActiveScene().name.Contains("Level") && char.IsDigit(SceneManager.GetActiveScene().name[5])) { player = GameObject.Find("PlayerGrass").GetComponent <Player>(); Debug.Log("SaveData obtained player reference."); } }
/** Update the game's graphical mode */ private void updateGraphics() { ResMode res = this.resolutions[this.resMode]; Screen.SetResolution(res.width, res.height, this.isFull, res.refreshRate); LevelSelectMenu.evictCache(); }
public void Initialize(LevelSelectMenu levelSelectMenu, int index, bool isUnlocked) { this.levelSelectMenu = levelSelectMenu; this.index = index; levelText.text = (index + 1).ToString(); button.interactable = isUnlocked; }
// Start is called before the first frame update void Start() { ws = new WallSpawner(); TheMainMenu = new MainMenu(); ThePauseMenu = new PauseMenu(); TheLevelSelectMenu = new LevelSelectMenu(); Game.GameActive = false; curScene = int.Parse(SceneManager.GetActiveScene().name.Remove(0, 5)); }
/// <summary> /// Initalise the Level Button /// </summary> /// <param name="levelIDToSet">ID this this level</param> /// <param name="creatingMenu">Menu that created this button</param> public void InitLevelButton(int levelIDToSet, LevelSelectMenu creatingMenu) { //Set ID/Text levelID = levelIDToSet; levelIDText.text = levelID.ToString(); //Add Button on click Button button = GetComponent <Button>(); button.onClick.AddListener(LoadLevel); }
// Use this for initialization void Awake() { numSelectedBy = 0; voters = new List <LevelVoter>(4); for (int i = 0; i < indicators.Length; i++) { indicators[i].color = Color.clear; } levSelMenu = GameObject.Find("LevelMenuManager").GetComponent <LevelSelectMenu>(); }
public void Initialize(LevelSelectMenu levelSelectMenu, GameObject unimogSelectMenu, int levelID, string sceneId, string level, string icon) { locked = true; //Set level texture Sprite lockedLevel = (Sprite)Resources.Load <Sprite>("Textures/Schloss"); levelTexture.sprite = lockedLevel; //Set level parameters levelSprite = Resources.Load <Sprite>("Textures/LvL_Icons/" + icon); this.levelSelectMenu = levelSelectMenu; this.unimogSelectMenu = unimogSelectMenu; this.levelId = levelID; this.sceneId = sceneId; this.level = level; text.text = level.ToString(); }
// Use this for initialization void Start() { _mainMenu = gameObject.FindComponentInChildren <MainMenu>(true); _optionsMenu = gameObject.FindComponentInChildren <OptionsMenu>(true); _gameMenu = gameObject.FindComponentInChildren <GameMenu>(true); _pauseMenu = gameObject.FindComponentInChildren <PauseMenu>(true); _gameOverMenu = gameObject.FindComponentInChildren <GameOverMenu>(true); _shareMenu = gameObject.FindComponentInChildren <ShareMenu>(true); _levelSelectMenu = gameObject.FindComponentInChildren <LevelSelectMenu>(true); _aboutMenu = gameObject.FindComponentInChildren <AboutMenu>(true); HideAllMenus(); currentMenu = CrossSceneMenuInfo.use.nextMenuOnReload; ShowMenu(currentMenu); }
public void StopState(STATE pGameState) { switch (pGameState) { case STATE.MAINMENU: if (_mm != null) { _mm.Destroy(); _mm = null; } break; case STATE.LEVELSELECTMENU: if (_lsm != null) { _lsm.Destroy(); _lsm = null; } break; case STATE.PAUSEMENU: if (_pm != null) { _pm.Destroy(); _pm = null; } break; case STATE.LEVEL1: case STATE.LEVEL2: case STATE.LEVEL3: if (_level != null) { _level.Destroy(); _level = null; } break; default: break; } }
IEnumerator YieldAnimationThenContinue(float yieldTime) { yield return(new WaitForSeconds(yieldTime)); LevelSelectMenu menu = Game.Instance.UICore.Create <LevelSelectMenu>(Resources.Load("Prefabs/UI/LevelSelectMenu") as GameObject); }
private void setupUi() { Transform t; UiTransform parent; GO template; GO thumbTemplate; float rowOffset; int w, h; const Axis vert = Axis.Vertical; parent = this.Content.parent.GetComponent <UiTransform>(); w = (int)this.Content.rect.width; this.numCols = LevelSelectMenu.getNumSlots(w, this.ThumbBorder, this.ThumbSpacing, this.ThumbSize); this.numRows = this.numItems / this.numCols; if (this.numItems % this.numCols != 0) { this.numRows++; } h = this.numRows * (this.ThumbSpacing + this.ThumbSize); h += this.ThumbBorder * 2 - this.ThumbSpacing; this.Content.SetSizeWithCurrentAnchors(vert, h); this.rowSelector = new Image[this.numRows]; template = new GO($"RowSelector"); this.thumbnails = new RawImage[this.numItems]; thumbTemplate = new GO($"Thumbnail"); t = this.RowView.transform; w = (int)(this.RowView.rect.width / 2); h = (int)(this.RowView.rect.height / this.numRows); rowOffset = h * 0.05f; for (int y = 0; y < this.numRows; y++) { GO newGo; Image img; float _x = w * 0.25f; float _y = (float)(y * h) - rowOffset; float _w = w * 0.75f; float _h = h * 0.9f; newGo = LevelSelectMenu.spawnCopy(template, t, _x, _y, _w, _h); img = newGo.AddComponent <Image>(); img.color = this.OtherRowsColor; this.rowSelector[y] = img; for (int x = 0; x < this.numCols; x++) { RawImage rimg; Transform _t = this.Content.transform; int i = x + y * this.numCols; if (i > this.numItems) { break; } _x = this.ThumbBorder + x * (this.ThumbSize + this.ThumbSpacing); _y = this.ThumbBorder + y * (this.ThumbSize + this.ThumbSpacing); _w = this.ThumbSize; _h = this.ThumbSize; newGo = LevelSelectMenu.spawnCopy(thumbTemplate, _t, _x, _y, _w, _h); rimg = newGo.AddComponent <RawImage>(); rimg.texture = LevelSelectMenu.cache[i].tex; rimg.material = LevelSelectMenu.cache[i].mat; this.thumbnails[i] = rimg; } } GO.Destroy(template); GO.Destroy(thumbTemplate); }
// Update is called once per frame void Update() { switch (MenuRightNow) { case MenuLocation.Main: MainMenuItself.SetActive(true); LevelSelectMenu.SetActive(false); SettingMenu.SetActive(false); ExtrasMenu.SetActive(false); UnknownMenu.SetActive(false); GameplayMenu.SetActive(false); break; case MenuLocation.LevelSelect: MainMenuItself.SetActive(false); LevelSelectMenu.SetActive(true); SettingMenu.SetActive(false); ExtrasMenu.SetActive(false); UnknownMenu.SetActive(false); GameplayMenu.SetActive(false); break; case MenuLocation.Setting: MainMenuItself.SetActive(false); LevelSelectMenu.SetActive(false); SettingMenu.SetActive(true); ExtrasMenu.SetActive(false); UnknownMenu.SetActive(false); GameplayMenu.SetActive(false); break; case MenuLocation.Extras: MainMenuItself.SetActive(false); LevelSelectMenu.SetActive(false); SettingMenu.SetActive(false); ExtrasMenu.SetActive(true); UnknownMenu.SetActive(false); GameplayMenu.SetActive(false); break; case MenuLocation.Unknown: MainMenuItself.SetActive(false); LevelSelectMenu.SetActive(false); SettingMenu.SetActive(false); ExtrasMenu.SetActive(false); UnknownMenu.SetActive(true); GameplayMenu.SetActive(false); break; case MenuLocation.Gameplay: MainMenuItself.SetActive(false); LevelSelectMenu.SetActive(false); SettingMenu.SetActive(false); ExtrasMenu.SetActive(false); UnknownMenu.SetActive(false); GameplayMenu.SetActive(true); break; } if (OnGoingLoading) { if (rawProgress >= 90f) { OnGoingLoading = false; } if (loadingScreen) { loadingScreen.SetActive(true); } } else { if (loadingScreen) { loadingScreen.SetActive(false); } } if (!cameraing) { GameObject go = GameObject.FindGameObjectWithTag("MainCamera"); if (go) { cameraing = go.GetComponent <PersonCamera2D>(); } } if (isPlayingGame) { //Titler.SetActive(false); Titler.transform.position = new Vector3(cameraing.transform.position.x, cameraing.transform.position.y, 0f); LoopingArea.SetActive(false); LoopingArea.transform.position = new Vector3(cameraing.transform.position.x, cameraing.transform.position.y, 0f); MainMenuItself.GetComponent <MenuArea>().pauseMenuMode = true; } else { Titler.transform.position = Vector3.zero; LoopingArea.SetActive(true); LoopingArea.transform.position = Vector3.zero; MainMenuItself.GetComponent <MenuArea>().pauseMenuMode = false; cameraing.ZeroCamera(); } if (MenuRightNow != MenuLocation.Main) { Titler.SetActive(false); } else { Titler.SetActive(true); } }