Merge branch '0功能/用户协议' into china/quick

# Conflicts:
#	Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua
dev_chengFeng
JieLing 2021-06-30 09:35:51 +08:00
commit 9a3c8508c4
7 changed files with 1075 additions and 15 deletions

View File

@ -23,6 +23,7 @@ namespace SDK
public virtual void CustomEvent(string events,string desc, string type) { } public virtual void CustomEvent(string events,string desc, string type) { }
public virtual void NewRoleTutorial(string eventName, string guide_start_time, string guide_end_time, string serverId, string serverName, string roleName, string roleId) { } public virtual void NewRoleTutorial(string eventName, string guide_start_time, string guide_end_time, string serverId, string serverName, string roleName, string roleId) { }
public virtual void OpenWeb(string url) { }
} }
} }

View File

@ -17,6 +17,8 @@ namespace SDK
public AndroidProxy() public AndroidProxy()
{ {
Debug.Log("AndroidProxy INit");
var player = new AndroidJavaClass(CLS_UNITY_PLAYER); var player = new AndroidJavaClass(CLS_UNITY_PLAYER);
currentActivity = player.GetStatic<AndroidJavaObject>("currentActivity"); currentActivity = player.GetStatic<AndroidJavaObject>("currentActivity");
} }
@ -102,6 +104,11 @@ namespace SDK
{ {
return currentActivity.Call<string>("GetOrderID"); return currentActivity.Call<string>("GetOrderID");
} }
//打开用户协议
public override void OpenWeb(string url)
{
currentActivity.Call("OpenWeb", url);
}
//SDK截屏 //SDK截屏

View File

@ -157,7 +157,11 @@ namespace SDK
{ {
return proxy.GetPayOrderID(); return proxy.GetPayOrderID();
} }
//打开用户协议
public void OpenWeb(string url)
{
proxy.OpenWeb(url);
}
public void CaptureShot() public void CaptureShot()
{ {
proxy.ShotCapture(); proxy.ShotCapture();

File diff suppressed because it is too large Load Diff

View File

@ -112,12 +112,12 @@ function PackageManager.SetVideo(obj, bg)
obj:SetActive(true) obj:SetActive(true)
end end
else else
LogError("视频加载失败:"..this.config.VideoName) Log("视频加载失败:"..this.config.VideoName)
end end
end) end)
end end
else else
LogError("包名:"..tostring(this.config.PackageName).."登录视频为空!") Log("包名:"..tostring(this.config.PackageName).."登录视频为空!")
end end
end end
end end

View File

