123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class BacklogCtrl : MonoBehaviour
- {
- public void CreateBacklog(List<BacklogCtrl.BacklogUnit> dicBacklog, UnityEngine.Object backlogPrefab)
- {
- this.ClearExistBacklog();
- if (dicBacklog != null)
- {
- foreach (BacklogCtrl.BacklogUnit backlogUnit in dicBacklog)
- {
- GameObject gameObject = UnityEngine.Object.Instantiate(backlogPrefab) as GameObject;
- GameObject childObject = UTY.GetChildObject(gameObject, "Voice", false);
- UIButton component = childObject.GetComponent<UIButton>();
- if (backlogUnit.m_voiceId != string.Empty)
- {
- childObject.SetActive(true);
- EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.ClickVoiceButton));
- component.name = backlogUnit.m_voiceId;
- if (!string.IsNullOrEmpty(component.name))
- {
- UIButton uibutton = component;
- string name = uibutton.name;
- uibutton.name = string.Concat(new object[]
- {
- name,
- "|",
- backlogUnit.m_voicePitch,
- "|",
- backlogUnit.m_voiceType.ToString()
- });
- }
- }
- else
- {
- childObject.SetActive(false);
- }
- gameObject.transform.parent = base.transform;
- gameObject.transform.localScale = Vector3.one;
- gameObject.transform.localPosition = Vector3.zero;
- gameObject.transform.rotation = Quaternion.identity;
- if (!Product.supportMultiLanguage)
- {
- UILabel component2 = UTY.GetChildObject(gameObject, "SpeakerName", false).GetComponent<UILabel>();
- component2.text = backlogUnit.m_speakerName;
- UILabel component3 = UTY.GetChildObject(gameObject, "Message", false).GetComponent<UILabel>();
- component3.text = backlogUnit.m_msg;
- }
- else
- {
- SubtitleDisplayManager component4 = gameObject.GetComponent<SubtitleDisplayManager>();
- component4.charaNameText = backlogUnit.m_speakerNameSet;
- component4.originalText = backlogUnit.m_msg;
- component4.subtitlesText = backlogUnit.m_subtitlemsg;
- }
- }
- }
- if (Product.supportMultiLanguage)
- {
- if (SubtitleDisplayManager.configDisplayType == SubtitleDisplayManager.DisplayType.OriginalAndSubtitle)
- {
- base.GetComponent<UIGrid>().cellHeight = 240f;
- }
- else
- {
- base.GetComponent<UIGrid>().cellHeight = 182f;
- }
- }
- base.GetComponent<UIGrid>().Reposition();
- }
- private void ClearExistBacklog()
- {
- IEnumerator enumerator = base.transform.GetEnumerator();
- try
- {
- while (enumerator.MoveNext())
- {
- object obj = enumerator.Current;
- Transform transform = (Transform)obj;
- UnityEngine.Object.Destroy(transform.gameObject);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- }
- private void ClickVoiceButton()
- {
- string name = UIButton.current.name;
- if (!string.IsNullOrEmpty(name))
- {
- string[] array = name.Split(new char[]
- {
- '|'
- });
- GameMain.Instance.SoundMgr.VoiceStopAll();
- GameMain.Instance.SoundMgr.PlayDummyVoice(array[0], 0f, false, false, int.Parse(array[1]), (AudioSourceMgr.Type)Enum.Parse(typeof(AudioSourceMgr.Type), array[2]));
- }
- Debug.Log(string.Format("ボイスボタン ボイスID={0}がクリックされました。", name));
- }
- public class BacklogUnit
- {
- public string m_speakerName { get; set; }
- public KeyValuePair<string, string> m_speakerNameSet { get; set; }
- public string m_msg { get; set; }
- public string m_subtitlemsg { get; set; }
- public string m_voiceId { get; set; }
- public int m_voicePitch { get; set; }
- public AudioSourceMgr.Type m_voiceType { get; set; }
- public override string ToString()
- {
- return string.Format("BacklogUnit=[m_speakerName={1}, m_msg={2}, m_voiceId={3}]", this.m_speakerName, this.m_msg, this.m_voiceId);
- }
- }
- }
|