|
@@ -9,9 +9,10 @@ namespace GFGGame
|
|
public class PoemPhotoView : BaseWindow
|
|
public class PoemPhotoView : BaseWindow
|
|
{
|
|
{
|
|
private UI_PoemPhotoUI _ui;
|
|
private UI_PoemPhotoUI _ui;
|
|
- private List<int> _listDelete = new List<int>();
|
|
|
|
|
|
+ private List<long> _listDelete = new List<long>();
|
|
|
|
+ private List<PoemPhotoData> _photoInfos;
|
|
|
|
+ private int _sourceType = 0;
|
|
|
|
|
|
- private bool _deleting = false;//是否删除状态
|
|
|
|
|
|
|
|
public override void Dispose()
|
|
public override void Dispose()
|
|
{
|
|
{
|
|
@@ -30,13 +31,14 @@ namespace GFGGame
|
|
_ui = UI_PoemPhotoUI.Create();
|
|
_ui = UI_PoemPhotoUI.Create();
|
|
this.viewCom = _ui.target;
|
|
this.viewCom = _ui.target;
|
|
isfullScreen = true;
|
|
isfullScreen = true;
|
|
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("gzs_bjbj");
|
|
|
|
|
|
+ _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xc_bjbj");
|
|
|
|
|
|
_ui.m_list.SetVirtual();
|
|
_ui.m_list.SetVirtual();
|
|
_ui.m_list.itemRenderer = RenderListItem;
|
|
_ui.m_list.itemRenderer = RenderListItem;
|
|
|
|
|
|
_ui.m_btnback.onClick.Add(OnBtnBackClick);
|
|
_ui.m_btnback.onClick.Add(OnBtnBackClick);
|
|
_ui.m_btnDelete.onClick.Add(OnBtnDeleteClick);
|
|
_ui.m_btnDelete.onClick.Add(OnBtnDeleteClick);
|
|
|
|
+ _ui.m_btnConfirmDelete.target.onClick.Add(OnBtnConfirmDeleteClick);
|
|
_ui.m_c1.onChanged.Add(OnBtnTabChange);
|
|
_ui.m_c1.onChanged.Add(OnBtnTabChange);
|
|
|
|
|
|
|
|
|
|
@@ -44,6 +46,7 @@ namespace GFGGame
|
|
protected override void AddEventListener()
|
|
protected override void AddEventListener()
|
|
{
|
|
{
|
|
base.AddEventListener();
|
|
base.AddEventListener();
|
|
|
|
+ EventAgent.AddEventListener(ConstMessage.POEM_PHOTO_INFOS_CHANGE, OnBtnTabChange);
|
|
|
|
|
|
}
|
|
}
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
@@ -55,75 +58,118 @@ namespace GFGGame
|
|
protected override void OnHide()
|
|
protected override void OnHide()
|
|
{
|
|
{
|
|
base.OnHide();
|
|
base.OnHide();
|
|
- _listDelete.Clear();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
protected override void RemoveEventListener()
|
|
protected override void RemoveEventListener()
|
|
{
|
|
{
|
|
base.RemoveEventListener();
|
|
base.RemoveEventListener();
|
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.POEM_PHOTO_INFOS_CHANGE, OnBtnTabChange);
|
|
|
|
|
|
}
|
|
}
|
|
private void OnBtnBackClick()
|
|
private void OnBtnBackClick()
|
|
{
|
|
{
|
|
- ViewManager.GoBackFrom(typeof(PoemPhotoView).FullName);
|
|
|
|
- }
|
|
|
|
|
|
+ if (_ui.m_c2.selectedIndex == 1)
|
|
|
|
+ {
|
|
|
|
+ _ui.m_c2.selectedIndex = 0;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ViewManager.GoBackFrom(typeof(PoemPhotoView).FullName);
|
|
|
|
+ if (_ui.m_list.numItems > 0) _ui.m_list.ScrollToView(0);
|
|
|
|
+ _ui.m_c1.selectedIndex = 0;
|
|
|
|
+ }
|
|
|
|
+ _ui.m_c2.selectedIndex = 0;
|
|
|
|
+ _listDelete.Clear();
|
|
|
|
|
|
|
|
+ }
|
|
private void OnBtnDeleteClick()
|
|
private void OnBtnDeleteClick()
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ if (_ui.m_list.numItems == 0)
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("暂无照片可删除");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ _ui.m_c2.selectedIndex = 1;
|
|
}
|
|
}
|
|
|
|
+ private void OnBtnConfirmDeleteClick()
|
|
|
|
+ {
|
|
|
|
+ AlertUI.Show("删除后的照片无法恢复,是否确认删除?")
|
|
|
|
+ .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
|
|
|
|
+ {
|
|
|
|
+ PoemPhotoSProxy.ReqRemovedPhoto(_listDelete, _sourceType).Coroutine();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
private void OnBtnTabChange()
|
|
private void OnBtnTabChange()
|
|
{
|
|
{
|
|
- _deleting = false;
|
|
|
|
|
|
+ _ui.m_c2.selectedIndex = 0;
|
|
|
|
+ _listDelete.Clear();
|
|
|
|
+
|
|
|
|
+ if (_ui.m_list.numItems > 0) _ui.m_list.ScrollToView(0);
|
|
|
|
+ UpdateView();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ private void UpdateView()
|
|
|
|
+ {
|
|
if (_ui.m_c1.selectedIndex == 0)
|
|
if (_ui.m_c1.selectedIndex == 0)
|
|
{
|
|
{
|
|
- _ui.m_list.numItems = 0;
|
|
|
|
|
|
+ _photoInfos = PoemPhotoDataManager.Instance.PersonalPhotoInfos;
|
|
|
|
+ _sourceType = (int)PictureSourceType.PersonalAlbum;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- _ui.m_list.numItems = 0;
|
|
|
|
|
|
+ _photoInfos = PoemPhotoDataManager.Instance.WsqsPhotoInfos;
|
|
|
|
+ _sourceType = (int)PictureSourceType.WanShuiQianShan;
|
|
}
|
|
}
|
|
|
|
+ _ui.m_list.numItems = _photoInfos.Count;
|
|
|
|
+
|
|
|
|
+ _ui.m_txtCount.text = string.Format("({0}/{1})", _photoInfos.Count, GlobalCfgArray.globalCfg.maxPhotoCount);
|
|
|
|
+ _ui.m_btnConfirmDelete.m_txtTitle.text = string.Format("删除({0}/{1})", _listDelete.Count, _photoInfos.Count);
|
|
}
|
|
}
|
|
|
|
|
|
private void RenderListItem(int index, GObject obj)
|
|
private void RenderListItem(int index, GObject obj)
|
|
{
|
|
{
|
|
UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);
|
|
UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);
|
|
- int id = 0;
|
|
|
|
- item.m_c1.selectedIndex = _deleting ? 1 : 0;
|
|
|
|
- item.m_c2.selectedIndex = !_deleting || _listDelete.IndexOf(id) < 0 ? 0 : 1;
|
|
|
|
|
|
+
|
|
|
|
+ item.m_imgSelect.visible = _ui.m_c2.selectedIndex == 1 && _listDelete.IndexOf(_photoInfos[index].PictureId) >= 0;
|
|
|
|
+ item.m_comIcon.m_loaIcon.texture = PoemPhotoDataManager.Instance.BytesToTexture2D(_photoInfos[index].Bytes);
|
|
|
|
+ item.m_txtTime.text = TimeUtil.FormattingTime1(_photoInfos[index].CreationTime);
|
|
|
|
+
|
|
if (item.m_btnLock.target.data == null)
|
|
if (item.m_btnLock.target.data == null)
|
|
{
|
|
{
|
|
item.m_btnLock.target.onClick.Add(OnBtnLockClick);
|
|
item.m_btnLock.target.onClick.Add(OnBtnLockClick);
|
|
}
|
|
}
|
|
- item.m_btnLock.target.data = id;
|
|
|
|
|
|
+ item.m_btnLock.target.data = index;
|
|
|
|
+
|
|
if (item.m_btnUp.target.data == null)
|
|
if (item.m_btnUp.target.data == null)
|
|
{
|
|
{
|
|
item.m_btnUp.target.onClick.Add(OnBtnUpClick);
|
|
item.m_btnUp.target.onClick.Add(OnBtnUpClick);
|
|
}
|
|
}
|
|
- item.m_btnUp.target.data = id;
|
|
|
|
- if (item.m_comIcon.m_loaIcon.data == null)
|
|
|
|
|
|
+ item.m_btnUp.target.data = index;
|
|
|
|
+
|
|
|
|
+ if (item.m_comIcon.target.data == null)
|
|
{
|
|
{
|
|
- item.m_comIcon.m_loaIcon.onClick.Add(OnLoaIconClick);
|
|
|
|
|
|
+ item.m_comIcon.target.onClick.Add(OnLoaIconClick);
|
|
}
|
|
}
|
|
- item.m_comIcon.m_loaIcon.data = id;
|
|
|
|
- item.target.data = index;
|
|
|
|
|
|
+
|
|
UI_ListPhotoItem.ProxyEnd();
|
|
UI_ListPhotoItem.ProxyEnd();
|
|
}
|
|
}
|
|
|
|
|
|
private void OnLoaIconClick(EventContext context)
|
|
private void OnLoaIconClick(EventContext context)
|
|
{
|
|
{
|
|
GObject obj = context.sender as GObject;
|
|
GObject obj = context.sender as GObject;
|
|
- if (!_deleting)
|
|
|
|
|
|
+ int index = (int)obj.data;
|
|
|
|
+ PoemPhotoData photoData = _photoInfos[index];
|
|
|
|
+ if (_ui.m_c2.selectedIndex == 0)
|
|
{
|
|
{
|
|
- int index = (int)obj.parent.data;
|
|
|
|
- ViewManager.Show<PoemPhotoPreView>(index, new object[] { typeof(PoemView).FullName, this.viewData });
|
|
|
|
|
|
+ ViewManager.Show<PoemPhotoPreView>(new object[] { index, _sourceType }, new object[] { typeof(PoemView).FullName, this.viewData });
|
|
}
|
|
}
|
|
- else
|
|
|
|
|
|
+ else if (_ui.m_c2.selectedIndex == 1)
|
|
{
|
|
{
|
|
- int id = (int)obj.data;
|
|
|
|
- UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj);
|
|
|
|
- item.m_c2.selectedIndex = item.m_c2.selectedIndex == 0 ? 1 : 0;
|
|
|
|
- if (item.m_c2.selectedIndex == 1)
|
|
|
|
|
|
+ long id = photoData.PictureId;
|
|
|
|
+ UI_ListPhotoItem item = UI_ListPhotoItem.Proxy(obj.parent);
|
|
|
|
+ item.m_imgSelect.visible = !item.m_imgSelect.visible;
|
|
|
|
+ if (item.m_imgSelect.visible)
|
|
{
|
|
{
|
|
_listDelete.Add(id);
|
|
_listDelete.Add(id);
|
|
}
|
|
}
|
|
@@ -132,16 +178,57 @@ namespace GFGGame
|
|
_listDelete.Remove(id);
|
|
_listDelete.Remove(id);
|
|
}
|
|
}
|
|
UI_ListPhotoItem.ProxyEnd();
|
|
UI_ListPhotoItem.ProxyEnd();
|
|
|
|
+ _ui.m_btnConfirmDelete.m_txtTitle.text = string.Format("删除({0}/{1})", _listDelete.Count, _photoInfos.Count);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
private void OnBtnLockClick(EventContext context)
|
|
private void OnBtnLockClick(EventContext context)
|
|
{
|
|
{
|
|
GObject item = context.sender as GObject;
|
|
GObject item = context.sender as GObject;
|
|
|
|
+ int index = (int)item.data;
|
|
|
|
+ PoemPhotoData photoData = _photoInfos[index];
|
|
|
|
+ if (photoData.LockingStatus == false)
|
|
|
|
+ {
|
|
|
|
+ AlertUI.Show("是否确认锁定此照片?", "(锁住的照片无法被删除)")
|
|
|
|
+ .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
|
|
|
|
+ {
|
|
|
|
+ PoemPhotoSProxy.ReqChangeLockingState(photoData.PictureId, true, _sourceType).Coroutine();
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ AlertUI.Show("是否确认解锁此照片?", "(解锁后的照片可随意删除)")
|
|
|
|
+ .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
|
|
|
|
+ {
|
|
|
|
+ PoemPhotoSProxy.ReqChangeLockingState(photoData.PictureId, false, _sourceType).Coroutine();
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
private void OnBtnUpClick(EventContext context)
|
|
private void OnBtnUpClick(EventContext context)
|
|
{
|
|
{
|
|
GObject item = context.sender as GObject;
|
|
GObject item = context.sender as GObject;
|
|
|
|
+ int index = (int)item.data;
|
|
|
|
+ PoemPhotoData photoData = _photoInfos[index];
|
|
|
|
+ if (photoData.ToppingStatus == false)
|
|
|
|
+ {
|
|
|
|
+ AlertUI.Show("是否确认置顶此照片?")
|
|
|
|
+ .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
|
|
|
|
+ {
|
|
|
|
+ PoemPhotoSProxy.ReqChangeToppingState(photoData.PictureId, true, _sourceType).Coroutine();
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ AlertUI.Show("是否确认取消置顶此照片?")
|
|
|
|
+ .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
|
|
|
|
+ {
|
|
|
|
+ PoemPhotoSProxy.ReqChangeToppingState(photoData.PictureId, false, _sourceType).Coroutine();
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|