123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using System.Collections.Generic;
- using ET;
- using FairyGUI;
- using UI.Poem;
- using UnityEngine;
- namespace GFGGame
- {
- public class PoemPhotoShareView : BaseWindow
- {
- private UI_PoemPhotoShareUI _ui;
- private PoemPhotoData _curPhotoData;
- 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_graBg.onClick.Add(OnBtnBackClick);
- _ui.m_btnSave.onClick.Add(OnBtnSaveClick);
- _ui.m_btnShare.onClick.Add(OnBtnShareClick);
- _ui.m_btnShare.visible = false;
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- }
- protected override void OnShown()
- {
- base.OnShown();
- _curPhotoData = this.viewData as PoemPhotoData;
- _ui.m_c1.selectedIndex = _curPhotoData.SourceType;
- if (_curPhotoData.SourceType == (int)PictureSourceType.PersonalAlbum)
- {
- _ui.m_loaBg.texture = _curPhotoData.Ntexture;
- _ui.m_loaBg.SetSize(_ui.m_loaBg.width, _ui.m_loaBg.texture.height * _ui.m_loaBg.width / _ui.m_loaBg.texture.width);
- }
- else if (_curPhotoData.SourceType == (int)PictureSourceType.WanShuiQianShan)
- {
- // UI_ComPostcard item = UI_ComPostcard.Proxy(_ui.m_comPostcard);
- TravelLoactionCfg loactionCfg = TravelLoactionCfgArray.Instance.GetCfg(_curPhotoData.TravelLocationId);
- _ui.m_comPostcard.m_comTravel.m_loaBg.url = ResPathUtil.GetTravelBgPath(loactionCfg.res);
- _ui.m_comPostcard.m_txtLocationName.text = loactionCfg.name;
- _ui.m_comPostcard.m_txtTime.text = TimeUtil.FormattingTime2(_curPhotoData.CreationTime);
- _ui.m_comPostcard.m_comTravel.m_loaRole.url = "";
- if (_curPhotoData.TravelSuitId > 0)
- {
- TravelSuitCfg travelSuitCfg = TravelSuitCfgArray.Instance.GetCfg(_curPhotoData.TravelSuitId);
- _ui.m_comPostcard.m_comTravel.m_loaRole.url = ResPathUtil.GetTravelRolePath(travelSuitCfg.reourcesArr[_curPhotoData.SuitResIndex]);
- _ui.m_comPostcard.m_comTravel.m_loaRole.SetXY(loactionCfg.positionsArr[_curPhotoData.PositionIndex][0], loactionCfg.positionsArr[_curPhotoData.PositionIndex][1]);
- }
- // UI_ComPostcard.ProxyEnd();
- }
- }
- 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 = _curPhotoData.Bytes;
- string fileName = "wsj" + TimeHelper.ServerNowSecs + ".jpg";
- PhotographDataManager.Instance.SavePicturoToLocal(bytes, fileName);
- }
- private void OnBtnShareClick()
- {
- }
- }
- }
|