主城金币
This commit is contained in:
parent
46d338e13d
commit
8de863c989
@ -11,8 +11,6 @@ local LOCAL_DATA_KEY = {
|
||||
MESSAGE_BOX_SHOW_TODAY = "MESSAGE_BOX_SHOW_TODAY",
|
||||
GAME_QUALITY_LEVEL = "GAME_QUALITY_LEVEL", -- 游戏设置品质等级
|
||||
LAST_LOGIN_URL = "LAST_LOGIN_URL",
|
||||
LAST_LOGIN_INFO = "LAST_LOGIN_INFO", -- 上一次登录成功的信息
|
||||
LAST_LOGIN_TYPE = "LAST_LOGIN_TYPE", -- 上次登录类型 token不记录
|
||||
LAST_LOGIN_NAME = "LAST_LOGIN_NAME",
|
||||
LAST_LOGIN_IP = "LAST_LOGIN_IP",
|
||||
ACCOUNT_INFO = "ACCOUNT_INFO",
|
||||
@ -201,44 +199,6 @@ function LocalData:getIosOrders()
|
||||
end
|
||||
end
|
||||
|
||||
function LocalData:setLastLoginInfo(loginType, id, token)
|
||||
local str = json.encode({
|
||||
type = loginType,
|
||||
id = id,
|
||||
token = token
|
||||
})
|
||||
if not loginType then
|
||||
self:setString(LOCAL_DATA_KEY.LAST_LOGIN_TYPE, "")
|
||||
elseif loginType ~= "token" then
|
||||
self:setString(LOCAL_DATA_KEY.LAST_LOGIN_TYPE, loginType)
|
||||
end
|
||||
self:setString(LOCAL_DATA_KEY.LAST_LOGIN_INFO, str)
|
||||
end
|
||||
|
||||
function LocalData:getLastLoginInfo()
|
||||
local str = self:getString(LOCAL_DATA_KEY.LAST_LOGIN_INFO, "{}")
|
||||
local info = json.decode(str)
|
||||
info.type = info.type or NetManager.LOGIN_TYPE.ANONYMOUS
|
||||
info.id = info.id or DeviceHelper:getDeviceId()
|
||||
info.token = info.token
|
||||
return info
|
||||
end
|
||||
|
||||
function LocalData:getLastLoginType()
|
||||
local str = self:getString(LOCAL_DATA_KEY.LAST_LOGIN_TYPE, "")
|
||||
if str == "" then
|
||||
str = NetManager.LOGIN_TYPE.ANONYMOUS
|
||||
end
|
||||
if str ~= NetManager.LOGIN_TYPE.ANONYMOUS and
|
||||
str ~= NetManager.LOGIN_TYPE.APPLE and
|
||||
str ~= NetManager.LOGIN_TYPE.GOOGLE and
|
||||
str ~= NetManager.LOGIN_TYPE.FACEBOOK
|
||||
then
|
||||
str = NetManager.LOGIN_TYPE.ANONYMOUS
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
function LocalData:setLastLoginName(name)
|
||||
name = name or ""
|
||||
self:setString(LOCAL_DATA_KEY.LAST_LOGIN_NAME, name)
|
||||
|
||||
@ -157,8 +157,6 @@ if NOT_PUBLISH then
|
||||
[SDKManager.tryLoadRewardedAdDelay] = true,
|
||||
[ScrollRectBase.refillCells] = true,
|
||||
[DataManager.scheduleGlobal] = true,
|
||||
[NetManager.performWithDelayGlobal] = true,
|
||||
[NetManager.scheduleGlobal] = true,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
@ -280,15 +280,15 @@ function SDKManager:showFullScreenAds(adsClickType, adCallback)
|
||||
return true
|
||||
end
|
||||
|
||||
if NetManager:isNotReachable() then
|
||||
-- 没有网
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.NO_NETWORK))
|
||||
return false
|
||||
end
|
||||
if NetManager:getIsBusy() then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.NETWORK_ERROE_1))
|
||||
return false
|
||||
end
|
||||
-- if NetManager:isNotReachable() then
|
||||
-- -- 没有网
|
||||
-- GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.NO_NETWORK))
|
||||
-- return false
|
||||
-- end
|
||||
-- if NetManager:getIsBusy() then
|
||||
-- GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.NETWORK_ERROE_1))
|
||||
-- return false
|
||||
-- end
|
||||
if DataManager.MallActData:skipAd() then
|
||||
self:adRewradAd(true)
|
||||
if adCallback then
|
||||
|
||||
@ -377,9 +377,9 @@ function SDKPayGoogleManager:doUncompletePay(callback)
|
||||
if not DataManager:getLoginSuccess() then
|
||||
return
|
||||
end
|
||||
if NetManager:getIsBusy() then
|
||||
return
|
||||
end
|
||||
-- if NetManager:getIsBusy() then
|
||||
-- return
|
||||
-- end
|
||||
if self:_getIsGoogleStoreConnected() then
|
||||
-- google商店是否初始化
|
||||
self.alreadyFinishUncompletePay = true
|
||||
|
||||
@ -277,9 +277,9 @@ function SDKPayiOSManager:doUncompletePay(callback)
|
||||
if not DataManager:getLoginSuccess() then
|
||||
return
|
||||
end
|
||||
if NetManager:getIsBusy() then
|
||||
return
|
||||
end
|
||||
-- if NetManager:getIsBusy() then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
if self:_getIsIosInitialized() then
|
||||
self.alreadyFinishUncompletePay = true
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
local ServerPushManager = {}
|
||||
|
||||
---- 注册推送监听
|
||||
function ServerPushManager:addServerPushListener(msgName, module, callback)
|
||||
NetManager:registerMsgCallback(msgName, module, callback)
|
||||
end
|
||||
|
||||
---- 移除推送监听
|
||||
function ServerPushManager:removeServerPushListener(msgName, module)
|
||||
NetManager:unRegisterMsgCallback(msgName, module)
|
||||
end
|
||||
|
||||
---- 初始化全局推送监听
|
||||
function ServerPushManager:initWhenLogin()
|
||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.KickOutNtf, UIManager, UIManager.showKickOut)
|
||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.MallActTriggerGiftNtf, ModuleManager.MallManager, ModuleManager.MallManager.MallActTriggerGiftNtf)
|
||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.BattlePassBoughtNtf, ModuleManager.BountyManager, ModuleManager.BountyManager.buyCardFinish)
|
||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.SummonPoolLevelNtf, ModuleManager.SummonManager, ModuleManager.SummonManager.SummonPoolLevelNtf)
|
||||
self:addServerPushListener(ProtoMsgType.FromMsgEnum.NewMailNtf, ModuleManager.MailManager, ModuleManager.MailManager.needUpdateMail)
|
||||
end
|
||||
|
||||
---- 移除全局推送监听
|
||||
function ServerPushManager:removeWhenLoginOut()
|
||||
self:removeServerPushListener(ProtoMsgType.FromMsgEnum.KickOutNtf, UIManager)
|
||||
end
|
||||
|
||||
return ServerPushManager
|
||||
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c64e57074a12a04a98c2bd95599566a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -73,13 +73,11 @@ function Game:initOther()
|
||||
BF.exports.EffectManager = require "app/common/effect_manager"
|
||||
BF.exports.SpineManager = require "app/common/spine_manager"
|
||||
BF.exports.WebRequestManager = require "app/common/webrequest_manager"
|
||||
BF.exports.NetManager = require "app/net/net_manager"
|
||||
BF.exports.I18N = require "app/common/i18n_manager"
|
||||
BF.exports.CellManager = require "app/common/cell_manager"
|
||||
BF.exports.Time = require "app/common/time"
|
||||
BF.exports.BaseData = require "app/userdata/base_data"
|
||||
BF.exports.BaseObject = require "app/bf/unity/base_object"
|
||||
BF.exports.ServerPushManager = require "app/common/server_push_manager"
|
||||
BF.exports.SafeAreaManager = require "app/common/safe_area_manager"
|
||||
BF.exports.BaseModule = require "app/module/base_module"
|
||||
BF.exports.ModuleManager = require "app/common/module_manager"
|
||||
@ -95,7 +93,6 @@ function Game:initOther()
|
||||
|
||||
CameraManager:init()
|
||||
WebRequestManager:init()
|
||||
NetManager:init()
|
||||
I18N:init()
|
||||
ServerDataManager:init()
|
||||
DataManager:init()
|
||||
@ -143,13 +140,11 @@ function Game:specialForIdea()
|
||||
EffectManager = EffectManager or require "app/common/effect_manager"
|
||||
SpineManager = SpineManager or require "app/common/spine_manager"
|
||||
WebRequestManager = WebRequestManager or require "app/common/webrequest_manager"
|
||||
NetManager = NetManager or require "app/net/net_manager"
|
||||
I18N = I18N or require "app/common/i18n_manager"
|
||||
CellManager = CellManager or require "app/common/cell_manager"
|
||||
Time = Time or require "app/common/time"
|
||||
BaseData = BaseData or require "app/userdata/base_data"
|
||||
BaseObject = BaseObject or require "app/bf/unity/base_object"
|
||||
ServerPushManager = ServerPushManager or require "app/module/login/server_push_manager"
|
||||
SafeAreaManager = SafeAreaManager or require "app/common/safe_area_manager"
|
||||
BaseModule = BaseModule or require "app/module/base_module"
|
||||
ModuleManager = ModuleManager or require "app/common/module_manager"
|
||||
|
||||
@ -1535,25 +1535,6 @@ function GFunc.getRewardTable(type, id, count)
|
||||
}
|
||||
end
|
||||
|
||||
function GFunc.formatRewardsToServerStruct(rewardList)
|
||||
local rewards = {}
|
||||
for _, reward in ipairs(rewardList) do
|
||||
local serverReward = GFunc.getServerRewardTable(reward.type, reward.id, reward.count)
|
||||
table.insert(rewards, serverReward)
|
||||
end
|
||||
return rewards
|
||||
end
|
||||
|
||||
function GFunc.getServerRewardTable(type, id, count)
|
||||
if type == GConst.REWARD_TYPE.ITEM then
|
||||
return GFunc.getServerItemRewardTable(id, count)
|
||||
elseif type == GConst.REWARD_TYPE.RUNES then
|
||||
return GFunc.getServerRuneRewardTable(id, BigNumOpt.bigNum2Num(count))
|
||||
elseif type == GConst.REWARD_TYPE.EQUIP then
|
||||
return GFunc.getServerEquipRewardTable(id, count)
|
||||
end
|
||||
end
|
||||
|
||||
function GFunc.getServerRuneRewardTable(id, level)
|
||||
return {
|
||||
type = GConst.REWARD_TYPE.RUNES,
|
||||
|
||||
@ -72,19 +72,6 @@ function BaseModule:removeAllEventListeners()
|
||||
end
|
||||
end
|
||||
|
||||
-- 阻塞式,等待服务器回复以后再回调callback
|
||||
function BaseModule:sendMessage(msgName, params, responseData, callback, getType, lockGame)
|
||||
if lockGame == nil then
|
||||
lockGame = true
|
||||
end
|
||||
NetManager:send(self, msgName, params, responseData, callback, lockGame, nil, getType)
|
||||
end
|
||||
|
||||
-- 阻塞式,等待所有指令完成以后再发送此消息,并且锁界面,等待服务器回复以后再回调callback
|
||||
function BaseModule:sendMessageTillBeforeOver(msgName, params, responseData, callback, getType)
|
||||
NetManager:sendTillBeforeOver(self, msgName, params, responseData, callback, true, nil, getType)
|
||||
end
|
||||
|
||||
-- 各个模块的manager按各自需求来重写clear即可
|
||||
function BaseModule:clear()
|
||||
end
|
||||
|
||||
@ -30,98 +30,6 @@ Example: del_item]],
|
||||
Example: clear_item]],
|
||||
type = "clear_item"
|
||||
},
|
||||
{
|
||||
title = "通关",
|
||||
desc = [[通关 type:pass_chapter
|
||||
Example: pass_chapter 100]],
|
||||
type = "pass_chapter"
|
||||
},
|
||||
-- {
|
||||
-- title = "添加装备",
|
||||
-- desc = [[添加装备 type:addEquip
|
||||
-- arg1:equipId arg2:数量
|
||||
-- Example: addEquip 10103 2]],
|
||||
-- type = "addEquip"
|
||||
-- },
|
||||
-- {
|
||||
-- title = "设置等级",
|
||||
-- desc = [[清号 type:setLv
|
||||
-- arg1:数量
|
||||
-- Example: setLv 100]],
|
||||
-- type = "setLv"
|
||||
-- },
|
||||
{
|
||||
title = "全装备",
|
||||
desc = [[全装备 type:all_equips
|
||||
Example: all_equips]],
|
||||
type = "all_equips"
|
||||
},
|
||||
{
|
||||
title = "全传家宝",
|
||||
desc = [[全传家宝 type:all_legacies
|
||||
Example: all_legacies]],
|
||||
type = "all_legacies"
|
||||
},
|
||||
{
|
||||
title = "全符文",
|
||||
desc = [[全符文 type:all_runes
|
||||
Example: all_runes]],
|
||||
type = "all_runes"
|
||||
},
|
||||
{
|
||||
title = "每日重置",
|
||||
desc = [[每日重置 type:reset_by_day
|
||||
Example: reset_by_day]],
|
||||
type = "reset_by_day"
|
||||
},
|
||||
{
|
||||
title = "设置时间",
|
||||
desc = [[设置时间 type:time
|
||||
Example: time 2023-3-9 18:10:59]],
|
||||
type = "time"
|
||||
},
|
||||
{
|
||||
title = "重置时间差",
|
||||
desc = [[重置时间差 type:time_diff
|
||||
Example: time_diff 0]],
|
||||
type = "time_diff"
|
||||
},
|
||||
{
|
||||
title = "调整时间差",
|
||||
desc = [[调整时间差 type:add_time_diff
|
||||
Example: add_time_diff 1000]],
|
||||
type = "add_time_diff"
|
||||
},
|
||||
{
|
||||
title = "设置引导任务状态",
|
||||
desc = [[通关 type:task_tutor
|
||||
Example: task_tutor id progress 0]],
|
||||
type = "task_tutor"
|
||||
},
|
||||
{
|
||||
title = "设置任务进度",
|
||||
desc = [[通关 type:trig_event
|
||||
Example: trig_event task_type progress]],
|
||||
type = "trig_event"
|
||||
},
|
||||
{
|
||||
title = "礼包购买",
|
||||
desc = [[通关 type:add_gift 1.mall_act 2.mall_daily 3.mall_treasure
|
||||
Example: add_gift 1 30001]],
|
||||
type = "add_gift"
|
||||
},
|
||||
{
|
||||
title = "新增邮件",
|
||||
desc = [[通关 type:add_mail id
|
||||
Example: add_mail 1]],
|
||||
type = "add_mail"
|
||||
},
|
||||
{
|
||||
title = "新增自定义邮件",
|
||||
desc = [[通关 type:add_cumail title body attachment
|
||||
Example: add_cumail title body attachment]],
|
||||
type = "add_cumail"
|
||||
},
|
||||
}
|
||||
|
||||
return GMConst
|
||||
@ -2,6 +2,7 @@ local ItemConst = {}
|
||||
|
||||
ItemConst.ITEM_ID_GOLD = 1
|
||||
ItemConst.ITEM_ID_GEM = 2
|
||||
ItemConst.ITEM_ID_VIT = 3
|
||||
|
||||
ItemConst.ITEM_TYPE = {
|
||||
RES = 1,
|
||||
|
||||
@ -37,7 +37,6 @@ end
|
||||
|
||||
function LoginManager:goToLoginScene()
|
||||
ModuleManager.BattleManager:clearOnExitScene()
|
||||
NetManager:closeAndClear()
|
||||
UIManager:backToLoginWithoutLogout()
|
||||
DataManager:clear()
|
||||
end
|
||||
|
||||
@ -38,9 +38,6 @@ function LoginUI:onLoadRootComplete()
|
||||
self:refreshServerList(serverList)
|
||||
ModuleManager.LoginManager:saveAuthArgs()
|
||||
ModuleManager.LoginManager:initSocket()
|
||||
|
||||
local info = LocalData:getLastLoginInfo()
|
||||
BIReport:postAccountLoginClick(info.type)
|
||||
end)
|
||||
|
||||
-- first 可以卸载了, 此项目只会启动时检查一次热更,之后不会再次检查
|
||||
|
||||
@ -77,9 +77,6 @@ function TestLoginUI:loginGame()
|
||||
-- ModuleManager.LoginManager:initSocket()
|
||||
ModuleManager.LoginManager:loginGame()
|
||||
|
||||
local info = LocalData:getLastLoginInfo()
|
||||
BIReport:postAccountLoginClick(info.type)
|
||||
|
||||
-- first 可以卸载了, 此项目只会启动时检查一次热更,之后不会再次检查
|
||||
CS.BF.BFMain.Instance.LuaMgr:OnGameInitSucc()
|
||||
LocalData:save()
|
||||
|
||||
@ -285,9 +285,7 @@ function TutorialManager:gmSkipTutorial()
|
||||
end
|
||||
|
||||
-- 强制引导则先跟服务器发送消息再退出
|
||||
-- NetManager:send(ProtoMsgType.FromMsgEnum.SkipGuideReq, {}, function(data)
|
||||
self:stopTutorial()
|
||||
-- end)
|
||||
self:stopTutorial()
|
||||
end
|
||||
|
||||
return TutorialManager
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,10 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc2318d7940bb8e41b78633f73e985e8
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -1,3 +1,11 @@
|
||||
local ServerPlayerData = class("ServerPlayerData", ServerBaseData)
|
||||
|
||||
function ServerPlayerData:setVit(vit)
|
||||
self.vit = tonumber(vit) or 0
|
||||
end
|
||||
|
||||
function ServerPlayerData:getVit()
|
||||
return self.vit or 0
|
||||
end
|
||||
|
||||
return ServerPlayerData
|
||||
@ -6,9 +6,6 @@ function ServerDataManager:init()
|
||||
self.ServerFormationManager = require("app/server/manager/server_formation_manager")
|
||||
end
|
||||
|
||||
function ServerDataManager:saveData()
|
||||
end
|
||||
|
||||
function ServerDataManager:randomReward(weightArr, callback)
|
||||
local maxWeight = 0
|
||||
for i, v in ipairs(weightArr) do
|
||||
@ -61,4 +58,67 @@ ServerDataManager.OP_FUNC = {
|
||||
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.UPDATE_FORMATION] = function (...) ServerDataManager.ServerFormationManager:updateFormation(...) end,
|
||||
}
|
||||
|
||||
function ServerDataManager:dealGM(params, callback)
|
||||
if IS_PUBLISH then
|
||||
return
|
||||
end
|
||||
if not params or not params.args then
|
||||
return
|
||||
end
|
||||
local args = params.args
|
||||
if args[1] == "add_item" then
|
||||
local id = tonumber(args[2])
|
||||
local count = tonumber(args[3])
|
||||
if not id or not count then
|
||||
return
|
||||
end
|
||||
ServerGameData.BagData.ItemData:addItem(id, count)
|
||||
if id == GConst.ItemConst.ITEM_ID_EXP then
|
||||
ServerGameData.PlayerData:addExp(count)
|
||||
end
|
||||
elseif args[1] == "add_items" then
|
||||
local cfg = ConfigManager:getConfig("item")
|
||||
local count = tonumber(args[2])
|
||||
if not count then
|
||||
for k, v in pairs(cfg) do
|
||||
if k == GConst.ItemConst.ITEM_ID_GOLD then
|
||||
ServerGameData.BagData.ItemData:addItem(k, 99999999)
|
||||
else
|
||||
ServerGameData.BagData.ItemData:addItem(k, 2000)
|
||||
end
|
||||
if k == GConst.ItemConst.ITEM_ID_EXP then
|
||||
ServerGameData.PlayerData:addExp(1000)
|
||||
end
|
||||
end
|
||||
else
|
||||
for k, v in pairs(cfg) do
|
||||
ServerGameData.BagData:addItem(k, count)
|
||||
if k == GConst.ItemConst.ITEM_ID_EXP then
|
||||
ServerGameData.PlayerData:addExp(count)
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif args[1] == "del_item" then
|
||||
local id = tonumber(args[2])
|
||||
local count = tonumber(args[3])
|
||||
if not id or not count then
|
||||
return
|
||||
end
|
||||
ServerGameData.BagData.ItemData:addItem(id, -count)
|
||||
if id == GConst.ItemConst.ITEM_ID_EXP then
|
||||
ServerGameData.PlayerData:addExp(-count)
|
||||
end
|
||||
elseif args[1] == "clear_item" then
|
||||
local items = ServerGameData.BagData.ItemData:getAllItems()
|
||||
for k, v in pairs(items) do
|
||||
v.count = 0
|
||||
end
|
||||
end
|
||||
|
||||
ServerGameData:saveData()
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end
|
||||
|
||||
return ServerDataManager
|
||||
@ -229,7 +229,7 @@ function BaseUI:isFullScreen()
|
||||
return true
|
||||
end
|
||||
|
||||
function BaseUI:currencyParams()
|
||||
function BaseUI:getCurrencyParams()
|
||||
return nil, false
|
||||
end
|
||||
|
||||
|
||||
@ -16,69 +16,40 @@ function ResourceCell:init()
|
||||
end
|
||||
|
||||
function ResourceCell:show(itemId, hideAddImg)
|
||||
-- hideAddImg = hideAddImg or false
|
||||
-- self:hide()
|
||||
-- if not itemId then
|
||||
-- return
|
||||
-- end
|
||||
-- self.baseObject:setActive(true)
|
||||
-- self.num = nil
|
||||
hideAddImg = hideAddImg or false
|
||||
self:hide()
|
||||
if not itemId then
|
||||
return
|
||||
end
|
||||
self.baseObject:setActive(true)
|
||||
|
||||
-- local obj = DataManager.BagData.ItemData:getItemById(itemId)
|
||||
-- self.resImg:setSprite(obj:getIconRes())
|
||||
local obj = DataManager.BagData.ItemData:getItemById(itemId)
|
||||
self.resImg:setSprite(obj:getIconRes())
|
||||
|
||||
-- self:unBindAll()
|
||||
-- self:bind(obj, "isDirty", function(binder, value)
|
||||
-- self:refreshTextRightNow()
|
||||
-- end)
|
||||
self:unBindAll()
|
||||
self:bind(obj, "isDirty", function(binder, value)
|
||||
self:refreshTextRightNow()
|
||||
end)
|
||||
|
||||
-- self.baseObject:removeClickListener()
|
||||
self.baseObject:removeClickListener()
|
||||
|
||||
-- self.timeTx:setVisible(false)
|
||||
-- self.itemId = itemId
|
||||
-- if itemId == GConst.ItemConst.ITEM_ID_GEM then
|
||||
-- self.baseObject:addClickListener(function()
|
||||
-- if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.SHOP, true) then
|
||||
-- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, {page = 5, storeIdx = 4})
|
||||
-- end
|
||||
-- end)
|
||||
-- self.addImg:setVisible(not hideAddImg)
|
||||
-- elseif itemId == GConst.ItemConst.ITEM_ID_GOLD then
|
||||
-- if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.SHOP, true) then
|
||||
-- self.baseObject:addClickListener(function()
|
||||
-- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, {page = 5, storeIdx = 2})
|
||||
-- end)
|
||||
-- end
|
||||
-- self.addImg:setVisible(not hideAddImg)
|
||||
-- else
|
||||
-- self.addImg:setVisible(not hideAddImg)
|
||||
-- end
|
||||
-- self:refreshCurrencyAddTx(itemId, nil)
|
||||
end
|
||||
|
||||
function ResourceCell:refreshCurrencyAddTx(itemId, bigNum)
|
||||
-- if self.itemId == itemId then
|
||||
-- if bigNum then
|
||||
-- local obj = DataManager.BagData.ItemData:getItemById(self.itemId)
|
||||
-- if obj:getItemType() == 6 then
|
||||
-- self.addTx:setText("+" .. tostring(BigNumOpt.bigNum2Num(bigNum)))
|
||||
-- else
|
||||
-- self.addTx:setText("+" .. BigNumOpt.bigNum2Str(bigNum))
|
||||
-- end
|
||||
-- else
|
||||
-- self.addTx:setText(nil)
|
||||
-- end
|
||||
-- end
|
||||
self.timeTx:setVisible(false)
|
||||
self.itemId = itemId
|
||||
if itemId == GConst.ItemConst.ITEM_ID_GOLD then
|
||||
self.addImg:setVisible(not hideAddImg)
|
||||
else
|
||||
self.addImg:setVisible(not hideAddImg)
|
||||
end
|
||||
end
|
||||
|
||||
function ResourceCell:updateTime()
|
||||
if self.itemId then
|
||||
--local curTime = DataManager.BagData:getTimelyItemRecoveryTime(self.itemId)
|
||||
--if curTime <= 0 then
|
||||
-- self.timeTx:setText("")
|
||||
--else
|
||||
-- self.timeTx:setText(GFunc.getTimeStrWithMS(curTime))
|
||||
--end
|
||||
local curTime = DataManager.BagData:getTimelyItemRecoveryTime(self.itemId)
|
||||
if curTime <= 0 then
|
||||
self.timeTx:setText(GConst.EMPTY_STRING)
|
||||
else
|
||||
self.timeTx:setText(GFunc.getTimeStrWithMS(curTime))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -95,18 +66,18 @@ function ResourceCell:getAnchoredPosition()
|
||||
end
|
||||
|
||||
function ResourceCell:refreshTextRightNow()
|
||||
-- if not self.itemId then
|
||||
-- return
|
||||
-- end
|
||||
-- local obj = DataManager.BagData.ItemData:getItemById(self.itemId)
|
||||
-- local bigNum = obj:getBigNum()
|
||||
-- if bigNum.value < 0 then
|
||||
-- self.numTx:setText(0)
|
||||
-- elseif obj:getItemType() == 6 then
|
||||
-- self.numTx:setText(BigNumOpt.bigNum2Num(bigNum))
|
||||
-- else
|
||||
-- self.numTx:setText(BigNumOpt.bigNum2Str(bigNum))
|
||||
-- end
|
||||
if not self.itemId then
|
||||
return
|
||||
end
|
||||
local obj = DataManager.BagData.ItemData:getItemById(self.itemId)
|
||||
local count = obj:getNum()
|
||||
if count < 0 then
|
||||
self.numTx:setText("0")
|
||||
elseif obj:getItemType() == GConst.ItemConst.ITEM_ID_VIT then
|
||||
self.numTx:setText(GFunc.num2Str(count) .. "/" .. DataManager.PlayerData:getMaxVit())
|
||||
else
|
||||
self.numTx:setText(GFunc.num2Str(count))
|
||||
end
|
||||
end
|
||||
|
||||
function ResourceCell:refreshText()
|
||||
@ -114,7 +85,7 @@ function ResourceCell:refreshText()
|
||||
return
|
||||
end
|
||||
local text = self.numTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).text
|
||||
self.numTx:setText("")
|
||||
self.numTx:setText(GConst.EMPTY_STRING)
|
||||
self.numTx:setText(text)
|
||||
end
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@ local CurrencyBar = class("CurrencyBar", Component)
|
||||
CurrencyBar.cellWidth = 174
|
||||
CurrencyBar.cellHeight = 40
|
||||
|
||||
local OFFSET_X = 200 -- -27
|
||||
local OFFSET_X = -27
|
||||
local OFFSET_Y = -22
|
||||
|
||||
function CurrencyBar:init()
|
||||
@ -97,14 +97,14 @@ function CurrencyBar:showSort()
|
||||
return
|
||||
end
|
||||
local w, h = GFunc.getUIExpandScreenSize()
|
||||
-- local offset = (w - 720) / 2
|
||||
local offset = 0
|
||||
local offset = (w - 720) / 2
|
||||
if offset <= 0 then
|
||||
offset = 0
|
||||
end
|
||||
if self.params.showType == GConst.CURRENCY_TYPE.HORIZONTAL then
|
||||
for i,v in ipairs(self.params.itemIds) do
|
||||
self.currencyList[i]:setAnchoredPosition(OFFSET_X + (i - 1)*self.cellWidth + self.offsetX - offset, OFFSET_Y + self.offsetY)
|
||||
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)
|
||||
end
|
||||
else
|
||||
for i,v in ipairs(self.params.itemIds) do
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
local DevToolManager = require "app/module/gm/dev_tool_manager"
|
||||
local GMConst = require "app/module/gm/gm_const"
|
||||
-- local ItemConst = require "app/module/item/item_const"
|
||||
local GMToolUI = class("GMToolUI",BaseUI)
|
||||
|
||||
function GMToolUI:ctor()
|
||||
@ -23,16 +21,10 @@ function GMToolUI:onRefresh()
|
||||
local titleTx = self.uiMap['gm_tool_ui.title']
|
||||
local okBtn = self.uiMap['gm_tool_ui.ok_btn']
|
||||
local okBtnText = self.uiMap['gm_tool_ui.ok_btn.text']
|
||||
local helpBtn = self.uiMap['gm_tool_ui.help_btn']
|
||||
local inputField = self.uiMap['gm_tool_ui.InputField']
|
||||
local inputFieldText = self.uiMap['gm_tool_ui.InputField.text']
|
||||
local scrollView = self.uiMap['gm_tool_ui.ScrollView']
|
||||
local textTip = self.uiMap['gm_tool_ui.text_tip']
|
||||
local speedUpBtn = self.uiMap["gm_tool_ui.speed_up_btn"]
|
||||
local attrBtn = self.uiMap["gm_tool_ui.attr_btn"]
|
||||
local attrBtnTx = self.uiMap["gm_tool_ui.attr_btn.text"]
|
||||
local heroListNode = self.uiMap["gm_tool_ui.hero_list_node"]
|
||||
self.heroListNode = heroListNode
|
||||
|
||||
self.uiMap['gm_tool_ui.close_btn']:addClickListener(function() self:closeUI() end)
|
||||
self.scrollRect = scrollView:getLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
@ -50,7 +42,6 @@ function GMToolUI:onRefresh()
|
||||
self.inputField = inputField
|
||||
titleTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "GM面板"
|
||||
okBtnText:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "确定"
|
||||
attrBtnTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "英雄属性"
|
||||
|
||||
|
||||
okBtn:addClickListener(function()
|
||||
@ -73,20 +64,6 @@ function GMToolUI:onRefresh()
|
||||
CS.UnityEngine.Time.timeScale = timeScale
|
||||
end)
|
||||
|
||||
attrBtn:addClickListener(function()
|
||||
local allAttr = DataManager.HeroData:getMainHeroEntity():getAllAttr()
|
||||
local allAttr1 = {}
|
||||
local cfg = ConfigManager:getConfig("attr")
|
||||
for i = 1, #cfg do
|
||||
allAttr1[i] = {unit = allAttr[i].unit, value = allAttr[i].value}
|
||||
end
|
||||
Logger.logHighlight("============================ hero attr")
|
||||
Logger.printTable(allAttr1)
|
||||
Logger.logHighlight("============================ hero attr")
|
||||
local str = json.encode(allAttr1)
|
||||
ModuleManager.TipsManager:showHelpTips({desc = str})
|
||||
end)
|
||||
|
||||
self.uiMap["gm_tool_ui.fps_btn"]:addClickListener(function()
|
||||
local comp = UIManager.uiRoot:getComponent(typeof(CS.BF.ShowFPS))
|
||||
if comp == nil then
|
||||
@ -95,10 +72,6 @@ function GMToolUI:onRefresh()
|
||||
comp.enabled = not comp.enabled
|
||||
end
|
||||
end)
|
||||
|
||||
heroListNode:addClickListener(function()
|
||||
heroListNode:setActive(false)
|
||||
end)
|
||||
end
|
||||
|
||||
function GMToolUI:initScrollRectCell(index, cell)
|
||||
@ -116,75 +89,15 @@ function GMToolUI:sendMsg(gmCommand)
|
||||
else
|
||||
local args = {}
|
||||
args.args = string.split(gmCommand, " ")
|
||||
if args.args[1] == "time" then -- 特殊处理
|
||||
local args1 = {}
|
||||
args1.args = {}
|
||||
args1.args[1] = args.args[1]
|
||||
args1.args[2] = args.args[2] .. " " .. args.args[3]
|
||||
ModuleManager.DevToolManager:dealGM(args1)
|
||||
else
|
||||
ModuleManager.DevToolManager:dealGM(args)
|
||||
end
|
||||
ServerDataManager:dealGM(args, function()
|
||||
ServerDataManager:dataOperate(GConst.ServerDataConst.DATA_OP_BEHAVIOR.SYNC_DATA, GConst.EMPTY_TABLE, function(msgData)
|
||||
DataManager:initWithServerData(msgData)
|
||||
ModuleManager.MaincityManager:firstEnterMainCity()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function GMToolUI:initHeroScrollRect(index, cell)
|
||||
self.heroList = {}
|
||||
-- local HeroConst = require "app/module/hero/hero_const"
|
||||
for hid, entity in pairs(DataManager.HeroData:getAllHero()) do
|
||||
local star = entity:getStar()
|
||||
local qlt = entity:getQuality()
|
||||
local group = entity:getGroup()
|
||||
local lv = entity:getLv()
|
||||
local heroId = entity:getId()
|
||||
local sort = 0
|
||||
sort = heroId + group*10000000 + qlt*100000000 + star*1000000000 + lv*10000000000
|
||||
-- if self.filterType == HeroConst.FILTER_TYPE.ALL then
|
||||
-- sort = heroId + group*10000000 + qlt*100000000 + star*1000000000 + lv*10000000000
|
||||
-- elseif self.filterType == HeroConst.FILTER_TYPE.STAR then
|
||||
-- sort = heroId + group*10000000 + qlt*100000000 + lv*1000000000 + star*100000000000
|
||||
-- elseif self.filterType == HeroConst.FILTER_TYPE.LV then
|
||||
-- sort = heroId + group*10000000 + qlt*100000000 + star*1000000000 + lv*10000000000
|
||||
-- elseif self.filterType == HeroConst.FILTER_TYPE.QLT then
|
||||
-- sort = heroId + group*10000000 + star*100000000 + lv*1000000000 + qlt*100000000000
|
||||
-- elseif self.filterType == HeroConst.FILTER_TYPE.GROUP then
|
||||
-- sort = heroId + qlt*10000000 + star*100000000 + lv*1000000000 + group*100000000000
|
||||
-- elseif self.filterType == HeroConst.FILTER_TYPE.USED then
|
||||
-- end
|
||||
table.insert(self.heroList, {
|
||||
heroData = entity,
|
||||
sort = sort
|
||||
})
|
||||
end
|
||||
table.sort(self.heroList, function (a, b)
|
||||
return a.sort > b.sort
|
||||
end)
|
||||
if self.heroScrollRect then
|
||||
self.heroScrollRect:refillCells(#self.heroList)
|
||||
return
|
||||
end
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.heroScrollRect = uiMap["gm_tool_ui.hero_list_node.ScrollView (1)"]:getLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
self.heroScrollRect:clearCells()
|
||||
self.heroScrollRect:setFadeArgs(0, 0.3)
|
||||
self.heroScrollRect:addInitCallback(function()
|
||||
return GConst.TYPEOF_LUA_CLASS.HERO_CELL
|
||||
end)
|
||||
self.heroScrollRect:addRefreshCallback(function(index, cell)
|
||||
self:refreshHeroCell(cell, self.heroList[index].heroData)
|
||||
end)
|
||||
self.heroScrollRect:refillCells(#self.heroList)
|
||||
end
|
||||
|
||||
function GMToolUI:refreshHeroCell(cell, heroData)
|
||||
cell:refresh(heroData)
|
||||
cell:addClickListener(function()
|
||||
self.textTip:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT).text = "英雄升级 (会清空当前经验) \n arg1:英雄唯一ID arg2 目标等级"
|
||||
self.inputField:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_INPUT_FIELD).text = string.format("%s %s ", "hero_upgrade", heroData:getHid())
|
||||
self.heroListNode:setActive(false)
|
||||
end)
|
||||
end
|
||||
|
||||
function GMToolUI:updateTime()
|
||||
local uiMap = self.root:genAllChildren()
|
||||
uiMap["gm_tool_ui.time"]:setText(Time:formatTimeYMDHMS(Time:getServerTime()))
|
||||
|
||||
@ -21,49 +21,25 @@ function MainCityUI:getUIType()
|
||||
return UIManager.UI_TYPE.MAIN
|
||||
end
|
||||
|
||||
function MainCityUI:currencyParams()
|
||||
if self.cheat then
|
||||
local params = {}
|
||||
params.itemIds = {}
|
||||
return params
|
||||
end
|
||||
function MainCityUI:getCurrencyParams()
|
||||
if self.currencyParams == nil then
|
||||
self.currencyParams = {
|
||||
itemIds = {}
|
||||
}
|
||||
end
|
||||
self.selectedIndex = self.selectedIndex or MAIN_COMP_INDEX
|
||||
local params = {}
|
||||
params.showType = GConst.CURRENCY_TYPE.HORIZONTAL
|
||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.COMMERCE then
|
||||
params.itemIds = {
|
||||
GConst.ItemConst.ITEM_ID_GOLD,
|
||||
GConst.ItemConst.ITEM_ID_GEM,
|
||||
GConst.ItemConst.ITEM_ID_VIT,
|
||||
}
|
||||
elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.EQUIP then
|
||||
params.itemIds = {
|
||||
GConst.ItemConst.ITEM_ID_GOLD,
|
||||
GConst.ItemConst.ITEM_ID_GEM,
|
||||
GConst.ItemConst.ITEM_ID_VIT,
|
||||
}
|
||||
elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
|
||||
params.itemIds = {
|
||||
GConst.ItemConst.ITEM_ID_GOLD,
|
||||
GConst.ItemConst.ITEM_ID_GEM,
|
||||
GConst.ItemConst.ITEM_ID_VIT,
|
||||
}
|
||||
elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.TALENT then
|
||||
params.itemIds = {
|
||||
GConst.ItemConst.ITEM_ID_GOLD,
|
||||
GConst.ItemConst.ITEM_ID_GEM,
|
||||
GConst.ItemConst.ITEM_ID_TALENT_ID,
|
||||
}
|
||||
elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.CHALLENGE then
|
||||
params.itemIds = {
|
||||
GConst.ItemConst.ITEM_ID_GOLD,
|
||||
GConst.ItemConst.ITEM_ID_GEM,
|
||||
GConst.ItemConst.ITEM_ID_VIT,
|
||||
}
|
||||
self.currencyParams.showType = GConst.CURRENCY_TYPE.HORIZONTAL
|
||||
for k, v in ipairs(self.currencyParams.itemIds) do
|
||||
table.remove(self.currencyParams.itemIds)
|
||||
end
|
||||
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
|
||||
self.currencyParams.itemIds[1] = GConst.ItemConst.ITEM_ID_VIT
|
||||
self.currencyParams.itemIds[2] = GConst.ItemConst.ITEM_ID_GOLD
|
||||
elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then
|
||||
return nil
|
||||
end
|
||||
return params, true
|
||||
end
|
||||
|
||||
return self.currencyParams
|
||||
end
|
||||
|
||||
function MainCityUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/main_city/main_ui.prefab"
|
||||
|
||||
@ -991,37 +991,6 @@ function UIManager:backToLoginWithoutLogout()
|
||||
Game:showLoginUI()
|
||||
end
|
||||
|
||||
-- 掉线提示处理
|
||||
function UIManager:showKickOut(msgData)
|
||||
local content
|
||||
local reason = NetManager:getKickOutReasonEnum(msgData.reason)
|
||||
if reason == 0 then -- 服务器维护
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.MAINTAIN)
|
||||
elseif reason == 1 then -- 网络消息流控,也就是短时间内通信次数太多
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.DISCONNECT_RELOGIN)
|
||||
elseif reason == 2 then -- 封号
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.FORBIDDEN)
|
||||
elseif reason == 3 then -- 多点登录
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.OTHER_LOGIN)
|
||||
else
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.DISCONNECT_RELOGIN)
|
||||
end
|
||||
self.disconnectMsgBoxVisible = true
|
||||
-- 被踢了的话就先断开连接再弹确认框
|
||||
NetManager:closeAndClear()
|
||||
local params = {
|
||||
content = content,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
okFunc = function()
|
||||
self.disconnectMsgBoxVisible = false
|
||||
ModuleManager.LoginManager:goToLoginScene()
|
||||
end,
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||||
top = true,
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
end
|
||||
|
||||
-- 掉线提示处理
|
||||
function UIManager:showDisconnect()
|
||||
self.disconnectMsgBoxVisible = true
|
||||
@ -1056,7 +1025,7 @@ function UIManager:_loadCurrencyBar(params, showBg, hidAddImg)
|
||||
end
|
||||
|
||||
function UIManager:showCurrencyBar(uiObj)
|
||||
local params, showBg, hidAddImg = uiObj:currencyParams()
|
||||
local params, showBg, hidAddImg = uiObj:getCurrencyParams()
|
||||
if params then
|
||||
local currCurrencyBarOrder = 0
|
||||
if self.currencyBarBindUI then
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
local ItemEntity = class("ItemEntity", BaseData)
|
||||
|
||||
function ItemEntity:ctor(id, bigNum)
|
||||
function ItemEntity:ctor(id, num)
|
||||
self.data.id = id
|
||||
self.data.bigNum = bigNum
|
||||
self.data.num = num
|
||||
self.data.isDirty = false
|
||||
self.config = nil
|
||||
|
||||
@ -30,19 +30,19 @@ function ItemEntity:getId()
|
||||
end
|
||||
|
||||
-- 道具数量
|
||||
function ItemEntity:getBigNum()
|
||||
return self.data.bigNum
|
||||
function ItemEntity:getNum()
|
||||
return self.data.num
|
||||
end
|
||||
|
||||
-- 加减道具数量
|
||||
function ItemEntity:addNum(num)
|
||||
self.data.bigNum = BigNumOpt.bigNumAdd(self.data.bigNum, bigNum)
|
||||
self.data.num = self.data.num + num
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
-- 设置数量
|
||||
function ItemEntity:setNum(bigNum)
|
||||
self.data.bigNum = bigNum
|
||||
function ItemEntity:setNum(num)
|
||||
self.data.num = num
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
@ -66,7 +66,7 @@ function ItemEntity:getFrameRes()
|
||||
end
|
||||
|
||||
function ItemEntity:getIconRes()
|
||||
return GConst.ATLAS_PATH.ICON_ITEM, tostring(self.config.icon)
|
||||
return GConst.ATLAS_PATH.ICON_ITEM, self.config.icon
|
||||
end
|
||||
|
||||
-- 类型
|
||||
|
||||
@ -3,4 +3,12 @@ local PlayerData = class("PlayerData", BaseData)
|
||||
function PlayerData:init(data)
|
||||
end
|
||||
|
||||
|
||||
function PlayerData:getMaxVit()
|
||||
if self.maxVit == nil then
|
||||
self.maxVit = ConfigManager:getConfig("recovery")[GConst.ItemConst.ITEM_ID_VIT].limit
|
||||
end
|
||||
return self.maxVit
|
||||
end
|
||||
|
||||
return PlayerData
|
||||
Loading…
x
Reference in New Issue
Block a user