PoemPhotoShareView.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 List<PoemPhotoData> _photoInfos;
  12. private PoemPhotoData _curPhotoData;
  13. private int _curIndex = 0;
  14. private int _sourceType = 0;
  15. public override void Dispose()
  16. {
  17. if (_ui != null)
  18. {
  19. _ui.Dispose();
  20. _ui = null;
  21. }
  22. base.Dispose();
  23. }
  24. protected override void OnInit()
  25. {
  26. base.OnInit();
  27. packageName = UI_PoemPhotoShareUI.PACKAGE_NAME;
  28. _ui = UI_PoemPhotoShareUI.Create();
  29. this.viewCom = _ui.target;
  30. isfullScreen = true;
  31. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xc_bjbj");
  32. _ui.m_btnback.onClick.Add(OnBtnBackClick);
  33. _ui.m_btnSave.onClick.Add(OnBtnSaveClick);
  34. _ui.m_btnShare.onClick.Add(OnBtnShareClick);
  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_loaBg.texture = _curPhotoData.Ntexture;
  45. _ui.m_loaBg.SetSize(_ui.m_loaBg.width, _ui.m_loaBg.texture.height * _ui.m_loaBg.width / _ui.m_loaBg.texture.width);
  46. }
  47. protected override void OnHide()
  48. {
  49. base.OnHide();
  50. }
  51. protected override void RemoveEventListener()
  52. {
  53. base.RemoveEventListener();
  54. }
  55. private void OnBtnBackClick()
  56. {
  57. ViewManager.GoBackFrom(typeof(PoemPhotoShareView).FullName);
  58. }
  59. private void OnBtnSaveClick()
  60. {
  61. byte[] bytes = _curPhotoData.Bytes;
  62. string fileName = "wsj" + TimeHelper.ServerNowSecs + ".jpg";
  63. PhotographDataManager.Instance.SavePicturoToLocal(bytes, fileName);
  64. }
  65. private void OnBtnShareClick()
  66. {
  67. }
  68. }
  69. }