|
@@ -51,6 +51,10 @@ namespace GFGGame
|
|
|
private PinchGesture pinchGesture;
|
|
|
private RotationGesture rotationGesture;
|
|
|
|
|
|
+ // 以下两个属于单选,单独保存
|
|
|
+ private int lastChooseBorder; // 上一次选择的边框
|
|
|
+ private int lastChooseBg; // 上一次选择的背景
|
|
|
+
|
|
|
public override void Dispose()
|
|
|
{
|
|
|
if (_sceneObject != null)
|
|
@@ -78,7 +82,7 @@ namespace GFGGame
|
|
|
|
|
|
_ui.m_btnBg.onClick.Add(OnClickBtnBg);
|
|
|
|
|
|
- _ui.m_btnChoose.onClick.Add(SetUIView);
|
|
|
+ _ui.m_btnChoose.onClick.Add(OnClickBtnChoose);
|
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
|
_ui.m_btnPhotograph.onClick.Add(OnClickBtnPhotograph);
|
|
|
_ui.m_btnGalleryJoin.onClick.Add(OnClickBtnGalleryJoin);
|
|
@@ -136,6 +140,7 @@ namespace GFGGame
|
|
|
RefreshList(EnumPhotographType.BG);
|
|
|
SetUIView();
|
|
|
PhotographSceneManager.Instance.AddBgItem(ItemCfgArray.Instance.GetCfg(MyDressUpHelper.dressUpObj.bgId));
|
|
|
+ SetListScrollByID(MyDressUpHelper.dressUpObj.bgId);
|
|
|
PhotographSceneManager.Instance.AddBodyItem();
|
|
|
UpdateScene();
|
|
|
PhotographUtil.Instance.SetLayer(null, "refresh");
|
|
@@ -144,23 +149,63 @@ namespace GFGGame
|
|
|
|
|
|
Timers.inst.AddUpdate(CheckGuide);
|
|
|
}
|
|
|
+
|
|
|
/************************************************************UI界面*********************************************************/
|
|
|
private void OnContorllerChanged(EventContext context)
|
|
|
{
|
|
|
int index = _ui.m_ComSelectRes.m_comBtnTab.m_c1.selectedIndex;
|
|
|
RefreshList((EnumPhotographType)index);
|
|
|
}
|
|
|
+
|
|
|
private void RefreshList(EnumPhotographType index)
|
|
|
{
|
|
|
_ui.m_ComSelectRes.m_list.numItems = 0;
|
|
|
|
|
|
_listData = PhotographDataManager.Instance.GetListData(index);
|
|
|
_ui.m_ComSelectRes.m_list.numItems = _listData.Count;
|
|
|
- if (index == EnumPhotographType.BORDER || index == EnumPhotographType.EFFECT)
|
|
|
+
|
|
|
+ bool setTop = false;
|
|
|
+ switch (index)
|
|
|
{
|
|
|
- _ui.m_ComSelectRes.m_list.selectedIndex = 0;
|
|
|
+ case EnumPhotographType.BORDER:
|
|
|
+ _ui.m_ComSelectRes.m_list.selectedIndex = lastChooseBorder;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case EnumPhotographType.BG:
|
|
|
+ _ui.m_ComSelectRes.m_list.selectedIndex = lastChooseBg;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ setTop = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!setTop)
|
|
|
+ {
|
|
|
+ _ui.m_ComSelectRes.m_list.ScrollToView(_ui.m_ComSelectRes.m_list.selectedIndex);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _ui.m_ComSelectRes.m_list.scrollPane.ScrollTop();
|
|
|
+ }
|
|
|
+ //if (index == EnumPhotographType.BORDER || index == EnumPhotographType.EFFECT)
|
|
|
+ //{
|
|
|
+ // _ui.m_ComSelectRes.m_list.selectedIndex = 0;
|
|
|
+ //}
|
|
|
+ }
|
|
|
+
|
|
|
+ private void SetListScrollByID(int id)
|
|
|
+ {
|
|
|
+ for(int i = 0; i < _listData.Count; i++)
|
|
|
+ {
|
|
|
+ if(id == _listData[i])
|
|
|
+ {
|
|
|
+ _ui.m_ComSelectRes.m_list.selectedIndex = i;
|
|
|
+ _ui.m_ComSelectRes.m_list.ScrollToView(_ui.m_ComSelectRes.m_list.selectedIndex);
|
|
|
+ lastChooseBg = i;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private void RenderListItem(int index, GObject obj)
|
|
|
{
|
|
|
ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_listData[index]);
|
|
@@ -172,6 +217,7 @@ namespace GFGGame
|
|
|
item.m_txtName.text = itemCfg.name;
|
|
|
UI_ListItem.ProxyEnd();
|
|
|
}
|
|
|
+
|
|
|
private void OnListItemClick(EventContext context)
|
|
|
{
|
|
|
EnumPhotographType type = (EnumPhotographType)_ui.m_ComSelectRes.m_comBtnTab.m_c1.selectedIndex;
|
|
@@ -180,9 +226,22 @@ namespace GFGGame
|
|
|
PromptController.Instance.ShowFloatTextPrompt("最多穿戴" + MAX_COUNT + "件物品");
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ switch (type)
|
|
|
+ {
|
|
|
+ case EnumPhotographType.BORDER:
|
|
|
+ lastChooseBorder = _ui.m_ComSelectRes.m_list.selectedIndex;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case EnumPhotographType.BG:
|
|
|
+ lastChooseBg = _ui.m_ComSelectRes.m_list.selectedIndex;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
int itemID = (int)((context.data as GObject).data);
|
|
|
ChangeItem(itemID);
|
|
|
}
|
|
|
+
|
|
|
private void ChangeItem(int itemID)
|
|
|
{
|
|
|
ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemID);
|
|
@@ -512,6 +571,8 @@ namespace GFGGame
|
|
|
_ui.m_comSelectBox.target.visible = false;
|
|
|
hitGameObj = null;
|
|
|
memoryHitGameObj = null;
|
|
|
+ lastChooseBorder = 0;
|
|
|
+ lastChooseBg = 0;
|
|
|
_ui.m_ComSelectRes.m_comBtnTab.target.scrollPane.SetPercX(0, false);
|
|
|
_ui.m_ComSelectRes.m_comBtnTab.m_c1.selectedIndex = 0;
|
|
|
if (_ui.m_ComSelectRes.m_list.numItems > 0)
|
|
@@ -521,6 +582,14 @@ namespace GFGGame
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void OnClickBtnChoose()
|
|
|
+ {
|
|
|
+ _ui.m_ComSelectRes.target.visible = true;
|
|
|
+ _ui.m_comSelectBox.target.visible = false;
|
|
|
+ hitGameObj = null;
|
|
|
+ memoryHitGameObj = null;
|
|
|
+ }
|
|
|
+
|
|
|
private void OnClickBtnUp()
|
|
|
{
|
|
|
|