You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
187 lines
5.3 KiB
187 lines
5.3 KiB
import { EPlatformType } from "../T/EPlatformType";
|
|
import { ShareInfo } from "../T/ShareInfo";
|
|
import IPlatform from "../T/IPlatform";
|
|
import { WebRecordManager } from "../Record/WebRecordManager";
|
|
import IRecordManager from "../T/IRecordManager";
|
|
import PlatformManagerProxy from "../PlatformManagerProxy";
|
|
import PlatformData from "../Data/PlatformData";
|
|
import { PlatformCommonDefine } from "../Common/PlatformCommonDefine";
|
|
import { Recommend } from "../Recommend/Recommend";
|
|
import LocalStorage from "../../Mgr_LocalData/LocalStorage";
|
|
import Base64 from "../../Mgr_LocalData/Base/Base64";
|
|
/**
|
|
* 默认平台
|
|
*/
|
|
export default class DefaultPlatform implements IPlatform {
|
|
isSliderBar: boolean;
|
|
isAddShortcut: boolean;
|
|
isCanShowRecommend: boolean;
|
|
showRecommend(callBack: Function) {
|
|
throw new Error("Method not implemented.");
|
|
}
|
|
mRecommend: Recommend;
|
|
IsLeaderboardsEnable: boolean=false;
|
|
base: any;
|
|
platformData: PlatformData;
|
|
onPause: Function;
|
|
appId: string;
|
|
platform: EPlatformType = EPlatformType.Web;
|
|
safeArea: PlatformCommonDefine.SafeArea = null;
|
|
lauchOption: PlatformCommonDefine.LaunchOption;
|
|
loginState: PlatformCommonDefine.LoginState;
|
|
onLoginEnd: Function;
|
|
onResume: Function;
|
|
recordManager: IRecordManager = new WebRecordManager();
|
|
systemInfo: any = null;
|
|
//Buildle:Map<string,cc.AssetManager.Bundle>=new Map<string,cc.AssetManager.Bundle>();
|
|
|
|
/**
|
|
* 是否支持直接跳转到其他小程序
|
|
* 默认平台进行强制fake true,方便进行调试
|
|
*/
|
|
isSupportJumpOther: boolean = true;
|
|
|
|
Init(platformData: PlatformData,callBack:Function) {
|
|
this.loginState = {
|
|
isLogin: false,
|
|
code: null,
|
|
openid:"",
|
|
};
|
|
this.isAddShortcut = false;
|
|
this.platformData = platformData;
|
|
this.loginState.openid = LocalStorage.getItem("UseID")
|
|
if (!this.loginState.openid || this.loginState.openid.length < 1) {
|
|
this.loginState.openid = Base64.encode(`${Date.now() + Math.random() * 100}_10086`)
|
|
LocalStorage.setItem("UseID", this.loginState.openid);
|
|
}
|
|
|
|
this.recordManager.Platform = this;
|
|
callBack && callBack();
|
|
}
|
|
IsBannerAvaliable() {
|
|
return false;
|
|
}
|
|
IsVideoAvaliable() {
|
|
return true;
|
|
}
|
|
IsInterstitalAvaliable() {
|
|
return false;
|
|
}
|
|
/**
|
|
* 显示banner
|
|
*/
|
|
ShowBannerAd() {
|
|
console.log("调用ShowBannerAd");
|
|
}
|
|
HideBannerAd() {
|
|
console.log("调用HideBannerAd");
|
|
}
|
|
/**
|
|
* 显示激励视频
|
|
*/
|
|
ShowRewardVideoAd(onSuccess: Function, onSkipped: Function) {
|
|
console.log("调用ShowRewardVideoAd");
|
|
//默认看完广告
|
|
onSuccess();
|
|
}
|
|
ShowRewardVideoAdAsync(): Promise<boolean> {
|
|
return new Promise(function (resolve) {
|
|
PlatformManagerProxy.instance.PlatformInstance.ShowRewardVideoAd(
|
|
((this, () => {
|
|
resolve(true);
|
|
}).bind(this)
|
|
),
|
|
((this, () => {
|
|
resolve(false);
|
|
})).bind(this));
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 显示插屏广告
|
|
*/
|
|
ShowInterstitalAd(callBack:Function) {
|
|
console.log("调用ShowInterstitalAd");
|
|
}
|
|
GetFromAppId(): string {
|
|
return null;
|
|
}
|
|
GetFeedType(): number {
|
|
return -1;
|
|
}
|
|
ShareAppMessage(obj: ShareInfo, onSuccess: Function = null, onFailed: Function = null) {
|
|
console.log("分享消息", obj);
|
|
if (onSuccess) {
|
|
onSuccess();
|
|
}
|
|
}
|
|
|
|
RecordEvent(eventId: string, param: object) {
|
|
console.log("记录事件", eventId, param);
|
|
}
|
|
|
|
ShareVideoInfo() {
|
|
console.log(PlatformManagerProxy.platformStr, "暂未实现录屏功能");
|
|
}
|
|
|
|
_CheckUpdate() {
|
|
|
|
}
|
|
|
|
ShowToast(str: string) {
|
|
console.log('显示消息:', str);
|
|
}
|
|
|
|
OpenGameBox() {
|
|
console.warn("当前平台", PlatformManagerProxy.platformStr, "暂不支持互推游戏盒子");
|
|
}
|
|
|
|
NavigateToApp(appid: string, path?: string, extra?: any): Promise<boolean> {
|
|
return new Promise((resolve, reject) => {
|
|
console.warn("当前平台", PlatformManagerProxy.platformStr, `暂不支持小程序跳转appid:${appid}`);
|
|
// 这里使用resolve
|
|
resolve(false);
|
|
});
|
|
}
|
|
createShortcut(BackFun:(isOK:boolean)=>void) {
|
|
BackFun && BackFun(true)
|
|
console.log('创建桌面图标');
|
|
}
|
|
checkShortcut(BackFun:(isOK:boolean)=>void) {
|
|
BackFun && BackFun(true)
|
|
console.log('检查是否创建桌面图标');
|
|
}
|
|
|
|
requestFeedSubscribe(BackFun:(isOK:boolean)=>void){
|
|
BackFun && BackFun(true)
|
|
console.log('直玩推订阅');
|
|
}
|
|
checkFeedSubscribe(BackFun:(isOK:boolean)=>void){
|
|
BackFun && BackFun(true)
|
|
console.log('检查是否订阅直玩推');
|
|
}
|
|
GetUserCloudStorage() {
|
|
|
|
}
|
|
SetUserCloudStorage() {
|
|
|
|
}
|
|
CloseGame() {
|
|
|
|
}
|
|
|
|
GetUserInfo(value: {
|
|
success?: Function,
|
|
fail?: Function,
|
|
btnStyle?:{ left: number, top: number, width: number, height: number },
|
|
}){}
|
|
|
|
hideUserInfoButton() {}
|
|
|
|
_InitABTest(){}
|
|
|
|
_InitShareList(){}
|
|
oceanengineEvent() {}
|
|
|
|
reportScene(sceneID: number){}
|
|
}
|