| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import JsbSystem from "../../../mk/system/JsbSystem";
- import Rule from "./Rule";
- const { ccclass, property } = cc._decorator;
- /**
- * 账号设置
- * @author 邹勇
- */
- @ccclass
- export default class Setting extends cc.Component {
- @property({ type: cc.Sprite, displayName: "头像" })
- img_head: cc.Sprite = null;
- @property({ type: cc.Label, displayName: "昵称" })
- lbl_nickname: cc.Label = null;
- @property({ type: cc.Label, displayName: "ID" })
- lbl_id: cc.Label = null;
- @property({ type: cc.Sprite, displayName: "音乐开关" })
- img_music: cc.Sprite = null;
- @property({ type: cc.Sprite, displayName: "音效开关" })
- img_effect: cc.Sprite = null;
- @property({ type: cc.Label, displayName: "版本号" })
- lbl_version: cc.Label = null;
- // @property({ type: cc.Node, displayName: "协议内容" })
- node_rule: cc.Node = null;
- onLoad() {
- this.initData();
- }
- start()
- {
- }
- private async initData() {
- console.log("=== gData.wechatData.unionid",gData.wechatData.unionid);
- console.log("=== gData.wechatData.nickName",gData.wechatData.nickName);
- this.lbl_id.string = "ID:" + gData.wechatData.unionid;
- this.lbl_nickname.string = gData.wechatData.nickName;
- let music = "module/setting/texture/" + (mk.audio.getSwitchMusic() ? "on" : "off");
- let effect = "module/setting/texture/" + (mk.audio.getSwitchEffect() ? "on" : "off");
- this.img_music.spriteFrame = await mk.loader.load(music, cc.SpriteFrame);
- this.img_effect.spriteFrame = await mk.loader.load(effect, cc.SpriteFrame);
- let result = await mk.loader.loadRemote(gData.wechatData.avatar, null);
- console.log("loadHead:", result);
- // this.img_head.spriteFrame = result;
- }
- clickCopy() {
- mk.audio.playEffect("button");
- JsbSystem.setClipboard(gData.wechatData.unionid);
- mk.tip.pop("复制成功");
- }
- async clickMusic() {
- mk.audio.switchMusicFunc();
- mk.audio.playEffect("button");
- let music = "module/setting/texture/" + (mk.audio.getSwitchMusic() ? "on" : "off");
- this.img_music.spriteFrame = await mk.loader.load(music, cc.SpriteFrame);
- }
- async clickEffect() {
- mk.audio.switchEffectFunc();
- mk.audio.playEffect("button");
- let effect = "module/setting/texture/" + (mk.audio.getSwitchEffect() ? "on" : "off");
- this.img_effect.spriteFrame = await mk.loader.load(effect, cc.SpriteFrame);
- }
- clickUpdate() {
- }
- /** 点击微信授权 */
- onClickWxAuth() {
- mk.ui.closePanel(this.node.name);
- JsbSystem.WxAuth();
- }
- async clickRule(data) {
- gData.setting.rule_type = parseInt(data);
- }
- update() {
- }
- onDestroy() {
- }
- }
|