123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- 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_loaBg.url = ResPathUtil.GetBgImgPath("gzs_bjbj");
- _ui.m_btnback.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.onClick.Add(OnBtnLockClick);
- _ui.m_btnUp.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<PoemPhotoShareView>(_curIndex, new object[] { typeof(PoemPhotoPreView).FullName, _curIndex });
- }
- }
- }
|