Merge branch 'china/dev' into china/test

dev_chengFeng
zhangshanxue 2021-11-15 18:39:21 +08:00
commit 6dc9993671
7 changed files with 103 additions and 16 deletions

View File

@ -616,7 +616,9 @@ function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageTy
-- end
-- damage = floor(max(damage * (1 + n / #arr - defRole:GetRoleData(RoleDataName.TeamDamageReduceFactor)), 0.3 * damage))
-- end
-- 计算护盾减伤
damage = BattleUtil.CalShield(atkRole, defRole, damage,skill)
--加入被动效果
local damagingFunc = function(dmgDeduction)
damage = damage - dmgDeduction
@ -625,10 +627,6 @@ function BattleUtil.ApplyDamage(skill, atkRole, defRole, damage, bCrit, damageTy
defRole.Event:DispatchEvent(BattleEventName.PassiveBeDamaging, damagingFunc, atkRole, damage, skill, dotType, bCrit)
BattleLogic.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit,damageType, dotType,isDirect)
-- 计算护盾减伤
damage = BattleUtil.CalShield(atkRole, defRole, damage,skill)
-- 造成的最终伤害
local damagingFunc = function(dmgDeduction)
damage = damage - dmgDeduction
@ -660,9 +658,14 @@ function BattleUtil.ApplyDamageNoPassive(skill, atkRole, defRole, damage, bCrit,
end
atkRole.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, defRole, damage, skill, dotType, bCrit,damageType, dotType,isDirect)
defRole.Event:DispatchEvent(BattleEventName.PassiveBeDamaging, damagingFunc, atkRole, damage, skill, dotType, bCrit)
BattleLogic.Event:DispatchEvent(BattleEventName.PassiveDamaging, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit,damageType, dotType,isDirect)
atkRole.Event:DispatchEvent(BattleEventName.FinalDamage, damagingFunc, defRole, damage, skill, dotType, bCrit, damageType)
defRole.Event:DispatchEvent(BattleEventName.FinalBeDamage, damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType)
defRole.Event:DispatchEvent(BattleEventName.FinalBeDamageEnd, damagingFunc, atkRole, damage, skill, dotType, bCrit, damageType,isDirect)
BattleLogic.Event:DispatchEvent(BattleEventName.FinalDamage, damagingFunc, atkRole, defRole, damage, skill, dotType, bCrit, damageType)
--
return BattleUtil.FinalDamage(skill, atkRole, defRole, damage, bCrit, damageType, dotType,isDirect)
end

View File

@ -224,8 +224,11 @@ function this:OnOpen(_fightData, _fightType, _endFunc, _guideType,isChangeBGM)
isBack = _fightType == BATTLE_TYPE.BACK --判定是否是战斗回放
hadCounted = 0
-- LogPink(fightType)
this.BG:GetComponent("Image").sprite = this.spLoader:LoadSprite(BattleManager.GetBattleBg(fightType))
if _fightData.bg then
this.BG:GetComponent("Image").sprite = this.spLoader:LoadSprite(_fightData.bg)
else
this.BG:GetComponent("Image").sprite = this.spLoader:LoadSprite(BattleManager.GetBattleBg(fightType))
end
-- SoundManager.PlayMusic(SoundConfig.BGM_Battle_1, true, function()
if not isChangeBGM then
SoundManager.PlayMusic(SoundConfig.BGM_Battle_2, false)

View File

@ -412,6 +412,7 @@ function this.InitBattleEvent()
BattleLogic.Event:AddEvent(BattleEventName.BattleEnd, this.EndBattle)
BattleLogic.Event:AddEvent(BattleEventName.BattleOrderChange, this.BattleOrderChange)
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundChange, this.BattleRoundChange)
BattleLogic.Event:AddEvent(BattleEventName.BattleRoundEnd, this.BattleRoundEnd)
BattleLogic.Event:AddEvent(BattleEventName.RoleTurnStart, this.RoleTurnChange)
BattleLogic.Event:AddEvent(BattleEventName.BattleStart, this.OnBattleStart)
@ -426,6 +427,7 @@ function this.ClearBattleEvent()
BattleLogic.Event:RemoveEvent(BattleEventName.BattleEnd, this.EndBattle)
BattleLogic.Event:RemoveEvent(BattleEventName.BattleOrderChange, this.BattleOrderChange)
BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundChange, this.BattleRoundChange)
BattleLogic.Event:RemoveEvent(BattleEventName.BattleRoundEnd, this.BattleRoundEnd)
BattleLogic.Event:RemoveEvent(BattleEventName.RoleTurnStart, this.RoleTurnChange)
BattleLogic.Event:RemoveEvent(BattleEventName.BattleStart, this.OnBattleStart)
end
@ -507,6 +509,14 @@ function this.RoleTurnChange(role)
end
end
-- 回合结束
function this.BattleRoundEnd(Round)
-- 回调UI层
if this.root.BattleRoundEnd then
this.root.BattleRoundEnd(Round)
end
end
-- 回合变化
function this.BattleRoundChange(Round)
-- 回调UI层
@ -695,6 +705,17 @@ function this.OnAddMonster(data)
end
end
-- 遍历灵兽列表
function this.ForeachMonster(func)
for _, monster in pairs(tbMonster) do
if func then
func(monster)
end
end
end
-- 移除灵兽
function this.OnRemoveMonster(data)
local view = tbMonster[data]
if view then

View File

@ -79,6 +79,33 @@ function GuideBattleLogic:OnBattleStart(func)
end)
end
end
function GuideBattleLogic:BattleRoundEnd(round)
-- 没有就不引导了
if not self.configList or #self.configList <= 0 then
return
end
local _config = nil
for _, con in ipairs(self.configList) do
if con.Round == -3 and con.Camp == round then -- 战中第n回合触发
_config = con
break
end
end
if not _config then
return
end
-- 对话形式的引导
if _config.TriggerType == 1 then
BattleManager.SetGuidePause(true)
local storyId = _config.TriggerId
StoryManager.EventTrigger(storyId, function()
BattleManager.SetGuidePause(false)
end)
end
end
-- 战斗结束
function GuideBattleLogic:OnBattleEnd(func)
-- 没有就不引导了
if not self.configList or #self.configList <= 0 then

View File

@ -65,10 +65,12 @@ end
--添加事件监听(用于子类重写)
function this:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Player.OnChangeName, this.OnNameChange)
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnChangeName, this.OnNameChange)
end
function this:OnSortingOrderChange()
@ -86,13 +88,13 @@ function this:OnOpen(_fightData, _endFunc, guideType)
endFunc = _endFunc
fightType = BATTLE_TYPE.Test --判定战斗类型
if guideType == 1 then
this.BG:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_zhandou_changjing_1005")
if _fightData.bg then
this.BG:GetComponent("Image").sprite = this.spLoader:LoadSprite(_fightData.bg)
else
this.BG:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_zhandou_changjing_2")
this.BG:GetComponent("Image").sprite = this.spLoader:LoadSprite(BattleManager.GetBattleBg(fightType))
end
this.BtnGM:SetActive(true)
this.BtnGM:SetActive(guideType ~= 3)
this.ButtonLock:SetActive(false)
this.BtnTimeScale:SetActive(false)
this.damagePanel:SetActive(false)
@ -182,7 +184,12 @@ function this.OnRoundChanged(round)
--显示波次
local curRound, maxRound = BattleLogic.GetCurRound()
this.roundText.text = string.format(Language[10211], curRound, maxRound)
end
-- 回合结束
function this.BattleRoundEnd(Round)
-- 回调UI层
GuideBattleLogic:BattleRoundEnd(Round)
end
-- 角色轮转回调
@ -195,6 +202,29 @@ function this.OnUpdate()
end
-- 当改变姓名的时候
function this.OnNameChange()
if this.guideType == 3 and NameManager.roleSex ~= ROLE_SEX.BOY then
BattleView.ForeachMonster(function(monster)
if monster.role.position == 100 and monster.camp == 0 then
-- 删除原来的
GameObject.DestroyImmediate(monster.RoleLiveGO2)
-- casting技能立绘 替换成女角色
monster.livePath="live2d_npc_girl"
monster.RoleLiveGO2 = poolManager:LoadLive(monster.livePath, monster.skillCastRoot.gameObject.transform.parent, Vector3.one, Vector3.zero)
monster.RoleLiveGO2.transform:SetParent(monster.skillCastRoot.gameObject.transform)
monster.RoleLiveGO2:GetComponent("RectTransform").anchoredPosition = Vector2.New(monster.offset[1], monster.offset[2])
monster.RoleLiveGO2.transform.localScale = Vector3.one * monster.play_liveScale
monster.RoleLiveGO2:SetActive(false)
monster.RoleLiveGOGraphic2 = monster.RoleLiveGO2:GetComponent("SkeletonGraphic")
monster.RoleLiveGOTran2 = monster.RoleLiveGO2:GetComponent("RectTransform")
monster.RoleLiveGOGraphic2.AnimationState:SetAnimation(0, "idle", true)
monster.RoleLiveGOTran2.sizeDelta = Vector2.New(1000, 1000)
end
end)
end
end
--界面关闭时调用(用于子类重写)
function this:OnClose()
BattleView:OnClose()

