123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- using System;
- using System.Collections.Generic;
- using UnityEngine;
- public class SubtitlesDisplayManager : MonoBehaviour
- {
- public string originalText
- {
- get
- {
- return this.originalUILabel.text;
- }
- set
- {
- this.Awake();
- if (this.originalText_ == value)
- {
- return;
- }
- this.originalUILabel.text = (this.originalText_ = ((!string.IsNullOrEmpty(value)) ? MessageClass.GetWrapString(this.originalUILabel, value) : string.Empty));
- if (this.displayType_ == SubtitlesDisplayManager.DisplayType.ON_OFF)
- {
- this.singleUILabel.text = this.originalText_;
- }
- }
- }
- public string subtitlesText
- {
- get
- {
- return this.subtitlesUILabel.text;
- }
- set
- {
- this.Awake();
- if (this.subtitlesText_ == value)
- {
- return;
- }
- this.subtitlesUILabel.text = (this.subtitlesText_ = ((!string.IsNullOrEmpty(value)) ? value : string.Empty));
- if (this.displayType_ == SubtitlesDisplayManager.DisplayType.OFF_ON)
- {
- this.singleUILabel.text = this.subtitlesText_;
- }
- }
- }
- public SubtitlesDisplayManager.DisplayType displayType
- {
- get
- {
- return this.displayType_;
- }
- set
- {
- this.Awake();
- this.displayType_ = value;
- if (this.displayType_ == SubtitlesDisplayManager.DisplayType.ON_ON)
- {
- this.twoTextAreaObject.SetActive(true);
- this.singleTextAreaObject.SetActive(false);
- }
- else if (this.displayType_ == SubtitlesDisplayManager.DisplayType.OFF_OFF)
- {
- this.twoTextAreaObject.SetActive(false);
- this.singleTextAreaObject.SetActive(false);
- }
- else if (this.displayType_ == SubtitlesDisplayManager.DisplayType.OFF_ON || this.displayType_ == SubtitlesDisplayManager.DisplayType.ON_OFF)
- {
- this.twoTextAreaObject.SetActive(false);
- this.singleTextAreaObject.SetActive(true);
- this.singleUILabel.text = ((this.displayType_ != SubtitlesDisplayManager.DisplayType.OFF_ON) ? this.originalText_ : this.subtitlesText_);
- }
- }
- }
- public bool visible
- {
- get
- {
- return base.gameObject.activeInHierarchy;
- }
- set
- {
- base.gameObject.SetActive(value);
- }
- }
- private void Awake()
- {
- if (this.callAwake)
- {
- return;
- }
- this.callAwake = true;
- string empty = string.Empty;
- this.subtitlesText = empty;
- this.originalText = empty;
- this.displayType = SubtitlesDisplayManager.DisplayType.ON_ON;
- }
- public void SetTextFromScriptStyle(string text)
- {
- if (string.IsNullOrEmpty(text))
- {
- string empty = string.Empty;
- this.subtitlesText = empty;
- this.originalText = empty;
- return;
- }
- KeyValuePair<string, string> translationText = MessageClass.GetTranslationText(text);
- this.originalText = translationText.Key;
- this.subtitlesText = translationText.Value;
- }
- [Header("日本語と翻訳,2テキスト表示する時の設定")]
- [SerializeField]
- private GameObject twoTextAreaObject;
- [SerializeField]
- private UILabel originalUILabel;
- [SerializeField]
- private UILabel subtitlesUILabel;
- [Header("日本語 or 翻訳の1テキストのみ表示する時の設定")]
- [SerializeField]
- private GameObject singleTextAreaObject;
- [SerializeField]
- private UILabel singleUILabel;
- private bool callAwake;
- private string originalText_;
- private string subtitlesText_;
- private SubtitlesDisplayManager.DisplayType displayType_;
- public enum DisplayType
- {
- ON_ON,
- OFF_OFF,
- OFF_ON,
- ON_OFF
- }
- }
|