This commit is contained in:
chenxi 2023-04-11 22:45:17 +08:00
parent b61b6a6f85
commit ce32bb29f6
12 changed files with 296 additions and 584 deletions

View File

@ -24,8 +24,9 @@ function CharacterSpineObject:getCharacterSpineHelper()
return self.characterSpineHelper return self.characterSpineHelper
end end
function CharacterSpineObject:initWithPrefab(assetPath, prefab) function CharacterSpineObject:initWithPrefab(assetPath, modelId, prefab)
BaseObject.initWithPrefab(self, assetPath, prefab) BaseObject.initWithPrefab(self, assetPath, prefab)
self.modelId = modelId
self.characterSpineHelper = self:getComponent(BF_CHARACTER_SPINE_HELPER) self.characterSpineHelper = self:getComponent(BF_CHARACTER_SPINE_HELPER)
if self.characterSpineHelper == nil then if self.characterSpineHelper == nil then
self.characterSpineHelper = self:addComponent(BF_CHARACTER_SPINE_HELPER) self.characterSpineHelper = self:addComponent(BF_CHARACTER_SPINE_HELPER)
@ -77,6 +78,10 @@ function CharacterSpineObject:getMainSpine()
return self.mainSpine return self.mainSpine
end end
function CharacterSpineObject:getModelId()
return self.modelId
end
function CharacterSpineObject:fastGetBonePosition(name) function CharacterSpineObject:fastGetBonePosition(name)
if self.characterSpineHelper then if self.characterSpineHelper then
self.characterSpineHelper:CacheBonePosition(name) self.characterSpineHelper:CacheBonePosition(name)

View File

