123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System.Collections.Generic;
- using ET;
- using FairyGUI;
- using UI.Poem;
- using UnityEngine;
- namespace GFGGame
- {
- public class PoemPhotoShareView : BaseWindow
- {
- private UI_PoemPhotoShareUI _ui;
- private List<PoemPhotoData> _photoInfos;
- private int _curIndex = 0;
- private int _sourceType = 0;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_PoemPhotoShareUI.PACKAGE_NAME;
- _ui = UI_PoemPhotoShareUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xc_bjbj");
- _ui.m_btnback.onClick.Add(OnBtnBackClick);
- _ui.m_btnSave.onClick.Add(OnBtnSaveClick);
- _ui.m_btnShare.onClick.Add(OnBtnShareClick);
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- }
- protected override void OnShown()
- {
- base.OnShown();
- _curIndex = (int)(this.viewData as object[])[0];
- _sourceType = (int)(this.viewData as object[])[1];
- if (_sourceType == (int)PictureSourceType.PersonalAlbum)
- {
- _photoInfos = PoemPhotoDataManager.Instance.PersonalPhotoInfos;
- }
- else
- {
- _photoInfos = PoemPhotoDataManager.Instance.WsqsPhotoInfos;
- }
- _ui.m_loaBg.texture = PoemPhotoDataManager.Instance.BytesToTexture2D(_photoInfos[_curIndex].Bytes);
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- }
- private void OnBtnBackClick()
- {
- ViewManager.GoBackFrom(typeof(PoemPhotoShareView).FullName);
- }
- private void OnBtnSaveClick()
- {
- byte[] bytes = _photoInfos[_curIndex].Bytes;
- string fileName = "wsj" + TimeHelper.ServerNowSecs + ".jpg";
- PhotographDataManager.Instance.SavePicturoToLocal(bytes, fileName);
- }
- private void OnBtnShareClick()
- {
- }
- }
- }
|