|
|
@@ -2,7 +2,7 @@
|
|
|
* @Author: mojunshou 1637302775@qq.com
|
|
|
* @Date: 2025-03-19 16:23:51
|
|
|
* @LastEditors: mojunshou 1637302775@qq.com
|
|
|
- * @LastEditTime: 2025-03-31 11:56:22
|
|
|
+ * @LastEditTime: 2025-03-31 15:06:48
|
|
|
* @Description: loading界面
|
|
|
*/
|
|
|
import { _decorator, sys } from "cc";
|
|
|
@@ -16,6 +16,7 @@ import { UIID } from "../../common/config/GameUIConfig";
|
|
|
import { AndroidMessageCenter } from '../../common/manager/AndroidMessageCenter';
|
|
|
import { smc } from "../../common/SingletonModuleComp";
|
|
|
import { EliminateViewComp } from "../../eliminate/view/EliminateViewComp";
|
|
|
+import { CocosHandler } from "../../common/manager/CocosHandler";
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
/** 游戏资源加载 */
|
|
|
@@ -31,7 +32,9 @@ export class LoadingViewComp extends CCVMParentComp {
|
|
|
/** 加载资源进度比例值 */
|
|
|
progress: "0",
|
|
|
/** 加载流程中提示文本 */
|
|
|
- prompt: ""
|
|
|
+ prompt: "",
|
|
|
+ /**btn_show*/
|
|
|
+ btn_show: 0
|
|
|
};
|
|
|
|
|
|
private progress: number = 0;
|
|
|
@@ -46,37 +49,21 @@ export class LoadingViewComp extends CCVMParentComp {
|
|
|
|
|
|
enter() {
|
|
|
this.addEvent();
|
|
|
- //查看缓存有没有同意过
|
|
|
- if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ //查看缓存有没有同意过,也要向服务器发送登录请求,如果有过登录就直接拿数据登录,没有就显示微信登录
|
|
|
+ let data = oops.storage.get("agree");
|
|
|
+ if (data == null || data == "") {
|
|
|
+ //打开温馨提示
|
|
|
+ oops.gui.open(UIID.KindTips);
|
|
|
+ return;
|
|
|
} else {
|
|
|
- this.loadRes();
|
|
|
- }
|
|
|
+ //同意过
|
|
|
+ if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
|
|
|
|
|
|
- // let data = sys.localStorage.getItem("agree");
|
|
|
- // if (!data) {
|
|
|
- // //打开温馨提示
|
|
|
- // oops.gui.open(UIID.KindTips);
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // //有没有登录过
|
|
|
- // let loginData = sys.localStorage.getItem("login");
|
|
|
- // if (!loginData) {
|
|
|
- // //显示微信登录按钮
|
|
|
- // // this.showWxLogin();
|
|
|
- // } else {
|
|
|
- // //登录了就--请求服务器,微信登录,成功再加载资源
|
|
|
- // this.loadRes();
|
|
|
- // }
|
|
|
- // if (!DeviceUtil.isNative) {
|
|
|
- // this.loadRes();
|
|
|
- // } else {
|
|
|
-
|
|
|
- // }
|
|
|
- this.loadRes();
|
|
|
+ } else {
|
|
|
+ //非原生,网页的
|
|
|
+ this.loadRes();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -89,10 +76,14 @@ export class LoadingViewComp extends CCVMParentComp {
|
|
|
|
|
|
private onAgreePrivacy() {
|
|
|
console.log("同意隐私协议");
|
|
|
- sys.localStorage.setItem("agree", "true");
|
|
|
+ oops.storage.set("agree", true);
|
|
|
oops.gui.remove(UIID.KindTips);
|
|
|
//如果是客户端就显示微信登录按钮
|
|
|
- this.loadRes();
|
|
|
+ if (DeviceUtil.isNative && DeviceUtil.isAndroid) {
|
|
|
+ this.showWxLogin();
|
|
|
+ } else {
|
|
|
+ this.loadRes();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/** 加载资源 */
|
|
|
@@ -132,7 +123,6 @@ export class LoadingViewComp extends CCVMParentComp {
|
|
|
// 获取用户信息的多语言提示文本
|
|
|
this.data.prompt = oops.language.getLangByID("loading_load_player");
|
|
|
await ModuleUtil.addViewUiAsync(smc.account, EliminateViewComp, UIID.Eliminate);
|
|
|
- // oops.gui.open(UIID.Game);
|
|
|
ModuleUtil.removeViewUi(this.ent, LoadingViewComp, UIID.Loading);
|
|
|
}
|
|
|
|
|
|
@@ -141,9 +131,23 @@ export class LoadingViewComp extends CCVMParentComp {
|
|
|
* @description: 微信登录
|
|
|
* @return {*}
|
|
|
*/
|
|
|
- private btn_wxlogin() {
|
|
|
+ private async btn_wxlogin() {
|
|
|
//跟安卓交互
|
|
|
+ //登录完要隐藏微信按钮然后加载进度
|
|
|
+ let result = await CocosHandler.getInstance().wechat_login();
|
|
|
+ if (result.code) {
|
|
|
+
|
|
|
+ //登录成功
|
|
|
+ //存数据
|
|
|
+ const wxNode = this.node.getChildByName("login_node");
|
|
|
+ if (wxNode) {
|
|
|
+ wxNode.active = false;
|
|
|
+ }
|
|
|
+ this.loadRes();
|
|
|
+ } else {
|
|
|
|
|
|
+ oops.gui.toast("登录失败,请重试")
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -151,8 +155,18 @@ export class LoadingViewComp extends CCVMParentComp {
|
|
|
* @return {*}
|
|
|
*/
|
|
|
showWxLogin() {
|
|
|
-
|
|
|
+ const wxNode = this.node.getChildByName("login_node");
|
|
|
+ if (wxNode) {
|
|
|
+ wxNode.active = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
reset(): void { }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存关卡,分数,目标分数
|
|
|
+ *
|
|
|
+ *
|
|
|
+ */
|
|
|
}
|