@ -68,7 +68,7 @@ function SpineManager:loadHeroAsync(id, parent, callback)
return return
end end
local characterObject = CharacterSpineObject:create() local characterObject = CharacterSpineObject:create()
characterObject:initWithPrefab(assetPath, prefab) characterObject:initWithPrefab(assetPath, id, prefab)
characterObject:addUnloadCallback(function(obj) characterObject:addUnloadCallback(function(obj)
local modelPath = obj:getAssetPath() local modelPath = obj:getAssetPath()
if self.heroCacheMap[modelPath] then if self.heroCacheMap[modelPath] then

View File

@ -6,36 +6,36 @@ local hero = {
["rouge_skill_1"]=200501, ["rouge_skill_1"]=200501,
["rouge_skill_2"]=200502, ["rouge_skill_2"]=200502,
["rouge_skill_3"]=200503, ["rouge_skill_3"]=200503,
["hp_1"]=100, ["hp_1"]=1000000,
["hp_2"]=110, ["hp_2"]=1100000,
["hp_3"]=120, ["hp_3"]=1200000,
["hp_4"]=130, ["hp_4"]=1300000,
["hp_5"]=140, ["hp_5"]=1400000,
["hp_6"]=150, ["hp_6"]=1500000,
["hp_7"]=160, ["hp_7"]=1600000,
["hp_8"]=170, ["hp_8"]=1700000,
["hp_9"]=180, ["hp_9"]=1800000,
["hp_10"]=190, ["hp_10"]=1900000,
["hp_11"]=200, ["hp_11"]=2000000,
["hp_12"]=210, ["hp_12"]=2100000,
["hp_13"]=220, ["hp_13"]=2200000,
["hp_14"]=230, ["hp_14"]=2300000,
["hp_15"]=240, ["hp_15"]=2400000,
["atk_1"]=100, ["atk_1"]=1000000,
["atk_2"]=110, ["atk_2"]=1100000,
["atk_3"]=120, ["atk_3"]=1200000,
["atk_4"]=130, ["atk_4"]=1300000,
["atk_5"]=140, ["atk_5"]=1400000,
["atk_6"]=150, ["atk_6"]=1500000,
["atk_7"]=160, ["atk_7"]=1600000,
["atk_8"]=170, ["atk_8"]=1700000,
["atk_9"]=180, ["atk_9"]=1800000,
["atk_10"]=190, ["atk_10"]=1900000,
["atk_11"]=200, ["atk_11"]=2000000,
["atk_12"]=210, ["atk_12"]=2100000,
["atk_13"]=220, ["atk_13"]=2200000,
["atk_14"]=230, ["atk_14"]=2300000,
["atk_15"]=240, ["atk_15"]=2400000,
["model_id"]="p0001", ["model_id"]="p0001",
["icon"]="1" ["icon"]="1"
}, },
@ -46,36 +46,36 @@ local hero = {
["rouge_skill_1"]=200201, ["rouge_skill_1"]=200201,
["rouge_skill_2"]=200202, ["rouge_skill_2"]=200202,
["rouge_skill_3"]=200203, ["rouge_skill_3"]=200203,
["hp_1"]=100, ["hp_1"]=1000000,
["hp_2"]=110, ["hp_2"]=1100000,
["hp_3"]=120, ["hp_3"]=1200000,
["hp_4"]=130, ["hp_4"]=1300000,
["hp_5"]=140, ["hp_5"]=1400000,
["hp_6"]=150, ["hp_6"]=1500000,
["hp_7"]=160, ["hp_7"]=1600000,
["hp_8"]=170, ["hp_8"]=1700000,
["hp_9"]=180, ["hp_9"]=1800000,
["hp_10"]=190, ["hp_10"]=1900000,
["hp_11"]=200, ["hp_11"]=2000000,
["hp_12"]=210, ["hp_12"]=2100000,
["hp_13"]=220, ["hp_13"]=2200000,
["hp_14"]=230, ["hp_14"]=2300000,
["hp_15"]=240, ["hp_15"]=2400000,
["atk_1"]=100, ["atk_1"]=1000000,
["atk_2"]=110, ["atk_2"]=1100000,
["atk_3"]=120, ["atk_3"]=1200000,
["atk_4"]=130, ["atk_4"]=1300000,
["atk_5"]=140, ["atk_5"]=1400000,
["atk_6"]=150, ["atk_6"]=1500000,
["atk_7"]=160, ["atk_7"]=1600000,
["atk_8"]=170, ["atk_8"]=1700000,
["atk_9"]=180, ["atk_9"]=1800000,
["atk_10"]=190, ["atk_10"]=1900000,
["atk_11"]=200, ["atk_11"]=2000000,
["atk_12"]=210, ["atk_12"]=2100000,
["atk_13"]=220, ["atk_13"]=2200000,
["atk_14"]=230, ["atk_14"]=2300000,
["atk_15"]=240, ["atk_15"]=2400000,
["model_id"]="p0002", ["model_id"]="p0002",
["icon"]="2" ["icon"]="2"
}, },
@ -86,36 +86,36 @@ local hero = {
["rouge_skill_1"]=200701, ["rouge_skill_1"]=200701,
["rouge_skill_2"]=200702, ["rouge_skill_2"]=200702,
["rouge_skill_3"]=200703, ["rouge_skill_3"]=200703,
["hp_1"]=150, ["hp_1"]=1500000,
["hp_2"]=165, ["hp_2"]=1650000,
["hp_3"]=180, ["hp_3"]=1800000,
["hp_4"]=195, ["hp_4"]=1950000,
["hp_5"]=210, ["hp_5"]=2100000,
["hp_6"]=225, ["hp_6"]=2250000,
["hp_7"]=240, ["hp_7"]=2400000,
["hp_8"]=255, ["hp_8"]=2550000,
["hp_9"]=270, ["hp_9"]=2700000,
["hp_10"]=285, ["hp_10"]=2850000,
["hp_11"]=300, ["hp_11"]=3000000,
["hp_12"]=315, ["hp_12"]=3150000,
["hp_13"]=330, ["hp_13"]=3300000,
["hp_14"]=345, ["hp_14"]=3450000,
["hp_15"]=360, ["hp_15"]=3600000,
["atk_1"]=150, ["atk_1"]=1500000,
["atk_2"]=165, ["atk_2"]=1650000,
["atk_3"]=180, ["atk_3"]=1800000,
["atk_4"]=195, ["atk_4"]=1950000,
["atk_5"]=210, ["atk_5"]=2100000,
["atk_6"]=225, ["atk_6"]=2250000,
["atk_7"]=240, ["atk_7"]=2400000,
["atk_8"]=255, ["atk_8"]=2550000,
["atk_9"]=270, ["atk_9"]=2700000,
["atk_10"]=285, ["atk_10"]=2850000,
["atk_11"]=300, ["atk_11"]=3000000,
["atk_12"]=315, ["atk_12"]=3150000,
["atk_13"]=330, ["atk_13"]=3300000,
["atk_14"]=345, ["atk_14"]=3450000,
["atk_15"]=360, ["atk_15"]=3600000,
["model_id"]="p0006", ["model_id"]="p0006",
["icon"]="6" ["icon"]="6"
}, },
@ -126,36 +126,36 @@ local hero = {
["rouge_skill_1"]=200101, ["rouge_skill_1"]=200101,
["rouge_skill_2"]=200102, ["rouge_skill_2"]=200102,
["rouge_skill_3"]=200103, ["rouge_skill_3"]=200103,
["hp_1"]=100, ["hp_1"]=1000000,
["hp_2"]=110, ["hp_2"]=1100000,
["hp_3"]=120, ["hp_3"]=1200000,
["hp_4"]=130, ["hp_4"]=1300000,
["hp_5"]=140, ["hp_5"]=1400000,
["hp_6"]=150, ["hp_6"]=1500000,
["hp_7"]=160, ["hp_7"]=1600000,
["hp_8"]=170, ["hp_8"]=1700000,
["hp_9"]=180, ["hp_9"]=1800000,
["hp_10"]=190, ["hp_10"]=1900000,
["hp_11"]=200, ["hp_11"]=2000000,
["hp_12"]=210, ["hp_12"]=2100000,
["hp_13"]=220, ["hp_13"]=2200000,
["hp_14"]=230, ["hp_14"]=2300000,
["hp_15"]=240, ["hp_15"]=2400000,
["atk_1"]=100, ["atk_1"]=1000000,
["atk_2"]=110, ["atk_2"]=1100000,
["atk_3"]=120, ["atk_3"]=1200000,
["atk_4"]=130, ["atk_4"]=1300000,
["atk_5"]=140, ["atk_5"]=1400000,
["atk_6"]=150, ["atk_6"]=1500000,
["atk_7"]=160, ["atk_7"]=1600000,
["atk_8"]=170, ["atk_8"]=1700000,
["atk_9"]=180, ["atk_9"]=1800000,
["atk_10"]=190, ["atk_10"]=1900000,
["atk_11"]=200, ["atk_11"]=2000000,
["atk_12"]=210, ["atk_12"]=2100000,
["atk_13"]=220, ["atk_13"]=2200000,
["atk_14"]=230, ["atk_14"]=2300000,
["atk_15"]=240, ["atk_15"]=2400000,
["model_id"]="p0003", ["model_id"]="p0003",
["icon"]="3" ["icon"]="3"
}, },
@ -166,36 +166,36 @@ local hero = {
["rouge_skill_1"]=200601, ["rouge_skill_1"]=200601,
["rouge_skill_2"]=200602, ["rouge_skill_2"]=200602,
["rouge_skill_3"]=200603, ["rouge_skill_3"]=200603,
["hp_1"]=150, ["hp_1"]=1500000,
["hp_2"]=165, ["hp_2"]=1650000,
["hp_3"]=180, ["hp_3"]=1800000,
["hp_4"]=195, ["hp_4"]=1950000,
["hp_5"]=210, ["hp_5"]=2100000,
["hp_6"]=225, ["hp_6"]=2250000,
["hp_7"]=240, ["hp_7"]=2400000,
["hp_8"]=255, ["hp_8"]=2550000,
["hp_9"]=270, ["hp_9"]=2700000,
["hp_10"]=285, ["hp_10"]=2850000,
["hp_11"]=300, ["hp_11"]=3000000,
["hp_12"]=315, ["hp_12"]=3150000,
["hp_13"]=330, ["hp_13"]=3300000,
["hp_14"]=345, ["hp_14"]=3450000,
["hp_15"]=360, ["hp_15"]=3600000,
["atk_1"]=150, ["atk_1"]=1500000,
["atk_2"]=165, ["atk_2"]=1650000,
["atk_3"]=180, ["atk_3"]=1800000,
["atk_4"]=195, ["atk_4"]=1950000,
["atk_5"]=210, ["atk_5"]=2100000,
["atk_6"]=225, ["atk_6"]=2250000,
["atk_7"]=240, ["atk_7"]=2400000,
["atk_8"]=255, ["atk_8"]=2550000,
["atk_9"]=270, ["atk_9"]=2700000,
["atk_10"]=285, ["atk_10"]=2850000,
["atk_11"]=300, ["atk_11"]=3000000,
["atk_12"]=315, ["atk_12"]=3150000,
["atk_13"]=330, ["atk_13"]=3300000,
["atk_14"]=345, ["atk_14"]=3450000,
["atk_15"]=360, ["atk_15"]=3600000,
["model_id"]="p0007", ["model_id"]="p0007",
["icon"]="7" ["icon"]="7"
}, },
@ -206,36 +206,36 @@ local hero = {
["rouge_skill_1"]=200301, ["rouge_skill_1"]=200301,
["rouge_skill_2"]=200302, ["rouge_skill_2"]=200302,
["rouge_skill_3"]=200303, ["rouge_skill_3"]=200303,
["hp_1"]=100, ["hp_1"]=1000000,
["hp_2"]=110, ["hp_2"]=1100000,
["hp_3"]=120, ["hp_3"]=1200000,
["hp_4"]=130, ["hp_4"]=1300000,
["hp_5"]=140, ["hp_5"]=1400000,
["hp_6"]=150, ["hp_6"]=1500000,
["hp_7"]=160, ["hp_7"]=1600000,
["hp_8"]=170, ["hp_8"]=1700000,
["hp_9"]=180, ["hp_9"]=1800000,
["hp_10"]=190, ["hp_10"]=1900000,
["hp_11"]=200, ["hp_11"]=2000000,
["hp_12"]=210, ["hp_12"]=2100000,
["hp_13"]=220, ["hp_13"]=2200000,
["hp_14"]=230, ["hp_14"]=2300000,
["hp_15"]=240, ["hp_15"]=2400000,
["atk_1"]=100, ["atk_1"]=1000000,
["atk_2"]=110, ["atk_2"]=1100000,
["atk_3"]=120, ["atk_3"]=1200000,
["atk_4"]=130, ["atk_4"]=1300000,
["atk_5"]=140, ["atk_5"]=1400000,
["atk_6"]=150, ["atk_6"]=1500000,
["atk_7"]=160, ["atk_7"]=1600000,
["atk_8"]=170, ["atk_8"]=1700000,
["atk_9"]=180, ["atk_9"]=1800000,
["atk_10"]=190, ["atk_10"]=1900000,
["atk_11"]=200, ["atk_11"]=2000000,
["atk_12"]=210, ["atk_12"]=2100000,
["atk_13"]=220, ["atk_13"]=2200000,
["atk_14"]=230, ["atk_14"]=2300000,
["atk_15"]=240, ["atk_15"]=2400000,
["model_id"]="p0004", ["model_id"]="p0004",
["icon"]="4" ["icon"]="4"
}, },
@ -246,36 +246,36 @@ local hero = {
["rouge_skill_1"]=200801, ["rouge_skill_1"]=200801,
["rouge_skill_2"]=200802, ["rouge_skill_2"]=200802,
["rouge_skill_3"]=200803, ["rouge_skill_3"]=200803,
["hp_1"]=150, ["hp_1"]=1500000,
["hp_2"]=165, ["hp_2"]=1650000,
["hp_3"]=180, ["hp_3"]=1800000,
["hp_4"]=195, ["hp_4"]=1950000,
["hp_5"]=210, ["hp_5"]=2100000,
["hp_6"]=225, ["hp_6"]=2250000,
["hp_7"]=240, ["hp_7"]=2400000,
["hp_8"]=255, ["hp_8"]=2550000,
["hp_9"]=270, ["hp_9"]=2700000,
["hp_10"]=285, ["hp_10"]=2850000,
["hp_11"]=300, ["hp_11"]=3000000,
["hp_12"]=315, ["hp_12"]=3150000,
["hp_13"]=330, ["hp_13"]=3300000,
["hp_14"]=345, ["hp_14"]=3450000,
["hp_15"]=360, ["hp_15"]=3600000,
["atk_1"]=150, ["atk_1"]=1500000,
["atk_2"]=165, ["atk_2"]=1650000,
["atk_3"]=180, ["atk_3"]=1800000,
["atk_4"]=195, ["atk_4"]=1950000,
["atk_5"]=210, ["atk_5"]=2100000,
["atk_6"]=225, ["atk_6"]=2250000,
["atk_7"]=240, ["atk_7"]=2400000,
["atk_8"]=255, ["atk_8"]=2550000,
["atk_9"]=270, ["atk_9"]=2700000,
["atk_10"]=285, ["atk_10"]=2850000,
["atk_11"]=300, ["atk_11"]=3000000,
["atk_12"]=315, ["atk_12"]=3150000,
["atk_13"]=330, ["atk_13"]=3300000,
["atk_14"]=345, ["atk_14"]=3450000,
["atk_15"]=360, ["atk_15"]=3600000,
["model_id"]="p0008", ["model_id"]="p0008",
["icon"]="8" ["icon"]="8"
}, },
@ -286,36 +286,36 @@ local hero = {
["rouge_skill_1"]=200401, ["rouge_skill_1"]=200401,
["rouge_skill_2"]=200402, ["rouge_skill_2"]=200402,
["rouge_skill_3"]=200403, ["rouge_skill_3"]=200403,
["hp_1"]=100, ["hp_1"]=1000000,
["hp_2"]=110, ["hp_2"]=1100000,
["hp_3"]=120, ["hp_3"]=1200000,
["hp_4"]=130, ["hp_4"]=1300000,
["hp_5"]=140, ["hp_5"]=1400000,
["hp_6"]=150, ["hp_6"]=1500000,
["hp_7"]=160, ["hp_7"]=1600000,
["hp_8"]=170, ["hp_8"]=1700000,
["hp_9"]=180, ["hp_9"]=1800000,
["hp_10"]=190, ["hp_10"]=1900000,
["hp_11"]=200, ["hp_11"]=2000000,
["hp_12"]=210, ["hp_12"]=2100000,
["hp_13"]=220, ["hp_13"]=2200000,
["hp_14"]=230, ["hp_14"]=2300000,
["hp_15"]=240, ["hp_15"]=2400000,
["atk_1"]=100, ["atk_1"]=1000000,
["atk_2"]=110, ["atk_2"]=1100000,
["atk_3"]=120, ["atk_3"]=1200000,
["atk_4"]=130, ["atk_4"]=1300000,
["atk_5"]=140, ["atk_5"]=1400000,
["atk_6"]=150, ["atk_6"]=1500000,
["atk_7"]=160, ["atk_7"]=1600000,
["atk_8"]=170, ["atk_8"]=1700000,
["atk_9"]=180, ["atk_9"]=1800000,
["atk_10"]=190, ["atk_10"]=1900000,
["atk_11"]=200, ["atk_11"]=2000000,
["atk_12"]=210, ["atk_12"]=2100000,
["atk_13"]=220, ["atk_13"]=2200000,
["atk_14"]=230, ["atk_14"]=2300000,
["atk_15"]=240, ["atk_15"]=2400000,
["model_id"]="p0005", ["model_id"]="p0005",
["icon"]="5" ["icon"]="5"
} }

