using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class BacklogCtrl : MonoBehaviour { public void CreateBacklog(List 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(); 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.SPP) { UILabel component2 = UTY.GetChildObject(gameObject, "SpeakerName", false).GetComponent(); component2.text = backlogUnit.m_speakerName; UILabel component3 = UTY.GetChildObject(gameObject, "Message", false).GetComponent(); component3.text = backlogUnit.m_msg; } else { SubtitleDisplayManager component4 = gameObject.GetComponent(); component4.charaNameText = backlogUnit.m_speakerNameSet; component4.originalText = backlogUnit.m_msg; component4.subtitlesText = backlogUnit.m_subtitlemsg; } } } if (Product.SPP) { if (SubtitleDisplayManager.configDisplayType == SubtitleDisplayManager.DisplayType.OriginalAndSubtitle) { base.GetComponent().cellHeight = 240f; } else { base.GetComponent().cellHeight = 182f; } } base.GetComponent().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 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); } } }