diff --git a/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua b/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua index 64c6e8f713..4cde180de5 100644 --- a/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua +++ b/Assets/ManagedResources/~Lua/Framework/Manager/PackageManager.lua @@ -145,4 +145,24 @@ end function PackageManager.GetCCCode() return ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.PACKAGE_CC_CODE) or "" +end + +-- 获取APPID +local AppIDConfig = { + ["com.tcxsw.project"] = "6a7c5e329e565fbecb9761f4ebdff709", + ["com.tcxkf.project"] = "6a7c5e329e565fbecb9761f4ebdff709", + ["com.tcxxqcs.project"] = "6a7c5e329e565fbecb9761f4ebdff709", + ["com.tcxxq.project"] = "2c3239afdb0c14631e8ad97b35e289d9", + ["com.tcx.project"] = "4bffbf7342f2bbb161734e7b3fe30ffe", + ["com.tcxzb.project"] = "4bffbf7342f2bbb161734e7b3fe30ffe", + ["com.tcxttml.project"] = "2cf98795b423de90af647d369efd3419", + ["com.tcxcsb.project"] = "2806a89515659caecc964d727dbd49c8", + ["com.tcxcn.test"] = "a3ad5f4090d59aecc42332088987f83b", + ["com.tcxcn.project"] = "a3ad5f4090d59aecc42332088987f83b", + ["com.tcxqd.project"] = "d4263a2ed36fd2b34ab8fa23e1f95dea", +} +function PackageManager.GetAppID() + if AppIDConfig[this.PackageName] then + return AppIDConfig[this.PackageName] + end end \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua b/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua index 05db15a482..1afd6bd279 100644 --- a/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua @@ -63,6 +63,8 @@ function this.Initialize() Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1]) end) end + -- 防沉迷检测 + this.CheckRealName() else local errCode = result[2] if not errCode then @@ -92,8 +94,46 @@ function this.Initialize() -- 发送登出事件 Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLogout) end -end +end +local _Time +function this.CheckRealName() + local appId = PackageManager.GetAppID() + if appId then + local url = "http://identity.tyu89.wang/cp/nppa/loop" + local jsonData = string.format("appId;%s;userId;%s", appId, AppConst.OpenId) + networkMgr:SendHttpPost_Json_Lua(url, jsonData, function(msg) + local json = require 'cjson' + local context = json.decode(msg) + if context and context.code == 200 then + if context.data.allowPlay then + if context.data.needLoop then + -- 每隔60秒请求一次 + if _Time then + _Time:Stop() + end + _Time = Timer.New(this.CheckRealName, 60) + _Time:Start() + end + else + if context.data.allowRemind then + MsgPanel.ShowOne(context.data.remindMessage, function() + if _Time then + _Time:Stop() + end + Game.Restart() + end) + else + if _Time then + _Time:Stop() + end + Game.Restart() + end + end + end + end, nil) + end +end -- 检测是否是新账户 function this.CheckIsRegister(openId, func) if func then diff --git a/Assets/Scripts/Editor/GameEditor/FrameTool/BuildWindow.cs b/Assets/Scripts/Editor/GameEditor/FrameTool/BuildWindow.cs index a547ab6f6c..234d150246 100644 --- a/Assets/Scripts/Editor/GameEditor/FrameTool/BuildWindow.cs +++ b/Assets/Scripts/Editor/GameEditor/FrameTool/BuildWindow.cs @@ -257,7 +257,7 @@ namespace GameEditor.FrameTool { static string versionPath = Application.dataPath + "/../Version"; static string editorVersion = Application.dataPath + "/../AssetBundles";// + AppConst.GameVersionFile; //static string persistVersion = Application.dataPath + "/Resources/version.txt"; - static string streamVersion = AppConst.StreamPath + AppConst.GameVersionFile; + static string streamVersion = AppConst.StreamPath; static VersionTxt m_VersionTxt; // 热更版本 @@ -311,6 +311,7 @@ namespace GameEditor.FrameTool { // 保存到version private static void SaveToVersion(string path, string json) { + path += "/" + AppConst.GameVersionFile; if (!string.IsNullOrEmpty(path) && File.Exists(path)) { File.WriteAllText(path, json);