|
@@ -14,7 +14,7 @@ namespace GFGGame
|
|
|
private GameObject _sceneObject;
|
|
|
private DressUpObj _targetDressUpObj;
|
|
|
private ValueBarController _valueBarController;
|
|
|
-
|
|
|
+ private ArenaDataManager _dataManager;
|
|
|
private ArenaTargetData _targetData;
|
|
|
private ArenaOpenCfg _arenaCfg;
|
|
|
|
|
@@ -67,7 +67,8 @@ namespace GFGGame
|
|
|
_ui.m_listTarget.itemRenderer = RenderListTargetItem;
|
|
|
// _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("gzs_bjbj");
|
|
|
|
|
|
- ArenaDataManager.Instance.SetTestInfo();
|
|
|
+ _dataManager = ArenaDataManager.Instance;
|
|
|
+ _dataManager.SetTestInfo();
|
|
|
}
|
|
|
protected override void AddEventListener()
|
|
|
{
|
|
@@ -78,29 +79,28 @@ namespace GFGGame
|
|
|
protected override async void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
- _targetData = this.viewData == null ? null : (this.viewData as object[])[0] as ArenaTargetData;
|
|
|
-
|
|
|
- _arenaCfg = ArenaOpenCfgArray.Instance.GetCfg(ArenaDataManager.Instance.SeasonId);
|
|
|
-
|
|
|
+ _targetData = this.viewData == null ? null : this.viewData as ArenaTargetData;
|
|
|
+ _arenaCfg = ArenaOpenCfgArray.Instance.GetCfg(_dataManager.SeasonId);
|
|
|
_valueBarController.OnShown();
|
|
|
- for (int i = 0; i < ArenaDataManager.Instance.Targets.Count; i++)
|
|
|
- {
|
|
|
- ArenaTargetData targetData = ArenaDataManager.Instance.Targets[i];
|
|
|
- if (targetData.Type == ArenaFightTargetType.PLAYER)
|
|
|
- {
|
|
|
- await ArenaSproxy.ReqArenaFightAttr(targetData.RoleInfo.roleId, targetData.RoleDressupList);
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ // for (int i = 0; i < _dataManager.Targets.Count; i++)
|
|
|
+ // {
|
|
|
+ // ArenaTargetData targetData = _dataManager.Targets[i];
|
|
|
+ // if (targetData.Type == ArenaFightTargetType.PLAYER)
|
|
|
+ // {
|
|
|
+ // await ArenaSproxy.ReqArenaFightAttr(targetData.RoleInfo.roleId, targetData.RoleDressupList);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
InstanceZonesDataManager.FightScene = ConstInstanceZonesType.Arena;
|
|
|
if (_targetData == null)
|
|
|
{
|
|
|
- ArenaDataManager.Instance.SelectTargetIndex = -1;
|
|
|
- ArenaDataManager.Instance.CurFightIndex = 0;
|
|
|
- ArenaDataManager.Instance.myScore.Clear();
|
|
|
- ArenaDataManager.Instance.targetScore.Clear();
|
|
|
- ArenaDataManager.Instance.myFightScore.Clear();
|
|
|
- ArenaDataManager.Instance.targetFightScore.Clear();
|
|
|
+ _dataManager.SelectTargetIndex = -1;
|
|
|
+ _dataManager.CurFightIndex = 0;
|
|
|
+ _dataManager.myScore.Clear();
|
|
|
+ _dataManager.targetScore.Clear();
|
|
|
+ _dataManager.myFightScore.Clear();
|
|
|
+ _dataManager.targetFightScore.Clear();
|
|
|
|
|
|
UpdateTargetList();
|
|
|
}
|
|
@@ -111,6 +111,7 @@ namespace GFGGame
|
|
|
UpdateNormal();
|
|
|
UpdateValue();
|
|
|
UpdateRole();
|
|
|
+ // GetFightResult();
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -179,12 +180,12 @@ namespace GFGGame
|
|
|
}
|
|
|
private void OnBtnDressClick()
|
|
|
{
|
|
|
- ViewManager.Show<ArenaDressInfoView>(new object[] { FightRoleType.MINE, 0, ArenaDataManager.Instance.DressupList, null }, new object[] { typeof(ArenaView).FullName, _targetData }, true);
|
|
|
+ ViewManager.Show<ArenaDressInfoView>(new object[] { FightRoleType.MINE, 0, _dataManager.DressupList, null }, new object[] { typeof(ArenaView).FullName, _targetData }, true);
|
|
|
}
|
|
|
|
|
|
private void OnBtnQuickFightClick()
|
|
|
{
|
|
|
- ArenaDataManager.Instance.QuickFight = _ui.m_btnQuickFight.selected;
|
|
|
+ _dataManager.QuickFight = _ui.m_btnQuickFight.selected;
|
|
|
}
|
|
|
private void OnBtnReSelectClick()
|
|
|
{
|
|
@@ -196,58 +197,57 @@ namespace GFGGame
|
|
|
|
|
|
private async void OnBtnFightClick()
|
|
|
{
|
|
|
- // bool result = await ArenaSproxy.ReqCheckArenaFight();
|
|
|
- // if (!result)
|
|
|
- // {
|
|
|
- // UpdateView();
|
|
|
- // return;
|
|
|
- // }
|
|
|
+ for (int i = 0; i < _dataManager.DressupList.Count; i++)
|
|
|
+ {
|
|
|
+ if (!MyDressUpHelper.CheckPutOnFinish(_dataManager.DressupList[i].itemList))
|
|
|
+ {
|
|
|
+ AlertUI.Show("全部主题穿戴完整才能开始战斗哦!").SetRightButton(true, "好的");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- List<long> selfFightPower = ArenaDataManager.Instance.GetFightScoreList(ArenaFightTargetType.PLAYER, ArenaDataManager.Instance.DressupList, null);
|
|
|
- List<long> targetFightPower = ArenaDataManager.Instance.GetFightScoreList(_targetData.Type, _targetData.RoleDressupList, _targetData.RobotDressupList);
|
|
|
|
|
|
|
|
|
+ GetFightResult();
|
|
|
+ if (_ui.m_btnQuickFight.selected)
|
|
|
+ {
|
|
|
+ ViewManager.Show<ArenaResultQuickView>();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ViewManager.Show<StoryFightTargetView>(null, null, true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void GetFightResult()
|
|
|
+ {
|
|
|
+ _dataManager.myScore.Clear();
|
|
|
+ _dataManager.targetScore.Clear();
|
|
|
+ _dataManager.myFightScore.Clear();
|
|
|
+ _dataManager.targetFightScore.Clear();
|
|
|
+
|
|
|
int winCount = 0;
|
|
|
|
|
|
- List<long> myScores = new List<long>();
|
|
|
- List<long> targetScores = new List<long>();
|
|
|
- for (int i = 0; i < ArenaDataManager.Instance.ThemeList.Count; i++)
|
|
|
+ for (int i = 0; i < _dataManager.ThemeList.Count; i++)
|
|
|
{
|
|
|
- int score = 0;
|
|
|
- int targetScore = 0;
|
|
|
+ long score = 0;
|
|
|
+ long targetScore = 0;
|
|
|
+
|
|
|
if (_targetData.Type == ArenaFightTargetType.PLAYER)
|
|
|
{
|
|
|
- FightDataManager.Instance.GetQuickFightResult(FightDataManager.Instance.roleData, _targetData.Type, _targetData.RoleDressupList[i], null, out score, out targetScore);
|
|
|
+ FightDataManager.Instance.GetQuickFightResult(i, ArenaDataManager.Instance.DressupList[i], _targetData.Type, _targetData.RoleDressupList[i], null, out score, out targetScore);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- FightDataManager.Instance.GetQuickFightResult(FightDataManager.Instance.roleData, _targetData.Type, null, _targetData.RobotDressupList[i], out score, out targetScore);
|
|
|
+ FightDataManager.Instance.GetQuickFightResult(i, ArenaDataManager.Instance.DressupList[i], _targetData.Type, null, _targetData.RobotDressupList[i], out score, out targetScore);
|
|
|
}
|
|
|
- myScores.Add(score);
|
|
|
- targetScores.Add(targetScore);
|
|
|
+ _dataManager.myScore.Add(score);
|
|
|
+ _dataManager.targetScore.Add(targetScore);
|
|
|
if (score > targetScore) winCount++;
|
|
|
}
|
|
|
- ArenaDataManager.Instance.myFightScore = selfFightPower;
|
|
|
- ArenaDataManager.Instance.targetFightScore = targetFightPower;
|
|
|
|
|
|
- bool result = await ArenaSproxy.ReqArenaFight(winCount >= 2, _targetData, selfFightPower, targetFightPower, myScores, targetScores);
|
|
|
- if (result)
|
|
|
- {
|
|
|
- if (_ui.m_btnQuickFight.selected)
|
|
|
- {
|
|
|
- ViewManager.Show<ArenaResultQuickView>();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ViewManager.Show<StoryFightTargetView>();
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- UpdateView();
|
|
|
- }
|
|
|
+ _dataManager.myFightScore = _dataManager.GetFightScoreList(ArenaFightTargetType.PLAYER, _dataManager.DressupList, null); ;
|
|
|
+ _dataManager.targetFightScore = _dataManager.GetFightScoreList(_targetData.Type, _targetData.RoleDressupList, _targetData.RobotDressupList); ;
|
|
|
}
|
|
|
-
|
|
|
private void UpdateView()
|
|
|
{
|
|
|
UpdateNormal();
|
|
@@ -257,20 +257,20 @@ namespace GFGGame
|
|
|
|
|
|
private void UpdateNormal()
|
|
|
{
|
|
|
- ItemUtil.UpdateTag(_ui.m_comTag, ArenaDataManager.Instance.Tag);
|
|
|
- _ui.m_loaScore0.url = ResPathUtil.GetScorePath(ArenaDataManager.Instance.ThemeList[0]);
|
|
|
- _ui.m_loaScore1.url = ResPathUtil.GetScorePath(ArenaDataManager.Instance.ThemeList[1]);
|
|
|
- _ui.m_loaScore2.url = ResPathUtil.GetScorePath(ArenaDataManager.Instance.ThemeList[2]);
|
|
|
+ ItemUtil.UpdateTag(_ui.m_comTag, _dataManager.Tag);
|
|
|
+ _ui.m_loaScore0.url = ResPathUtil.GetScorePath(_dataManager.ThemeList[0]);
|
|
|
+ _ui.m_loaScore1.url = ResPathUtil.GetScorePath(_dataManager.ThemeList[1]);
|
|
|
+ _ui.m_loaScore2.url = ResPathUtil.GetScorePath(_dataManager.ThemeList[2]);
|
|
|
string openTime = TimeUtil.FormattingTime3(TimeUtil.DateTimeToTimestamp(_arenaCfg.openTime));
|
|
|
string endTime = TimeUtil.FormattingTime3(TimeUtil.DateTimeToTimestamp(_arenaCfg.endTime));
|
|
|
_ui.m_txtTime.text = string.Format("{0}/{1}", openTime, endTime);
|
|
|
_ui.m_txtName.text = RoleDataManager.roleName;
|
|
|
- _ui.m_txtRank.text = string.Format("段位排名:{0}", ArenaDataManager.Instance.Rank);
|
|
|
- _ui.m_txtDanTitle.text = ArenaRankCfgArray.Instance.GetCfg(ArenaDataManager.Instance.Grade).gradeName;
|
|
|
- long fightScore = ArenaDataManager.Instance.GetAllFightScore(ArenaFightTargetType.PLAYER, ArenaDataManager.Instance.DressupList, null);
|
|
|
+ _ui.m_txtRank.text = string.Format("段位排名:{0}", _dataManager.Rank);
|
|
|
+ _ui.m_txtDanTitle.text = ArenaRankCfgArray.Instance.GetCfg(_dataManager.Grade).gradeName;
|
|
|
+ long fightScore = _dataManager.GetAllFightScore(ArenaFightTargetType.PLAYER, _dataManager.DressupList, null);
|
|
|
_ui.m_txtFightScore.text = string.Format("竞技场战力:{0}", fightScore);
|
|
|
- _ui.m_btnQuickFight.selected = ArenaDataManager.Instance.QuickFight;
|
|
|
- ArenaViewManager.Instance.UpdateFightScore(_ui.m_comFightScore.target, ArenaDataManager.Instance.DressupList);
|
|
|
+ _ui.m_btnQuickFight.selected = _dataManager.QuickFight;
|
|
|
+ ArenaViewManager.Instance.UpdateFightScore(_ui.m_comFightScore.target, _dataManager.DressupList);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -306,7 +306,7 @@ namespace GFGGame
|
|
|
targetSceneObj.SetActive(false);
|
|
|
_targetDressUpObj.setSceneObj(targetSceneObj, false, false);
|
|
|
}
|
|
|
- MyDressUpHelper.dressUpObj.PutOnItemList(ArenaDataManager.Instance.DressupList[0].itemList);
|
|
|
+ MyDressUpHelper.dressUpObj.PutOnItemList(_dataManager.DressupList[0].itemList);
|
|
|
if (_ui.m_c1.selectedIndex == 1)
|
|
|
{
|
|
|
GameObject targetSceneObj = _sceneObject.transform.Find("TargetRole").gameObject;
|
|
@@ -325,11 +325,11 @@ namespace GFGGame
|
|
|
private void UpdateTargetList()
|
|
|
{
|
|
|
_ui.m_c1.selectedIndex = 0;
|
|
|
- _ui.m_listTarget.numItems = ArenaDataManager.Instance.Targets.Count;
|
|
|
+ _ui.m_listTarget.numItems = _dataManager.Targets.Count;
|
|
|
}
|
|
|
private void RenderListTargetItem(int index, GObject obj)
|
|
|
{
|
|
|
- ArenaTargetData targetData = ArenaDataManager.Instance.Targets[index];
|
|
|
+ ArenaTargetData targetData = _dataManager.Targets[index];
|
|
|
ArenaRankCfg rankCfg = ArenaRankCfgArray.Instance.GetCfg(targetData.Grade);
|
|
|
|
|
|
UI_ListTargetItem item = UI_ListTargetItem.Proxy(obj);
|
|
@@ -347,7 +347,7 @@ namespace GFGGame
|
|
|
item.m_txtDanTitle.text = rankCfg.gradeName;
|
|
|
item.m_comLv.GetChild("txtLvl").asTextField.text = targetData.RoleInfo.roleLv.ToString();
|
|
|
|
|
|
- long fightScore = ArenaDataManager.Instance.GetAllFightScore(targetData.Type, targetData.RoleDressupList, targetData.RobotDressupList);
|
|
|
+ long fightScore = _dataManager.GetAllFightScore(targetData.Type, targetData.RoleDressupList, targetData.RobotDressupList);
|
|
|
item.m_txtFightScore.text = string.Format("竞技场战力:{0}", fightScore);
|
|
|
item.m_txtRank.text = string.Format("段位排名:{0}", targetData.RankInGrade);
|
|
|
|
|
@@ -369,8 +369,8 @@ namespace GFGGame
|
|
|
private void OnSelectRoleClick(EventContext context)
|
|
|
{
|
|
|
int index = (int)(context.sender as GObject).data;
|
|
|
- _targetData = ArenaDataManager.Instance.Targets[index];
|
|
|
- ArenaDataManager.Instance.SelectTargetIndex = index;
|
|
|
+ _targetData = _dataManager.Targets[index];
|
|
|
+ _dataManager.SelectTargetIndex = index;
|
|
|
|
|
|
_ui.m_c1.selectedIndex = 1;
|
|
|
UpdateRole();
|