|
@@ -13,10 +13,13 @@ public class MessageClass
|
|
this.message_window_panel_ = message_window_panel;
|
|
this.message_window_panel_ = message_window_panel;
|
|
this.message_label_ = UTY.GetChildObject(this.message_window_panel_, "MessageViewer/MsgParent/Message", false).GetComponent<UILabel>();
|
|
this.message_label_ = UTY.GetChildObject(this.message_window_panel_, "MessageViewer/MsgParent/Message", false).GetComponent<UILabel>();
|
|
this.name_label_ = UTY.GetChildObject(this.message_window_panel_, "MessageViewer/MsgParent/SpeakerName/Name", false).GetComponent<UILabel>();
|
|
this.name_label_ = UTY.GetChildObject(this.message_window_panel_, "MessageViewer/MsgParent/SpeakerName/Name", false).GetComponent<UILabel>();
|
|
|
|
+ this.subtitles_manager_ = UTY.GetChildObject(this.message_window_panel_, "MessageViewer/MsgParent/SubtitlesDisplayPanel", false).GetComponent<SubtitleDisplayManager>();
|
|
this.hitret_sprite_ = UTY.GetChildObject(this.message_window_panel_, "MessageViewer/MsgParent/Hitret", false).GetComponent<UISprite>();
|
|
this.hitret_sprite_ = UTY.GetChildObject(this.message_window_panel_, "MessageViewer/MsgParent/Hitret", false).GetComponent<UISprite>();
|
|
- NDebug.AssertNull(this.message_label_ != null && this.name_label_ != null && this.hitret_sprite_ != null);
|
|
|
|
- this.message_label_.ProcessText();
|
|
|
|
this.hitret_sprite_.alpha = 0f;
|
|
this.hitret_sprite_.alpha = 0f;
|
|
|
|
+ this.mainTextAnimation = new MessageClass.TextAnimation();
|
|
|
|
+ this.subTextAnimation = new MessageClass.TextAnimation();
|
|
|
|
+ this.subtitles_manager_.visible = false;
|
|
|
|
+ this.subtitles_manager_ = null;
|
|
}
|
|
}
|
|
|
|
|
|
public static KeyValuePair<string, string> GetTranslationText(string baseText)
|
|
public static KeyValuePair<string, string> GetTranslationText(string baseText)
|
|
@@ -111,59 +114,54 @@ public class MessageClass
|
|
public void SetText(string name, string text, string voice_file, int voice_pitch)
|
|
public void SetText(string name, string text, string voice_file, int voice_pitch)
|
|
{
|
|
{
|
|
this.exit_wait_count_ = -1;
|
|
this.exit_wait_count_ = -1;
|
|
- this.name_label_.text = name;
|
|
|
|
- this.ch_anime_data_.Clear();
|
|
|
|
- this.ch_anime_data_.text_info = new StringInfo(MessageClass.GetWrapString(this.message_label_, text));
|
|
|
|
- this.ch_anime_data_.type = MessageClass.ChAnimeData.Type.Execution;
|
|
|
|
- this.ch_anime_data_.start_time = GameMain.tick_count;
|
|
|
|
- this.ch_anime_data_.start_time = this.ch_anime_data_.start_time - this.ch_wait;
|
|
|
|
this.hitret_sprite_.alpha = 0f;
|
|
this.hitret_sprite_.alpha = 0f;
|
|
- this.message_mgr_.AddBackLog(name, this.ch_anime_data_.text_info.String, voice_file, voice_pitch);
|
|
|
|
|
|
+ this.charaNameText = name;
|
|
|
|
+ this.mainTextAnimation.StartAnimation(MessageClass.GetWrapString(this.message_label_, text));
|
|
|
|
+ this.message_mgr_.AddBackLog(name, this.mainTextAnimation.text, voice_file, voice_pitch);
|
|
this.Update();
|
|
this.Update();
|
|
}
|
|
}
|
|
|
|
|
|
public void Clear()
|
|
public void Clear()
|
|
{
|
|
{
|
|
this.exit_wait_count_ = -1;
|
|
this.exit_wait_count_ = -1;
|
|
- UILabel uilabel = this.message_label_;
|
|
|
|
string empty = string.Empty;
|
|
string empty = string.Empty;
|
|
- this.name_label_.text = empty;
|
|
|
|
- uilabel.text = empty;
|
|
|
|
- this.ch_anime_data_.Clear();
|
|
|
|
|
|
+ this.charaNameText = empty;
|
|
|
|
+ this.messageText = empty;
|
|
|
|
+ this.mainTextAnimation.Clear();
|
|
|
|
+ this.subTextAnimation.Clear();
|
|
this.hitret_sprite_.alpha = 0f;
|
|
this.hitret_sprite_.alpha = 0f;
|
|
}
|
|
}
|
|
|
|
|
|
public void FinishChAnime()
|
|
public void FinishChAnime()
|
|
{
|
|
{
|
|
- if (this.ch_anime_data_.type == MessageClass.ChAnimeData.Type.Null)
|
|
|
|
|
|
+ if (!this.ch_anime_enabled)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- this.message_label_.text = this.ch_anime_data_.text_info.String;
|
|
|
|
- this.ch_anime_data_.Clear();
|
|
|
|
|
|
+ this.messageText = this.mainTextAnimation.text;
|
|
|
|
+ this.mainTextAnimation.Clear();
|
|
|
|
+ this.subtitlesText = this.subTextAnimation.text;
|
|
|
|
+ this.subTextAnimation.Clear();
|
|
this.hitret_sprite_.alpha = 255f;
|
|
this.hitret_sprite_.alpha = 255f;
|
|
this.exit_wait_count_ = GameMain.tick_count;
|
|
this.exit_wait_count_ = GameMain.tick_count;
|
|
}
|
|
}
|
|
|
|
|
|
public void Update()
|
|
public void Update()
|
|
{
|
|
{
|
|
- if (this.ch_anime_data_.type == MessageClass.ChAnimeData.Type.Null)
|
|
|
|
|
|
+ if (!this.ch_anime_enabled)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (this.skip_mode || this.ch_wait <= 0)
|
|
|
|
- {
|
|
|
|
- this.FinishChAnime();
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- int num = Mathf.Max(0, Mathf.Min((GameMain.tick_count - this.ch_anime_data_.start_time) / this.ch_wait, this.ch_anime_data_.text_info.LengthInTextElements));
|
|
|
|
- if (num == this.ch_anime_data_.text_info.LengthInTextElements)
|
|
|
|
|
|
+ KeyValuePair<bool, string> keyValuePair = this.mainTextAnimation.UodateAnimation();
|
|
|
|
+ KeyValuePair<bool, string> keyValuePair2 = this.subTextAnimation.UodateAnimation();
|
|
|
|
+ if (this.skip_mode || keyValuePair.Key)
|
|
{
|
|
{
|
|
this.FinishChAnime();
|
|
this.FinishChAnime();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- this.message_label_.text = this.ch_anime_data_.text_info.SubstringByTextElements(0, num);
|
|
|
|
|
|
+ this.messageText = keyValuePair.Value;
|
|
|
|
+ this.subtitlesText = (keyValuePair2.Key ? this.subTextAnimation.text : keyValuePair2.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -176,15 +174,48 @@ public class MessageClass
|
|
{
|
|
{
|
|
get
|
|
get
|
|
{
|
|
{
|
|
- return this.ch_anime_data_.type == MessageClass.ChAnimeData.Type.Execution;
|
|
|
|
|
|
+ return this.mainTextAnimation.isPlay;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private int ch_wait
|
|
|
|
|
|
+ private string messageText
|
|
{
|
|
{
|
|
- get
|
|
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ if (this.message_label_ != null)
|
|
|
|
+ {
|
|
|
|
+ this.message_label_.text = value;
|
|
|
|
+ }
|
|
|
|
+ if (this.subtitles_manager_ != null)
|
|
|
|
+ {
|
|
|
|
+ this.subtitles_manager_.originalText = value;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private string subtitlesText
|
|
|
|
+ {
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ if (this.subtitles_manager_ != null)
|
|
|
|
+ {
|
|
|
|
+ this.subtitles_manager_.subtitlesText = value;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private string charaNameText
|
|
|
|
+ {
|
|
|
|
+ set
|
|
{
|
|
{
|
|
- return (int)((100f - (float)GameMain.Instance.CMSystem.MsgTextSpeed) * 1.5f);
|
|
|
|
|
|
+ if (this.name_label_ != null)
|
|
|
|
+ {
|
|
|
|
+ this.name_label_.text = value;
|
|
|
|
+ }
|
|
|
|
+ if (this.subtitles_manager_ != null)
|
|
|
|
+ {
|
|
|
|
+ this.subtitles_manager_.charaNameText = value;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -204,34 +235,82 @@ public class MessageClass
|
|
|
|
|
|
private readonly ScriptManager script_mgr_;
|
|
private readonly ScriptManager script_mgr_;
|
|
|
|
|
|
|
|
+ private UISprite hitret_sprite_;
|
|
|
|
+
|
|
|
|
+ private int exit_wait_count_;
|
|
|
|
+
|
|
|
|
+ private MessageClass.TextAnimation mainTextAnimation;
|
|
|
|
+
|
|
|
|
+ private MessageClass.TextAnimation subTextAnimation;
|
|
|
|
+
|
|
private UILabel message_label_;
|
|
private UILabel message_label_;
|
|
|
|
|
|
private UILabel name_label_;
|
|
private UILabel name_label_;
|
|
|
|
|
|
- private UISprite hitret_sprite_;
|
|
|
|
|
|
+ public SubtitleDisplayManager subtitles_manager_;
|
|
|
|
|
|
- private MessageClass.ChAnimeData ch_anime_data_;
|
|
|
|
|
|
+ private class TextAnimation
|
|
|
|
+ {
|
|
|
|
+ private int ch_wait
|
|
|
|
+ {
|
|
|
|
+ get
|
|
|
|
+ {
|
|
|
|
+ return (int)((100f - (float)GameMain.Instance.CMSystem.MsgTextSpeed) * 1.5f);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- private int exit_wait_count_;
|
|
|
|
|
|
+ public bool isPlay
|
|
|
|
+ {
|
|
|
|
+ get
|
|
|
|
+ {
|
|
|
|
+ return this.type != MessageClass.TextAnimation.Type.Null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public string text
|
|
|
|
+ {
|
|
|
|
+ get
|
|
|
|
+ {
|
|
|
|
+ return (this.text_info == null) ? string.Empty : this.text_info.String;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void StartAnimation(string text)
|
|
|
|
+ {
|
|
|
|
+ this.Clear();
|
|
|
|
+ this.text_info = new StringInfo(text);
|
|
|
|
+ this.type = MessageClass.TextAnimation.Type.Execution;
|
|
|
|
+ this.start_time = GameMain.tick_count - this.ch_wait;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public KeyValuePair<bool, string> UodateAnimation()
|
|
|
|
+ {
|
|
|
|
+ if (this.type == MessageClass.TextAnimation.Type.Null || this.ch_wait <= 0)
|
|
|
|
+ {
|
|
|
|
+ return new KeyValuePair<bool, string>(true, null);
|
|
|
|
+ }
|
|
|
|
+ int num = Mathf.Max(0, Mathf.Min((GameMain.tick_count - this.start_time) / this.ch_wait, this.text_info.LengthInTextElements));
|
|
|
|
+ if (num == this.text_info.LengthInTextElements)
|
|
|
|
+ {
|
|
|
|
+ return new KeyValuePair<bool, string>(true, null);
|
|
|
|
+ }
|
|
|
|
+ return new KeyValuePair<bool, string>(false, this.text_info.SubstringByTextElements(0, num));
|
|
|
|
+ }
|
|
|
|
|
|
- private struct ChAnimeData
|
|
|
|
- {
|
|
|
|
public void Clear()
|
|
public void Clear()
|
|
{
|
|
{
|
|
- this.type = MessageClass.ChAnimeData.Type.Null;
|
|
|
|
- this.start_time = (this.cur_pos = 0);
|
|
|
|
|
|
+ this.type = MessageClass.TextAnimation.Type.Null;
|
|
|
|
+ this.start_time = 0;
|
|
this.text_info = null;
|
|
this.text_info = null;
|
|
}
|
|
}
|
|
|
|
|
|
- public MessageClass.ChAnimeData.Type type;
|
|
|
|
-
|
|
|
|
- public int start_time;
|
|
|
|
|
|
+ private MessageClass.TextAnimation.Type type;
|
|
|
|
|
|
- public StringInfo text_info;
|
|
|
|
|
|
+ private int start_time;
|
|
|
|
|
|
- public int cur_pos;
|
|
|
|
|
|
+ private StringInfo text_info;
|
|
|
|
|
|
- public enum Type
|
|
|
|
|
|
+ private enum Type
|
|
{
|
|
{
|
|
Null,
|
|
Null,
|
|
Execution
|
|
Execution
|