|
@@ -1,3 +1,4 @@
|
|
|
+using System.Collections.Generic;
|
|
|
using ET;
|
|
|
using FairyGUI;
|
|
|
using UI.Travel;
|
|
@@ -8,6 +9,8 @@ namespace GFGGame
|
|
|
public class TravelDressupView : BaseWindow
|
|
|
{
|
|
|
private UI_TravelDressupUI _ui;
|
|
|
+ private List<int> _selectTravelSuitIds = new List<int>();
|
|
|
+ private List<int> _travelSuitIds = new List<int>();
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -26,6 +29,11 @@ namespace GFGGame
|
|
|
_ui = UI_TravelDressupUI.Create();
|
|
|
this.viewCom = _ui.target;
|
|
|
isfullScreen = true;
|
|
|
+ _ui.m_btnCancle.onClick.Add(Hide);
|
|
|
+ _ui.m_btnGo.onClick.Add(OnBtnGoClick);
|
|
|
+ _ui.m_comDress0.target.onClick.Add(OnComDressClick0);
|
|
|
+ _ui.m_comDress1.target.onClick.Add(OnComDressClick);
|
|
|
+ _ui.m_comDress2.target.onClick.Add(OnComDressClick);
|
|
|
_ui.m_loaBg.url = ResPathUtil.GetBgImgPath("gzs_bjbj");
|
|
|
}
|
|
|
protected override void AddEventListener()
|
|
@@ -36,13 +44,15 @@ namespace GFGGame
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
-
|
|
|
+ UpdateView();
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
base.OnHide();
|
|
|
-
|
|
|
+ _selectTravelSuitIds.Clear();
|
|
|
+ _travelSuitIds.Clear();
|
|
|
+ if (_ui.m_list.numItems > 0) _ui.m_list.ScrollToView(0);
|
|
|
}
|
|
|
|
|
|
protected override void RemoveEventListener()
|
|
@@ -50,5 +60,69 @@ namespace GFGGame
|
|
|
base.RemoveEventListener();
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ private void UpdateView()
|
|
|
+ {
|
|
|
+ _travelSuitIds = new List<int>(DressUpMenuSuitDataManager.TravelSuitIDList.ToArray());
|
|
|
+ for (int i = 0; i < _selectTravelSuitIds.Count; i++)
|
|
|
+ {
|
|
|
+ if (_travelSuitIds.IndexOf(_selectTravelSuitIds[i]) >= 0)
|
|
|
+ {
|
|
|
+ _travelSuitIds.Remove(_selectTravelSuitIds[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _ui.m_list.numItems = _travelSuitIds.Count;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void RenderListItem(int index, GObject obj)
|
|
|
+ {
|
|
|
+ TravelSuitCfg travelSuitCfg = TravelSuitCfgArray.Instance.GetCfg(_travelSuitIds[index]);
|
|
|
+ UI_ListDressItem item = UI_ListDressItem.Proxy(obj);
|
|
|
+
|
|
|
+ item.target.data = _travelSuitIds[index];
|
|
|
+ UI_ListDressItem.ProxyEnd();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnListItemClick(EventContext context)
|
|
|
+ {
|
|
|
+ if (_selectTravelSuitIds.Count >= 2)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("行囊已满");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int travelSuitId = (int)(context.data as GObject).data;
|
|
|
+ _selectTravelSuitIds.Add(travelSuitId);
|
|
|
+
|
|
|
+ UpdateView();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnComDressClick0()
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("必带服装不能取消");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnComDressClick(EventContext context)
|
|
|
+ {
|
|
|
+
|
|
|
+ int travelSuitId = (int)(context.sender as GObject).data;
|
|
|
+ _selectTravelSuitIds.Remove(travelSuitId);
|
|
|
+
|
|
|
+ UpdateView();
|
|
|
+ }
|
|
|
+
|
|
|
+ private async void OnBtnGoClick()
|
|
|
+ {
|
|
|
+ if (_selectTravelSuitIds.Count < 2)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("需带齐服装才能出发");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ bool result = await TravelSProxy.ReqGoTravel(_selectTravelSuitIds);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ this.Hide();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|