private IEnumerator OpenNextTutorialBox() { yield return(new WaitForSeconds(0.1f)); int prefabIx = this.tutorialPrefabs.Length - this.tutorialBoxesRemaining; GameObject box = Instantiate <GameObject> (this.tutorialPrefabs [prefabIx]); Button completeButton = box.GetComponentInChildren <Button> (); if (completeButton != null) { // TODO completeButton.onClick.AddListener(this.CloseTutorialBox); } TutorialBox tbox = box.GetComponent <TutorialBox> (); this.tutorialNote = null; this.tutorialMinion = null; if (tbox != null) { tbox.Open(this.minions, this.notes); this.tutorialMinion = tbox.minion; this.tutorialNote = tbox.note; } this.currentTutorialBox = box; this.currentTutorialBoxScript = tbox; }
public IEnumerator CleanUpTutorial() { this.DisableSuperDogTutorial(); this.DisableEmptyStaff(); this.DisableFirstNote(); if (!finished) { TutorialBox tbox = this.currentTutorialBoxScript; if (tbox != null) { tbox.Close(); } Destroy(this.currentTutorialBox); } zoomSpeed = 0.1f; GameObject tmp = new GameObject(); tmp.AddComponent <Zoom>(); tmp.GetComponent <Zoom>().pos = new Vector3(0, 0, -10); tmp.GetComponent <Zoom>().size = 4.25f; yield return(Zoom(tmp)); }
private GameObject ShowTutorialBox(float x, float y, float width, float height, string title, string content, TutorialBox.ButtonClickDelegate onClose) { GameObject go = Instantiate(tutorialBox, tutorialPanel.transform, false); TutorialBox tBox = go.GetComponent <TutorialBox>(); tBox.Title = title; tBox.Content = content; tBox.advanceButtonClickedHandler = onClose; tBox.SetSize(width, height); tBox.transform.localPosition = new Vector3(x, y, 0); return(go); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { Engines = new List <GameEngine>(); Width = GraphicsDevice.PresentationParameters.BackBufferWidth; Height = GraphicsDevice.PresentationParameters.BackBufferHeight; WidthScale = Width / Constants.SampleWindowWidth; HeightScale = Height / Constants.SampleWindowHeight; // Scale = Matrix2D.CreateScale((float)WidthScale, (float)HeightScale); Scale = Matrix2D.CreateScale((float)ScaleFactor); int h = 64; int w = 64; int x = Constants.SampleWindowWidth / 2 - w / 2; StartButton = new Button(x, 10, w, h); SettingsButton = new Button(x, 90, w, h); SettingsButton.GraphicsDevice = StartButton.GraphicsDevice = this.GraphicsDevice; LevelButtons = new List <Button>(); w = Constants.SampleWindowWidth / Levels - 15; for (int i = 0; i < Levels; i++) { LevelButtons.Add(new Button(15 + i * (w + 5), Constants.SampleWindowHeight / 2 - 15, w, 30)); LevelButtons[i].GraphicsDevice = GraphicsDevice; } CurrentSettingsUI = new SettingsUI(); FontManager.Initialize(Content); if (Settings.ShowTutorial) { TextBox = new TutorialBox(Constants.SampleWindowWidth / 4, Constants.SampleWindowHeight / 4); TutorialEngine = new GameEngine(GraphicsDevice); } base.Initialize(); }
/* Finishes this tutorial box and calls the new tutorial box */ public void CloseTutorialBox() { TutorialBox tbox = this.currentTutorialBoxScript; if (tbox != null) { tbox.Close(); } Destroy(this.currentTutorialBox); this.tutorialBoxesRemaining--; if (this.showingTutorials) { StartCoroutine(this.OpenTutorialBox()); } else { //Close tutorial finished = true; } }
public void CloseTutorialBox() { TutorialBox tbox = this.currentTutorialBoxScript; if (tbox != null) { tbox.Close(); } Destroy(this.currentTutorialBox); this.tutorialBoxesRemaining--; if (this.showingTutorials) { StartCoroutine(this.OpenNextTutorialBox()); } else { this.EnableMinions(); this.EnableNotes(); this.EnableBackground(); } }
private IEnumerator OpenNextTutorialBox() { yield return new WaitForSeconds (0.1f); int prefabIx = this.tutorialPrefabs.Length - this.tutorialBoxesRemaining; GameObject box = Instantiate<GameObject> (this.tutorialPrefabs [prefabIx]); Button completeButton = box.GetComponentInChildren<Button> (); if (completeButton != null) { // TODO completeButton.onClick.AddListener(this.CloseTutorialBox); } TutorialBox tbox = box.GetComponent<TutorialBox> (); this.tutorialNote = null; this.tutorialMinion = null; if (tbox != null) { tbox.Open(this.minions, this.notes); this.tutorialMinion = tbox.minion; this.tutorialNote = tbox.note; } this.currentTutorialBox = box; this.currentTutorialBoxScript = tbox; }