@ -26,6 +26,9 @@ local orginLayer
local timeStamp = Time.realtimeSinceStartup local timeStamp = Time.realtimeSinceStartup
local timeSign = Util.MD5Encrypt(string.format("%s%s", timeStamp, LoginManager.sign)) local timeSign = Util.MD5Encrypt(string.format("%s%s", timeStamp, LoginManager.sign))
local UrlList = {}
local HaveConfirm = false
--初始化组件(用于子类重写) --初始化组件(用于子类重写)
function this:InitComponent() function this:InitComponent()
this.spLoader = SpriteLoader.New() this.spLoader = SpriteLoader.New()
@ -89,7 +92,7 @@ function this:InitComponent()
this.healthTip:SetActive(IS_SHOW_HEALTH_TIP) this.healthTip:SetActive(IS_SHOW_HEALTH_TIP)
this.bh = Util.GetGameObject(this.gameObject, "healthTip/bh"):GetComponent("Text") this.bh = Util.GetGameObject(this.gameObject, "healthTip/bh"):GetComponent("Text")
local bhContent = PackageManager.GetBHContent() local bhContent = PackageManager.GetBHContent()
LogError(tostring(bhContent)) -- LogError(tostring(bhContent))
if bhContent then if bhContent then
this.bh.text = bhContent this.bh.text = bhContent
else else
@ -97,6 +100,13 @@ function this:InitComponent()
end end
this.video = Util.GetGameObject(this.gameObject, "VideoPlayer") this.video = Util.GetGameObject(this.gameObject, "VideoPlayer")
--用户隐私协议
this.protos = Util.GetGameObject(this.gameObject, "protos")
this.instructionsBtn = Util.GetGameObject(this.gameObject, "protos/instructionsBtn")
this.privacyBtn = Util.GetGameObject(this.gameObject, "protos/privacyBtn")
this.ConfirmBtn = Util.GetGameObject(this.gameObject, "protos/Confirm")
this.ConfirmImg = Util.GetGameObject(this.ConfirmBtn, "gou")
end end
--绑定事件(用于子类重写) --绑定事件(用于子类重写)
@ -156,6 +166,24 @@ function this:BindEvent()
this.SDKLogin() this.SDKLogin()
end) end)
--用户隐私协议
Util.AddClick(this.instructionsBtn, function()
SDKMgr:OpenWeb(UrlList[1])
end)
Util.AddClick(this.privacyBtn, function()
SDKMgr:OpenWeb(UrlList[2])
end)
Util.AddClick(this.ConfirmBtn, function()
local confirm = PlayerPrefs.GetInt("IHaveConfirmProtos")
if confirm == 0 then
this.ConfirmImg:SetActive(true)
PlayerPrefs.SetInt("IHaveConfirmProtos",1)
elseif confirm == 1 then
this.ConfirmImg:SetActive(false)
PlayerPrefs.SetInt("IHaveConfirmProtos",0)
end
end)
end end
-- sdk 初始化完成回调 -- sdk 初始化完成回调
@ -255,7 +283,7 @@ function this:OnOpen(...)
-- 获取服务器列表 -- 获取服务器列表
this.RequestServerList(userId, this.OnReceiveServerList) this.RequestServerList(userId, this.OnReceiveServerList)
end end
local tran = this.tip:GetComponent("RectTransform") local tran = this.tip:GetComponent("RectTransform")
--LayoutUtility.GetPreferredWidth(tran) --LayoutUtility.GetPreferredWidth(tran)
local offsetX = (GetPreferredWidth(tran) + Screen.width) / 2 local offsetX = (GetPreferredWidth(tran) + Screen.width) / 2
@ -293,7 +321,7 @@ end
-- 请求获取 -- 请求获取
function this.RequestServerVersion(func) function this.RequestServerVersion(func)
local ChannelID = LoginRoot_Channel local ChannelID = LoginRoot_UserChannel == "" and LoginRoot_Channel or LoginRoot_UserChannel
local packId = PackageManager.GetPackageID() local packId = PackageManager.GetPackageID()
if packId then if packId then
ChannelID = ChannelID.. packId ChannelID = ChannelID.. packId
@ -333,8 +361,46 @@ function this.RequestServerList(userId, callback)
Log(url) Log(url)
networkMgr:SendGetHttp(url, callback, nil, nil, nil) networkMgr:SendGetHttp(url, callback, nil, nil, nil)
end) end)
--用户协议,隐私政策
this.RequestProtos(userId)
end end
--获取用户隐私协议
function this.RequestProtos(userId)
this.protos:SetActive(false)
this.ConfirmImg:SetActive(PlayerPrefs.GetInt("IHaveConfirmProtos") == 1)
UrlList[1] = ""
UrlList[2] = ""
local ChannelID = LoginRoot_UserChannel == "" and LoginRoot_Channel or LoginRoot_UserChannel
local PackageID = PackageManager.GetPackageID()
if PackageID then
ChannelID = ChannelID .. PackageID
end
networkMgr:SendGetHttp(LoginRoot_Url.."jl_loginserver/getAgreement?gamePack="..ChannelID, function (str)
local json = require 'cjson'
local data = json.decode(str)
if data.parms then
UrlList[1] = data.parms.instructions
UrlList[2] = data.parms.privacy
Log("instructionsUrl:"..tostring(UrlList[1]).." privacyUrl:"..tostring(UrlList[2]))
HaveConfirm = true
else
this.protos:SetActive(false)
Log("用户和隐私协议地址为空")
HaveConfirm = false
return
end
if UrlList[1] ~= "" and UrlList[2] ~="" then
this.protos:SetActive(true)
HaveConfirm = true
else
this.protos:SetActive(false)
HaveConfirm = false
end
end, nil, nil, nil)
end
--界面销毁时调用(用于子类重写) --界面销毁时调用(用于子类重写)
function this:OnDestroy() function this:OnDestroy()
@ -599,6 +665,10 @@ end
this.isLoginClick = false this.isLoginClick = false
function this.OnLoginClick() function this.OnLoginClick()
if HaveConfirm and PlayerPrefs.GetInt("IHaveConfirmProtos") == 0 then
PopupTipPanel.ShowTip("为了保证您的个人隐私和隐私安全,请详细阅读并同意用户协议及隐私政策")
return
end
if LoginManager.state == 0 or LoginManager.state == 1 then if LoginManager.state == 0 or LoginManager.state == 1 then
local function reServerCallback(str) local function reServerCallback(str)
if str == nil then if str == nil then

View File

@ -16,6 +16,7 @@ public class SDK_SDKManagerWrap
L.RegFunction("IsSupportExit", IsSupportExit); L.RegFunction("IsSupportExit", IsSupportExit);
L.RegFunction("ExitGame", ExitGame); L.RegFunction("ExitGame", ExitGame);
L.RegFunction("GetPayOrderID", GetPayOrderID); L.RegFunction("GetPayOrderID", GetPayOrderID);
L.RegFunction("OpenWeb", OpenWeb);
L.RegFunction("CaptureShot", CaptureShot); L.RegFunction("CaptureShot", CaptureShot);
L.RegFunction("CustomEvent", CustomEvent); L.RegFunction("CustomEvent", CustomEvent);
L.RegFunction("NewRoleTutorial", NewRoleTutorial); L.RegFunction("NewRoleTutorial", NewRoleTutorial);
@ -191,6 +192,23 @@ public class SDK_SDKManagerWrap
} }
} }
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int OpenWeb(IntPtr L)
{
try
{
ToLua.CheckArgsCount(L, 2);
SDK.SDKManager obj = (SDK.SDKManager)ToLua.CheckObject<SDK.SDKManager>(L, 1);
string arg0 = ToLua.CheckString(L, 2);
obj.OpenWeb(arg0);
return 0;
}
catch (Exception e)
{
return LuaDLL.toluaL_exception(L, e);
}
}
[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
static int CaptureShot(IntPtr L) static int CaptureShot(IntPtr L)
{ {