This commit is contained in:
xiekaidong 2023-06-02 19:01:36 +08:00
commit 63b03dba2a
24 changed files with 526 additions and 100 deletions

View File

@ -259,6 +259,11 @@ function BaseObject:addPosition(x, y, z)
transform.position = Vector3
end
function BaseObject:getPosition()
local transform = self:getTransform()
return transform.position
end
function BaseObject:getLocalPosition()
local transform = self:getTransform()
return transform.localPosition

View File

@ -101,6 +101,7 @@ function DataManager:clear()
-- 任务数据最后清理
self.TaskData:clear()
ModuleManager.TaskManager:clear()
self:clearTryOpenFunc()
end
function DataManager:initWithServerData(data)
@ -255,6 +256,44 @@ function DataManager:scheduleGlobal()
end, 1)
end
function DataManager:tryOpenModules()
if not self.tryOpenCallbacks then
return
end
for k, v in pairs(self.tryOpenCallbacks) do
v()
end
end
function DataManager:registerTryOpenFunc(bindId, func)
if not bindId or not func then
return
end
if not self.tryOpenCallbacks then
self.tryOpenCallbacks = {}
end
self.tryOpenCallbacks[bindId] = func
end
function DataManager:unregisterTryOpenFunc(bindId)
if not bindId then
return
end
if not self.tryOpenCallbacks then
return
end
self.tryOpenCallbacks[bindId] = nil
end
function DataManager:clearTryOpenFunc()
if not self.tryOpenCallbacks then
return
end
for k, v in pairs(self.tryOpenCallbacks) do
self.tryOpenCallbacks[k] = nil
end
end
function DataManager:getSignInfo()
local nowTime = Time:getServerTime()
local lastSignTime = self.signInfo.latest_at // 1000
@ -264,7 +303,7 @@ function DataManager:getSignInfo()
canSign = false
end
return self.signInfo.count or 0, canSign, self.hasSigned
end
end
function DataManager:setSignCount(count)
self.hasSigned = true

View File

@ -194,6 +194,17 @@ local LocalizationGlobalConst =
NO_ADS = "NO_ADS",
BESURE_DELETE_TIPS_DESC = "BESURE_DELETE_TIPS_DESC",
BESURE_DELETE_ACCOUNT_DESC = "BESURE_DELETE_ACCOUNT_DESC",
DELETE_ACCOUNT_FAILED = "DELETE_ACCOUNT_FAILED",
CHANGE_ACCOUNT_TIPS_DESC = "CHANGE_ACCOUNT_TIPS_DESC",
BIND_ACCOUNT_SUCCESS = "BIND_ACCOUNT_SUCCESS",
MAINTAIN = "MAINTAIN",
DISCONNECT_RELOGIN = "DISCONNECT_RELOGIN",
FORBIDDEN = "FORBIDDEN",
OTHER_LOGIN = "OTHER_LOGIN",
ACCOUNT_EXCHANGE_DESC = "ACCOUNT_EXCHANGE_DESC",
ALREADY_BINDED_DESC = "ALREADY_BINDED_DESC",
BIND_ACCOUNT_FAILED = "BIND_ACCOUNT_FAILED",
CHANGE_ACCOUNT_FAILED = "CHANGE_ACCOUNT_FAILED",
}
return LocalizationGlobalConst

View File

