public void change_text_speed() { switch (textSpeed) { case TextSpeed.SLOW: textSpeed = TextSpeed.NORMAL; textSpeedButton.GetComponent <Text>().text = "Text Speed NORMAL"; text_to_time_ratio = normal_text_speed; global_wait_time -= 0.6; text_speed_multiplier = 1.0f; break; case TextSpeed.SKIP: case TextSpeed.NORMAL: textSpeed = TextSpeed.FAST; textSpeedButton.GetComponent <Text>().text = "Text Speed FAST"; text_to_time_ratio = fast_text_speed; global_wait_time -= 0.4; text_speed_multiplier = 2.5f; break; case TextSpeed.FAST: textSpeed = TextSpeed.SLOW; textSpeedButton.GetComponent <Text>().text = "Text Speed SLOW"; text_to_time_ratio = slow_text_speed; text_speed_multiplier = 0.5f; global_wait_time += 1.2; break; default: textSpeed = TextSpeed.NORMAL; break; } }
public async Task SetTextSpeed(TextSpeed speed, CancellationToken token) { var textSpeedByte = await Connection.ReadBytesAsync(TextSpeedOffset, 1, token).ConfigureAwait(false); var data = new[] { (byte)((textSpeedByte[0] & 0xFC) | (int)speed) }; await Connection.WriteBytesAsync(data, TextSpeedOffset, token).ConfigureAwait(false); }
public void Initialize(TextboxController textboxController, TextSpeed textSpeed, int linesPerTextbox) { this.textboxController = textboxController; if (font == null) { LoadDefaultFont(); } this.linesPerTextbox = linesPerTextbox; this.textSpeed = textSpeed; if (fontScaler == null) { fontScaler = new AutoFontScaler(); } if (autoFontSize) { SetAutoFontSize(); } SetHigherSpeed(); }
public void SetHigherSpeed() { switch (textSpeed) { case TextSpeed.verySlow: higherTextSpeed = TextSpeed.slow; break; case TextSpeed.slow: higherTextSpeed = TextSpeed.medium; break; case TextSpeed.medium: higherTextSpeed = TextSpeed.fast; break; case TextSpeed.fast: higherTextSpeed = TextSpeed.instant; break; case TextSpeed.instant: higherTextSpeed = TextSpeed.instant; break; default: throw new System.NotImplementedException("Text speed not accounted for in text settings."); } //Debug.Log("Higher speed is:" + higherTextSpeed); }
public void Initialize(TextSpeed textSpeed, int linesPerTextbox) { InitializeSubmodules(textSpeed, linesPerTextbox); AlignSizeToBox(); SubscribeToEvents(); SetupCallbacks(); }
public SerializedOptions(DataSettings settings) { brightness = settings.Brightness; musicVolume = settings.MusicVolume; sfxVolume = settings.SFXVolume; textSpeed = settings.TextSpeed; res = settings.Resolution; antiAliasing = settings.AntiAliasing; }
public SerializedOptions() { brightness = 0f; musicVolume = 1f; sfxVolume = 1f; textSpeed = TextSpeed.Normal; res = Resolution.FullHD; antiAliasing = false; }
public SerializedOptions(float b, float mV, float sfxV, TextSpeed ts, Resolution r, bool aa) { brightness = b; musicVolume = mV; sfxVolume = sfxV; textSpeed = ts; res = r; antiAliasing = aa; }
/// <summary> /// Copy constructor. /// </summary> /// <param name="toCopy">To copy.</param> public TextSettings(TextSettings toCopy) { this.textboxController = toCopy.textboxController; this.audioSample = toCopy.audioSample; this.textSpeed = toCopy.textSpeed; SetHigherSpeed(); this.linesPerTextbox = toCopy.linesPerTextbox; this.font = toCopy.font; if (font == null) { LoadDefaultFont(); } this.fontSize = toCopy.fontSize; }
void InitializeSubmodules(TextSpeed textSpeed, int linesPerTextbox) { textSettings.Initialize(this, textSpeed, linesPerTextbox); //textSettings.SetAutoFontSize(); box.Initialize(this); text.Initialize(this, testing); // Not all textboxes will need portraits or nametags, hence the safety-checking here if (nameTag != null) { nameTag.Initialize(this); nameTag.font = font; } if (portrait != null) { portrait.Initialize(this); } }
public static GameObject Create(GameObject prefab, int linesPerTextbox = 3, TextSpeed textSpeed = TextSpeed.medium) { GameObject textbox = MonoBehaviour.Instantiate <GameObject>(prefab); textbox.SetActive(true); TextboxController textboxController = textbox.GetComponent <TextboxController>(); // for safety if (textboxController == null) { string errorMessage = "Prefab passed in TST Textbox instantiation has no TST Textbox Controller."; throw new ArgumentException(errorMessage); } textboxController.Initialize(textSpeed, linesPerTextbox); textboxesOnScreen++; ATextboxSpawned.Invoke(textboxController); return(textbox); }
IEnumerator PlaySoundByte(float pauseDuration, float volume = 0.55f, TextSpeed minSpeedToAbideBy = TextSpeed.verySlow, TextSpeed maxSpeedToAbideBy = TextSpeed.fast) { // plays the sound byte while keeping it from playing too many times at once, // which avoids that ugly sound error float actualPause = Mathf.Clamp(pauseDuration, 1f / (float)maxSpeedToAbideBy, 1f / (float)minSpeedToAbideBy); while (true) { if (!sfxPlayer.isPlaying && pauseDuration != 1f / (float)TextSpeed.instant && textSound != null) { sfxPlayer.PlayOneShot(textSound, volume); } yield return(new WaitForSeconds(actualPause)); } }
public TextSpeedSettings(TextSpeed normalSpeed, TextSpeed higherSpeed) { this.normalSpeed = normalSpeed; this.higherSpeed = higherSpeed; effectiveTextSpeed = normalSpeed; }
/// <summary> /// Combines a text speed flag and a frame style flag into a single byte (for an Options block). /// </summary> public static byte CombineTextSpeedFrameStyle(TextSpeed textSpeed, FrameStyle frameStyle) { return(CombineOptions((byte)textSpeed, (byte)frameStyle)); }
public void SetTextSpeedSlow() { TextSpeed = TextSpeed.Slow; }
public void ChangeTextSpeed(float textSpeed) { TextSpeed.GetComponent <UIController>().showTextSpeed = textSpeed; }
public void SetTextSpeed(TextSpeed t) { speed = t; }
public void SetTextSpeedNorm() { TextSpeed = TextSpeed.Normal; }
public void SetTextSpeedFast() { TextSpeed = TextSpeed.Fast; }
private void Button_Click(object sender, RoutedEventArgs e) { TextAngl.Clear(); TextSpeed.Clear(); }
// Update is called once per frame void Update() { string speech_state = ""; if (Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown(KeyCode.Escape)) //alternatives for pause { toggle_options_menu(); } #if UNITY_EDITOR //CHEAT KEYS if (Input.GetKeyDown(KeyCode.N)) //next { Debug.Log("N"); textSpeed = TextSpeed.SKIP; text_to_time_ratio = skip_text_speed; global_wait_time = 0; text_speed_multiplier = 6.0f; } else if (Input.GetKey(KeyCode.N)) { talk_timer -= Time.deltaTime; wait_timer -= Time.deltaTime; choice_timer -= Time.deltaTime; fade_timer -= Time.deltaTime; } else if (Input.GetKeyDown(KeyCode.M)) //superskip, only use when there's no choice to be made { talk_timer = 0; wait_timer = 0; choice_timer = 0; fade_timer = 0; } else if (Input.GetKeyDown(KeyCode.B)) //back { foreach (GameObject thought in thoughts) { hide_thought(thought); } process_json_game_event(pop_events(previous_events), true); } else if (Input.GetKeyUp(KeyCode.N)) { change_text_speed(); } #endif if (game_paused) { talk_timer += Time.deltaTime; wait_timer += Time.deltaTime; choice_timer += Time.deltaTime; fade_timer += Time.deltaTime; } else { switch (dialogueState) { case TimerState.TALKING: speech_state = System.String.Format("Talking for {0:0.##}", talk_timer - Time.time); if (Time.time > talk_timer) { dialogueState = TimerState.WAITING; handle_thoughts(current_event.choices); //trigger non-interrupt choices } break; case TimerState.WAITING: speech_state = System.String.Format("Waiting for {0:0.##}", wait_timer - Time.time); if (resolution <= 0 && current_event_name == "3_graduation4") { //dreamer interrupts game_paused = false; OptionsMenu.SetActive(false); foreach (GameObject thought in thoughts) { hide_thought(thought); } SFXSystem.GetComponent <SFX>().playInterrupt(); process_json_game_event("3_badend"); return; } if (Time.time > wait_timer) { dialogueState = TimerState.CHOOSING; } break; case TimerState.CHOOSING: speech_state = System.String.Format("Choosing for {0:0.##}", choice_timer - Time.time); if (Time.time > choice_timer) { start_fade(); dialogueState = TimerState.FADING; } break; case TimerState.FADING: speech_state = System.String.Format("Fading for {0:0.##}", fade_timer - Time.time); if (Time.time > fade_timer) { string eventName = get_next_event_string(); if (eventName == "endgame") { UnityEngine.SceneManagement.SceneManager.LoadScene("Credits"); } else if (resolution <= 0 && (eventName == "3_dunno" || eventName == "3_grew" || eventName == "3_reality")) { process_json_game_event("3_badend"); } else if (eventName == "endsplitter") { if (resolution > RESOLUTION_TO_WIN) { process_json_game_event("3_goodend"); } else { process_json_game_event("3_neutralend_1"); } } else { process_json_game_event(eventName); } } break; default: Debug.LogError("Invalid TimerState"); break; } } Text debugInfo = DebugInfo.GetComponent <Text>(); if (!debugInfo.text.Contains("Invalid") && !debugInfo.text.Contains("Error")) { debugInfo.text = System.String.Format("Debug info:\nAwkward={0}\nTension={1}\nResolution={2}\nScript={3}\nMusic={4}\n{5}", awkward.ToString("F1"), tension.ToString("F1"), resolution.ToString("F1"), current_event_name, music.getMusicPlaying(), speech_state); } }