From 83999b75d50ac753dcc26aa6d44da06fbb1d85f1 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Thu, 30 Jul 2020 10:57:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E5=86=85=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E4=B8=8A=E6=8A=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Battle/View/BattlePanel.lua | 6 +++++ .../~Lua/Modules/Battle/View/BattleView.lua | 24 ++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua index 7fdfd88e53..f3ca3042e8 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua @@ -35,6 +35,7 @@ function this:InitComponent() this.BtnExit = Util.GetGameObject(this.DownRoot, "option/BtnExit") this.ButtonLock = Util.GetGameObject(this.DownRoot, "option/Button/lock") this.BtnGM = Util.GetGameObject(this.DownRoot, "option/Button") + this.submit = Util.GetGameObject(this.DownRoot, "bg") this.DefResult = Util.GetGameObject(this.UpRoot, "result") @@ -53,6 +54,11 @@ end --绑定事件(用于子类重写) function this:BindEvent() + Util.AddLongPressClick(this.submit, function() + BattleRecordManager.SubmitBattleRecord() + end, 0.5) + + Util.AddClick(this.BtnTimeScale, function () if not BattleManager.IsCanOperate() then return diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua index 35bb353cb7..0bf2acfdcb 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua @@ -235,6 +235,17 @@ function this:SetData(_fightData, _seed, _battleType, _maxRound) -- 设置角色展示界面数据 -- RoleShowView.SetData(_fightData) + + -- 加入战斗记录 + local record = { + fightData = this.fightData, + fightSeed = this.seed, + fightType = this.battleType, + maxRound = this.maxRound + } + this.recordId = BattleRecordManager.SetBattleRecord(record) + BattleRecordManager.SetBattleBothNameStr(this.nameStr, this.recordId) + end @@ -277,17 +288,8 @@ end function this.EndBattle(result) -- 清空数据 this.Clear() - -- 加入战斗记录 - local record = { - fightData = this.fightData, - fightSeed = this.seed, - fightType = this.battleType, - maxRound = this.maxRound - } - local battleId = BattleRecordManager.SetBattleRecord(record) - BattleRecordManager.SetBattleBothNameStr(this.nameStr, battleId) - - result = result or BattleRecordManager.GetBattleRecordResult(battleId) + -- 判断结果 + result = result or BattleRecordManager.GetBattleRecordResult(this.recordId) -- 战斗结束 this.root.BattleEnd(result)