@ -207,7 +207,12 @@ local skill = {
["shake_type"]=5,
["sound_hit"]=1200120,
["name_act"]="skill01",
["fx_self"]=300022
["fx_self"]=300022,
["bullet_time"]={
1167,
3000,
300
}
},
[1200121]={
["position"]=1,
@ -409,7 +414,12 @@ local skill = {
["shake_type"]=5,
["sound_hit"]=1200120,
["name_act"]="skill01",
["fx_self"]=300059
["fx_self"]=300059,
["bullet_time"]={
1900,
3000,
400
}
},
[1300121]={
["position"]=1,
@ -495,7 +505,12 @@ local skill = {
["shake_type"]=5,
["sound_hit"]=1200120,
["name_act"]="skill01",
["fx_self"]=300059
["fx_self"]=300059,
["bullet_time"]={
1900,
3000,
400
}
},
[1300124]={
["position"]=1,
@ -703,7 +718,12 @@ local skill = {
["shake_type"]=5,
["sound_hit"]=1200114,
["name_act"]="skill01",
["fx_self"]=300039
["fx_self"]=300039,
["bullet_time"]={
1500,
3000,
400
}
},
[1300221]={
["position"]=1,
@ -806,7 +826,12 @@ local skill = {
["shake_type"]=5,
["sound_hit"]=1200114,
["name_act"]="skill01",
["fx_self"]=300039
["fx_self"]=300039,
["bullet_time"]={
1500,
3000,
400
}
},
[1400110]={
["position"]=1,
@ -929,7 +954,12 @@ local skill = {
["shake_type"]=5,
["sound_hit"]=1200120,
["name_act"]="skill01",
["fx_self"]=300049
["fx_self"]=300049,
["bullet_time"]={
400,
3000,
400
}
},
[1400121]={
["position"]=1,
@ -1131,7 +1161,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300009,
["bullet_time"]={
1100,
933,
3000,
400
}
@ -1218,7 +1248,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300009,
["bullet_time"]={
1100,
933,
3000,
400
}
@ -1352,7 +1382,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300044,
["bullet_time"]={
1100,
1400,
3000,
400
}
@ -1420,7 +1450,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300044,
["bullet_time"]={
1100,
1400,
3000,
400
}
@ -1649,7 +1679,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300054,
["bullet_time"]={
1100,
800,
3000,
400
}
@ -2100,7 +2130,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300004,
["bullet_time"]={
1566,
966,
5000,
400
}
@ -2506,7 +2536,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300074,
["bullet_time"]={
1100,
1500,
3000,
400
}
@ -2604,7 +2634,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300074,
["bullet_time"]={
1100,
1500,
3000,
400
}
@ -2689,7 +2719,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300074,
["bullet_time"]={
1100,
1500,
3000,
400
}
@ -2825,7 +2855,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300092,
["bullet_time"]={
1100,
1600,
3000,
400
}
@ -2947,7 +2977,7 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=300092,
["bullet_time"]={
1100,
1600,
3000,
400
}
@ -3061,7 +3091,12 @@ local skill = {
["shake_type"]=6,
["sound_hit"]=4200120,
["name_act"]="skill01",
["fx_target"]=300014
["fx_target"]=300014,
["bullet_time"]={
1066,
3000,
400
}
},
[4200121]={
["position"]=4,
@ -3248,7 +3283,12 @@ local skill = {
["shake_type"]=6,
["sound_hit"]=4200120,
["name_act"]="skill01",
["fx_self"]=300084
["fx_self"]=300084,
["bullet_time"]={
200,
3000,
400
}
},
[4300121]={
["position"]=4,
@ -3366,7 +3406,12 @@ local skill = {
["shake_type"]=6,
["sound_hit"]=4200120,
["name_act"]="skill01",
["fx_self"]=300084
["fx_self"]=300084,
["bullet_time"]={
200,
3000,
400
}
},
[4300210]={
["position"]=4,
@ -3497,7 +3542,12 @@ local skill = {
["shake_type"]=6,
["sound_hit"]=4200120,
["name_act"]="skill01",
["fx_self"]=300079
["fx_self"]=300079,
["bullet_time"]={
1833,
3000,
400
}
},
[4300221]={
["position"]=4,
@ -3706,7 +3756,7 @@ local skill = {
["name_act"]="skill01",
["fx_target"]=300034,
["bullet_time"]={
733,
633,
3000,
400
}
@ -4068,7 +4118,12 @@ local skill = {
["shake_type"]=6,
["sound_hit"]=4200120,
["name_act"]="skill01",
["fx_self"]=300064
["fx_self"]=300064,
["bullet_time"]={
2066,
3000,
400
}
},
[5300121]={
["position"]=5,
@ -4267,7 +4322,12 @@ local skill = {
["shake_type"]=6,
["sound_hit"]=4200120,
["name_act"]="skill01",
["fx_self"]=300069
["fx_self"]=300069,
["bullet_time"]={
1133,
3000,
400
}
},
[5300221]={
["position"]=5,
@ -4409,7 +4469,12 @@ local skill = {
["shake_type"]=6,
["sound_hit"]=4200120,
["name_act"]="skill01",
["fx_self"]=300069
["fx_self"]=300069,
["bullet_time"]={
1133,
3000,
400
}
},
[5400110]={
["position"]=5,
@ -4531,7 +4596,12 @@ local skill = {
["shake_type"]=6,
["sound_hit"]=4200120,
["name_act"]="skill01",
["fx_self"]=300089
["fx_self"]=300089,
["bullet_time"]={
1800,
3000,
400
}
},
[5400121]={
["skill_type"]=11,
@ -4593,7 +4663,12 @@ local skill = {
["shake_type"]=6,
["sound_hit"]=4200120,
["name_act"]="skill01",
["fx_self"]=300089
["fx_self"]=300089,
["bullet_time"]={
1800,
3000,
400
}
},
[5400124]={
["effect_type"]=2,
@ -4879,9 +4954,9 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=200045,
["bullet_time"]={
333,
500,
3000,
666
400
}
},
[10017]={
@ -4911,9 +4986,9 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=200037,
["bullet_time"]={
333,
1500,
3000,
666
400
}
},
[10018]={
@ -4948,9 +5023,9 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=200117,
["bullet_time"]={
333,
400,
3000,
666
400
}
},
[10019]={
@ -4980,9 +5055,9 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=200002,
["bullet_time"]={
333,
666,
3000,
666
400
}
},
[10020]={
@ -5012,9 +5087,9 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=200005,
["bullet_time"]={
333,
666,
3000,
666
400
}
},
[10021]={
@ -5044,9 +5119,9 @@ local skill = {
["name_act"]="skill01",
["fx_self"]=400044,
["bullet_time"]={
333,
200,
3000,
666
400
}
},
[10022]={
@ -5371,7 +5446,7 @@ local skill = {
["trigger"]=1,
["effect"]={
{
["type"]="shield_rebound_200",
["type"]="shield",
["num"]=1000,
["ratio"]=10000,
["round"]=2
@ -5578,8 +5653,6 @@ local skill = {
["sound_hit"]=1200120,
["name_act"]="skill01",
["fx_self"]=200028,
["fx_target"]=2,
["fx_target_delay"]=900,
["bullet_time"]={
1100,
3000,

View File

@ -194,6 +194,17 @@ local localization_global =
["NO_ADS"] = "新广告还没有准备好",
["BESURE_DELETE_TIPS_DESC"] = "是否要删除账号删除后将清除所有信息和内容账号重新登陆后将是初始1级新手状态。如果确定请输入“{0}”",
["BESURE_DELETE_ACCOUNT_DESC"] = "确认删除",
["DELETE_ACCOUNT_FAILED"] = "账号删除失败,请重试",
["CHANGE_ACCOUNT_TIPS_DESC"] = "当前账号未绑定, 切换后可能会导致数据丢失, 是否确认要切换?",
["BIND_ACCOUNT_SUCCESS"] = "账号绑定成功",
["MAINTAIN"] = "服务器维护",
["DISCONNECT_RELOGIN"] = "网络连接已断开, 请重新登录",
["FORBIDDEN"] = "封号/禁止登录",
["OTHER_LOGIN"] = "账号在其他设备登录",
["ACCOUNT_EXCHANGE_DESC"] = "账号是没有信息的新号,无法切换。",
["ALREADY_BINDED_DESC"] = "绑定失败,该账号已有其他绑定信息",
["BIND_ACCOUNT_FAILED"] = "账号绑定失败,请重试",
["CHANGE_ACCOUNT_FAILED"] = "账号切换失败,请重试",
}
return localization_global

View File

@ -57,14 +57,14 @@ function AccountManager:bindAccount()
end
function AccountManager:onBindAccount(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then
if result.status == 0 then
local accountInfo = LocalData:getAccountInfo()
local loginType = SDKManager.BF_LOGIN_TYPE.GOOGLE
if Platform:isIosPlatform() then
loginType = SDKManager.BF_LOGIN_TYPE.APPLE
accountInfo.apple_id = result.reqData.id
else
accountInfo.googld_id = result.reqData.id
accountInfo.google_id = result.reqData.id
end
LocalData:setLastLoginInfo(loginType, result.reqData.id, result.reqData.token)
LocalData:setAccountInfo(accountInfo)
@ -73,7 +73,17 @@ function AccountManager:onBindAccount(result)
BIReport:postAccountBindFinish(loginType, true)
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_SUCCESS))
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BIND_ACCOUNT_SUCCESS)
else -- 一些失败的提示
else
local params = {
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
}
if result.status == 13 then -- 重复绑定
params.content = I18N:getGlobalText(I18N.GlobalConst.ALREADY_BINDED_DESC)
else
params.content = I18N:getGlobalText(I18N.GlobalConst.BIND_ACCOUNT_FAILED)
end
GFunc.showMessageBox(params)
local loginType = SDKManager.BF_LOGIN_TYPE.GOOGLE
if Platform:isIosPlatform() then
loginType = SDKManager.BF_LOGIN_TYPE.APPLE
@ -103,14 +113,14 @@ function AccountManager:changeAccount()
end
function AccountManager:onChangeAccount(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then -- 目标账号存在,切换到目标账号
if result.status == 0 then
local accountInfo = LocalData:getAccountInfo()
local loginType = SDKManager.BF_LOGIN_TYPE.GOOGLE
if Platform:isIosPlatform() then
loginType = SDKManager.BF_LOGIN_TYPE.APPLE
accountInfo.apple_id = result.reqData.id
else
accountInfo.googld_id = result.reqData.id
accountInfo.google_id = result.reqData.id
end
LocalData:setLastLoginInfo(loginType, result.reqData.id, result.reqData.token)
LocalData:setAccountInfo(accountInfo)
@ -118,6 +128,16 @@ function AccountManager:onChangeAccount(result)
BIReport:postAccountChangeFinish(loginType, true)
ModuleManager.LoginManager:goToLoginScene()
else
local params = {
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
}
if result.status == 14 then
params.content = I18N:getGlobalText(I18N.GlobalConst.ACCOUNT_EXCHANGE_DESC)
else
params.content = I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_FAILED)
end
GFunc.showMessageBox(params)
local loginType = SDKManager.BF_LOGIN_TYPE.GOOGLE
if Platform:isIosPlatform() then
loginType = SDKManager.BF_LOGIN_TYPE.APPLE

View File

@ -119,6 +119,8 @@ function ChapterManager:endFightFinish(result)
if maxChapter == 1 then
DataManager.ShopData:markPopUpGiftForBeginnerGift()
end
-- 新章节通关,尝试解锁新功能
DataManager:tryOpenModules()
-- 章节通关 标记可弹出章节礼包
DataManager.ShopData:markPopUpGiftForActChapterStore(maxChapter)
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_PASS_CHAPTER)

View File

@ -98,6 +98,12 @@ args:不掉落的元素类型
Example: set_seal_element 1 2 3]],
type = "set_seal_element"
},
{
title = "账号解绑",
desc = [[ type:unbind
Example: unbind google]],
type = "unbind"
},
}
return GMConst

View File

@ -26,7 +26,13 @@ function MaincityManager:firstEnterMainCity()
end
function MaincityManager:changeMainCityLeftSideBarOpenOrClose()
local mainUI = UIManager:getUIByIndex(UIManager.UI_PATH.MAINCITY_UI)
if not mainUI then
return nil
end
self.isLeftSideBarClose = not self.isLeftSideBarClose
mainUI:refreshLeftBtns()
end
function MaincityManager:getIsMainCityLeftSideBarClose()
@ -34,11 +40,62 @@ function MaincityManager:getIsMainCityLeftSideBarClose()
end
function MaincityManager:changeMainCityRightSideBarOpenOrClose()
local mainUI = UIManager:getUIByIndex(UIManager.UI_PATH.MAINCITY_UI)
if not mainUI then
return nil
end
self.isRightSideBarClose = not self.isRightSideBarClose
mainUI:refreshRightBtns()
end
function MaincityManager:getIsMainCityRightSideBarClose()
return self.isRightSideBarClose
end
-- 获取主界面各个模块的入口坐标
function MaincityManager:getModuleEntrancePos(moduleKey)
local mainUI = UIManager:getUIByIndex(UIManager.UI_PATH.MAINCITY_UI)
if not mainUI then
return nil
end
if moduleKey == ModuleManager.MODULE_KEY.TASK then
return mainUI:getTaskIconPos()
elseif moduleKey == ModuleManager.MODULE_KEY.MALL_DAILY then
return mainUI:getMallIconPos()
elseif moduleKey == ModuleManager.MODULE_KEY.DAILY_CHALLENGE then
return mainUI:getDailyChallengeIconPos()
elseif moduleKey == ModuleManager.MODULE_KEY.FUND or
moduleKey == ModuleManager.MODULE_KEY.IDLE_DROP or
moduleKey == ModuleManager.MODULE_KEY.SEVEN_DAY then
return mainUI:getSideBarActIconPos(moduleKey)
end
end
-- 模块在侧边栏,-10不在侧边栏1
function MaincityManager:getModuleInSideBarWhere(moduleKey)
local mainUI = UIManager:getUIByIndex(UIManager.UI_PATH.MAINCITY_UI)
if not mainUI then
return nil
end
if mainUI:isInSideBarLeft(moduleKey) then
return -1
elseif mainUI:isInSideBarRight(moduleKey) then
return 1
else
return 0
end
end
function MaincityManager:isActivSideBarModule(moduleKey)
local mainUI = UIManager:getUIByIndex(UIManager.UI_PATH.MAINCITY_UI)
if not mainUI then
return nil
end
return mainUI:isActivSideBarModule(moduleKey)
end
return MaincityManager

View File

@ -20,6 +20,7 @@ function PlayerManager:onLevelUpFinish(result)
if diffLv > 0 then
self:showPlayerUpUI(currLv, result.rewards)
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_PLAYER_LV_REACH, diffLv)
DataManager:tryOpenModules()
end
end
end

View File

@ -5,6 +5,12 @@ local DEFAULT_RED_POINT_POS_Y = 30
local DEFAULT_RED_POINT_SCALE = 0.6
-- 需要继承重写的部分 ***********************************************************
-- 模块key值对应ModuleManager.MODULE_KEY
function SideBarBaseCellComp:getModuleKey()
return nil
end
function SideBarBaseCellComp:getIsOpen()
return false
end
@ -19,6 +25,16 @@ function SideBarBaseCellComp:getSpineName()
return nil
end
-- 图标动画资源默认名称
function SideBarBaseCellComp:getSpineAnimationName()
return "idle"
end
-- 图标动画默认位置
function SideBarBaseCellComp:getSpinePositionY()
return 0
end
-- 特效资源路径,为空时不显示
function SideBarBaseCellComp:getVfxRes()
return nil
@ -67,10 +83,11 @@ function SideBarBaseCellComp:refreshSpine()
self.spine:getSkeletonGraphic().enabled = false
return
end
self.spine:setAnchoredPositionY(self:getSpinePositionY())
if not self.isInitSpine then
self.isInitSpine = true
self.spine:loadAssetAsync(self:getSpineName(), function()
self.spine:playAnim("idle", true, true, true)
self.spine:playAnim(self:getSpineAnimationName(), true, true, true)
if self.isActive then
self.spine:setActive(true)
else
@ -142,6 +159,19 @@ function SideBarBaseCellComp:setVisible(visible)
end
end
function SideBarBaseCellComp:getIsVisible()
return self.visible
end
function SideBarBaseCellComp:getEntrancePos()
if self:getIconRes() then
return self.icon:getPosition()
elseif self:getSpineName() then
return self.spine:getPosition()
end
return nil
end
function SideBarBaseCellComp:getCellPath()
return self.cellPath
end

View File

@ -1,12 +1,16 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarBeginnerGiftCell = class("SideBarBeginnerGiftCell", SideBarBaseCellComp)
function SideBarBeginnerGiftCell:getModuleKey()
return ModuleManager.MODULE_KEY.BEGINNER_GIFT
end
function SideBarBeginnerGiftCell:getIsOpen()
return DataManager.ShopData:getBeginnerGiftShowSideBar()
end
function SideBarBeginnerGiftCell:getIconRes()
return "main_btn_gift_1"
function SideBarBeginnerGiftCell:getSpineName()
return "main_btn_gift_new"
end
function SideBarBeginnerGiftCell:onClick()

View File

@ -1,6 +1,10 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarFirstRechargeCell = class("SideBarFirstRechargeCell", SideBarBaseCellComp)
function SideBarFirstRechargeCell:getModuleKey()
return ModuleManager.MODULE_KEY.FIRST_RECHARGE
end
function SideBarFirstRechargeCell:getIsOpen()
return DataManager.ShopData:getShowFirstRechargeSideBar()
end

View File

@ -1,6 +1,10 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarGoldPigCell = class("SideBarGoldPigCell", SideBarBaseCellComp)
function SideBarGoldPigCell:getModuleKey()
return ModuleManager.MODULE_KEY.GOLD_PIG
end
function SideBarGoldPigCell:getIsOpen()
return DataManager.GoldPigData:getIsOpen()
end

View File

@ -5,8 +5,8 @@ function SideBarGrowUpGift1Cell:getIsOpen()
return #DataManager.ShopData:getValidGrowUpGifts() >= 1
end
function SideBarGrowUpGift1Cell:getIconRes()
return "main_btn_gift_2"
function SideBarGrowUpGift1Cell:getSpineName()
return "ui_main_btn_gift_grow"
end
function SideBarGrowUpGift1Cell:onClick()

View File

@ -5,8 +5,8 @@ function SideBarGrowUpGift2Cell:getIsOpen()
return #DataManager.ShopData:getValidGrowUpGifts() >= 2
end
function SideBarGrowUpGift2Cell:getIconRes()
return "main_btn_gift_2"
function SideBarGrowUpGift2Cell:getSpineName()
return "ui_main_btn_gift_grow"
end
function SideBarGrowUpGift2Cell:onClick()

View File

@ -1,6 +1,10 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarGrowthFundCell = class("SideBarGrowthFundCell", SideBarBaseCellComp)
function SideBarGrowthFundCell:getModuleKey()
return ModuleManager.MODULE_KEY.FUND
end
function SideBarGrowthFundCell:getIsOpen()
return DataManager.GrowthFundData:getIsOpen()
end
@ -9,6 +13,10 @@ function SideBarGrowthFundCell:getSpineName()
return "ui_main_btn_growup"
end
function SideBarGrowthFundCell:getSpinePositionY()
return -50 -- 临时资源
end
function SideBarGrowthFundCell:onClick()
ModuleManager.FundManager:showLevelFundUI()
end

View File

@ -1,6 +1,10 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarIdleCell = class("SideBarIdleCell", SideBarBaseCellComp)
function SideBarIdleCell:getModuleKey()
return ModuleManager.MODULE_KEY.IDLE_DROP
end
function SideBarIdleCell:getIsOpen()
return DataManager.IdleData:getIsOpen()
end

View File

@ -1,6 +1,10 @@
local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
local SideBarSevenDaysCell = class("SideBarSevenDaysCell", SideBarBaseCellComp)
function SideBarSevenDaysCell:getModuleKey()
return ModuleManager.MODULE_KEY.SEVEN_DAY
end
function SideBarSevenDaysCell:getIsOpen()
return DataManager.SevenDayData:getIsOpen()
end

View File

@ -71,8 +71,10 @@ function MainComp:refreshFightBtn()
end
function MainComp:refreshLeftBtn()
local leftBtn = self.uiMap["main_comp.left_btn"]
leftBtn:setActive(false)
if self.leftBtn == nil then
self.leftBtn = self.uiMap["main_comp.left_btn"]
end
self.leftBtn:setActive(false)
local leftIdx = self:getCurLeftModuleIdx()
if leftIdx == nil then
@ -83,23 +85,25 @@ function MainComp:refreshLeftBtn()
return
end
leftBtn:setActive(true)
self.leftBtn:setActive(true)
local iconAtlas, iconName = moduleCell:getEntranceIcon()
self.uiMap["main_comp.left_btn.desc"]:setText(moduleCell:getEntranceName())
self.uiMap["main_comp.left_btn.icon"]:setSprite(iconAtlas, iconName)
leftBtn:addClickListener(function()
self.leftBtn:addClickListener(function()
self:refreshModule(leftIdx)
end)
if moduleCell:getShowEntranceRedPoint() then
leftBtn:addRedPoint(65, 35, 0.6)
self.leftBtn:addRedPoint(65, 35, 0.6)
else
leftBtn:removeRedPoint()
self.leftBtn:removeRedPoint()
end
end
function MainComp:refreshRightBtn()
local rightBtn = self.uiMap["main_comp.right_btn"]
rightBtn:setActive(false)
if self.rightBtn == nil then
self.rightBtn = self.uiMap["main_comp.right_btn"]
end
self.rightBtn:setActive(false)
local rightIdx = self:getCurRightModuleIdx()
if rightIdx == nil then
@ -110,17 +114,17 @@ function MainComp:refreshRightBtn()
return
end
rightBtn:setActive(true)
self.rightBtn:setActive(true)
local iconAtlas, iconName = moduleCell:getEntranceIcon()
self.uiMap["main_comp.right_btn.desc"]:setText(moduleCell:getEntranceName())
self.uiMap["main_comp.right_btn.icon"]:setSprite(iconAtlas, iconName)
rightBtn:addClickListener(function()
self.rightBtn:addClickListener(function()
self:refreshModule(rightIdx)
end)
if moduleCell:getShowEntranceRedPoint() then
rightBtn:addRedPoint(-65, 35, 0.6)
self.rightBtn:addRedPoint(-65, 35, 0.6)
else
rightBtn:removeRedPoint()
self.rightBtn:removeRedPoint()
end
end
@ -188,4 +192,13 @@ function MainComp:refreshStageFormaion()
end
end
function MainComp:getDailyChallengeIconPos()
if self:getCurLeftModuleIdx() == GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE then
return self.leftBtn:getPosition()
end
if self:getCurRightModuleIdx() == GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE then
return self.rightBtn:getPosition()
end
end
return MainComp

View File

@ -403,7 +403,6 @@ end
function MainCityUI:openOrCloseLeftSideBar()
ModuleManager.MaincityManager:changeMainCityLeftSideBarOpenOrClose()
self:refreshLeftBtns()
if self.isShowLeftSideBarArrowRedPoint ~= nil then
local isShowLeftSideBarArrowRedPoint = self.isShowLeftSideBarArrowRedPoint
self.isShowLeftSideBarArrowRedPoint = nil
@ -470,7 +469,6 @@ end
function MainCityUI:openOrCloseRightSideBar()
ModuleManager.MaincityManager:changeMainCityRightSideBarOpenOrClose()
self:refreshRightBtns()
if self.isShowRightSideBarArrowRedPoint ~= nil then
local isShowRightSideBarArrowRedPoint = self.isShowRightSideBarArrowRedPoint
self.isShowRightSideBarArrowRedPoint = nil
@ -969,4 +967,63 @@ function MainCityUI:checkGift()
end
end
function MainCityUI:getTaskIconPos()
return self.taskBtn:getPosition()
end
function MainCityUI:getMallIconPos()
return self.bottomBtnSpines[GConst.MainCityConst.BOTTOM_PAGE.SHOP]:getPosition()
end
function MainCityUI:getDailyChallengeIconPos()
return self.subComps[GConst.MainCityConst.BOTTOM_PAGE.MAIN]:getDailyChallengeIconPos()
end
function MainCityUI:getSideBarActIconPos(moduleKey)
for name, cell in pairs(self.leftBarList) do
if moduleKey == cell:getModuleKey() then
return cell:getBaseObject():getPosition()
end
end
for name, cell in pairs(self.rightBarList) do
if moduleKey == cell:getModuleKey() then
return cell:getBaseObject():getPosition()
end
end
return nil
end
function MainCityUI:isInSideBarLeft(moduleKey)
for name, cell in pairs(self.leftBarList) do
if moduleKey == cell:getModuleKey() then
return true
end
end
return false
end
function MainCityUI:isInSideBarRight(moduleKey)
for name, cell in pairs(self.rightBarList) do
if moduleKey == cell:getModuleKey() then
return true
end
end
return false
end
function MainCityUI:isActivSideBarModule(moduleKey)
for name, cell in pairs(self.leftBarList) do
if moduleKey == cell:getModuleKey() then
return cell:getIsActive() and cell:getIsVisible()
end
end
for name, cell in pairs(self.rightBarList) do
if moduleKey == cell:getModuleKey() then
return cell:getIsActive() and cell:getIsVisible()
end
end
return nil
end
return MainCityUI

View File

@ -29,54 +29,114 @@ end
function ModuleUnlockUI:onLoadRootComplete()
self.uiMap = self.root:genAllChildren()
self.uiMap["module_unlock_ui.bg"]:addClickListener(function()
self:showNextModuleUnlockAnimation()
self.bg = self.uiMap["module_unlock_ui.bg"]
self.bg:addClickListener(function()
if not self.canClick then
return
end
self:showModuleUnlockVanishAnim()
end)
self.moduleNameTx = self.uiMap["module_unlock_ui.name_tx"]
self.moduleNameTx = self.uiMap["module_unlock_ui.bg.name_tx"]
self.moduleIcon = self.uiMap["module_unlock_ui.icon"]
self.uiMap["module_unlock_ui.continue"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_TO_CONTINUE))
self.uiMap["module_unlock_ui.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.FUNC_UNLOCK))
self.titleTx = self.uiMap["module_unlock_ui.bg.spine_title.title_tx"]
self.spineTitle = self.uiMap["module_unlock_ui.bg.spine_title"]
self.spineCircle = self.uiMap["module_unlock_ui.icon.spine_circle"]
self.spineStar = self.uiMap["module_unlock_ui.spine_star"]
self.uiMap["module_unlock_ui.bg.continue"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_TO_CONTINUE))
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.FUNC_UNLOCK))
self:showModuleUnlockAnimation()
self.initIconPos = self.uiMap["module_unlock_ui.init_pos"]:getPosition()
self.canvasGroupBg = self.bg:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
self.canvasGroupTitleTx = self.titleTx:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
self.canvasGroupIcon = self.moduleIcon:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
self:checkShowNext()
end
function ModuleUnlockUI:showNextModuleUnlockAnimation()
if self:showModuleUnlockAnimation() then
self:playUnlockAnimation()
end
end
function ModuleUnlockUI:showModuleUnlockAnimation()
-- 检查是否展示
function ModuleUnlockUI:checkShowNext()
if #self.unlockList <= 0 then
self:closeUI()
return false
return
end
local moduleKey = table.remove(self.unlockList, 1)
local info = ConfigManager:getConfig("func_open")[moduleKey]
local i18nInfo = I18N:getConfig("func_open")[moduleKey]
self.moduleKey = table.remove(self.unlockList, 1)
local info = ConfigManager:getConfig("func_open")[self.moduleKey]
local i18nInfo = I18N:getConfig("func_open")[self.moduleKey]
if info == nil or i18nInfo == nil then
self:closeUI()
return false
return
end
self.moduleNameTx:setText(i18nInfo.name)
if info.icon then
self.moduleIcon:setSprite(GConst.ATLAS_PATH.MODULE, info.icon)
end
return true
-- 侧边栏功能,检查处理侧边栏打开
if not ModuleManager.MaincityManager:isActivSideBarModule(self.moduleKey) then
if ModuleManager.MaincityManager:getModuleInSideBarWhere(self.moduleKey) == -1 then
ModuleManager.MaincityManager:changeMainCityLeftSideBarOpenOrClose()
elseif ModuleManager.MaincityManager:getModuleInSideBarWhere(self.moduleKey) == 1 then
ModuleManager.MaincityManager:changeMainCityRightSideBarOpenOrClose()
end
end
self:showModuleUnlockAppearAnim()
end
function ModuleUnlockUI:playUnlockAnimation()
if self.unlockAnimationSeq == nil then
self.unlockAnimationSeq = self.root:createBindTweenSequence()
local scaleTween1 = self.root:getTransform():DOScale(1.05, 0.15)
self.unlockAnimationSeq:Append(scaleTween1)
-- 出现
function ModuleUnlockUI:showModuleUnlockAppearAnim()
self.canClick = false
self.canvasGroupBg.alpha = 0
self.canvasGroupTitleTx.alpha = 0
self.canvasGroupIcon.alpha = 0
self.titleTx:setLocalScale(0,0,0)
self.moduleIcon:setLocalScale(1,1,1)
self.moduleIcon:setPosition(self.initIconPos.x, self.initIconPos.y, self.initIconPos.z)
local scaleTween2 = self.root:getTransform():DOScale(1, 0.2)
self.unlockAnimationSeq:Append(scaleTween2)
self.unlockAnimationSeq:SetAutoKill(false)
self.spineTitle:playAnim("idle", false, true, true)
self:performWithDelayGlobal(function()
self.spineCircle:playAnim("idle", false, true, true)
end, 0.17)
if self.animAppear == nil then
self.animAppear = self.root:createBindTweenSequence()
self.animAppear:Insert(0, self.canvasGroupBg:DOFade(1, 0.14))
self.animAppear:Insert(0.13, self.canvasGroupIcon:DOFade(1, 0.07))
self.animAppear:Insert(0.13, self.moduleIcon:getTransform():DOScale(1.2, 0.07))
self.animAppear:Insert(0.17, self.canvasGroupTitleTx:DOFade(1, 0.1))
self.animAppear:Insert(0.17, self.titleTx:getTransform():DOScale(1.2, 0.1))
self.animAppear:Insert(0.2, self.moduleIcon:getTransform():DOScale(1, 0.13))
self.animAppear:SetAutoKill(false)
self.animAppear:OnComplete(function()
self.canClick = true
end)
else
self.unlockAnimationSeq:Restart()
self.animAppear:Restart()
end
end
-- 消失
function ModuleUnlockUI:showModuleUnlockVanishAnim()
self.canClick = false
self.animVanish = self.root:createBindTweenSequence()
self.animVanish:Insert(0, self.canvasGroupBg:DOFade(0, 0.1))
self.animVanish:Insert(0, self.titleTx:getTransform():DOScale(1, 0.16))
self.animVanish:Insert(0, self.moduleIcon:getTransform():DOScale(0.46, 0.1))
self.animVanish:Insert(0.33, self.canvasGroupIcon:DOFade(0, 0.07))
local targetPos = ModuleManager.MaincityManager:getModuleEntrancePos(self.moduleKey)
if targetPos then
self.spineStar:setPosition(targetPos.x, targetPos.y, targetPos.z)
self.animVanish:Insert(0.17, self.moduleIcon:getTransform():DOMove(CS.UnityEngine.Vector3(targetPos.x, targetPos.y, targetPos.z), 0.16))
self.animVanish:OnComplete(function()
self.animVanish = nil
self.spineStar:playAnimComplete("idle", false, true, function()
self:checkShowNext()
end)
end)
else
self.animVanish:OnComplete(function()
self.animVanish = nil
self:checkShowNext()
end)
end
end

View File

@ -1,7 +1,6 @@
local ActivityData = class("ActivityData", BaseData)
function ActivityData:init(data)
end
return ActivityData

View File

@ -13,6 +13,7 @@ function SevenDayData:clear()
self.tasks = {}
self.stepRewards = {}
DataManager:unregisterCrossDayFunc("SevenDayData")
DataManager:unregisterTryOpenFunc("SevenDayData")
end
function SevenDayData:init(data)
@ -35,6 +36,19 @@ function SevenDayData:init(data)
self:calCollectStepCount()
self:initTaskListener()
if self.openTs <= 0 then
DataManager:registerTryOpenFunc("SevenDayData", function()
if self.openTs <= 0 then
if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.SEVEN_DAY, true) then
self.openTs = Time:getBeginningOfServerToday()
self.endTime = self.openTs + self:getDurationTime()
self.actDay = 1
DataManager:unregisterTryOpenFunc("SevenDayData")
end
end
end)
end
DataManager:registerCrossDayFunc("SevenDayData", function()
self.actDay = self.actDay + 1
self:setDirty()
@ -361,7 +375,7 @@ end
function SevenDayData:initTaskListener()
local nowTime = Time:getServerTime()
-- 活动结束就不用监听了
if self.endTime < nowTime then
if self.endTime > 0 and self.endTime < nowTime then
ModuleManager.TaskManager:unRegisterAllModuleTask("SevenDayData")
return false
end