void enableCharaChapter(string charaPref, int parameter) { continueButton.interactable = false; bool[] charaTemp = VNPrefs.GetBoolArray(charaPref); charaTemp [parameter] = true; VNPrefs.SetBoolArray(charaPref, charaTemp); lineCounter++; messageScrolling = false; StartCoroutine(nextWithWaitSpriteAnimator()); continueButton.interactable = true; }
void enableCGReward(string prefName, int arrayNumber) { continueButton.interactable = false; bool[] charaTemp = VNPrefs.GetBoolArray(prefName); charaTemp [arrayNumber] = true; VNPrefs.SetBoolArray(prefName, charaTemp); lineCounter++; messageScrolling = false; StartCoroutine(nextWithWaitSpriteAnimator()); continueButton.interactable = true; }
public void nextMessage() { Debug.Log(lineCounter); if (!messageScrolling) //if message is not changing { messageScrolling = true; if (Application.platform == RuntimePlatform.Android) //If running on Android { } else //Not running in android { if (lineCounter < lines.Count) { //Check if line is a function or not if (!lines [lineCounter].isFunction()) //Not a function { if (lines [lineCounter].getLine() == null) { charName.gameObject.GetComponent <Text>().text = lines [lineCounter].getCharaName(); lineCounter++; messageScrolling = false; messageScrolling2 = false; nextMessage(); } else { dialougeWindow.gameObject.SetActive(true); string lineContainer = lines [lineCounter].getLine(); textBox.gameObject.GetComponent <Text> ().text = ""; if (!messageScrolling2) { StartCoroutine("nextChar", lineContainer); // Debug.Log (lineCounter); lineCounter++; } } //Per char text //lineContainer=textBox.gameObject.GetComponent<Text> ().text; //line =lineContainer +r.ReadLine (); } else { //Debug.Log ("is function"); //Line is function string [] param; switch (lines [lineCounter].getFunctionName()) { case "Play_Music": playBGM(int.Parse(lines [lineCounter].getFunctionParameter())); break; case "Skip": lineCounter++; //Debug.Log ("skip called"); messageScrolling = false; break; case "Play_Clip": StartCoroutine(playClipDialouge(int.Parse(lines [lineCounter].getFunctionParameter()))); lineCounter++; messageScrolling = false; break; case "Play_Clip_No_Wait": StartCoroutine(playClipDialougeNoWait(int.Parse(lines [lineCounter].getFunctionParameter()))); lineCounter++; messageScrolling = false; break; case "Selection": lineCounter++; instantiateSelection(int.Parse(lines [lineCounter - 1].getFunctionParameter())); break; case "Jump_to_Line": LoadDialouge(int.Parse(lines [lineCounter].getFunctionParameter())); break; case "Fade_BG": StartCoroutine(fadeBG(int.Parse(lines [lineCounter].getFunctionParameter()))); break; case "Tint_Sprite": param = lines [lineCounter].getFunctionParameter().Split(','); Debug.Log(param[0] + ' ' + param[1]); StartCoroutine(tintSprite(int.Parse(param[0]), param[1], param[2])); break; case "Transation_Sprite_X_Position": param = lines [lineCounter].getFunctionParameter().Split(','); Debug.Log(param[0] + ' ' + param[1]); StartCoroutine(transationSpriteXPosition(int.Parse(param[0]), float.Parse(param[1]), param[2])); break; case "Clear_Box": StartCoroutine(clearBox()); break; case "Fade_In_From_Black": param = lines [lineCounter].getFunctionParameter().Split(','); StartCoroutine(fadeInFromBlack(float.Parse(param[0]), param[1])); break; case "Fade_Out_To_Black": param = lines [lineCounter].getFunctionParameter().Split(','); StartCoroutine(fadeOutToBlack(float.Parse(param[0]), param[1])); break; case "Close_Dialouge_Window": param = lines [lineCounter].getFunctionParameter().Split(','); StartCoroutine(closeDialougeWindow(param[0])); break; case "Change_Scene_With_Pref": changeSceneForReturn(int.Parse(lines [lineCounter].getFunctionParameter())); break; case "Change_Scene_No_Pref": changeSceneNoReturn(int.Parse(lines [lineCounter].getFunctionParameter())); break; default: switch (lines [lineCounter].getLineType()) { case "CS": setPrefString(lines [lineCounter].getFunctionName(), lines [lineCounter].getFunctionParameter()); break; case "CI": setPrefInt(lines [lineCounter].getFunctionName(), int.Parse(lines [lineCounter].getFunctionParameter())); break; case "CC": enableCharaChapter(lines [lineCounter].getFunctionName(), int.Parse(lines [lineCounter].getFunctionParameter())); break; case "CCG": enableCGReward(lines [lineCounter].getFunctionName(), int.Parse(lines [lineCounter].getFunctionParameter())); break; case "CB": //Change Bool VNPrefs.SetBool(lines [lineCounter].getFunctionName(), true); lineCounter++; StartCoroutine(nextWithWaitSpriteAnimator()); messageScrolling = false; break; } break; } } } else { //do nothing } } } else //if message is scrolling, skip text to end { if (Application.platform == RuntimePlatform.Android) //if running in android { } else { if (!lines [lineCounter - 1].isFunction()) //only rum if not a function { StopCoroutine("nextChar"); textBox.gameObject.GetComponent <Text> ().text = ""; textBox.gameObject.GetComponent <Text> ().text = lines [lineCounter - 1].getLine(); //StartCoroutine(haltContinueButton(0.25f)); messageScrolling = false; messageScrolling2 = false; } } } }