|
@@ -7,6 +7,9 @@ namespace GFGGame
|
|
{
|
|
{
|
|
private UI_PersonalPhotoUI _ui;
|
|
private UI_PersonalPhotoUI _ui;
|
|
|
|
|
|
|
|
+ private int _showIndex = 0;
|
|
|
|
+ private long _showPictureId = 0;
|
|
|
|
+
|
|
public override void Dispose()
|
|
public override void Dispose()
|
|
{
|
|
{
|
|
if (_ui != null)
|
|
if (_ui != null)
|
|
@@ -26,13 +29,19 @@ namespace GFGGame
|
|
this.viewCom.Center();
|
|
this.viewCom.Center();
|
|
this.modal = true;
|
|
this.modal = true;
|
|
|
|
|
|
|
|
+ _ui.m_list.SetVirtual();
|
|
_ui.m_list.itemRenderer = RenderListItem;
|
|
_ui.m_list.itemRenderer = RenderListItem;
|
|
|
|
+ _ui.m_list.onClickItem.Add(OnListItemClick);
|
|
|
|
+
|
|
|
|
+ _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("xc_bjbj");
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
{
|
|
{
|
|
base.OnShown();
|
|
base.OnShown();
|
|
- _ui.m_list.numItems = RoleSkillCfgArray.Instance.dataArray.Length;
|
|
|
|
|
|
+ _showIndex = (int)this.viewData;
|
|
|
|
+ _showPictureId = RoleInfoManager.Instance.photoDatas[_showIndex];
|
|
|
|
+ _ui.m_list.numItems = PoemPhotoDataManager.Instance.PersonalPhotoInfos.Count;
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
protected override void OnHide()
|
|
@@ -42,14 +51,49 @@ namespace GFGGame
|
|
|
|
|
|
private void RenderListItem(int index, GObject obj)
|
|
private void RenderListItem(int index, GObject obj)
|
|
{
|
|
{
|
|
- RoleSkillCfg cfg = RoleSkillCfgArray.Instance.dataArray[index];
|
|
|
|
- UI_ListSkillItem item = UI_ListSkillItem.Proxy(obj);
|
|
|
|
|
|
+ PoemPhotoData photoData = PoemPhotoDataManager.Instance.PersonalPhotoInfos[index];
|
|
|
|
+ UI_ListPhotoItem1 item = UI_ListPhotoItem1.Proxy(obj);
|
|
|
|
+ item.m_comIcon.m_loaIcon.texture = photoData.Ntexture;
|
|
|
|
+ bool curSelect = photoData.PictureId == _showPictureId;
|
|
|
|
+ bool otherSelect = !curSelect && RoleInfoManager.Instance.photoDatas.IndexOf(photoData.PictureId) >= 0;
|
|
|
|
+ item.m_imgSelect.visible = curSelect;
|
|
|
|
+ item.m_imgOtherSelect.visible = otherSelect;
|
|
|
|
+
|
|
|
|
+ item.target.data = photoData.PictureId;
|
|
|
|
+ UI_ListPhotoItem1.ProxyEnd();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ private void OnListItemClick(EventContext context)
|
|
|
|
+ {
|
|
|
|
+ GObject obj = context.data as GObject;
|
|
|
|
+ long selectPictureId = (long)obj.data;
|
|
|
|
+ if (selectPictureId == _showPictureId)//删除:点击相同id照片
|
|
|
|
+ {
|
|
|
|
+ RoleInfoManager.Instance.photoDatas[_showIndex] = 0;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ if (_showPictureId == 0)//添加:原来未展示图片
|
|
|
|
+ {
|
|
|
|
+ RoleInfoManager.Instance.photoDatas[_showIndex] = selectPictureId;
|
|
|
|
+ }
|
|
|
|
+ else//原来有展示图片
|
|
|
|
+ {
|
|
|
|
+ if (RoleInfoManager.Instance.photoDatas.IndexOf(selectPictureId) < 0)//更换:选中的图片未被选中
|
|
|
|
+ {
|
|
|
|
+ RoleInfoManager.Instance.photoDatas[_showIndex] = selectPictureId;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ int selectPictureIndex = RoleInfoManager.Instance.photoDatas.IndexOf(selectPictureId);
|
|
|
|
|
|
- item.m_loaIcon.url = string.Format("ui://Main/{0}", cfg.res);
|
|
|
|
- item.m_txtname.text = cfg.name;
|
|
|
|
- item.m_txtDesc.text = cfg.desc;
|
|
|
|
- UI_ListSkillItem.ProxyEnd();
|
|
|
|
|
|
+ RoleInfoManager.Instance.photoDatas[_showIndex] = selectPictureId;
|
|
|
|
+ RoleInfoManager.Instance.photoDatas[selectPictureIndex] = _showPictureId;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ ViewManager.GoBackFrom(typeof(PersonalPhotoView).FullName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|