View File

@ -6,6 +6,10 @@ function ServerDataManager:init()
self.ServerFormationManager = require("app/server/manager/server_formation_manager") self.ServerFormationManager = require("app/server/manager/server_formation_manager")
end end
function ServerDataManager:saveData()
ServerGameData:saveData()
end
function ServerDataManager:randomReward(weightArr, callback) function ServerDataManager:randomReward(weightArr, callback)
local maxWeight = 0 local maxWeight = 0
for i, v in ipairs(weightArr) do for i, v in ipairs(weightArr) do

View File

@ -103,7 +103,6 @@ function CurrencyBar:showSort()
end end
if self.params.showType == GConst.CURRENCY_TYPE.HORIZONTAL then if self.params.showType == GConst.CURRENCY_TYPE.HORIZONTAL then
for i,v in ipairs(self.params.itemIds) do for i,v in ipairs(self.params.itemIds) do
Logger.logHighlight(OFFSET_X - (i - 1)*self.cellWidth + self.offsetX - offset)
self.currencyList[i]:setAnchoredPosition(OFFSET_X - (i - 1)*self.cellWidth + self.offsetX - offset, OFFSET_Y + self.offsetY) self.currencyList[i]:setAnchoredPosition(OFFSET_X - (i - 1)*self.cellWidth + self.offsetX - offset, OFFSET_Y + self.offsetY)
end end
else else

