require("gameplatform.Platform")
|
|
require("gameplatform.PlatformSetting")
|
|
|
|
PlatformMgr = PlatformMgr or BaseClass()
|
|
local PlatformMgr = PlatformMgr
|
|
|
|
PlatformMgr.SY_RECORD_EVENT = {
|
|
LOGIN = 1001, --登录
|
|
CREATE = 1002, --创角
|
|
SELECT = 1003, --选角
|
|
ENTER = 1004, --进入游戏
|
|
}
|
|
|
|
function PlatformMgr:__init()
|
|
if PlatformMgr.Instance ~= nil then
|
|
error("attempt to create singleton(PlatformMgr) twice!")
|
|
return
|
|
end
|
|
PlatformMgr.Instance = self
|
|
self.cur_platform = nil
|
|
self.bind_level_change = false
|
|
|
|
self:InitPlatform()
|
|
end
|
|
|
|
function PlatformMgr:getInstance()
|
|
if PlatformMgr.Instance == nil then
|
|
PlatformMgr.New()
|
|
end
|
|
return PlatformMgr.Instance
|
|
end
|
|
|
|
function PlatformMgr:InitPlatform()
|
|
if ClientConfig.plat_lua_name and ClientConfig.plat_lua_class then
|
|
require("gameplatform." .. ClientConfig.plat_lua_name)
|
|
self.cur_platform = _G[ClientConfig.plat_lua_class].New()
|
|
else
|
|
self.cur_platform = GamePlatform.New()
|
|
end
|
|
|
|
if self.cur_platform then
|
|
self.cur_platform:InitWindow()
|
|
end
|
|
|
|
local create_role = function(role_id)
|
|
self:SubmitCreateRoleInfo(role_id)
|
|
self:SuyouEventRecord(PlatformMgr.SY_RECORD_EVENT.CREATE)
|
|
end
|
|
GlobalEventSystem:Bind(LoginStateEvent.CREATE_ROLE_SUCCEED,create_role)
|
|
|
|
local game_start = function()
|
|
self:SubmitEnterGame()
|
|
self:SuyouEventRecord(PlatformMgr.SY_RECORD_EVENT.ENTER)
|
|
|
|
if not self.bind_level_change then
|
|
self.bind_level_change = true
|
|
|
|
local level_change = function()
|
|
if self._use_delete_method then return end
|
|
self:RoleLevelChange()
|
|
end
|
|
RoleManager.Instance.mainRoleInfo:Bind(EventName.CHANGE_LEVEL, level_change)
|
|
end
|
|
end
|
|
GlobalEventSystem:Bind(EventName.GAME_START,game_start)
|
|
end
|
|
|
|
function PlatformMgr:SDKCallBack( func_name, func_data)
|
|
if self.cur_platform then
|
|
self.cur_platform:SDKCallBack( func_name, func_data )
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:ShowWindow( show_state )
|
|
if self.cur_platform then
|
|
self.cur_platform:ShowWindow( show_state )
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:LoginRequest(login_back)
|
|
if self.cur_platform then
|
|
self.cur_platform:LoginRequest(login_back)
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:SetLoginCallBack(login_back)
|
|
if self.cur_platform then
|
|
self.cur_platform:SetLoginCallBack(login_back)
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:LoginOut()
|
|
if self.cur_platform then
|
|
self.cur_platform:LoginOut()
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:PayRequest( custom_money, custom_info, custom_callpack )
|
|
if ClientConfig.open_pay then
|
|
if self.cur_platform then
|
|
self.cur_platform:PayRequest( custom_money, custom_info, custom_callpack)
|
|
end
|
|
else
|
|
Message.show("您好,游戏当前未开放充值,请等待每日发放福利!")
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:ExitPlatform()
|
|
if self.cur_platform then
|
|
self.cur_platform:ExitPlatform()
|
|
self.cur_platform:DeleteMe()
|
|
self.cur_platform = nil
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:InitWindow()
|
|
if self.cur_platform then
|
|
self.cur_platform:InitWindow()
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:SubmitCreateRoleInfo(role_id)
|
|
if self.cur_platform then
|
|
self.cur_platform:SubmitCreateRoleInfo(role_id)
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:SubmitEnterGame()
|
|
if self.cur_platform then
|
|
self.cur_platform:SubmitEnterGame()
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:RoleLevelChange()
|
|
if self.cur_platform then
|
|
self.cur_platform:RoleLevelChange()
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:SubmitSelectServer()
|
|
if self.cur_platform then
|
|
self.cur_platform:SubmitSelectServer()
|
|
end
|
|
self:SuyouEventRecord(PlatformMgr.SY_RECORD_EVENT.SELECT)
|
|
end
|
|
|
|
function PlatformMgr:ExitGame( default_func )
|
|
if self.cur_platform then
|
|
self.cur_platform:ExitPlatform()
|
|
if not self.cur_platform:NeedCustomExitGame() then
|
|
default_func()
|
|
end
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:IsCustomUser()
|
|
if self.cur_platform then
|
|
return self.cur_platform:IsCustomUser()
|
|
end
|
|
return false
|
|
end
|
|
|
|
function PlatformMgr:ShowUserCenter()
|
|
if self.cur_platform then
|
|
self.cur_platform:ShowUserCenter()
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:RequestPayData( money, call_back )
|
|
if self.cur_platform then
|
|
self.cur_platform:RequestPayData(money, call_back)
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:IsPlatAlphaState()
|
|
local is_alpha_state = string.find(ClientConfig.plat_name, "alpha")
|
|
if is_alpha_state then
|
|
return true
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:NoSupportPhotoMsg()
|
|
-- if ClientConfig.plat_name == "lz_leniu_smqy_yyb" and AppConst_EnglineVer < 50 then
|
|
-- return "头像上传失败,请联系客服QQ:800810788"
|
|
-- end
|
|
return nil
|
|
end
|
|
|
|
function PlatformMgr:GetUserID()
|
|
if self.cur_platform then
|
|
return self.cur_platform:GetUserID()
|
|
end
|
|
end
|
|
|
|
--速游专属
|
|
function PlatformMgr:IsSuyouPlatform()
|
|
local inner_state = string.find(ClientConfig.plat_name, "wzqst")
|
|
if inner_state then
|
|
return true
|
|
end
|
|
|
|
local suyou_state = string.find(ClientConfig.plat_name, "suyou")
|
|
if suyou_state then
|
|
return true
|
|
end
|
|
|
|
return false
|
|
end
|
|
|
|
function PlatformMgr:IsMlLianyun()
|
|
return false
|
|
end
|
|
--讯飞提审用:开放聊天没有等级限制,并显示讯飞信息
|
|
function PlatformMgr:IsIflyRecord()
|
|
PlatformMgr.OPEN_CHAT_LIST = PlatformMgr.OPEN_CHAT_LIST or {["bgdwd"] = true, ["bfqstwd"] = true, ["bfqstml"] = true, ["bfqstiosml"] = true, ["bfqstsuyou"] = true}
|
|
return PlatformMgr.OPEN_CHAT_LIST[ClientConfig.plat_name]
|
|
|
|
end
|
|
|
|
--内部包,根据服务端秘籍协议推送列表来判断
|
|
PlatformMgr.is_internal_palt = nil
|
|
function PlatformMgr:IsInternalPalt()
|
|
-- if PlatformMgr.is_internal_palt == nil then
|
|
-- PlatformMgr.OPEN_CHAT_LIST = PlatformMgr.INTERNAL_PLAT_LIST or {["mrsddev"] = true, ["mrzjdev"] = true}
|
|
-- PlatformMgr.is_internal_palt = PlatformMgr.OPEN_CHAT_LIST[ClientConfig.plat_name]
|
|
-- end
|
|
return PlatformMgr.is_internal_palt
|
|
end
|
|
|
|
function PlatformMgr:IsLeniuPlatform()
|
|
local find = string.find(ClientConfig.plat_name, "leniu")
|
|
if find then
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
function PlatformMgr:ShareBySDK()
|
|
if self.cur_platform then
|
|
self.cur_platform:ShareBySDK()
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:JumpToAppStore()
|
|
Message.Show("等待跳转")
|
|
end
|
|
|
|
--Eyou平台(繁体)
|
|
function PlatformMgr:IsEyouPlatform()
|
|
local is_eyou = string.find(ClientConfig.plat_name, "lz_eyou")
|
|
local is_tw = string.find(ClientConfig.plat_name, "tw")
|
|
if is_eyou and is_tw then
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
--Eyou平台(英文)
|
|
function PlatformMgr:IsEyouEnPlatform()
|
|
local is_eyou = string.find(ClientConfig.plat_name, "lz_eyou")
|
|
local is_en = string.find(ClientConfig.plat_name, "en")
|
|
if is_eyou and is_en then
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
--Eyou平台(韩文)
|
|
function PlatformMgr:IsEyouKrPlatform()
|
|
local is_eyou = string.find(ClientConfig.plat_name, "lz_eyou")
|
|
local is_kr = string.find(ClientConfig.plat_name, "kr")
|
|
if is_eyou and is_kr then
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
--Eyou平台(日文)
|
|
function PlatformMgr:IsEyouJpPlatform()
|
|
local is_eyou = string.find(ClientConfig.plat_name, "lz_eyou")
|
|
local is_jp = string.find(ClientConfig.plat_name, "jp")
|
|
if is_eyou and is_jp then
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
|
|
--是否云试玩平台
|
|
function PlatformMgr:IsCloudTest( )
|
|
end
|
|
|
|
function PlatformMgr:SuyouEventRecord( event_id )
|
|
if self.cur_platform then
|
|
self.cur_platform:SuyouEventRecord( event_id )
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:CanSendVoice( )
|
|
if RuntimePlatform and Application.platform == RuntimePlatform.IPhonePlayer then
|
|
return true
|
|
end
|
|
if self.cur_platform then
|
|
return self.cur_platform:CanSendVoice()
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:RequestSendVoice( )
|
|
if self.cur_platform then
|
|
self.cur_platform:RequestAudioPermission()
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:IsNeedRequestAudioPermission( )
|
|
-- if self.cur_platform then
|
|
-- return self.cur_platform:IsNeedRequestAudioPermission()
|
|
-- end
|
|
end
|
|
|
|
function PlatformMgr:SubmitSpecialData( parm_type, parm_value )
|
|
if self.cur_platform then
|
|
self.cur_platform:SubmitSpecialData(parm_type, parm_value)
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:TATrack( data )
|
|
if self.cur_platform then
|
|
self.cur_platform:TATrack(data)
|
|
end
|
|
end
|
|
|
|
function PlatformMgr:IsForeignActivityVersion( )--是否是国外活动版本
|
|
return false
|
|
end
|