using ET; using FairyGUI; using UI.Poem; using UnityEngine; namespace GFGGame { public class PoemPhotoPreView : BaseWindow { private UI_PoemPhotoPreviewUI _ui; private int _curIndex = 0; public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_PoemPhotoPreviewUI.PACKAGE_NAME; _ui = UI_PoemPhotoPreviewUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_grhBg.onClick.Add(OnBtnBackClick); _ui.m_list.SetVirtual(); _ui.m_list.itemRenderer = RenderListItem; _ui.m_btnLeft.onClick.Add(OnBtnLeftClick); _ui.m_btnRight.onClick.Add(OnBtnRightClick); _ui.m_btnLock.target.onClick.Add(OnBtnLockClick); _ui.m_btnUp.target.onClick.Add(OnBtnUpClick); _ui.m_btnShare.onClick.Add(OnBtnShareClick); } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); _curIndex = (int)this.viewData; _ui.m_list.numItems = 0; _ui.m_list.ScrollToView(_curIndex); } protected override void OnHide() { base.OnHide(); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void OnBtnBackClick() { ViewManager.GoBackFrom(typeof(PoemPhotoPreView).FullName); } private void UpdateView() { _ui.m_btnLeft.enabled = _curIndex > 0; _ui.m_btnRight.enabled = _curIndex < _ui.m_list.numItems - 1; } private void RenderListItem(int index, GObject obj) { UI_ListPhotoPreviewItem item = UI_ListPhotoPreviewItem.Proxy(obj); UI_ListPhotoPreviewItem.ProxyEnd(); } private void OnBtnLeftClick() { _curIndex--; _curIndex = Mathf.Max(0, _curIndex); UpdateView(); } private void OnBtnRightClick() { _curIndex++; _curIndex = Mathf.Min(_ui.m_list.numItems - 1, _curIndex); UpdateView(); } private void OnBtnLockClick() { } private void OnBtnUpClick() { } private void OnBtnShareClick() { ViewManager.Show(_curIndex, new object[] { typeof(PoemPhotoPreView).FullName, _curIndex }); } } }