View File

@ -146,8 +146,8 @@ function CreateNamePopup:BindEvent()
this.curName = this.textName.text
local callBack = function()
if this.options then
-- self:ClosePanel()
StoryManager.StoryJumpType(this.options[1], self)
self:ClosePanel()
StoryManager.StoryJumpType(this.options[1], nil, this.callBackFunc)
else
PopupTipPanel.ShowTip(Language[10837])
this:ClosePanel()
@ -181,7 +181,7 @@ function CreateNamePopup:BindEvent()
local callBack = function()
if this.options then
self:ClosePanel()
StoryManager.StoryJumpType(this.options[1], self)
StoryManager.StoryJumpType(this.options[1], nil, this.callBackFunc)
-- 发送创建角色事件
CustomEventManager.SendCustomEvents(FBSDKCustomEventType.CreateCharacter)
CustomEventManager.SendCustomEvents(FBSDKCustomEventType.RoleLv,1)
@ -301,6 +301,7 @@ function CreateNamePopup:OnOpen(...)
this.eventId = args[2]
this.showValues = args[3]
this.options = args[4]
this.callBackFunc = args[5]
this.InitName()
this.RefreshShow()
end

View File

@ -5,6 +5,7 @@ local chapterDataConfig = ConfigManager.GetConfig(ConfigName.ChapterEventPointCo
local chapterOptionData = ConfigManager.GetConfig(ConfigName.ChapterOptionConfig)
local chapterTitleData = ConfigManager.GetConfig(ConfigName.LevelSetting)
local dialogueSetData = ConfigManager.GetConfig(ConfigName.DialogueViewConfig)
local FakeBattleNew = ConfigManager.GetConfig(ConfigName.FakeBattleNew)
@ -49,14 +50,15 @@ function this.EventTrigger(eventId, callBack)
UIManager.OpenPanel(UIName.StoryDialoguePanel, eventId, false)
--UIManager.OpenPanel(UIName.StoryOptionPopup, eventId)
elseif showType == 10 then -- 起名字界面
UIManager.OpenPanel(UIName.CreateNamePopup, showType, eventId, showValues, options)
UIManager.OpenPanel(UIName.CreateNamePopup, showType, eventId, showValues, options, callBack)
elseif showType == 14 then -- 引导战斗
local fdata, fseed = BattleManager.GetFakeBattleData(options[1])
local testFightData = {
fightData = fdata,
fightSeed = fseed,
fightType = BATTLE_SERVER_TYPE.StoryFight,
maxRound = 20
maxRound = 20,
bg = FakeBattleNew[options[1]].BgName
}
local panel = UIManager.OpenPanel(UIName.GuideBattlePanel, testFightData, function()
StoryManager.StoryJumpType(options[3])