using System; using System.Collections.Generic; using System.IO; using UnityEngine; using wf; public class SoundWindow : BaseMaidPhotoWindow { public override void Awake() { base.Awake(); PhotoSoundData.Create(); this.scroll_view_ = NGUITools.FindInParents(this.Grid.transform); for (int i = 0; i < PhotoSoundData.data.Count; i++) { PhotoSoundData photoSoundData = PhotoSoundData.data[i]; GameObject gameObject = Utility.CreatePrefab(this.Grid.gameObject, "ScenePhotoMode/WindowListItem", true); gameObject.name = photoSoundData.id.ToString(); UILabel componentInChildren = gameObject.GetComponentInChildren(); componentInChildren.fontSize = 15; componentInChildren.text = photoSoundData.name; EventDelegate.Add(gameObject.GetComponent().onSelect, new EventDelegate.Callback(this.OnSelectBtn)); } this.tab_panel_ = this.Grid.GetComponent(); NGUITools.FindInParents(this.Grid.transform).ResetPosition(); this.Grid.Reposition(); this.tab_panel_.UpdateChildren(); this.scroll_view_.ResetPosition(); this.UpdateChildren(); } public override void Start() { base.Start(); this.Init(); } public void Init() { Dictionary> woldStoreData = base.GetWoldStoreData(); if (!woldStoreData.ContainsKey("再生サウンド")) { woldStoreData["再生サウンド"] = new Dictionary(); woldStoreData["再生サウンド"]["id"] = PhotoSoundData.Get(Path.ChangeExtension(this.initBgmFileName, ".ogg")).id.ToString(); } long num = long.Parse(woldStoreData["再生サウンド"]["id"]); if (PhotoSoundData.Get(num) == null) { num = PhotoSoundData.Get("BGM021.ogg").id; } UIWFTabButton uiwftabButton = null; List childList = this.Grid.GetChildList(); int num2 = 0; while (num2 < childList.Count && uiwftabButton == null) { if (long.Parse(childList[num2].name) == num) { uiwftabButton = childList[num2].GetComponent(); } num2++; } this.tab_panel_.Select(uiwftabButton); } public void OnSelectBtn() { if (!UIWFSelectButton.current.isSelected) { return; } long id = long.Parse(UIWFSelectButton.current.name); PhotoSoundData photoSoundData = PhotoSoundData.Get(id); photoSoundData.Play(); Dictionary> woldStoreData = base.GetWoldStoreData(); if (!woldStoreData.ContainsKey("再生サウンド")) { woldStoreData["再生サウンド"] = new Dictionary(); } woldStoreData["再生サウンド"]["id"] = id.ToString(); } public override void OnFinishMaidDeserializeLoad() { base.OnFinishMaidDeserializeLoad(); this.scroll_view_.ResetPosition(); GameMain.Instance.SoundMgr.StopBGM(0f); this.Init(); } public override void OnDeserializeEvent() { List maidStoreGuidList = this.mgr.GetMaidStoreGuidList(); if (maidStoreGuidList.Count == 0) { this.scroll_view_.ResetPosition(); GameMain.Instance.SoundMgr.StopBGM(0f); this.Init(); } } public new PhotoWindowManager mgr { get { return base.mgr; } } public UIGrid Grid; public string initBgmFileName; private UIWFTabPanel tab_panel_; private UIScrollView scroll_view_; }