【资源和谐】后台控制完成

dev_chengFeng
gaoxin 2021-11-09 10:49:37 +08:00
parent 964f45b245
commit 3131ffca2f
9 changed files with 79 additions and 41 deletions

View File

@ -40,7 +40,7 @@ TextureImporter:
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0

View File

@ -11,6 +11,7 @@ local ManagerNames = {
"Setting/SettingManager",
--通信管理,所有的通信接口
"Net/NetManager",
"Net/HttpManager",
--推送管理,所有的推送接口
"Net/IndicationManager",
--登录数据管理

View File

@ -121,7 +121,7 @@ GameDataBase.SheetLineBase.__index = function(t,k)
local val = t.val[index]
-- *************************
-- 提审服部分资源替换,特殊处理
if SERVER_VERSION == 1 then
if LoginManager and LoginManager.IsShield then
if (val == "live2d_c_0038" and t.val[1] == 2004)
or (val == "live2d_c_0043" and t.val[1] == 2008)
or (val == "live2d_c_0023" and t.val[1] == 2066)

View File

@ -1053,7 +1053,7 @@ function this.RequestBattleDataByFightId(serverUrl, fightId, func)
local uid = string.split(fightId, "_")[1]
local requestUrl = string.format("http://%s/req/getFightRecord?uid=%s&fightid=%s", serverUrl, uid, fightId)
LogGreen(requestUrl)
LoginManager:SendGetHttp(requestUrl, function(str)
HttpManager:SendGetHttp(requestUrl, function(str)
--LogGreen(str)
local json = require 'cjson'
local data = json.decode(str)

View File

@ -61,7 +61,7 @@ function this.DOGetBindPhone(type, phoneNumber, code)
local sign = Util.MD5Encrypt(string.format("%s%s%s%s%s%s", pid,
gid, type, phoneNumber, time, signKey))
local code = code and code or ""
LoginManager:SendGetHttp(string.format("%s?pid=%s&gid=%s&token=%s&type=%s&phone=%s&code=%s&time=%s&sign=%s",
HttpManager:SendGetHttp(string.format("%s?pid=%s&gid=%s&token=%s&type=%s&phone=%s&code=%s&time=%s&sign=%s",
GetBindUrl, pid, gid, token, type, phoneNumber, code, time, sign), this.OnCodeResult, nil, nil, nil)
end

View File

@ -94,8 +94,8 @@ function this.Initialize()
-- 发送登出事件
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLogout)
end
end
--
local _Time
function this.CheckRealName()
local appId = PackageManager.GetAppID()
@ -173,7 +173,7 @@ function this.RequestRegist(name, pw, call)
pw, this.sign))
RequestPanel.Show(Language[11132])
this:SendGetHttp(LoginRoot_Url .. "jl_loginserver/registerUser?userName=".. name .. "&password=".. pw .."&repeat=".. pw .. "&sign=" .. sign,
HttpManager:SendGetHttp(LoginRoot_Url .. "jl_loginserver/registerUser?userName=".. name .. "&password=".. pw .."&repeat=".. pw .. "&sign=" .. sign,
function(str)
RequestPanel.Hide()
if str == nil then
@ -199,7 +199,7 @@ function this.RequestUser(name, pw, call)
pw, this.sign))
RequestPanel.Show(Language[11134])
this:SendGetHttp(LoginRoot_Url .. "jl_loginserver/userLogin?userName=".. name .. "&password=".. pw .. "&sign=" .. sign, function(str)
HttpManager:SendGetHttp(LoginRoot_Url .. "jl_loginserver/userLogin?userName=".. name .. "&password=".. pw .. "&sign=" .. sign, function(str)
RequestPanel.Hide()
if str == nil then
return
@ -228,29 +228,6 @@ function this.RequestUser(name, pw, call)
end,nil,nil,nil)
end
require("Base.HttpCrypt")
local CRYPT_KEY = "d53b3e8ef74bf72d8aafce3a1c8671a0"
function this:SendGetHttp(url, callback, _, _, failCB)
local request = url
LogGreen("Http请求"..request)
if AppConst.Platform == "IOS" then
local urlList = string.split(url, "?")
urlList[2] = HTTP_ENCRYPT(urlList[2], CRYPT_KEY)
request = urlList[1] .. "?crypt=" .. urlList[2]
LogGreen("Http加密请求"..request)
end
networkMgr:SendGetHttp(request, function(msg)
LogGreen("Http请求结果"..msg)
if AppConst.Platform == "IOS" then
msg = HTTP_DECRYPT(msg, CRYPT_KEY)
LogGreen("Http请求结果解密"..msg)
end
if callback then
callback(msg)
end
end, nil, nil, failCB)
end
-- 判断服务器状态是否可进入
function this.IsServerStateEnterable(state)
if not state then
@ -264,4 +241,28 @@ function this.IsServerStateEnterable(state)
return true
end
-- 初始化包信息
function this.InitPackInfo()
local LoginRoot_Url = ServerConfigManager.GetVersionInfo("serverUrl")
local LoginRoot_Channel = ServerConfigManager.GetVersionInfo("channel")
local LoginRoot_UserChannel = ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.USER_CHANNEL) or ""
local ChannelID = LoginRoot_UserChannel == "" and LoginRoot_Channel or LoginRoot_UserChannel
local packId = PackageManager.GetPackageID()
if packId then
ChannelID = ChannelID.. packId
end
HttpManager:SendGetHttp(LoginRoot_Url.."jl_loginserver/getChannelInfo?ccId="..ChannelID, function(str)
if str == "" or str == "null" or string.find(str, "html") then
LogWarn("获取到的数据是空值,请检查!")
else
local json = require 'cjson'
local context = json.decode(str)
this.IsShield = context.shielding == 1
end
end)
end
return this

View File

@ -318,6 +318,8 @@ function this:OnOpen(...)
local offsetX = (GetPreferredWidth(tran) + Screen.width) / 2
tran.anchoredPosition = Vector2.New(offsetX, 0)
tran:DOAnchorPosX(-offsetX, 30, false):SetEase(Ease.Linear):SetLoops(-1)
-- 初始化一些数据
LoginManager.InitPackInfo()
SoundManager.PlayMusic(SoundConfig.BGM_Login)
SoundManager.PlayAmbient(SoundConfig.Ambient_Login)
@ -362,8 +364,7 @@ function this.ShowNotice()
end
end
local url = LoginRoot_Url .. "jl_loginserver/getNotice?timestamp="..timeStamp.."&sign=".. timeSign.."&packageName="..noticeChannel
Log(url)
LoginManager:SendGetHttp(url,function (str)
HttpManager:SendGetHttp(url,function (str)
UIManager.OpenPanel(UIName.NoticePopup,str)
end, nil, nil, nil)
end
@ -376,9 +377,7 @@ function this.RequestServerVersion(func)
ChannelID = ChannelID.. packId
end
local url = LoginRoot_Url .. "jl_loginserver/getServerVersion?serverVersion="..ChannelID
LogPink(url)
LoginManager:SendGetHttp(url, function (str)
LogPink(str)
HttpManager:SendGetHttp(url, function (str)
if str == "" or str == "null" or string.find(str, "html") then
LogWarn("获取到的ServerVersion数据是空值请检查")
else
@ -415,8 +414,7 @@ function this.RequestServerList(userId, callback)
local url = string.format(
"%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s&server_version=%s",
LoginRoot_Url, userId, LoginRoot_Channel, LoginRoot_SubChannel, SERVER_VERSION)
Log(url)
LoginManager:SendGetHttp(url, callback, nil, nil, nil)
HttpManager:SendGetHttp(url, callback, nil, nil, nil)
end)
--用户协议,隐私政策
@ -440,8 +438,7 @@ function this.RequestProtos(userId)
ChannelID = ChannelID .. PackageID
end
local url = LoginRoot_Url.."jl_loginserver/getAgreement?gamePack="..ChannelID
Log(url)
LoginManager:SendGetHttp(url, function (str)
HttpManager:SendGetHttp(url, function (str)
local json = require 'cjson'
local data = json.decode(str)
if data.parms then
@ -833,8 +830,7 @@ function this.RequestHttpLogin()
end
end
Log(url)
LoginManager:SendGetHttp(url, this.OnReceiveLogin, nil, nil, nil)
HttpManager:SendGetHttp(url, this.OnReceiveLogin, nil, nil, nil)
end
--用户id登录

View File

@ -0,0 +1,33 @@
require("Base.HttpCrypt")
HttpManager = {}
-- 加密密钥
local CRYPT_KEY = "d53b3e8ef74bf72d8aafce3a1c8671a0"
-- 是否要加密
local isCrypt = AppConst.Platform == "IOS" --or AppConst.Platform == "EDITOR"
-- 计数器
local _Counter = 0
-- GET 请求
function HttpManager:SendGetHttp(url, callback, _, _, failCB)
local request = url
_Counter = _Counter + 1
local count = _Counter
LogWarn("Http请求" .. count.. ""..request)
if isCrypt then
local urlList = string.split(url, "?")
urlList[2] = HTTP_ENCRYPT(urlList[2], CRYPT_KEY)
request = urlList[1] .. "?crypt=" .. urlList[2]
LogWarn("Http加密请求" .. count.. ""..request)
end
networkMgr:SendGetHttp(request, function(msg)
LogWarn("Http请求" .. count.. "结果:"..msg)
if isCrypt then
msg = HTTP_DECRYPT(msg, CRYPT_KEY)
LogWarn("Http请求" .. count.. "结果解密:"..msg)
end
if callback then
callback(msg)
end
end, nil, nil, failCB)
end
return HttpManager

View File

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