2 files added
7 files modified
| New file |
| | |
| | | import Userdata from "./Userdata"; |
| | | |
| | | const {ccclass, property} = cc._decorator; |
| | | |
| | | @ccclass |
| | | export default class AccountManager extends cc.Component { |
| | | |
| | | onClickCancel(){ |
| | | this.node.active = false; |
| | | } |
| | | |
| | | onClickOK(){ |
| | | Userdata.clearAllData(); |
| | | cc.director.loadScene('logo'); |
| | | } |
| | | } |
| New file |
| | |
| | | { |
| | | "ver": "1.1.0", |
| | | "uuid": "f3c1e0eb-9d0a-411e-bba0-0952063e5ee3", |
| | | "importer": "typescript", |
| | | "isPlugin": false, |
| | | "loadPluginInWeb": true, |
| | | "loadPluginInNative": true, |
| | | "loadPluginInEditor": false, |
| | | "subMetas": {} |
| | | } |
| | |
| | | |
| | | startGame() { |
| | | if (Sdk.isHuawei) { |
| | | Sdk.ins.startGame((result) => { |
| | | if (result) {//自动登录成功 |
| | | cc.director.loadScene(this.nextSceneName); |
| | | } else {//显示开始游戏按钮 |
| | | this.buttonStartGame.node.active = true; |
| | | this.ppNode.active = false; |
| | | } |
| | | }); |
| | | if (Sdk.ins.isLogin) { |
| | | //显示开始游戏按钮 |
| | | this.buttonStartGame.node.active = true; |
| | | this.ppNode.active = false; |
| | | Sdk.ins.isLogin = false; |
| | | } else |
| | | Sdk.ins.startGame((result) => { |
| | | if (result) {//自动登录成功 |
| | | cc.director.loadScene(this.nextSceneName); |
| | | } else {//显示开始游戏按钮 |
| | | this.buttonStartGame.node.active = true; |
| | | this.ppNode.active = false; |
| | | } |
| | | }); |
| | | } else { |
| | | cc.director.loadScene(this.nextSceneName); |
| | | } |
| | |
| | | @property(cc.Node) |
| | | moregamesNode: cc.Node = null; |
| | | |
| | | @property(cc.Node) |
| | | accountNode: cc.Node = null; |
| | | |
| | | |
| | | shopLayer: ShopLayer = null; |
| | | private leng: number = 100; |
| | |
| | | }); |
| | | } |
| | | |
| | | onClickAccount(){ |
| | | this.accountNode.active = true; |
| | | } |
| | | |
| | | checkShowButtonShow() { |
| | | if (Sdk.isToutiao) { |
| | | this.shopButtonNode.active = false; |
| | |
| | | */ |
| | | export class SdkDefault { |
| | | |
| | | isLogin = false; |
| | | |
| | | constructor() { |
| | | cc.log('init Sdk constructor.'); |
| | | } |
| | |
| | | success: (data) => { |
| | | // 登录成功后,可以存储账号信息。 |
| | | console.log(" game login with real success:" + JSON.stringify(data)); |
| | | this.isLogin = true; |
| | | cb && cb(true); |
| | | |
| | | this.lastShowInterAdTime = Date.now(); |
| | |
| | | } |
| | | |
| | | static clearAllData() { |
| | | this._replaceLoadData(Userdata.data, Userdata.defaultData); |
| | | cc.sys.localStorage.removeItem(Userdata.USERDATA_NAME); |
| | | let obj = {}; |
| | | obj[Userdata.USERDATA_NAME] = JSON.stringify(Userdata.defaultData); |
| | | Userdata.setData(obj); |
| | | cc.sys.localStorage.setItem(Userdata.USERDATA_NAME, JSON.stringify(Userdata.data)); |
| | | } |
| | | |
| | | static saveUserdata() { |
| | |
| | | "tinyPackageMode": true, |
| | | "tinyPackageServer": "", |
| | | "useDebugKey": false, |
| | | "versionCode": "2", |
| | | "versionCode": "3", |
| | | "versionName": "1.0.2", |
| | | "packFirstScreenRes": false, |
| | | "separateEngineMode": false |