View File

@ -1,114 +0,0 @@
local DemoFightSettingUI = class("DemoFightSettingUI", BaseUI)
function DemoFightSettingUI:isFullScreen()
return false
end
function DemoFightSettingUI:getPrefabPath()
return "assets/prefabs/ui/gm/demo_fight_setting_ui.prefab"
end
function DemoFightSettingUI:onLoadRootComplete()
self._baseRootCanvas.sortingOrder = 30001 -- 比develop面板高一点
self.atkInfo, self.defInfo = ModuleManager.DevToolManager:getCacheDemoFightInfo()
self.atkInfo = self.atkInfo or {}
self.defInfo = self.defInfo or {}
self:_display()
self:_addListeners()
end
function DemoFightSettingUI:_display()
local uiMap = self.root:genAllChildren()
uiMap["demo_fight_setting_ui.ok_btn.Text"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "开始战斗"
uiMap["demo_fight_setting_ui.def_hero_node.title"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "敌方阵容"
uiMap["demo_fight_setting_ui.atk_hero_node.title"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "我方阵容"
uiMap["demo_fight_setting_ui.ok_btn_2.Text"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "直接使用demofight配置战斗"
uiMap["demo_fight_setting_ui.clear_btn.Text"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "清除选定阵容"
if not self.defCells then
self.defCells = {}
self.atkCells = {}
for i = 1, 5 do
self.defCells[i] = CellManager:addCellComp(uiMap["demo_fight_setting_ui.def_hero_node.Image_" .. i .. ".hero_cell"], GConst.TYPEOF_LUA_CLASS.HERO_CELL)
self.atkCells[i] = CellManager:addCellComp(uiMap["demo_fight_setting_ui.atk_hero_node.Image_" .. i .. ".hero_cell"], GConst.TYPEOF_LUA_CLASS.HERO_CELL)
end
end
for i = 1, 5 do
if self.atkInfo[i] then
if self.atkInfo[i].ishero == 1 then
self.atkCells[i]:refreshWithHeroId(self.atkInfo[i].heroid, self.atkInfo[i].level, self.atkInfo[i].as or 0)
else
self.atkCells[i]:refreshWithMonsterId(self.atkInfo[i].heroid)
end
else
self.atkCells[i]:refreshEmpty()
end
if self.defInfo[i] then
if self.defInfo[i].ishero == 1 then
self.defCells[i]:refreshWithHeroId(self.defInfo[i].heroid, self.defInfo[i].level, self.defInfo[i].as or 0)
else
self.defCells[i]:refreshWithMonsterId(self.defInfo[i].heroid)
end
else
self.defCells[i]:refreshEmpty()
end
end
end
function DemoFightSettingUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["demo_fight_setting_ui.close_btn"]:addClickListener(function() self:closeUI() end)
uiMap["demo_fight_setting_ui.ok_btn"]:addClickListener(function()
ModuleManager.DevToolManager:cacheDemoFightInfo(self.atkInfo, self.defInfo)
if table.nums(self.atkInfo) <= 0 or table.nums(self.defInfo) <= 0 then
Logger.logError("对战双方阵容缺失")
return
end
ModuleManager.BattleManager:playBattle(ModuleManager.BattleManager.BATTLE_TYPE.DEMO)
end)
uiMap["demo_fight_setting_ui.ok_btn_2"]:addClickListener(function()
ModuleManager.DevToolManager:cacheDemoFightInfo(self.atkInfo, self.defInfo, true)
ModuleManager.BattleManager:playBattle(ModuleManager.BattleManager.BATTLE_TYPE.DEMO)
end)
uiMap["demo_fight_setting_ui.clear_btn"]:addClickListener(function()
self.atkInfo = {}
self.defInfo = {}
ModuleManager.DevToolManager:cacheDemoFightInfo(self.atkInfo, self.defInfo)
self:_display()
end)
if self.defCells then
for i, cell in ipairs(self.defCells) do
cell:addClickListener(function()
UIManager:showUI("app/ui/gm/hero_choose_ui", {heroInfo = clone(self.defInfo[i]), callback = function(newInfo)
if newInfo.heroid <= 0 then
newInfo = nil
end
self.defInfo[i] = newInfo
self:_display()
end})
end)
end
end
if self.atkCells then
for i, cell in ipairs(self.atkCells) do
cell:addClickListener(function()
UIManager:showUI("app/ui/gm/hero_choose_ui", {heroInfo = clone(self.atkInfo[i]), callback = function(newInfo)
if newInfo.heroid <= 0 then
newInfo = nil
end
self.atkInfo[i] = newInfo
self:_display()
end})
end)
end
end
end
return DemoFightSettingUI

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 3f9bf625a28cab649bba0be035eeba0b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -8,13 +8,6 @@ local TOOL_INFO_LIST = {
UIManager:showUI(UIManager.UI_PATH.GM_TOO_UI) UIManager:showUI(UIManager.UI_PATH.GM_TOO_UI)
end end
}, },
{
title = "DEMO战斗",
func = function()
-- ModuleManager.BattleManager:playBattle(ModuleManager.BattleManager.BATTLE_TYPE.DEMO)
UIManager:showUI("app/ui/gm/demo_fight_setting_ui")
end
},
{ {
title = "FPS", title = "FPS",
func = function(self) func = function(self)

View File

@ -1,204 +0,0 @@
local HeroChooseUI = class("HeroChooseUI", BaseUI)
local HERO_INFO_CELL = "app/ui/gm/cell/hero_info_cell"
local TYPE = {
HERO = 1,
MONSTER = 2,
HERO_BAG = 3
}
function HeroChooseUI:isFullScreen()
return false
end
function HeroChooseUI:getPrefabPath()
return "assets/prefabs/ui/gm/hero_choose_ui.prefab"
end
function HeroChooseUI:ctor(params)
self.heroInfo = params.heroInfo
self.callback = params.callback
end
function HeroChooseUI:onLoadRootComplete()
self._baseRootCanvas.sortingOrder = 30002 -- 比develop面板高一点
self:_display()
self:_addListeners()
end
function HeroChooseUI:_display()
local uiMap = self.root:genAllChildren()
uiMap["hero_choose_ui.close_btn (1).Text"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "确认"
self:refreshCurHero(self.heroInfo)
self:changeType(TYPE.HERO)
end
function HeroChooseUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["hero_choose_ui.close_btn"]:addClickListener(function()
self:closeUI()
end)
uiMap["hero_choose_ui.ok_btn"]:addClickListener(function()
self:closeUI()
if self.callback then
local heroInfo
if self.infoCell and self.infoCell:getHeroInfo() then
heroInfo = clone(self.infoCell:getHeroInfo())
end
self.callback(heroInfo)
end
end)
uiMap["hero_choose_ui.scroll_rect.hero"]:addClickListener(function()
self:changeType(TYPE.HERO)
end)
uiMap["hero_choose_ui.scroll_rect.monster"]:addClickListener(function()
self:changeType(TYPE.MONSTER)
end)
uiMap["hero_choose_ui.scroll_rect.hero_bag"]:addClickListener(function()
self:changeType(TYPE.HERO_BAG)
end)
end
function HeroChooseUI:_refreshHeroScroll()
if not self.heroList then
self.heroList = {}
for id, info in pairs(ConfigManager:getConfig("hero")) do
table.insert(self.heroList, {id = id, cfg = info})
end
table.sort(self.heroList, function(a, b)
if a.cfg.qlt == b.cfg.qlt then
return a.id > b.id
else
return a.cfg.qlt > b.cfg.qlt
end
end)
self.monsterList = {}
for id, info in pairs(ConfigManager:getConfig("monster")) do
table.insert(self.monsterList, {id = id, cfg = info})
end
table.sort(self.monsterList, function(a, b)
if a.cfg.qlt == b.cfg.qlt then
return a.id > b.id
else
return a.cfg.qlt > b.cfg.qlt
end
end)
self.heroBagList = {}
for hid, entity in pairs(DataManager.HeroData:getAllHero()) do
table.insert(self.heroBagList, entity)
end
table.sort(self.heroBagList, function(a, b)
if a:getQuality() == b:getQuality() then
return a:getHid() > b:getHid()
else
return a:getQuality() > b:getQuality()
end
end)
end
if self.curPage == TYPE.HERO then
self.curList = self.heroList
elseif self.curPage == TYPE.MONSTER then
self.curList = self.monsterList
else
self.curList = self.heroBagList
end
if self.scrollRect then
self.scrollRect:clearCells()
self.scrollRect:refillCells(#self.curList)
return
end
local uiMap = self.root:genAllChildren()
local scrollView = uiMap["hero_choose_ui.scroll_rect"]
self.scrollRect = scrollView:getLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRect:clearCells()
self.scrollRect:setFadeArgs(0, 0.3)
self.scrollRect:addInitCallback(function()
return GConst.TYPEOF_LUA_CLASS.HERO_CELL
end)
self.scrollRect:addRefreshCallback(function(index, cell)
if self.curPage ~= TYPE.MONSTER then
if self.curPage == TYPE.HERO_BAG then
cell:refreshWithHeroId(self.curList[index]:getId(), self.curList[index]:getLv(), self.curList[index]:getAscended())
else
cell:refreshWithHeroId(self.curList[index].id, 1, 0)
end
else
cell:refreshWithMonsterId(self.curList[index].id)
end
cell:addClickListener(function()
local params
if self.curPage == TYPE.HERO_BAG then
params = {}
local entity = self.curList[index]
params.ishero = 1
params.heroid = entity:getId()
params.level = entity:getLv()
params.as = entity:getAscended()
params.hid = entity:getHid()
else
if self.heroInfo and self.heroInfo.heroid == self.curList[index].id then
params = clone(self.heroInfo)
else
params = {heroid = self.curList[index].id, level= 1, as = 0}
end
params.as = 0
params.ishero = self.curPage == TYPE.MONSTER and 0 or 1
params.hid = nil
end
self:refreshCurHero(params)
end)
end)
self.scrollRect:refillCells(#self.curList)
end
function HeroChooseUI:refreshCurHero(heroInfo)
if not self.infoCell then
local uiMap = self.root:genAllChildren()
self.infoCell = CellManager:addCellComp(uiMap["hero_choose_ui.hero_node.hero_info_cell"], HERO_INFO_CELL)
end
self.infoCell:refresh(heroInfo)
end
function HeroChooseUI:changeType(type)
if self.curPage == type then
return
end
self.curPage = type
local uiMap = self.root:genAllChildren()
local heroBtn = uiMap["hero_choose_ui.scroll_rect.hero"]
local heroBtnText = uiMap["hero_choose_ui.scroll_rect.hero.Text"]
local monsterBtn = uiMap["hero_choose_ui.scroll_rect.monster"]
local monsterBtntext = uiMap["hero_choose_ui.scroll_rect.monster.Text"]
local heroBagBtn = uiMap["hero_choose_ui.scroll_rect.hero_bag"]
local heroBagBtnText = uiMap["hero_choose_ui.scroll_rect.hero_bag.Text"]
local normalSprite = "common_menu_3"
local highlightSprite = "common_menu_1"
heroBtn:setSprite(GConst.ATLAS_PATH.COMMON, self.curPage == TYPE.HERO and highlightSprite or normalSprite)
monsterBtn:setSprite(GConst.ATLAS_PATH.COMMON, self.curPage == TYPE.MONSTER and highlightSprite or normalSprite)
heroBagBtn:setSprite(GConst.ATLAS_PATH.COMMON, self.curPage == TYPE.HERO_BAG and highlightSprite or normalSprite)
heroBtnText:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "hero"
monsterBtntext:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "monster"
heroBagBtnText:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "英雄背包"
self:_refreshHeroScroll()
end
return HeroChooseUI

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: ddff352fd40a0c042b251be91ca31e8f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -16,6 +16,21 @@ function HeroComp:init()
for id, v in pairs(heroCfg) do for id, v in pairs(heroCfg) do
table.insert(self.heroList, id) table.insert(self.heroList, id)
end end
self.heroNodeList = {
self.uiMap["hero_ui.formation.hero_1"],
self.uiMap["hero_ui.formation.hero_2"],
self.uiMap["hero_ui.formation.hero_3"],
self.uiMap["hero_ui.formation.hero_4"],
self.uiMap["hero_ui.formation.hero_5"],
}
self.heroAddImgList = {
self.uiMap["hero_ui.formation.hero_1.add"],
self.uiMap["hero_ui.formation.hero_2.add"],
self.uiMap["hero_ui.formation.hero_3.add"],
self.uiMap["hero_ui.formation.hero_4.add"],
self.uiMap["hero_ui.formation.hero_5.add"],
}
self.heroSpineList = {}
end end
function HeroComp:refresh() function HeroComp:refresh()
@ -25,7 +40,34 @@ function HeroComp:refresh()
end end
function HeroComp:refreshStageFormation() function HeroComp:refreshStageFormation()
for i = 1, 5 do
local heroId = self.stageFormation[i]
local hero = DataManager.HeroData:getHeroById(heroId)
if hero and hero:getLv() > 0 then
self.heroAddImgList[i]:setVisible(false)
if self.heroSpineList[i] and self.heroSpineList[i]:getModelId() == hero:getModelId() then
self.heroSpineList[i]:setActive(true)
self.heroSpineList[i]:playAnimation("idle", true)
else
SpineManager:loadHeroAsync(hero:getModelId(), self.heroNodeList[i], function(spineObject)
if heroId ~= self.stageFormation[i] then
return
end
if self.heroSpineList[i] then
self.heroSpineList[i]:destroy()
end
spineObject:playAnimation("idle", true)
self.heroSpineList[i] = spineObject
self.heroSpineList[i]:setLocalPosition(0, -52, 0)
end)
end
else
self.heroAddImgList[i]:setVisible(true)
if self.heroSpineList[i] then
self.heroSpineList[i]:setActive(false)
end
end
end
end end
function HeroComp:refreshScrollRect() function HeroComp:refreshScrollRect()

View File

@ -36,7 +36,8 @@ end
self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_VIT self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_VIT
self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_GOLD self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_GOLD
elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then
return nil self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_VIT
self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_GOLD
end end
return self.currencyParams return self.currencyParams
end end