|
@@ -17,7 +17,7 @@ namespace GFGGame
|
|
private int _needItemId;
|
|
private int _needItemId;
|
|
private int _needItemCount;
|
|
private int _needItemCount;
|
|
|
|
|
|
- private List<List<ItemData>> _totalBonusList;
|
|
|
|
|
|
+ private List<ItemData> _bonusList;
|
|
private int _index;
|
|
private int _index;
|
|
private int _expAdd;
|
|
private int _expAdd;
|
|
private int _power;
|
|
private int _power;
|
|
@@ -47,7 +47,7 @@ namespace GFGGame
|
|
{
|
|
{
|
|
base.AddEventListener();
|
|
base.AddEventListener();
|
|
EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBtnFightTimes);
|
|
EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBtnFightTimes);
|
|
- EventAgent.AddEventListener(ConstMessage.STORY_FIGHT_QUICKLY_SUCCESS, StartShowBonus);
|
|
|
|
|
|
+ // EventAgent.AddEventListener(ConstMessage.STORY_FIGHT_QUICKLY_SUCCESS, StartShowBonus);
|
|
}
|
|
}
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
{
|
|
{
|
|
@@ -72,6 +72,9 @@ namespace GFGGame
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
_ui.m_txtName.text = title;
|
|
_ui.m_txtName.text = title;
|
|
|
|
+
|
|
|
|
+ _ui.m_c1.selectedIndex = _needItemId <= 0 || _needItemCount <= 0 || ItemDataManager.GetItemNum(_needItemId) >= _needItemCount ? 0 : 1;
|
|
|
|
+
|
|
updateNeedItem();
|
|
updateNeedItem();
|
|
StartFight();
|
|
StartFight();
|
|
|
|
|
|
@@ -80,7 +83,7 @@ namespace GFGGame
|
|
protected override void OnHide()
|
|
protected override void OnHide()
|
|
{
|
|
{
|
|
base.OnHide();
|
|
base.OnHide();
|
|
- Timers.inst.Remove(ShowBonusItem);
|
|
|
|
|
|
+ // Timers.inst.Remove(ShowBonusItem);
|
|
ViewManager.GoBackFrom(typeof(StoryFightQuicklyView).Name);
|
|
ViewManager.GoBackFrom(typeof(StoryFightQuicklyView).Name);
|
|
InstanceZonesDataManager.isQuicklyFighting = false;
|
|
InstanceZonesDataManager.isQuicklyFighting = false;
|
|
|
|
|
|
@@ -89,13 +92,13 @@ namespace GFGGame
|
|
{
|
|
{
|
|
base.RemoveEventListener();
|
|
base.RemoveEventListener();
|
|
EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBtnFightTimes);
|
|
EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateBtnFightTimes);
|
|
- EventAgent.RemoveEventListener(ConstMessage.STORY_FIGHT_QUICKLY_SUCCESS, StartShowBonus);
|
|
|
|
|
|
+ // EventAgent.RemoveEventListener(ConstMessage.STORY_FIGHT_QUICKLY_SUCCESS, StartShowBonus);
|
|
}
|
|
}
|
|
|
|
|
|
private void StartFight()
|
|
private void StartFight()
|
|
{
|
|
{
|
|
- InstanceZonesDataManager.GetCanFightTime(_type, _storyType, _levelID, out int times, out string title);
|
|
|
|
- if (times == 0)
|
|
|
|
|
|
+ InstanceZonesDataManager.GetCanFightTime(_type, _storyType, _levelID, out _fightTimes, out string title);
|
|
|
|
+ if (_fightTimes == 0)
|
|
{
|
|
{
|
|
StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
|
|
StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
|
|
|
|
|
|
@@ -123,64 +126,80 @@ namespace GFGGame
|
|
|
|
|
|
// _ui.m_t0.Play(() =>
|
|
// _ui.m_t0.Play(() =>
|
|
// {
|
|
// {
|
|
|
|
+ _fightTimes = _fightType == 1 ? 1 : _fightTimes;
|
|
_ui.m_btnExit.visible = false;
|
|
_ui.m_btnExit.visible = false;
|
|
_ui.m_btnFightTimes.visible = false;
|
|
_ui.m_btnFightTimes.visible = false;
|
|
_ui.m_txtPowerDesc.visible = false;
|
|
_ui.m_txtPowerDesc.visible = false;
|
|
_ui.m_list.RemoveChildren();
|
|
_ui.m_list.RemoveChildren();
|
|
InstanceZonesDataManager.isQuicklyFighting = true;
|
|
InstanceZonesDataManager.isQuicklyFighting = true;
|
|
- InstanceZonesSProxy.FinishStoryFightQuickly(_levelID, _fightType == 1 ? 1 : times).Coroutine();
|
|
|
|
|
|
+ // InstanceZonesSProxy.FinishStoryFightQuickly(_levelID, _fightType == 1 ? 1 : times).Coroutine();
|
|
|
|
+ _index = 0;
|
|
|
|
+
|
|
|
|
+ ReqFightQuickly(null);
|
|
this.clickBlankToClose = true;
|
|
this.clickBlankToClose = true;
|
|
// });
|
|
// });
|
|
}
|
|
}
|
|
-
|
|
|
|
- private void StartShowBonus(EventContext eventContext)
|
|
|
|
- {
|
|
|
|
- _totalBonusList = (List<List<ItemData>>)eventContext.data;
|
|
|
|
- _index = 0;
|
|
|
|
- ShowBonusItem();
|
|
|
|
- Timers.inst.Add(0.3f, 0, ShowBonusItem);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void ShowBonusItem(object param = null)
|
|
|
|
|
|
+ private async void ReqFightQuickly(object param)
|
|
{
|
|
{
|
|
- if (_index < _totalBonusList.Count)
|
|
|
|
|
|
+ bool isFinish = _needItemId > 0 && _needItemCount > 0 && ItemDataManager.GetItemNum(_needItemId) >= _needItemCount;
|
|
|
|
+ if (_index >= _fightTimes || isFinish)
|
|
{
|
|
{
|
|
- List<ItemData> bonusList = _totalBonusList[_index] as List<ItemData>;
|
|
|
|
- UI_StoryFightQuicklyBonusListItem listItem = UI_StoryFightQuicklyBonusListItem.Proxy();
|
|
|
|
- listItem.m_list.itemRenderer = ListItemRender;
|
|
|
|
-
|
|
|
|
- _ui.m_list.AddChild(listItem.target);
|
|
|
|
- int order = _index + 1;
|
|
|
|
- listItem.m_txtTimes.SetVar("n", "" + NumberUtil.GetChiniseNumberText(order)).FlushVars();
|
|
|
|
- listItem.m_txtExp.SetVar("n", "" + _expAdd).FlushVars();
|
|
|
|
- listItem.m_list.numItems = bonusList.Count;
|
|
|
|
- listItem.m_list.ResizeToFit();
|
|
|
|
- listItem.target.height = listItem.m_list.y + listItem.m_list.height;
|
|
|
|
- _index++;
|
|
|
|
- UI_StoryFightQuicklyBonusListItem.ProxyEnd();
|
|
|
|
-
|
|
|
|
|
|
+ if (isFinish)
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("材料已足够");
|
|
|
|
+ }
|
|
|
|
+ ShowEnding();
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- UI_StoryFightQuicklyComplete completeItem = UI_StoryFightQuicklyComplete.Proxy();
|
|
|
|
- _ui.m_list.AddChild(completeItem.target);
|
|
|
|
- UI_StoryFightQuicklyComplete.ProxyEnd();
|
|
|
|
- Timers.inst.Remove(ShowBonusItem);
|
|
|
|
- InstanceZonesDataManager.isQuicklyFighting = false;
|
|
|
|
-
|
|
|
|
- _ui.m_btnExit.visible = true;
|
|
|
|
- UpdateBtnFightTimes();
|
|
|
|
- updateNeedItem();
|
|
|
|
|
|
+ List<ItemData> result = await InstanceZonesSProxy.FinishStoryFightQuickly(_levelID, 1);
|
|
|
|
+ ET.Log.Debug("result:" + result.Count);
|
|
|
|
+ if (result != null)
|
|
|
|
+ {
|
|
|
|
+ _bonusList = result;
|
|
|
|
+ ShowBonusItem();
|
|
|
|
+ _index++;
|
|
|
|
+ Timers.inst.Add(0.3f, 1, ReqFightQuickly);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- _ui.m_list.ScrollToView(_index - 1, true);
|
|
|
|
|
|
|
|
- //.ScrollBottom();
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void ShowBonusItem()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ UI_StoryFightQuicklyBonusListItem listItem = UI_StoryFightQuicklyBonusListItem.Proxy();
|
|
|
|
+ _ui.m_list.AddChild(listItem.target);
|
|
|
|
+ listItem.m_list.itemRenderer = ListItemRender;
|
|
|
|
+ listItem.m_txtTimes.SetVar("n", "" + NumberUtil.GetChiniseNumberText(_index + 1)).FlushVars();
|
|
|
|
+ listItem.m_txtExp.SetVar("n", "" + _expAdd).FlushVars();
|
|
|
|
+ listItem.m_list.numItems = _bonusList.Count;
|
|
|
|
+ listItem.m_list.ResizeToFit();
|
|
|
|
+ listItem.target.height = listItem.m_list.y + listItem.m_list.height;
|
|
|
|
+ UI_StoryFightQuicklyBonusListItem.ProxyEnd();
|
|
|
|
+
|
|
|
|
+ _ui.m_list.ScrollToView(_index, true);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ private void ShowEnding()
|
|
|
|
+ {
|
|
|
|
+ UI_StoryFightQuicklyComplete completeItem = UI_StoryFightQuicklyComplete.Proxy();
|
|
|
|
+ _ui.m_list.AddChild(completeItem.target);
|
|
|
|
+ UI_StoryFightQuicklyComplete.ProxyEnd();
|
|
|
|
+
|
|
|
|
+ InstanceZonesDataManager.isQuicklyFighting = false;
|
|
|
|
+
|
|
|
|
+ _ui.m_btnExit.visible = true;
|
|
|
|
+ _ui.m_list.ScrollToView(_index, true);
|
|
|
|
+ UpdateBtnFightTimes();
|
|
|
|
+ updateNeedItem();
|
|
|
|
+ _index = 0;
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private void ListItemRender(int index, GObject item)
|
|
private void ListItemRender(int index, GObject item)
|
|
{
|
|
{
|
|
- List<ItemData> bonusList = _totalBonusList[_index] as List<ItemData>;
|
|
|
|
- ItemData itemData = bonusList[index] as ItemData;
|
|
|
|
|
|
+ ItemData itemData = _bonusList[index] as ItemData;
|
|
if (item.data == null)
|
|
if (item.data == null)
|
|
{
|
|
{
|
|
item.data = new ItemView(item as GComponent);
|
|
item.data = new ItemView(item as GComponent);
|
|
@@ -195,30 +214,33 @@ namespace GFGGame
|
|
{
|
|
{
|
|
StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
|
|
StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
|
|
|
|
|
|
- InstanceZonesDataManager.GetCanFightTime(_type, _storyType, _levelID, out int times, out string title);
|
|
|
|
|
|
+ InstanceZonesDataManager.GetCanFightTime(_type, _storyType, _levelID, out _fightTimes, out string title);
|
|
_ui.m_btnFightTimes.title = _fightType == 1 ? "挑战一次" : title;
|
|
_ui.m_btnFightTimes.title = _fightType == 1 ? "挑战一次" : title;
|
|
- _ui.m_btnFightTimes.visible = times > 0;
|
|
|
|
|
|
+ _ui.m_btnFightTimes.visible = _fightTimes > 0;
|
|
|
|
|
|
_ui.m_txtPowerDesc.visible = _ui.m_btnFightTimes.visible;
|
|
_ui.m_txtPowerDesc.visible = _ui.m_btnFightTimes.visible;
|
|
if (_ui.m_txtPowerDesc.visible)
|
|
if (_ui.m_txtPowerDesc.visible)
|
|
{
|
|
{
|
|
- int power = times * levelCfg.power;
|
|
|
|
|
|
+ int power = _fightTimes * levelCfg.power;
|
|
_ui.m_txtPowerDesc.SetVar("v1", "" + power).FlushVars();
|
|
_ui.m_txtPowerDesc.SetVar("v1", "" + power).FlushVars();
|
|
}
|
|
}
|
|
|
|
+ _fightTimes = _fightType == 1 ? 1 : _fightTimes;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
private void updateNeedItem()
|
|
private void updateNeedItem()
|
|
{
|
|
{
|
|
- if (_needItemId <= 0 || _needItemCount <= 0)
|
|
|
|
|
|
+
|
|
|
|
+ bool isFinish = _needItemId > 0 && _needItemCount > 0 && ItemDataManager.GetItemNum(_needItemId) >= _needItemCount;
|
|
|
|
+ if (isFinish)
|
|
{
|
|
{
|
|
- _ui.m_c1.selectedIndex = 0;
|
|
|
|
- return;
|
|
|
|
|
|
+ _needItemCount = 0;
|
|
}
|
|
}
|
|
- _ui.m_c1.selectedIndex = 1;
|
|
|
|
|
|
+ if (_ui.m_c1.selectedIndex == 0) return;
|
|
|
|
+
|
|
_ui.m_txtItemName.text = string.Format("目标道具:{0}", ItemCfgArray.Instance.GetCfg(_needItemId).name);
|
|
_ui.m_txtItemName.text = string.Format("目标道具:{0}", ItemCfgArray.Instance.GetCfg(_needItemId).name);
|
|
int hasCount = ItemDataManager.GetItemNum(_needItemId);
|
|
int hasCount = ItemDataManager.GetItemNum(_needItemId);
|
|
- _ui.m_txtItemNeedNum.text = string.Format("还需:{0}个", Math.Max(0, _needItemCount - hasCount));
|
|
|
|
|
|
+ _ui.m_txtItemNeedNum.text = (_needItemCount - hasCount) <= 0 ? "材料已足够" : string.Format("还需:{0}个", Math.Max(0, _needItemCount - hasCount));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|