|
@@ -8,7 +8,8 @@ namespace GFGGame
|
|
|
public class PoemGalleryPreviewView : BaseWindow
|
|
|
{
|
|
|
private UI_PoemGalleryPreviewUI _ui;
|
|
|
-
|
|
|
+ private int _sortType = 0;//由 GallerySortType 定义
|
|
|
+ private PoemGalleryData _galleryData;
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
if (_ui != null)
|
|
@@ -27,6 +28,12 @@ namespace GFGGame
|
|
|
this.viewCom = _ui.target;
|
|
|
isfullScreen = true;
|
|
|
// _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("gzs_bjbj");
|
|
|
+
|
|
|
+ _ui.m_btnback.onClick.Add(OnBtnBackClick);
|
|
|
+ _ui.m_btnCollect.onClick.Add(OnBtnCollectClick);
|
|
|
+ _ui.m_btnVote.onClick.Add(OnBtnVoteClick);
|
|
|
+ _ui.m_btnAddFriend.onClick.Add(OnBtnAddFriendClick);
|
|
|
+ _ui.m_btnDelete.onClick.Add(OnBtnDeleteClick);
|
|
|
}
|
|
|
protected override void AddEventListener()
|
|
|
{
|
|
@@ -36,7 +43,24 @@ namespace GFGGame
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
+ _sortType = (int)(this.viewData as object[])[0];
|
|
|
+ _galleryData = (this.viewData as object[])[1] as PoemGalleryData;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ private void UpdateView()
|
|
|
+ {
|
|
|
+ _ui.m_c1.selectedIndex = _sortType;
|
|
|
+ _ui.m_txtName.text = _galleryData.AuthorName;
|
|
|
+
|
|
|
+ string themeTime = PoemGalleryDataManager.Instance.GetThemeTime();
|
|
|
+ GalleryThemeCfg themeCfg = GalleryThemeCfgArray.Instance.GetCfg((int)PoemGalleryDataManager.Instance.ThemeId);
|
|
|
+ string themeName = themeCfg.theme;
|
|
|
+ _ui.m_txtTheme.text = string.Format("{0} {1}", themeTime, themeName);// PoemGalleryDataManager.Instance.GetThemeTime();
|
|
|
+ _ui.m_btnCollect.selected = _galleryData.CollectOrNot;
|
|
|
+ _ui.m_btnCollect.title = _galleryData.CollectCount.ToString();
|
|
|
+ _ui.m_btnVote.selected = _galleryData.VoteOrNot;
|
|
|
+ _ui.m_btnVote.title = _galleryData.VoteCount.ToString();
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -50,5 +74,57 @@ namespace GFGGame
|
|
|
base.RemoveEventListener();
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ private void OnBtnBackClick()
|
|
|
+ {
|
|
|
+ ViewManager.GoBackFrom(typeof(PoemGalleryPreviewView).FullName);
|
|
|
+ }
|
|
|
+
|
|
|
+ private async void OnBtnCollectClick(EventContext context)
|
|
|
+ {
|
|
|
+ if (_galleryData.CollectOrNot)
|
|
|
+ {
|
|
|
+ bool result = await PoemGallerySProxy.ReqCancelCollecteGalleryWorks(_galleryData.WorkId);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ _galleryData.CollectOrNot = false;
|
|
|
+ _galleryData.CollectCount = _galleryData.CollectCount - 1;
|
|
|
+ UpdateView();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bool result = await PoemGallerySProxy.ReqCollecteGalleryWorks(_galleryData.WorkId);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ _galleryData.CollectOrNot = true;
|
|
|
+ _galleryData.CollectCount = _galleryData.CollectCount + 1;
|
|
|
+ UpdateView();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private async void OnBtnVoteClick(EventContext context)
|
|
|
+ {
|
|
|
+ if (_galleryData.VoteOrNot) return;
|
|
|
+ bool result = await PoemGallerySProxy.ReqVoteGalleryWorks(_galleryData.WorkId);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ _galleryData.VoteOrNot = true;
|
|
|
+ _galleryData.CollectCount = _galleryData.CollectCount + 1;
|
|
|
+ UpdateView();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnBtnAddFriendClick(EventContext context)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnBtnDeleteClick(EventContext context)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|