【战斗】灵兽加入测试战斗
parent
00f262d2f4
commit
c4ca00dfd3
File diff suppressed because it is too large
Load Diff
|
|
@ -218,16 +218,17 @@ function this.MonsterSkillAdapter(MSkillId)
|
|||
local skill = {}
|
||||
local monsterSkill = SpiritAnimalSkill[tonumber(MSkillId)]
|
||||
for index, skillId in ipairs(monsterSkill.SkillIDList) do
|
||||
skill.effect = this.GetSkillData(tonumber(skillId))
|
||||
skill.triggerId = monsterSkill.ReleasePoint[index]
|
||||
skill.triggerCondition = {0}
|
||||
skill[index] = {}
|
||||
skill[index].effect = this.GetSkillData(tonumber(skillId))
|
||||
skill[index].triggerId = monsterSkill.ReleasePoint[index]
|
||||
skill[index].triggerCondition = {0}
|
||||
if monsterSkill.ReleaseLimit and monsterSkill.ReleaseLimit[index] then
|
||||
for k, v in ipairs(monsterSkill.ReleaseLimit[index]) do
|
||||
skill.triggerCondition[k] = v
|
||||
skill[index].triggerCondition[k] = v
|
||||
end
|
||||
end
|
||||
skill.maxCount = monsterSkill.WarEffectCount[index] or 999
|
||||
skill.maxRoundCount = monsterSkill.TurnEffectCount[index] or 999
|
||||
skill[index].maxCount = monsterSkill.WarEffectCount[index] or 999
|
||||
skill[index].maxRoundCount = monsterSkill.TurnEffectCount[index] or 999
|
||||
end
|
||||
return skill
|
||||
end
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ function MonsterManager.AddMonster(data)
|
|||
local index = data.camp * 6 + data.position
|
||||
local monster = Monster:New()
|
||||
monster:Init(data)
|
||||
if not this.monsterList then
|
||||
this.monsterList = {}
|
||||
end
|
||||
this.monsterList[index] = monster
|
||||
|
||||
BattleLogic.Event:DispatchEvent(BattleEventName.AddMonster, monster)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ function MSkill:New()
|
|||
end
|
||||
|
||||
function MSkill:Init(owner, group, index, skillData)
|
||||
LogBattle("MSkill Init")
|
||||
self.owner = owner
|
||||
self.group = group
|
||||
self.groupIndex = index
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ end
|
|||
|
||||
-- 初始化数据
|
||||
function MSkillGroup:Init(monster, groupData)
|
||||
LogBattle("MSkillGroup Init")
|
||||
self.owner = monster
|
||||
self.skillGroupData = groupData
|
||||
-- 创建技能
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ end
|
|||
-- 创建一个技能组
|
||||
function this.CreateMSkillGroup(monster, skillGroupData)
|
||||
local index = monster:GetCamp() * 6 + monster:GetPosition()
|
||||
if not this.MSkillGroupList then
|
||||
this.MSkillGroupList = {}
|
||||
end
|
||||
if not this.MSkillGroupList[index] then
|
||||
this.MSkillGroupList[index] = MSkillGroup:New()
|
||||
end
|
||||
|
|
@ -24,6 +27,9 @@ end
|
|||
function this.CreateMSkill(monster, group, index, skilldata)
|
||||
local owner = group:GetOwner()
|
||||
local m_index = owner:GetCamp() * 6 + owner:GetPosition()
|
||||
if not this.MSkillList then
|
||||
this.MSkillList = {}
|
||||
end
|
||||
if not this.MSkillList[m_index] then
|
||||
this.MSkillList[m_index] = {}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -133,6 +133,9 @@ end
|
|||
-- 技能加入检测
|
||||
function MTrigger.AddSkill(triggerId, condition, skill)
|
||||
LogBattle("AddSkill "..triggerId)
|
||||
if not this.TriggerList then
|
||||
this.TriggerList = {}
|
||||
end
|
||||
if not this.TriggerList[triggerId] then
|
||||
this.TriggerList[triggerId] = {}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,402 +0,0 @@
|
|||
|
||||
RoleSetView = {}
|
||||
local MonsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
|
||||
-- 初始化角色设置界面
|
||||
function RoleSetView:Init(root)
|
||||
self.gameObject = root
|
||||
self.monsterId = Util.GetGameObject(root, "configId/input"):GetComponent("InputField")
|
||||
self.btnLoad = Util.GetGameObject(root, "configId/load")
|
||||
|
||||
self.roleId = Util.GetGameObject(root, "roleId/input"):GetComponent("InputField")
|
||||
self.passivity = Util.GetGameObject(root, "passivity/input"):GetComponent("InputField")
|
||||
self.skill = Util.GetGameObject(root, "skill/input"):GetComponent("InputField")
|
||||
self.superSkill = Util.GetGameObject(root, "superSkill/input"):GetComponent("InputField")
|
||||
|
||||
self.props = Util.GetGameObject(root, "props")
|
||||
self.propList = {}
|
||||
for i = 1, self.props.transform.childCount do
|
||||
self.propList[i] = Util.GetGameObject(self.props.transform:GetChild(i-1), "input"):GetComponent("InputField")
|
||||
end
|
||||
|
||||
self.btnComfirm = Util.GetGameObject(root, "Root/confirm")
|
||||
self.deletefirm = Util.GetGameObject(root, "Root/delete")
|
||||
self.btnCancel = Util.GetGameObject(root, "Root/cancel")
|
||||
self.content = Util.GetGameObject(root, "Root/cancel"):GetComponent("Text")
|
||||
|
||||
--
|
||||
Util.AddOnceClick(self.btnComfirm, function()
|
||||
self:ApplyData()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.deletefirm, function()
|
||||
self:RemoveData()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.btnCancel, function()
|
||||
self:Close()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.btnLoad, function()
|
||||
self:LoadFromConfig()
|
||||
end)
|
||||
end
|
||||
|
||||
-- 根据配置加载数据
|
||||
function RoleSetView:LoadFromConfig()
|
||||
local monsterId = tonumber(self.monsterId.text)
|
||||
local config = MonsterConfig[monsterId]
|
||||
if not config then
|
||||
LogRed(Language[10240]..monsterId)
|
||||
return
|
||||
end
|
||||
|
||||
local passivity = config.PassiveSkillList and table.concat(config.PassiveSkillList, "#") or ""
|
||||
local skill = config.SkillList[1] or ""
|
||||
local superSkill = config.SkillList[2] or ""
|
||||
self.localData = {
|
||||
monsterId,
|
||||
config.MonsterId, -- roleId
|
||||
passivity,
|
||||
skill,
|
||||
superSkill,
|
||||
|
||||
config.Level,
|
||||
config.Hp,
|
||||
config.Hp,
|
||||
config.Attack,
|
||||
config.PhysicalDefence,
|
||||
config.MagicDefence,
|
||||
config.Speed,
|
||||
config.DamageBocusFactor,
|
||||
config.DamageReduceFactor,
|
||||
config.Hit,
|
||||
config.CritFactor,
|
||||
config.CritDamageFactor,
|
||||
config.AntiCritDamageFactor,
|
||||
config.TreatFacter,
|
||||
config.CureFacter,
|
||||
}
|
||||
|
||||
|
||||
-- 设置数据
|
||||
self.roleId.text = self:GetLocalData(2)
|
||||
self.passivity.text = self:GetLocalData(3)
|
||||
self.skill.text = self:GetLocalData(4)
|
||||
self.superSkill.text = self:GetLocalData(5)
|
||||
for propIndex, prop in ipairs(self.propList) do
|
||||
prop.text = self:GetLocalData(propIndex + 5)
|
||||
end
|
||||
end
|
||||
|
||||
-- 从本地加载数据
|
||||
function RoleSetView:loadFromLocal()
|
||||
local dataStr = PlayerPrefs.GetString("test_battle_role_"..self.camp..self.pos)
|
||||
LogGreen(dataStr)
|
||||
self.localData = string.split(dataStr, "|")
|
||||
end
|
||||
|
||||
-- 保存数据到本地
|
||||
function RoleSetView:saveToLocal()
|
||||
local str = ""
|
||||
str = str .. (self.data.monsterId or "")
|
||||
str = str .. "|"..(self.data.roleId or "")
|
||||
str = str .. "|"..(self.data.passivity or "")
|
||||
str = str .. "|"..(self.data.skill or "")
|
||||
str = str .. "|"..(self.data.superSkill or "")
|
||||
|
||||
for propIndex, prop in ipairs(self.data.props) do
|
||||
str = str .. "|"..(prop or "")
|
||||
end
|
||||
LogGreen(str)
|
||||
PlayerPrefs.SetString("test_battle_role_"..self.camp..self.pos, str)
|
||||
end
|
||||
|
||||
function RoleSetView:GetLocalData(index)
|
||||
local defaultData = {
|
||||
"", -- monsterID
|
||||
10001, -- roleID
|
||||
"", -- 被动
|
||||
1011, -- 普技
|
||||
1012, -- 特殊
|
||||
|
||||
100, -- 等级
|
||||
100000, -- hp
|
||||
100000, -- maxhp
|
||||
100, -- attack
|
||||
0, -- 物抗
|
||||
0, -- 魔抗
|
||||
0, -- 速度(未使用)
|
||||
0, -- 伤害加成系数
|
||||
0, -- 伤害减免系数
|
||||
1, -- 命中率(未使用)
|
||||
0, -- 闪避率(未使用)
|
||||
0.2, -- 暴击率
|
||||
1.5, -- 爆伤系数
|
||||
0, -- 抗暴率
|
||||
1, -- 治疗系数
|
||||
1, -- 治愈系数
|
||||
}
|
||||
if not self.localData[index] or self.localData[index] == "" then
|
||||
return (defaultData[index] or 0)
|
||||
end
|
||||
return self.localData[index]
|
||||
end
|
||||
|
||||
function RoleSetView:Show(camp, pos, data, func)
|
||||
data = data or {props = {}}
|
||||
self.gameObject:SetActive(true)
|
||||
self.camp = camp
|
||||
self.pos = pos
|
||||
self.data = data
|
||||
self.func = func
|
||||
self:loadFromLocal() -- 加载本地资源
|
||||
|
||||
-- 设置数据
|
||||
self.monsterId.text = data.monsterId or self:GetLocalData(1)
|
||||
self.roleId.text = data.roleId or self:GetLocalData(2)
|
||||
self.passivity.text = data.passivity or self:GetLocalData(3)
|
||||
self.skill.text = data.skill or self:GetLocalData(4)
|
||||
self.superSkill.text = data.superSkill or self:GetLocalData(5)
|
||||
for propIndex, prop in ipairs(self.propList) do
|
||||
prop.text = data.props[propIndex] or self:GetLocalData(propIndex + 5)
|
||||
end
|
||||
end
|
||||
|
||||
-- 应用数据
|
||||
function RoleSetView:ApplyData()
|
||||
self.data.monsterId = tonumber(self.monsterId.text)
|
||||
self.data.roleId = tonumber(self.roleId.text)
|
||||
self.data.passivity = self.passivity.text
|
||||
self.data.skill = tonumber(self.skill.text)
|
||||
self.data.superSkill = tonumber(self.superSkill.text)
|
||||
for propIndex, prop in ipairs(self.propList) do
|
||||
local value = prop.text == "" and 0 or tonumber(prop.text)
|
||||
self.data.props[propIndex] = tonumber(value)
|
||||
end
|
||||
-- 保存数据到本地
|
||||
self:saveToLocal()
|
||||
-- 应用数据
|
||||
if self.func then
|
||||
self.func(self.camp, self.pos, self.data)
|
||||
PopupTipPanel.ShowTip(Language[10241])
|
||||
end
|
||||
end
|
||||
|
||||
-- 应用数据
|
||||
function RoleSetView:RemoveData()
|
||||
-- 应用数据
|
||||
if self.func then
|
||||
self.func(self.camp, self.pos, nil)
|
||||
PopupTipPanel.ShowTip(Language[10242])
|
||||
end
|
||||
end
|
||||
-- 关闭界面
|
||||
function RoleSetView:Close()
|
||||
self.gameObject:SetActive(false)
|
||||
|
||||
end
|
||||
|
||||
-- 异妖设置界面
|
||||
MonsterSetView = {}
|
||||
|
||||
-- 初始化角色设置界面
|
||||
function MonsterSetView:Init(root)
|
||||
self.gameObject = root
|
||||
self.monster1 = Util.GetGameObject(root, "monster1/input"):GetComponent("InputField")
|
||||
self.monster2 = Util.GetGameObject(root, "monster2/input"):GetComponent("InputField")
|
||||
self.monster3 = Util.GetGameObject(root, "monster3/input"):GetComponent("InputField")
|
||||
|
||||
self.btnComfirm = Util.GetGameObject(root, "Root/confirm")
|
||||
self.btnCancel = Util.GetGameObject(root, "Root/cancel")
|
||||
self.content = Util.GetGameObject(root, "Root/cancel"):GetComponent("Text")
|
||||
|
||||
--
|
||||
Util.AddOnceClick(self.btnComfirm, function()
|
||||
self:ApplyData()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.btnCancel, function()
|
||||
self:Close()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function MonsterSetView:Show(camp, data, func)
|
||||
self.gameObject:SetActive(true)
|
||||
self.camp = camp
|
||||
self.data = data or {}
|
||||
self.func = func
|
||||
self.monster1.text = data.monster1
|
||||
self.monster2.text = data.monster2
|
||||
self.monster3.text = data.monster3
|
||||
end
|
||||
|
||||
-- 应用数据
|
||||
function MonsterSetView:ApplyData()
|
||||
self.data.monster1 = self.monster1.text
|
||||
self.data.monster2 = self.monster2.text
|
||||
self.data.monster3 = self.monster3.text
|
||||
|
||||
-- 应用数据
|
||||
if self.func then
|
||||
if self.func(self.camp, self.data) then
|
||||
PopupTipPanel.ShowTip(Language[10241])
|
||||
return
|
||||
end
|
||||
end
|
||||
PopupTipPanel.ShowTip(Language[10243])
|
||||
end
|
||||
|
||||
-- 关闭界面
|
||||
function MonsterSetView:Close()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- 全局设置界面
|
||||
AllSetView = {}
|
||||
|
||||
-- 初始化角色设置界面
|
||||
function AllSetView:Init(root)
|
||||
self.gameObject = root
|
||||
self.passivity = Util.GetGameObject(root, "passivity/input"):GetComponent("InputField")
|
||||
|
||||
self.btnComfirm = Util.GetGameObject(root, "Root/confirm")
|
||||
self.btnCancel = Util.GetGameObject(root, "Root/cancel")
|
||||
self.content = Util.GetGameObject(root, "Root/cancel"):GetComponent("Text")
|
||||
|
||||
--
|
||||
Util.AddOnceClick(self.btnComfirm, function()
|
||||
self:ApplyData()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.btnCancel, function()
|
||||
self:Close()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function AllSetView:Show(camp, data, func)
|
||||
self.gameObject:SetActive(true)
|
||||
self.camp = camp
|
||||
self.data = data or {}
|
||||
self.func = func
|
||||
self.passivity.text = data.passivity
|
||||
end
|
||||
|
||||
-- 应用数据
|
||||
function AllSetView:ApplyData()
|
||||
self.data.passivity = self.passivity.text
|
||||
-- 应用数据
|
||||
if self.func then
|
||||
if self.func(self.camp, self.data) then
|
||||
PopupTipPanel.ShowTip(Language[10241])
|
||||
return
|
||||
end
|
||||
end
|
||||
PopupTipPanel.ShowTip(Language[10243])
|
||||
end
|
||||
|
||||
-- 关闭界面
|
||||
function AllSetView:Close()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- 全局设置界面
|
||||
SkillSetView = {}
|
||||
|
||||
local MonsterViewConfig = ConfigManager.GetConfig(ConfigName.MonsterViewConfig)
|
||||
local MonsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
|
||||
local RoleConfig = ConfigManager.GetConfig(ConfigName.RoleConfig)
|
||||
local HeroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
||||
local SkillLogicConfig = ConfigManager.GetConfig(ConfigName.SkillLogicConfig)
|
||||
|
||||
-- 初始化角色设置界面
|
||||
function SkillSetView:Init(root)
|
||||
self.gameObject = root
|
||||
self.rt = Util.GetGameObject(root, "role/time1/input"):GetComponent("InputField")
|
||||
self.rt2 = Util.GetGameObject(root, "role/time2/input"):GetComponent("InputField")
|
||||
self.nt1 = Util.GetGameObject(root, "normal/time1/input"):GetComponent("InputField")
|
||||
self.nt2 = Util.GetGameObject(root, "normal/time2/input"):GetComponent("InputField")
|
||||
self.st1 = Util.GetGameObject(root, "special/time1/input"):GetComponent("InputField")
|
||||
self.st2 = Util.GetGameObject(root, "special/time2/input"):GetComponent("InputField")
|
||||
|
||||
|
||||
self.btnComfirm = Util.GetGameObject(root, "Root/confirm")
|
||||
self.btnCancel = Util.GetGameObject(root, "Root/cancel")
|
||||
|
||||
--
|
||||
Util.AddOnceClick(self.btnComfirm, function()
|
||||
self:ApplyData()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.btnCancel, function()
|
||||
self:Close()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function SkillSetView:Show(camp, pos, BattleView)
|
||||
self.gameObject:SetActive(true)
|
||||
self.camp = camp
|
||||
self.pos = pos
|
||||
self.role = RoleManager.GetRole(camp, pos)
|
||||
self.roleView = BattleView.GetRoleView(self.role)
|
||||
|
||||
local nSkillId = self.role.roleData.skill[1]
|
||||
local sSkillId = self.role.roleData.superSkill[1]
|
||||
|
||||
self.rt.text = self.roleView.spAtkTime*1000
|
||||
self.rt2.text = self.roleView.atkSoundTime*1000
|
||||
|
||||
local nCombat = BattleManager.GetSkillCombat(SkillLogicConfig[nSkillId].SkillDisplay)
|
||||
self.nt1.text = nCombat.BulletTime
|
||||
self.nt2.text = nCombat.KeyFrame
|
||||
|
||||
local sCombat = BattleManager.GetSkillCombat(SkillLogicConfig[sSkillId].SkillDisplay)
|
||||
self.st1.text = sCombat.BulletTime
|
||||
self.st2.text = sCombat.KeyFrame
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- 应用数据
|
||||
function SkillSetView:ApplyData()
|
||||
local nSkillId = self.role.roleData.skill[1]
|
||||
local sSkillId = self.role.roleData.superSkill[1]
|
||||
|
||||
self.roleView.spAtkTime = (tonumber(self.rt.text)or 0)/1000
|
||||
self.roleView.atkSoundTime = (tonumber(self.rt2.text)or 0)/1000
|
||||
|
||||
local ncId = SkillLogicConfig[nSkillId].SkillDisplay
|
||||
local nCombat = BattleManager.GetSkillCombat(ncId)
|
||||
local nBulletTime = tonumber(self.nt1.text) or 0
|
||||
local nKeyFrame = tonumber(self.nt2.text) or 0
|
||||
nCombat.BulletTime = nBulletTime
|
||||
nCombat.KeyFrame = nKeyFrame
|
||||
BattleManager.SetSkillCombat(ncId, nCombat)
|
||||
for i=2, #self.role.skill do
|
||||
self.role.skill[2] = nKeyFrame/1000
|
||||
end
|
||||
|
||||
local scId = SkillLogicConfig[sSkillId].SkillDisplay
|
||||
local sCombat = BattleManager.GetSkillCombat(scId)
|
||||
local sBulletTime = tonumber(self.st1.text) or 0
|
||||
local sKeyFrame = tonumber(self.st2.text) or 0
|
||||
sCombat.BulletTime = sBulletTime
|
||||
sCombat.KeyFrame = sKeyFrame
|
||||
BattleManager.SetSkillCombat(scId, sCombat)
|
||||
for i=2, #self.role.superSkill do
|
||||
self.role.superSkill[2] = sKeyFrame/1000
|
||||
end
|
||||
|
||||
PopupTipPanel.ShowTip(Language[10241])
|
||||
end
|
||||
|
||||
-- 关闭界面
|
||||
function SkillSetView:Close()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
|
|
@ -1,8 +1,12 @@
|
|||
require("Base/BasePanel")
|
||||
require("Base/Stack")
|
||||
require("Modules.Battle.Config.PokemonEffectConfig")
|
||||
require("Modules/Battle/Test/BattleSetView")
|
||||
require("Modules.Battle.Test.View.AllSetView")
|
||||
require("Modules.Battle.Test.View.MonsterSetView")
|
||||
require("Modules.Battle.Test.View.RoleSetView")
|
||||
require("Modules.Battle.Test.View.SkillSetView")
|
||||
local MonsterGroup = ConfigManager.GetConfig(ConfigName.MonsterGroup)
|
||||
local SpriteAnimalSkill = ConfigManager.GetConfig(ConfigName.SpiritAnimalSkill)
|
||||
local BattleView = require("Modules/Battle/View/BattleView")
|
||||
BattleTestPanel = Inherit(BasePanel)
|
||||
|
||||
|
|
@ -34,11 +38,13 @@ local _IsCanNext = false
|
|||
|
||||
--初始化组件(用于子类重写)
|
||||
function this:InitComponent()
|
||||
BattleView:InitComponent(self)
|
||||
orginLayer = 0
|
||||
|
||||
this.BattlePanel = Util.GetGameObject(self.gameObject, "BattlePanel")
|
||||
BattleView:InitComponent(this, this.BattlePanel)
|
||||
|
||||
this.UpRoot = Util.GetGameObject(self.gameObject, "UpRoot")
|
||||
this.DownRoot = Util.GetGameObject(self.gameObject, "DownRoot")
|
||||
this.UpRoot = Util.GetGameObject(this.BattlePanel, "UpRoot")
|
||||
this.DownRoot = Util.GetGameObject(this.BattlePanel, "DownRoot")
|
||||
|
||||
this.Option = Util.GetGameObject(this.UpRoot, "option")
|
||||
this.roundText = Util.GetGameObject(this.Option, "timeCount"):GetComponent("Text")
|
||||
|
|
@ -57,10 +63,9 @@ function this:InitComponent()
|
|||
this.monsterGroupId = Util.GetGameObject(this.tOption, "loadMonster/InputField"):GetComponent("InputField")
|
||||
|
||||
this.SkillOption = Util.GetGameObject(self.gameObject, "skillOption")
|
||||
this.RoleSkillOption = Util.GetGameObject(self.gameObject, "skillOption/Role")
|
||||
|
||||
|
||||
|
||||
|
||||
-- 初始化设置界面
|
||||
RoleSetView:Init(Util.GetGameObject(self.gameObject, "roleSet"))
|
||||
MonsterSetView:Init(Util.GetGameObject(self.gameObject, "monsterSet"))
|
||||
|
|
@ -75,6 +80,18 @@ function this:InitComponent()
|
|||
this.EnemyRolePosList[i] = Util.GetGameObject(self.gameObject, "Test/enemy/btn"..i)
|
||||
end
|
||||
|
||||
-- 灵兽
|
||||
this.MonsterSkillOption = Util.GetGameObject(self.gameObject, "skillOption/Monster")
|
||||
this.EnemyMonsterSet = Util.GetGameObject(this.MonsterSkillOption, "enemyMonster/set")
|
||||
this.PlayerMonsterSet = Util.GetGameObject(this.MonsterSkillOption, "playerMonster/set")
|
||||
|
||||
this.EnemyMonsterList = {}
|
||||
this.PlayerMonsterList = {}
|
||||
for i = 1 , 6 do
|
||||
this.EnemyMonsterList[i] = Util.GetGameObject(this.MonsterSkillOption, "enemyMonster/list/"..i.."/cast")
|
||||
this.PlayerMonsterList[i] = Util.GetGameObject(this.MonsterSkillOption, "playerMonster/list/"..i.."/cast")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
|
|
@ -95,7 +112,7 @@ function this:BindEvent()
|
|||
--TODO:
|
||||
BattleView:StopBattle()
|
||||
_IsStart = false
|
||||
this.SkillOption:SetActive(false)
|
||||
this.RoleSkillOption:SetActive(false)
|
||||
BattleView.Clear()
|
||||
BattleView:OnClose()
|
||||
|
||||
|
|
@ -185,6 +202,27 @@ function this:BindEvent()
|
|||
RoleSetView:Show(1, i, roleTestData[i+6], this.ApplyRoleData)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
Util.AddClick(this.EnemyMonsterSet, function ()
|
||||
Log("EnemyMonsterSet")
|
||||
if _IsStart then
|
||||
PopupTipPanel.ShowTip(Language[10249])
|
||||
return
|
||||
end
|
||||
MonsterSetView:Show(1, monsterTestData, this.ApplyMonsterData)
|
||||
end)
|
||||
|
||||
Util.AddClick(this.PlayerMonsterSet, function ()
|
||||
Log("PlayerMonsterSet")
|
||||
if _IsStart then
|
||||
PopupTipPanel.ShowTip(Language[10249])
|
||||
return
|
||||
end
|
||||
MonsterSetView:Show(0, monsterTestData, this.ApplyMonsterData)
|
||||
end)
|
||||
|
||||
|
||||
end
|
||||
|
||||
function this:LoseJump(id)
|
||||
|
|
@ -246,8 +284,9 @@ end
|
|||
-- 根据当前设置生成战斗数据
|
||||
function this.RefreshFightData(type)
|
||||
if not type or type == 1 then
|
||||
TestFightData.playerData = { teamSkill = {}, teamPassive = {} }
|
||||
TestFightData.enemyData = {{teamSkill = {}, teamPassive = {} }}
|
||||
-- 清除所有数据
|
||||
this.ClearRoleData()
|
||||
-- 重新添加
|
||||
for i = 1, 12 do
|
||||
local role = roleTestData[i]
|
||||
if role then
|
||||
|
|
@ -279,19 +318,96 @@ function this.RefreshFightData(type)
|
|||
this.AddRoleData(data)
|
||||
end
|
||||
end
|
||||
|
||||
-- 刷新角色显示
|
||||
this.RefreshAllRoleShow()
|
||||
end
|
||||
|
||||
-- 灵兽数据刷新
|
||||
if not type or type == 2 then
|
||||
-- 清除所有数据
|
||||
this.ClearMonsterData()
|
||||
-- 重新添加
|
||||
for i = 1, 12 do
|
||||
local monster = monsterTestData[i]
|
||||
if monster then
|
||||
local data = {}
|
||||
data.camp = math.floor((i-1)/6)
|
||||
data.position = (i - 1) % 6 + 1
|
||||
data.id = monster.id
|
||||
data.star = monster.star
|
||||
data.property = {}
|
||||
for pi = 1, 25 do
|
||||
data.property[pi] = monster.props[pi] or 0
|
||||
end
|
||||
local MSkillId = data.id..data.star
|
||||
data.skill = BattleManager.MonsterSkillAdapter(MSkillId) or {}
|
||||
-- 添加角色数据
|
||||
this.AddMonsterData(data)
|
||||
end
|
||||
end
|
||||
|
||||
-- 刷新显示
|
||||
this.RefreshAllMonsterShow()
|
||||
end
|
||||
|
||||
if not type or type == 3 then
|
||||
|
||||
end
|
||||
--
|
||||
this.RefreshAllRoleShow()
|
||||
LogGreen(Language[10251] .. BattleManager.PrintBattleTable(TestFightData))
|
||||
end
|
||||
|
||||
|
||||
function this.ApplyMonsterData(data)
|
||||
monsterTestData = data
|
||||
this.RefreshFightData(2)
|
||||
end
|
||||
function this.ClearMonsterData(camp)
|
||||
if camp == 0 then
|
||||
TestFightData.playerData.monsterList = {}
|
||||
elseif camp == 1 then
|
||||
TestFightData.enemyData[1].monsterList = {}
|
||||
else -- 全清
|
||||
TestFightData.playerData.monsterList = {}
|
||||
TestFightData.enemyData[1].monsterList = {}
|
||||
end
|
||||
end
|
||||
function this.AddMonsterData(data)
|
||||
local camp = data.camp
|
||||
local pos = data.position
|
||||
if camp == 0 then
|
||||
local rIndex
|
||||
for index, role in ipairs(TestFightData.playerData.monsterList) do
|
||||
if role.position == pos then
|
||||
rIndex = index
|
||||
break
|
||||
end
|
||||
end
|
||||
if rIndex then
|
||||
TestFightData.playerData.monsterList[rIndex] = data
|
||||
else
|
||||
table.insert(TestFightData.playerData.monsterList, data)
|
||||
end
|
||||
|
||||
else
|
||||
local rIndex
|
||||
for index, role in ipairs(TestFightData.enemyData[1].monsterList) do
|
||||
if role.position == pos then
|
||||
rIndex = index
|
||||
break
|
||||
end
|
||||
end
|
||||
if rIndex then
|
||||
TestFightData.enemyData[1].monsterList[rIndex] = data
|
||||
else
|
||||
table.insert(TestFightData.enemyData[1].monsterList, data)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- 角色数据
|
||||
function this.ApplyRoleData(camp, pos, data)
|
||||
if camp == 0 then
|
||||
|
|
@ -299,10 +415,21 @@ function this.ApplyRoleData(camp, pos, data)
|
|||
else
|
||||
roleTestData[pos+6] = data
|
||||
end
|
||||
|
||||
this.RefreshFightData(1)
|
||||
end
|
||||
|
||||
-- 清除人物数据
|
||||
function this.ClearRoleData(camp)
|
||||
for i = 1, 6 do
|
||||
if camp == 0 then
|
||||
TestFightData.playerData[i] = nil
|
||||
elseif camp == 1 then
|
||||
TestFightData.enemyData[1][i] = nil
|
||||
else -- 全清
|
||||
TestFightData.playerData[i] = nil
|
||||
TestFightData.enemyData[1][i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
-- 增加一个数据
|
||||
function this.AddRoleData(data)
|
||||
local camp = data.camp
|
||||
|
|
@ -358,10 +485,26 @@ function this.RefreshAllRoleShow()
|
|||
end
|
||||
end
|
||||
|
||||
-- 异妖数据
|
||||
function this.ApplyMonsterData(camp, data)
|
||||
|
||||
function this.RefreshAllMonsterShow()
|
||||
-- 灵兽
|
||||
if TestFightData.enemyData[1] and TestFightData.enemyData[1].monsterList then
|
||||
for _, data in ipairs(TestFightData.enemyData[1].monsterList) do
|
||||
if data.id then
|
||||
MonsterManager.AddMonster(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if TestFightData.playerData and TestFightData.playerData.monsterList then
|
||||
-- 加载角色
|
||||
for _, data in ipairs(TestFightData.playerData.monsterList) do
|
||||
if data.id then
|
||||
MonsterManager.AddMonster(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- 全局被动
|
||||
function this.ApplyAllData(camp, data)
|
||||
|
||||
|
|
@ -419,14 +562,14 @@ end
|
|||
|
||||
-- 初始化技能选项
|
||||
function this.InitSkillOption()
|
||||
this.SkillOption:SetActive(this.IsSkill.isOn)
|
||||
this.RoleSkillOption:SetActive(this.IsSkill.isOn)
|
||||
if this.IsSkill.isOn then
|
||||
for i = 1, 12 do
|
||||
local camp = math.floor((i-1)/6)
|
||||
local pos = i - camp*6
|
||||
local btn1 = Util.GetGameObject(this.SkillOption, i.."/1")
|
||||
local btn2 = Util.GetGameObject(this.SkillOption, i.."/2")
|
||||
local btn3 = Util.GetGameObject(this.SkillOption, i.."/3")
|
||||
local btn1 = Util.GetGameObject(this.RoleSkillOption, i.."/1")
|
||||
local btn2 = Util.GetGameObject(this.RoleSkillOption, i.."/2")
|
||||
local btn3 = Util.GetGameObject(this.RoleSkillOption, i.."/3")
|
||||
Util.AddOnceClick(btn1, function()
|
||||
if _IsCanNext then
|
||||
local role = RoleManager.GetRole(camp, pos)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 42ffe84bb5ce5364ab961fb275ecaccf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
|
||||
|
||||
-- 全局设置界面
|
||||
AllSetView = {}
|
||||
|
||||
-- 初始化角色设置界面
|
||||
function AllSetView:Init(root)
|
||||
self.gameObject = root
|
||||
self.passivity = Util.GetGameObject(root, "passivity/input"):GetComponent("InputField")
|
||||
|
||||
self.btnComfirm = Util.GetGameObject(root, "Root/confirm")
|
||||
self.btnCancel = Util.GetGameObject(root, "Root/cancel")
|
||||
self.content = Util.GetGameObject(root, "Root/cancel"):GetComponent("Text")
|
||||
|
||||
--
|
||||
Util.AddOnceClick(self.btnComfirm, function()
|
||||
self:ApplyData()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.btnCancel, function()
|
||||
self:Close()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function AllSetView:Show(camp, data, func)
|
||||
self.gameObject:SetActive(true)
|
||||
self.camp = camp
|
||||
self.data = data or {}
|
||||
self.func = func
|
||||
self.passivity.text = data.passivity
|
||||
end
|
||||
|
||||
-- 应用数据
|
||||
function AllSetView:ApplyData()
|
||||
self.data.passivity = self.passivity.text
|
||||
-- 应用数据
|
||||
if self.func then
|
||||
if self.func(self.camp, self.data) then
|
||||
PopupTipPanel.ShowTip(Language[10241])
|
||||
return
|
||||
end
|
||||
end
|
||||
PopupTipPanel.ShowTip(Language[10243])
|
||||
end
|
||||
|
||||
-- 关闭界面
|
||||
function AllSetView:Close()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bbc63fb893a67e44c9d5008d41eab07a
|
||||
guid: c04fb21f4a0ae1646bbc16a6f379db69
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
|
@ -0,0 +1,162 @@
|
|||
|
||||
-- 异妖设置界面
|
||||
MonsterSetView = {}
|
||||
|
||||
-- 初始化角色设置界面
|
||||
function MonsterSetView:Init(root)
|
||||
self.gameObject = root
|
||||
|
||||
self.btnComfirm = Util.GetGameObject(root, "Root/confirm")
|
||||
self.btnCancel = Util.GetGameObject(root, "Root/cancel")
|
||||
-- self.content = Util.GetGameObject(root, "Root/cancel"):GetComponent("Text")
|
||||
|
||||
self.btnList = {}
|
||||
for i = 1, 6 do
|
||||
self.btnList[i] = Util.GetGameObject(root, "btnList/btn"..i)
|
||||
Util.AddOnceClick(self.btnList[i], function()
|
||||
if self.curChoose == i then
|
||||
return
|
||||
end
|
||||
self:ChooseMonster(i)
|
||||
end)
|
||||
end
|
||||
|
||||
self.monsterTip = Util.GetGameObject(root, "monster"):GetComponent("Text")
|
||||
self.mId = Util.GetGameObject(root, "monster/id"):GetComponent("InputField")
|
||||
self.star = Util.GetGameObject(root, "monster/star"):GetComponent("InputField")
|
||||
self.props = Util.GetGameObject(root, "monster/props")
|
||||
self.propList = {}
|
||||
for i = 1, self.props.transform.childCount do
|
||||
self.propList[i] = Util.GetGameObject(self.props.transform:GetChild(i-1), "input"):GetComponent("InputField")
|
||||
end
|
||||
--
|
||||
Util.AddOnceClick(self.btnComfirm, function()
|
||||
self:ApplyData()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.btnCancel, function()
|
||||
self:Close()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function MonsterSetView:Show(camp, data, func)
|
||||
self.gameObject:SetActive(true)
|
||||
self.camp = camp
|
||||
self.data = data
|
||||
self.func = func
|
||||
self.curChoose = nil
|
||||
self.curData = nil
|
||||
self:loadFromLocal() -- 加载本地资源
|
||||
self:ChooseMonster(1)
|
||||
end
|
||||
|
||||
function MonsterSetView:ChooseMonster(pos)
|
||||
-- 切换时保存数据
|
||||
self:ApplyData()
|
||||
--
|
||||
self.curChoose = pos
|
||||
self.curData = self.data[pos] or {props = {}}
|
||||
self.monsterTip.text = "灵兽"..pos
|
||||
|
||||
self.mId.text = self.curData.id or self:GetLocalData(self.camp, pos, 1)
|
||||
self.star.text = self.curData.star or self:GetLocalData(self.camp, pos, 2)
|
||||
for propIndex, prop in ipairs(self.propList) do
|
||||
prop.text = self.curData.props[propIndex] or self:GetLocalData(self.camp, pos, propIndex + 2)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- 应用数据
|
||||
function MonsterSetView:ApplyData()
|
||||
if not self.curData then
|
||||
return
|
||||
end
|
||||
self.curData.id = tonumber(self.mId.text)
|
||||
self.curData.star = tonumber(self.star.text)
|
||||
for propIndex, prop in ipairs(self.propList) do
|
||||
local value = prop.text == "" and 0 or prop.text
|
||||
self.curData.props[propIndex] = tonumber(value)
|
||||
end
|
||||
self.data[self.camp * 6 + self.curChoose] = self.curData
|
||||
self:saveToLocal()
|
||||
|
||||
-- 应用数据
|
||||
if self.func then
|
||||
if self.func(self.data) then
|
||||
PopupTipPanel.ShowTip(Language[10241])
|
||||
return
|
||||
end
|
||||
end
|
||||
PopupTipPanel.ShowTip(Language[10243])
|
||||
end
|
||||
|
||||
|
||||
-- 从本地加载数据
|
||||
function MonsterSetView:loadFromLocal()
|
||||
self.localData = {}
|
||||
for i = 1, 12 do
|
||||
local camp = math.floor((i-1)/6)
|
||||
local pos = (i - 1)%6 + 1
|
||||
local dataStr = PlayerPrefs.GetString("test_battle_monster_"..camp..pos)
|
||||
LogGreen(dataStr)
|
||||
self.localData[i] = string.split(dataStr, "|")
|
||||
end
|
||||
end
|
||||
|
||||
-- 保存数据到本地
|
||||
function MonsterSetView:saveToLocal()
|
||||
for i = 1, #self.data do
|
||||
if self.data and self.data[i] then
|
||||
|
||||
local camp = self.camp
|
||||
local pos = i
|
||||
|
||||
local str = ""
|
||||
str = str .. (self.data[i].id or "")
|
||||
str = str .. "|"..(self.data[i].star or "")
|
||||
|
||||
for propIndex, prop in ipairs(self.data[i].props) do
|
||||
str = str .. "|"..(prop or "")
|
||||
end
|
||||
LogGreen(str)
|
||||
PlayerPrefs.SetString("test_battle_monster_"..camp..pos, str)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
function MonsterSetView:GetLocalData(camp, pos, index)
|
||||
local defaultData = {
|
||||
20001, -- roleID
|
||||
0, -- star
|
||||
|
||||
100, -- 等级
|
||||
100000, -- hp
|
||||
100000, -- maxhp
|
||||
100, -- attack
|
||||
0, -- 物抗
|
||||
0, -- 魔抗
|
||||
0, -- 速度(未使用)
|
||||
0, -- 伤害加成系数
|
||||
0, -- 伤害减免系数
|
||||
1, -- 命中率(未使用)
|
||||
0, -- 闪避率(未使用)
|
||||
0.2, -- 暴击率
|
||||
1.5, -- 爆伤系数
|
||||
0, -- 抗暴率
|
||||
1, -- 治疗系数
|
||||
1, -- 治愈系数
|
||||
}
|
||||
local i = camp * 6 + pos
|
||||
if not self.localData[i][index] or self.localData[i][index] == "" then
|
||||
return (defaultData[index] or 0)
|
||||
end
|
||||
return self.localData[i][index]
|
||||
end
|
||||
|
||||
|
||||
-- 关闭界面
|
||||
function MonsterSetView:Close()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b5ddf1eee01db234fa3e93092bb2ee79
|
||||
guid: c60a15ace3153a84388eca4af38df536
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
|
||||
RoleSetView = {}
|
||||
local MonsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
|
||||
-- 初始化角色设置界面
|
||||
function RoleSetView:Init(root)
|
||||
self.gameObject = root
|
||||
self.monsterId = Util.GetGameObject(root, "configId/input"):GetComponent("InputField")
|
||||
self.btnLoad = Util.GetGameObject(root, "configId/load")
|
||||
|
||||
self.roleId = Util.GetGameObject(root, "roleId/input"):GetComponent("InputField")
|
||||
self.passivity = Util.GetGameObject(root, "passivity/input"):GetComponent("InputField")
|
||||
self.skill = Util.GetGameObject(root, "skill/input"):GetComponent("InputField")
|
||||
self.superSkill = Util.GetGameObject(root, "superSkill/input"):GetComponent("InputField")
|
||||
|
||||
self.props = Util.GetGameObject(root, "props")
|
||||
self.propList = {}
|
||||
for i = 1, self.props.transform.childCount do
|
||||
self.propList[i] = Util.GetGameObject(self.props.transform:GetChild(i-1), "input"):GetComponent("InputField")
|
||||
end
|
||||
|
||||
self.btnComfirm = Util.GetGameObject(root, "Root/confirm")
|
||||
self.deletefirm = Util.GetGameObject(root, "Root/delete")
|
||||
self.btnCancel = Util.GetGameObject(root, "Root/cancel")
|
||||
self.content = Util.GetGameObject(root, "Root/cancel"):GetComponent("Text")
|
||||
|
||||
--
|
||||
Util.AddOnceClick(self.btnComfirm, function()
|
||||
self:ApplyData()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.deletefirm, function()
|
||||
self:RemoveData()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.btnCancel, function()
|
||||
self:Close()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.btnLoad, function()
|
||||
self:LoadFromConfig()
|
||||
end)
|
||||
end
|
||||
|
||||
-- 根据配置加载数据
|
||||
function RoleSetView:LoadFromConfig()
|
||||
local monsterId = tonumber(self.monsterId.text)
|
||||
local config = MonsterConfig[monsterId]
|
||||
if not config then
|
||||
LogRed(Language[10240]..monsterId)
|
||||
return
|
||||
end
|
||||
|
||||
local passivity = config.PassiveSkillList and table.concat(config.PassiveSkillList, "#") or ""
|
||||
local skill = config.SkillList[1] or ""
|
||||
local superSkill = config.SkillList[2] or ""
|
||||
self.localData = {
|
||||
monsterId,
|
||||
config.MonsterId, -- roleId
|
||||
passivity,
|
||||
skill,
|
||||
superSkill,
|
||||
|
||||
config.Level,
|
||||
config.Hp,
|
||||
config.Hp,
|
||||
config.Attack,
|
||||
config.PhysicalDefence,
|
||||
config.MagicDefence,
|
||||
config.Speed,
|
||||
config.DamageBocusFactor,
|
||||
config.DamageReduceFactor,
|
||||
config.Hit,
|
||||
config.CritFactor,
|
||||
config.CritDamageFactor,
|
||||
config.AntiCritDamageFactor,
|
||||
config.TreatFacter,
|
||||
config.CureFacter,
|
||||
}
|
||||
|
||||
|
||||
-- 设置数据
|
||||
self.roleId.text = self:GetLocalData(2)
|
||||
self.passivity.text = self:GetLocalData(3)
|
||||
self.skill.text = self:GetLocalData(4)
|
||||
self.superSkill.text = self:GetLocalData(5)
|
||||
for propIndex, prop in ipairs(self.propList) do
|
||||
prop.text = self:GetLocalData(propIndex + 5)
|
||||
end
|
||||
end
|
||||
|
||||
-- 从本地加载数据
|
||||
function RoleSetView:loadFromLocal()
|
||||
local dataStr = PlayerPrefs.GetString("test_battle_role_"..self.camp..self.pos)
|
||||
LogGreen(dataStr)
|
||||
self.localData = string.split(dataStr, "|")
|
||||
end
|
||||
|
||||
-- 保存数据到本地
|
||||
function RoleSetView:saveToLocal()
|
||||
local str = ""
|
||||
str = str .. (self.data.monsterId or "")
|
||||
str = str .. "|"..(self.data.roleId or "")
|
||||
str = str .. "|"..(self.data.passivity or "")
|
||||
str = str .. "|"..(self.data.skill or "")
|
||||
str = str .. "|"..(self.data.superSkill or "")
|
||||
|
||||
for propIndex, prop in ipairs(self.data.props) do
|
||||
str = str .. "|"..(prop or "")
|
||||
end
|
||||
LogGreen(str)
|
||||
PlayerPrefs.SetString("test_battle_role_"..self.camp..self.pos, str)
|
||||
end
|
||||
|
||||
function RoleSetView:GetLocalData(index)
|
||||
local defaultData = {
|
||||
"", -- monsterID
|
||||
10001, -- roleID
|
||||
"", -- 被动
|
||||
1011, -- 普技
|
||||
1012, -- 特殊
|
||||
|
||||
100, -- 等级
|
||||
100000, -- hp
|
||||
100000, -- maxhp
|
||||
100, -- attack
|
||||
0, -- 物抗
|
||||
0, -- 魔抗
|
||||
0, -- 速度(未使用)
|
||||
0, -- 伤害加成系数
|
||||
0, -- 伤害减免系数
|
||||
1, -- 命中率(未使用)
|
||||
0, -- 闪避率(未使用)
|
||||
0.2, -- 暴击率
|
||||
1.5, -- 爆伤系数
|
||||
0, -- 抗暴率
|
||||
1, -- 治疗系数
|
||||
1, -- 治愈系数
|
||||
}
|
||||
if not self.localData[index] or self.localData[index] == "" then
|
||||
return (defaultData[index] or 0)
|
||||
end
|
||||
return self.localData[index]
|
||||
end
|
||||
|
||||
function RoleSetView:Show(camp, pos, data, func)
|
||||
data = data or {props = {}}
|
||||
self.gameObject:SetActive(true)
|
||||
self.camp = camp
|
||||
self.pos = pos
|
||||
self.data = data
|
||||
self.func = func
|
||||
self:loadFromLocal() -- 加载本地资源
|
||||
|
||||
-- 设置数据
|
||||
self.monsterId.text = data.monsterId or self:GetLocalData(1)
|
||||
self.roleId.text = data.roleId or self:GetLocalData(2)
|
||||
self.passivity.text = data.passivity or self:GetLocalData(3)
|
||||
self.skill.text = data.skill or self:GetLocalData(4)
|
||||
self.superSkill.text = data.superSkill or self:GetLocalData(5)
|
||||
for propIndex, prop in ipairs(self.propList) do
|
||||
prop.text = data.props[propIndex] or self:GetLocalData(propIndex + 5)
|
||||
end
|
||||
end
|
||||
|
||||
-- 应用数据
|
||||
function RoleSetView:ApplyData()
|
||||
self.data.monsterId = tonumber(self.monsterId.text)
|
||||
self.data.roleId = tonumber(self.roleId.text)
|
||||
self.data.passivity = self.passivity.text
|
||||
self.data.skill = tonumber(self.skill.text)
|
||||
self.data.superSkill = tonumber(self.superSkill.text)
|
||||
for propIndex, prop in ipairs(self.propList) do
|
||||
local value = prop.text == "" and 0 or tonumber(prop.text)
|
||||
self.data.props[propIndex] = tonumber(value)
|
||||
end
|
||||
-- 保存数据到本地
|
||||
self:saveToLocal()
|
||||
-- 应用数据
|
||||
if self.func then
|
||||
self.func(self.camp, self.pos, self.data)
|
||||
PopupTipPanel.ShowTip(Language[10241])
|
||||
end
|
||||
end
|
||||
|
||||
-- 应用数据
|
||||
function RoleSetView:RemoveData()
|
||||
-- 应用数据
|
||||
if self.func then
|
||||
self.func(self.camp, self.pos, nil)
|
||||
PopupTipPanel.ShowTip(Language[10242])
|
||||
end
|
||||
end
|
||||
-- 关闭界面
|
||||
function RoleSetView:Close()
|
||||
self.gameObject:SetActive(false)
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 570d7f095e8b35b45baf88e6504c6b9b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
|
||||
-- 全局设置界面
|
||||
SkillSetView = {}
|
||||
|
||||
local MonsterViewConfig = ConfigManager.GetConfig(ConfigName.MonsterViewConfig)
|
||||
local MonsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
|
||||
local RoleConfig = ConfigManager.GetConfig(ConfigName.RoleConfig)
|
||||
local HeroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
||||
local SkillLogicConfig = ConfigManager.GetConfig(ConfigName.SkillLogicConfig)
|
||||
|
||||
-- 初始化角色设置界面
|
||||
function SkillSetView:Init(root)
|
||||
self.gameObject = root
|
||||
self.rt = Util.GetGameObject(root, "role/time1/input"):GetComponent("InputField")
|
||||
self.rt2 = Util.GetGameObject(root, "role/time2/input"):GetComponent("InputField")
|
||||
self.nt1 = Util.GetGameObject(root, "normal/time1/input"):GetComponent("InputField")
|
||||
self.nt2 = Util.GetGameObject(root, "normal/time2/input"):GetComponent("InputField")
|
||||
self.st1 = Util.GetGameObject(root, "special/time1/input"):GetComponent("InputField")
|
||||
self.st2 = Util.GetGameObject(root, "special/time2/input"):GetComponent("InputField")
|
||||
|
||||
|
||||
self.btnComfirm = Util.GetGameObject(root, "Root/confirm")
|
||||
self.btnCancel = Util.GetGameObject(root, "Root/cancel")
|
||||
|
||||
--
|
||||
Util.AddOnceClick(self.btnComfirm, function()
|
||||
self:ApplyData()
|
||||
end)
|
||||
--
|
||||
Util.AddOnceClick(self.btnCancel, function()
|
||||
self:Close()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
function SkillSetView:Show(camp, pos, BattleView)
|
||||
self.gameObject:SetActive(true)
|
||||
self.camp = camp
|
||||
self.pos = pos
|
||||
self.role = RoleManager.GetRole(camp, pos)
|
||||
self.roleView = BattleView.GetRoleView(self.role)
|
||||
|
||||
local nSkillId = self.role.roleData.skill[1]
|
||||
local sSkillId = self.role.roleData.superSkill[1]
|
||||
|
||||
self.rt.text = self.roleView.spAtkTime*1000
|
||||
self.rt2.text = self.roleView.atkSoundTime*1000
|
||||
|
||||
local nCombat = BattleManager.GetSkillCombat(SkillLogicConfig[nSkillId].SkillDisplay)
|
||||
self.nt1.text = nCombat.BulletTime
|
||||
self.nt2.text = nCombat.KeyFrame
|
||||
|
||||
local sCombat = BattleManager.GetSkillCombat(SkillLogicConfig[sSkillId].SkillDisplay)
|
||||
self.st1.text = sCombat.BulletTime
|
||||
self.st2.text = sCombat.KeyFrame
|
||||
|
||||
|
||||
end
|
||||
|
||||
-- 应用数据
|
||||
function SkillSetView:ApplyData()
|
||||
local nSkillId = self.role.roleData.skill[1]
|
||||
local sSkillId = self.role.roleData.superSkill[1]
|
||||
|
||||
self.roleView.spAtkTime = (tonumber(self.rt.text)or 0)/1000
|
||||
self.roleView.atkSoundTime = (tonumber(self.rt2.text)or 0)/1000
|
||||
|
||||
local ncId = SkillLogicConfig[nSkillId].SkillDisplay
|
||||
local nCombat = BattleManager.GetSkillCombat(ncId)
|
||||
local nBulletTime = tonumber(self.nt1.text) or 0
|
||||
local nKeyFrame = tonumber(self.nt2.text) or 0
|
||||
nCombat.BulletTime = nBulletTime
|
||||
nCombat.KeyFrame = nKeyFrame
|
||||
BattleManager.SetSkillCombat(ncId, nCombat)
|
||||
for i=2, #self.role.skill do
|
||||
self.role.skill[2] = nKeyFrame/1000
|
||||
end
|
||||
|
||||
local scId = SkillLogicConfig[sSkillId].SkillDisplay
|
||||
local sCombat = BattleManager.GetSkillCombat(scId)
|
||||
local sBulletTime = tonumber(self.st1.text) or 0
|
||||
local sKeyFrame = tonumber(self.st2.text) or 0
|
||||
sCombat.BulletTime = sBulletTime
|
||||
sCombat.KeyFrame = sKeyFrame
|
||||
BattleManager.SetSkillCombat(scId, sCombat)
|
||||
for i=2, #self.role.superSkill do
|
||||
self.role.superSkill[2] = sKeyFrame/1000
|
||||
end
|
||||
|
||||
PopupTipPanel.ShowTip(Language[10241])
|
||||
end
|
||||
|
||||
-- 关闭界面
|
||||
function SkillSetView:Close()
|
||||
self.gameObject:SetActive(false)
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3243bc6189fec7b4798f46fbde6abac5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -18,7 +18,7 @@ local hadCounted = 0
|
|||
|
||||
--初始化组件(用于子类重写)
|
||||
function this:InitComponent()
|
||||
BattleView:InitComponent(self)
|
||||
BattleView:InitComponent(self, self.gameObject)
|
||||
orginLayer = 0
|
||||
|
||||
this.BG = Util.GetGameObject(self.gameObject, "BG")
|
||||
|
|
|
|||
|
|
@ -86,11 +86,11 @@ local addDelayRecycleRes = function(path, go, recycleTime, delayFunc, delayTime)
|
|||
end
|
||||
|
||||
|
||||
function this:InitComponent(root)
|
||||
function this:InitComponent(root, go)
|
||||
-- body
|
||||
this.root = root
|
||||
this.gameObject = root.gameObject
|
||||
this.transform = root.transform
|
||||
this.gameObject = go.gameObject
|
||||
this.transform = go.transform
|
||||
|
||||
this.BG = Util.GetGameObject(self.gameObject, "BG")
|
||||
-- this.LastBG = Util.GetGameObject(self.gameObject, "LastBG")
|
||||
|
|
@ -454,7 +454,9 @@ end
|
|||
-- 战斗波次变化
|
||||
function this.BattleOrderChange(order)
|
||||
-- 回调UI层
|
||||
this.root.OnOrderChanged(order)
|
||||
if this.root.OnOrderChanged then
|
||||
this.root.OnOrderChanged(order)
|
||||
end
|
||||
|
||||
this.ElementalResonanceView.elementalResonanceBtn:SetActive(true)
|
||||
this.ElementalResonanceView2.elementalResonanceBtn:SetActive(true)
|
||||
|
|
|
|||
|
|
@ -2,24 +2,261 @@ testBattleData1 = {
|
|||
enemyData = {
|
||||
{
|
||||
{
|
||||
ai = {0},
|
||||
camp = 1,
|
||||
element = 3,
|
||||
monsterId = 10102162,
|
||||
element = 1,
|
||||
passivity = {},
|
||||
position = 2,
|
||||
professionId = 0,
|
||||
property = {1, 1124, 1124, 359, 103, 103, 400, 0, 0, 1, 0, 0.2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
quality = 1,
|
||||
roleId = 10048,
|
||||
skill = {100481, 0.05, 0, 1, {210003, {1, 0.47, 1}}},
|
||||
star = 0,
|
||||
superSkill = {100482, 0.05, 0, 1, {210003, {1, 1.72, 1}}},
|
||||
type = 2
|
||||
position = 1,
|
||||
professionId = 2,
|
||||
property = {100, 100000, 100000, 100, 0, 0, 0, 0, 0, 1, 0, 0.2, 1.5, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
quality = 5,
|
||||
roleId = 10001,
|
||||
skill = {1011, 0.05, 0, 1, {210003, {1, 0.47, 2}}},
|
||||
star = 10,
|
||||
superSkill = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
type = 1
|
||||
},
|
||||
monsterList = {
|
||||
{
|
||||
camp = 1,
|
||||
id = 20001,
|
||||
position = 1,
|
||||
property = {
|
||||
100,
|
||||
100000,
|
||||
100000,
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0.2,
|
||||
1.5,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
skill = {
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
},
|
||||
{
|
||||
camp = 1,
|
||||
id = 20001,
|
||||
position = 2,
|
||||
property = {
|
||||
100,
|
||||
100000,
|
||||
100000,
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0.2,
|
||||
1.5,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
skill = {
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
},
|
||||
{
|
||||
camp = 1,
|
||||
id = 20001,
|
||||
position = 3,
|
||||
property = {
|
||||
100,
|
||||
100000,
|
||||
100000,
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0.2,
|
||||
1.5,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
skill = {
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
},
|
||||
{
|
||||
camp = 1,
|
||||
id = 20001,
|
||||
position = 4,
|
||||
property = {
|
||||
100,
|
||||
100000,
|
||||
100000,
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0.2,
|
||||
1.5,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
skill = {
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
},
|
||||
{
|
||||
camp = 1,
|
||||
id = 20001,
|
||||
position = 5,
|
||||
property = {
|
||||
100,
|
||||
100000,
|
||||
100000,
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0.2,
|
||||
1.5,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
skill = {
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
},
|
||||
{
|
||||
camp = 1,
|
||||
id = 20001,
|
||||
position = 6,
|
||||
property = {
|
||||
100,
|
||||
100000,
|
||||
100000,
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0.2,
|
||||
1.5,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
},
|
||||
skill = {
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
}
|
||||
},
|
||||
firstCamp = 0,
|
||||
monsterList = {},
|
||||
outData = "",
|
||||
teamPassive = {},
|
||||
teamSkill = {}
|
||||
}
|
||||
|
|
@ -30,30 +267,27 @@ testBattleData1 = {
|
|||
element = 1,
|
||||
passivity = {},
|
||||
position = 1,
|
||||
professionId = 4,
|
||||
property = {1, 43000, 43000, 6450, 2150, 2150, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
quality = 0,
|
||||
roleId = 10068,
|
||||
skill = {100681, 0.05, 0, 1, {400000, {1, 0.9, 2}}},
|
||||
star = 4,
|
||||
superSkill = {100682, 0.05, 0, 1, {200003, {113, 1.55, 2, 1, 0.2, 7, 1}}},
|
||||
professionId = 2,
|
||||
property = {100, 100000, 100000, 100, 0, 0, 0, 0, 0, 1, 0, 0.2, 1.5, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
quality = 5,
|
||||
roleId = 10001,
|
||||
skill = {1011, 0.05, 0, 1, {210003, {1, 0.47, 2}}},
|
||||
star = 10,
|
||||
superSkill = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
type = 1
|
||||
},
|
||||
firstCamp = 0,
|
||||
monsterList = {
|
||||
{
|
||||
camp = 0,
|
||||
id = 20003,
|
||||
id = 20001,
|
||||
position = 1,
|
||||
property = {1, 0, 24000, 3600, 1200, 1200, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1},
|
||||
property = {100, 100000, 100000, 100, 0, 0, 0, 0, 0, 1, 0, 0.2, 1.5, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
skill = {
|
||||
{
|
||||
effect = {2000301, 0.05, 0, 1, {220000, {1, 1.72, 1}}},
|
||||
maxCount = 99,
|
||||
maxRoundCount = 1,
|
||||
triggerCondition = {0, 0, 0},
|
||||
triggerId = 9
|
||||
}
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
},
|
||||
|
|
@ -61,21 +295,74 @@ testBattleData1 = {
|
|||
camp = 0,
|
||||
id = 20001,
|
||||
position = 2,
|
||||
property = {1, 0, 16000, 2400, 800, 800, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1},
|
||||
property = {100, 100000, 100000, 100, 0, 0, 0, 0, 0, 1, 0, 0.2, 1.5, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
skill = {
|
||||
{
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
}
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
},
|
||||
{
|
||||
camp = 0,
|
||||
id = 20001,
|
||||
position = 3,
|
||||
property = {100, 100000, 100000, 100, 0, 0, 0, 0, 0, 1, 0, 0.2, 1.5, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
skill = {
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
},
|
||||
{
|
||||
camp = 0,
|
||||
id = 20001,
|
||||
position = 4,
|
||||
property = {100, 100000, 100000, 100, 0, 0, 0, 0, 0, 1, 0, 0.2, 1.5, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
skill = {
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
},
|
||||
{
|
||||
camp = 0,
|
||||
id = 20001,
|
||||
position = 5,
|
||||
property = {100, 100000, 100000, 100, 0, 0, 0, 0, 0, 1, 0, 0.2, 1.5, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
skill = {
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
},
|
||||
{
|
||||
camp = 0,
|
||||
id = 20001,
|
||||
position = 6,
|
||||
property = {100, 100000, 100000, 100, 0, 0, 0, 0, 0, 1, 0, 0.2, 1.5, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
skill = {
|
||||
effect = {2000101, 0.1, 0, 1, {100211, {24, 1, 4.5}}},
|
||||
maxCount = 1,
|
||||
maxRoundCount = 99,
|
||||
triggerCondition = {1, 2, 6000},
|
||||
triggerId = 2
|
||||
},
|
||||
star = 0
|
||||
}
|
||||
},
|
||||
outData = "",
|
||||
teamPassive = {{}},
|
||||
teamPassive = {},
|
||||
teamSkill = {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue