PoemPhotoShareView.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using System.Collections.Generic;
  2. using ET;
  3. using FairyGUI;
  4. using UI.Poem;
  5. using UnityEngine;
  6. namespace GFGGame
  7. {
  8. public class PoemPhotoShareView : BaseWindow
  9. {
  10. private UI_PoemPhotoShareUI _ui;
  11. private PoemPhotoData _curPhotoData;
  12. public override void Dispose()
  13. {
  14. if (_ui != null)
  15. {
  16. _ui.Dispose();
  17. _ui = null;
  18. }
  19. base.Dispose();
  20. }
  21. protected override void OnInit()
  22. {
  23. base.OnInit();
  24. packageName = UI_PoemPhotoShareUI.PACKAGE_NAME;
  25. _ui = UI_PoemPhotoShareUI.Create();
  26. this.viewCom = _ui.target;
  27. isfullScreen = true;
  28. isReturnView = true;
  29. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xc_bjbj");
  30. _ui.m_btnback.onClick.Add(OnBtnBackClick);
  31. _ui.m_mask.onClick.Add(OnBtnBackClick);
  32. _ui.m_btnSave.onClick.Add(OnBtnSaveClick);
  33. _ui.m_btnShare.onClick.Add(OnBtnShareClick);
  34. _ui.m_btnShare.visible = false;
  35. }
  36. protected override void AddEventListener()
  37. {
  38. base.AddEventListener();
  39. }
  40. protected override void OnShown()
  41. {
  42. base.OnShown();
  43. _curPhotoData = this.viewData as PoemPhotoData;
  44. _ui.m_c1.selectedIndex = _curPhotoData.SourceType;
  45. if (_curPhotoData.SourceType == (int)PictureSourceType.PersonalAlbum)
  46. {
  47. _ui.m_loaBg.texture = _curPhotoData.Ntexture;
  48. _ui.m_loaBg.SetSize(_ui.m_loaBg.width, _ui.m_loaBg.texture.height * _ui.m_loaBg.width / _ui.m_loaBg.texture.width);
  49. }
  50. else if (_curPhotoData.SourceType == (int)PictureSourceType.WanShuiQianShan)
  51. {
  52. // UI_ComPostcard item = UI_ComPostcard.Proxy(_ui.m_comPostcard);
  53. TravelLoactionCfg loactionCfg = TravelLoactionCfgArray.Instance.GetCfg(_curPhotoData.TravelLocationId);
  54. _ui.m_comPostcard.m_comTravel.m_loaBg.url = ResPathUtil.GetTravelBgPath(loactionCfg.res);
  55. _ui.m_comPostcard.m_txtLocationName.text = loactionCfg.name;
  56. _ui.m_comPostcard.m_txtTime.text = TimeUtil.FormattingTimeTo_yyyMMdd1(_curPhotoData.CreationTime);
  57. _ui.m_comPostcard.m_comTravel.m_loaRole.url = "";
  58. if (_curPhotoData.TravelSuitId > 0)
  59. {
  60. TravelSuitCfg travelSuitCfg = TravelSuitCfgArray.Instance.GetCfg(_curPhotoData.TravelSuitId);
  61. _ui.m_comPostcard.m_comTravel.m_loaRole.url = ResPathUtil.GetTravelRolePath(travelSuitCfg.reourcesArr[_curPhotoData.SuitResIndex]);
  62. _ui.m_comPostcard.m_comTravel.m_loaRole.SetXY(loactionCfg.positionsArr[_curPhotoData.PositionIndex][0], loactionCfg.positionsArr[_curPhotoData.PositionIndex][1]);
  63. }
  64. // UI_ComPostcard.ProxyEnd();
  65. }
  66. }
  67. protected override void OnHide()
  68. {
  69. base.OnHide();
  70. }
  71. protected override void RemoveEventListener()
  72. {
  73. base.RemoveEventListener();
  74. }
  75. private void OnBtnBackClick()
  76. {
  77. ViewManager.GoBackFrom(typeof(PoemPhotoShareView).FullName);
  78. }
  79. private void OnBtnSaveClick()
  80. {
  81. byte[] bytes = _curPhotoData.Bytes;
  82. string fileName = "wsj" + TimeHelper.ServerNowSecs + ".jpg";
  83. PhotographUtil.Instance.SavePicturoToLocal(bytes, fileName);
  84. }
  85. private void OnBtnShareClick()
  86. {
  87. }
  88. }
  89. }