Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class SetParagraphText : MonoBehaviour
- {
- public int ChapterStatus;
- public int PreviousChapterStatus;
- public string ChapterStatusString;
- public string PreviousChapterStatusString;
- private GameObject StoryButton1;
- private GameObject StoryButton2;
- private GameObject StoryButton3;
- private GameObject StoryButton4;
- private GameObject StoryButton5;
- private GameObject SoundManager;
- SoundManagerScript SoundManagerClass;
- // Start is called before the first frame update
- void Start()
- {
- // int ChapterStatus = 1;
- SoundManager = GameObject.Find("SoundManager");
- SoundManagerClass = SoundManager.GetComponent <SoundManagerScript> ();
- }
- public void FindStoryButtons()
- {
- // Debug.Log("Finding Story Buttons");
- StoryButton1 = GameObject.Find("StoryButton1");
- StoryButton2 = GameObject.Find("StoryButton2");
- StoryButton3 = GameObject.Find("StoryButton3");
- StoryButton4 = GameObject.Find("StoryButton4");
- StoryButton5 = GameObject.Find("StoryButton5");
- // Debug.Log("Story buttons found!");
- }
- public void ChangeStoryByString(string numberinput)
- {
- PreviousChapterStatus = ChapterStatus;
- int.TryParse(numberinput, out int realnumberinput);
- ChapterStatus = realnumberinput;
- GetComponent<Text>().text = LoadStoryData.storylist[realnumberinput].storytext;
- string TextToChangeButton1To = LoadStoryData.storylist[ChapterStatus].button1;
- if(TextToChangeButton1To == "blank") {
- StoryButton2.SetActive(false);
- }
- else {
- StoryButton1.SetActive(true);
- StoryButton1.GetComponent <SetButton1Text> ().ChangeButton1();
- }
- string TextToChangeButton2To = LoadStoryData.storylist[ChapterStatus].button2;
- if(TextToChangeButton2To == "blank") {
- StoryButton2.SetActive(false);
- }
- else {
- StoryButton2.SetActive(true);
- StoryButton2.GetComponent <SetButton2Text> ().ChangeButton2();
- }
- string TextToChangeButton3To = LoadStoryData.storylist[ChapterStatus].button3;
- if(TextToChangeButton3To == "blank") {
- StoryButton3.SetActive(false);
- }
- else {
- StoryButton3.SetActive(true);
- StoryButton3.GetComponent <SetButton3Text> ().ChangeButton3();
- }
- string TextToChangeButton4To = LoadStoryData.storylist[ChapterStatus].button4;
- if(TextToChangeButton4To == "blank") {
- StoryButton4.SetActive(false);
- }
- else {
- StoryButton4.SetActive(true);
- StoryButton4.GetComponent <SetButton4Text> ().ChangeButton4();
- }
- string TextToChangeButton5To = LoadStoryData.storylist[ChapterStatus].button5;
- if(TextToChangeButton5To == "blank") {
- StoryButton5.SetActive(false);
- }
- else {
- StoryButton5.SetActive(true);
- StoryButton5.GetComponent <SetButton5Text> ().ChangeButton5();
- }
- SoundManagerClass.PlaySound ("VOpart"+ChapterStatus);
- PlayerPrefs.SetInt("chapter", ChapterStatus);
- PlayerPrefs.Save ();
- Debug.Log("Chapter Status is "+ChapterStatus+" and Previous Chapter is "+PreviousChapterStatus);
- }
- public void ChangeStoryByVariableButton(int ButtonID) {
- PreviousChapterStatus = ChapterStatus;
- switch (ButtonID) {
- case 1:
- ChapterStatus = LoadStoryData.storylist[PreviousChapterStatus].button1link;
- break;
- case 2:
- ChapterStatus = LoadStoryData.storylist[PreviousChapterStatus].button2link;
- break;
- case 3:
- ChapterStatus = LoadStoryData.storylist[PreviousChapterStatus].button3link;
- break;
- case 4:
- ChapterStatus = LoadStoryData.storylist[PreviousChapterStatus].button4link;
- break;
- case 5:
- ChapterStatus = LoadStoryData.storylist[PreviousChapterStatus].button5link;
- break;
- default:
- ChapterStatus = 0;
- break;
- }
- GetComponent<Text>().text = LoadStoryData.storylist[ChapterStatus].storytext;
- string TextToChangeButton1To = LoadStoryData.storylist[ChapterStatus].button1;
- if(TextToChangeButton1To == "blank") {
- StoryButton1.SetActive(false);
- }
- else {
- StoryButton1.SetActive(true);
- StoryButton1.GetComponent <SetButton1Text> ().ChangeButton1();
- }
- string TextToChangeButton2To = LoadStoryData.storylist[ChapterStatus].button2;
- if(TextToChangeButton2To == "blank") {
- StoryButton2.SetActive(false);
- }
- else {
- StoryButton2.SetActive(true);
- StoryButton2.GetComponent <SetButton2Text> ().ChangeButton2();
- }
- string TextToChangeButton3To = LoadStoryData.storylist[ChapterStatus].button3;
- if(TextToChangeButton3To == "blank") {
- StoryButton3.SetActive(false);
- }
- else {
- StoryButton3.SetActive(true);
- StoryButton3.GetComponent <SetButton3Text> ().ChangeButton3();
- }
- string TextToChangeButton4To = LoadStoryData.storylist[ChapterStatus].button4;
- if(TextToChangeButton4To == "blank") {
- StoryButton4.SetActive(false);
- }
- else {
- StoryButton4.SetActive(true);
- StoryButton4.GetComponent <SetButton4Text> ().ChangeButton4();
- }
- string TextToChangeButton5To = LoadStoryData.storylist[ChapterStatus].button5;
- if(TextToChangeButton5To == "blank") {
- StoryButton5.SetActive(false);
- }
- else {
- StoryButton5.SetActive(true);
- StoryButton5.GetComponent <SetButton5Text> ().ChangeButton5();
- }
- SoundManagerClass.PlaySound ("VOpart"+ChapterStatus);
- PlayerPrefs.SetInt("chapter", ChapterStatus);
- PlayerPrefs.Save ();
- Debug.Log("Chapter Status is "+ChapterStatus+" and Previous Chapter is "+PreviousChapterStatus);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement