同步前提交,安卓自动切换线路
|
|
@ -50,46 +50,8 @@ function M:init()
|
||||||
iOSWXLoginErrorView.new()
|
iOSWXLoginErrorView.new()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
GameApplication.Instance:SetAppInfo(self:EncodeAppInfo(self._lineData, self._chooseIndex))
|
|
||||||
ViewUtil.ShowModalWait(true, "正在登录游戏...", 2)
|
|
||||||
coroutine.start(function()
|
|
||||||
coroutine.wait(8)
|
|
||||||
if self.isWXCallBackMark then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
ViewUtil.CloseModalWait()
|
|
||||||
ViewUtil.ErrorTip(10000, "微信登录失败!")
|
|
||||||
if GetPlatform() == "iOS" then
|
|
||||||
view:GetController('wx').selectedIndex = 0
|
|
||||||
view:GetChild('btn_ShowLine').visible = false
|
|
||||||
end
|
|
||||||
iOSWXLoginErrorView.new()
|
|
||||||
end)
|
|
||||||
if (not GameApplication.Instance.accountTest) then
|
|
||||||
GameApplication.Instance:WXLogin(handler(self, self.LoginCallBack))
|
|
||||||
else
|
|
||||||
--local ctr_user = view:GetController("user")
|
|
||||||
|
|
||||||
local _tex_unionid = view:GetChild("tex_unionid")
|
self:CallWxLogin()
|
||||||
|
|
||||||
local utez = _tex_unionid.text --.. (ctr_user.selectedIndex + 1)
|
|
||||||
|
|
||||||
local _data = {}
|
|
||||||
_data["userId"] = utez
|
|
||||||
local key = "userId"
|
|
||||||
local s, e = pcall(function()
|
|
||||||
Utils.SaveLocalFile(key, json.encode(_data))
|
|
||||||
end)
|
|
||||||
if not s then
|
|
||||||
print("Error:" .. e)
|
|
||||||
end
|
|
||||||
DataManager.SelfUser.acc = utez
|
|
||||||
-- DataManager.SelfUser.acc = utez
|
|
||||||
DataManager.SelfUser.nick_name = utez
|
|
||||||
DataManager.SelfUser.sex = 1
|
|
||||||
DataManager.SelfUser.head_url = ""
|
|
||||||
self:LoginCallBack(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- end
|
-- end
|
||||||
-- end)
|
-- end)
|
||||||
|
|
@ -288,10 +250,10 @@ function M:QuickLogin()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:LoginCallBack(result, data)
|
function M:LoginCallBack(result, data)
|
||||||
self.isWXCallBackMark = true
|
-- self.isWXCallBackMark = true
|
||||||
--print("微信登录返回================================================================")
|
-- print("微信登录返回================================================================")
|
||||||
--print("result===>"..result)
|
-- print("result===>" .. result)
|
||||||
--pt(data)
|
-- pt(data)
|
||||||
if (not result) or result ~= 0 then
|
if (not result) or result ~= 0 then
|
||||||
if result == 10 then
|
if result == 10 then
|
||||||
ViewUtil.ShowModalWait(true, nil, 2)
|
ViewUtil.ShowModalWait(true, nil, 2)
|
||||||
|
|
@ -300,7 +262,8 @@ function M:LoginCallBack(result, data)
|
||||||
ViewUtil.CloseModalWait()
|
ViewUtil.CloseModalWait()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
ViewUtil.CloseModalWait()
|
||||||
|
PlayerPrefs.SetString("chooseLine", self._chooseIndex - 1)
|
||||||
if data then
|
if data then
|
||||||
local jd = json.decode(data)
|
local jd = json.decode(data)
|
||||||
pt(jd)
|
pt(jd)
|
||||||
|
|
@ -358,3 +321,56 @@ function M:ReplaceClip1(e, t, i, n)
|
||||||
t.url = string.format("%s%03d", n, i)
|
t.url = string.format("%s%03d", n, i)
|
||||||
return i + 6
|
return i + 6
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M:CallWxLogin(index)
|
||||||
|
local index = index or 0
|
||||||
|
local view = self._view
|
||||||
|
|
||||||
|
GameApplication.Instance:SetAppInfo(self:EncodeAppInfo(self._lineData, self._chooseIndex))
|
||||||
|
ViewUtil.ShowModalWait(true, "正在登录游戏...", 2)
|
||||||
|
coroutine.start(function()
|
||||||
|
coroutine.wait(3)
|
||||||
|
if self.isWXCallBackMark then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if GetPlatform() == "iOS" then
|
||||||
|
ViewUtil.CloseModalWait()
|
||||||
|
ViewUtil.ErrorTip(10000, "微信登录失败!")
|
||||||
|
view:GetController('wx').selectedIndex = 0
|
||||||
|
view:GetChild('btn_ShowLine').visible = false
|
||||||
|
else
|
||||||
|
if index > 8 then
|
||||||
|
ViewUtil.CloseModalWait()
|
||||||
|
ViewUtil.ErrorTip(10000, "微信登录失败!")
|
||||||
|
iOSWXLoginErrorView.new()
|
||||||
|
else
|
||||||
|
self._chooseIndex = self._chooseIndex % 8 + 1
|
||||||
|
self._view:GetChild('list_show').selectedIndex = self._chooseIndex - 1
|
||||||
|
self:CallWxLogin(index + 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
if (not GameApplication.Instance.accountTest) then
|
||||||
|
GameApplication.Instance:WXLogin(handler(self, self.LoginCallBack))
|
||||||
|
else
|
||||||
|
local _tex_unionid = view:GetChild("tex_unionid")
|
||||||
|
|
||||||
|
local utez = _tex_unionid.text --.. (ctr_user.selectedIndex + 1)
|
||||||
|
|
||||||
|
local _data = {}
|
||||||
|
_data["userId"] = utez
|
||||||
|
local key = "userId"
|
||||||
|
local s, e = pcall(function()
|
||||||
|
Utils.SaveLocalFile(key, json.encode(_data))
|
||||||
|
end)
|
||||||
|
if not s then
|
||||||
|
print("Error:" .. e)
|
||||||
|
end
|
||||||
|
DataManager.SelfUser.acc = utez
|
||||||
|
-- DataManager.SelfUser.acc = utez
|
||||||
|
DataManager.SelfUser.nick_name = utez
|
||||||
|
DataManager.SelfUser.sex = 1
|
||||||
|
DataManager.SelfUser.head_url = ""
|
||||||
|
self:LoginCallBack(0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.5 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.0 MiB |
|
Before Width: | Height: | Size: 210 KiB After Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 239 KiB After Width: | Height: | Size: 250 KiB |
|
Before Width: | Height: | Size: 866 KiB After Width: | Height: | Size: 965 KiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 574 KiB After Width: | Height: | Size: 535 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.1 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 756 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 722 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 763 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 747 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 749 KiB |
|
Before Width: | Height: | Size: 649 KiB After Width: | Height: | Size: 626 KiB |
|
Before Width: | Height: | Size: 1010 KiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 341 KiB After Width: | Height: | Size: 195 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 307 KiB After Width: | Height: | Size: 354 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 791 KiB |
|
Before Width: | Height: | Size: 1024 KiB After Width: | Height: | Size: 804 KiB |
|
Before Width: | Height: | Size: 1.1 MiB After Width: | Height: | Size: 805 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 705 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 467 KiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 766 KiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 590 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 382 KiB After Width: | Height: | Size: 591 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 2.7 MiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 2.9 MiB |
|
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 496 KiB After Width: | Height: | Size: 473 KiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 3.0 MiB After Width: | Height: | Size: 2.8 MiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 915 KiB |
|
Before Width: | Height: | Size: 6.7 MiB After Width: | Height: | Size: 5.1 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 287 KiB After Width: | Height: | Size: 280 KiB |
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 878 KiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 966 KiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 481 KiB After Width: | Height: | Size: 626 KiB |
|
Before Width: | Height: | Size: 642 KiB After Width: | Height: | Size: 666 KiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 1.8 MiB After Width: | Height: | Size: 1.7 MiB |
|
Before Width: | Height: | Size: 720 KiB After Width: | Height: | Size: 711 KiB |
|
Before Width: | Height: | Size: 496 KiB After Width: | Height: | Size: 579 KiB |
|
Before Width: | Height: | Size: 6.7 MiB After Width: | Height: | Size: 5.1 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
Before Width: | Height: | Size: 287 KiB After Width: | Height: | Size: 280 KiB |
|
Before Width: | Height: | Size: 782 KiB After Width: | Height: | Size: 844 KiB |
|
Before Width: | Height: | Size: 1.7 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 2.0 MiB |
|
Before Width: | Height: | Size: 131 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 2.8 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 2.7 MiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.5 MiB |
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.1 MiB |
|
Before Width: | Height: | Size: 1.6 MiB After Width: | Height: | Size: 1.6 MiB |
|
Before Width: | Height: | Size: 149 KiB After Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 141 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 2.8 MiB After Width: | Height: | Size: 2.8 MiB |
|
Before Width: | Height: | Size: 222 KiB After Width: | Height: | Size: 224 KiB |
|
Before Width: | Height: | Size: 839 KiB After Width: | Height: | Size: 898 KiB |
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 68 KiB |