暂存 已有UI替换
This commit is contained in:
parent
1f0db6c4a9
commit
497c5853be
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,4 +4,4 @@
|
||||||
/packages/
|
/packages/
|
||||||
/build-templates/
|
/build-templates/
|
||||||
/build/
|
/build/
|
||||||
/图片资源/
|
/图片资源/
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,6 @@
|
||||||
import { MiniGameSdk } from "../../Sdk/MiniGameSdk";
|
|
||||||
|
|
||||||
|
import { MiniGameSdk } from "../../Sdk/MiniGameSdk";
|
||||||
|
//@ts-ignore
|
||||||
//最大工具类 各种公共方法,以及处理上传,获取后端接口数据
|
//最大工具类 各种公共方法,以及处理上传,获取后端接口数据
|
||||||
var GameTool = {
|
var GameTool = {
|
||||||
_startTime: 0,
|
_startTime: 0,
|
||||||
|
@ -386,9 +387,10 @@ var GameTool = {
|
||||||
// console.log("上传",data);
|
// console.log("上传",data);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
//@ts-ignore
|
||||||
//获取用户金币数量
|
//获取用户金币数量
|
||||||
getUserCoin(callback: Function) {
|
getUserCoin(callback: Function) {
|
||||||
|
//@ts-ignore
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx!== 'undefined' && wx!== null) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.cloud.callFunction({
|
wx.cloud.callFunction({
|
||||||
|
@ -412,6 +414,7 @@ var GameTool = {
|
||||||
|
|
||||||
//改变用户金币
|
//改变用户金币
|
||||||
setUserCoin(callback){
|
setUserCoin(callback){
|
||||||
|
//@ts-ignore
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx!== 'undefined' && wx!== null) {
|
||||||
if(cc.fx.GameConfig.GM_INFO.coin <= 0 || cc.fx.GameConfig.GM_INFO.coin == undefined){
|
if(cc.fx.GameConfig.GM_INFO.coin <= 0 || cc.fx.GameConfig.GM_INFO.coin == undefined){
|
||||||
console.log("金币上传失败",cc.fx.GameConfig.GM_INFO.coin);
|
console.log("金币上传失败",cc.fx.GameConfig.GM_INFO.coin);
|
||||||
|
@ -450,6 +453,7 @@ var GameTool = {
|
||||||
|
|
||||||
//获取用户关卡数
|
//获取用户关卡数
|
||||||
getUserLevel(callback: Function) {
|
getUserLevel(callback: Function) {
|
||||||
|
//@ts-ignore
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx!== 'undefined' && wx!== null) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.cloud.callFunction({
|
wx.cloud.callFunction({
|
||||||
|
@ -536,6 +540,7 @@ var GameTool = {
|
||||||
|
|
||||||
//获取用户体力值
|
//获取用户体力值
|
||||||
getUserHealth(callback: Function) {
|
getUserHealth(callback: Function) {
|
||||||
|
//@ts-ignore
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx!== 'undefined' && wx!== null) {
|
||||||
console.log("即将进入体力获取接口");
|
console.log("即将进入体力获取接口");
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
|
@ -582,6 +587,7 @@ var GameTool = {
|
||||||
}
|
}
|
||||||
cc.fx.StorageMessage.setStorage("health",healthInfo);
|
cc.fx.StorageMessage.setStorage("health",healthInfo);
|
||||||
MiniGameSdk.API.shushu_SetSuperProperties();
|
MiniGameSdk.API.shushu_SetSuperProperties();
|
||||||
|
//@ts-ignore
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx!== 'undefined' && wx!== null) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.cloud.callFunction({
|
wx.cloud.callFunction({
|
||||||
|
@ -609,6 +615,7 @@ var GameTool = {
|
||||||
|
|
||||||
//购买行为
|
//购买行为
|
||||||
buyReview(coin,callback: Function){
|
buyReview(coin,callback: Function){
|
||||||
|
//@ts-ignore
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx!== 'undefined' && wx!== null) {
|
||||||
// console.log("实际即将消耗金币:",coin);
|
// console.log("实际即将消耗金币:",coin);
|
||||||
// this.changeCoin(coin);
|
// this.changeCoin(coin);
|
||||||
|
@ -618,6 +625,7 @@ var GameTool = {
|
||||||
|
|
||||||
//更改用户道具数
|
//更改用户道具数
|
||||||
buyProp(propid,callback: Function) {
|
buyProp(propid,callback: Function) {
|
||||||
|
//@ts-ignore
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx!== 'undefined' && wx!== null) {
|
||||||
cc.fx.GameTool.changeCoin(-1500);
|
cc.fx.GameTool.changeCoin(-1500);
|
||||||
cc.fx.GameTool.setUserProp(propid,3,(data)=>{
|
cc.fx.GameTool.setUserProp(propid,3,(data)=>{
|
||||||
|
@ -647,6 +655,7 @@ var GameTool = {
|
||||||
|
|
||||||
//改变用户关卡
|
//改变用户关卡
|
||||||
setUserLevel(callback){
|
setUserLevel(callback){
|
||||||
|
//@ts-ignore
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx!== 'undefined' && wx!== null) {
|
||||||
// if(cc.fx.GameConfig.GM_INFO.level <= 0 || cc.fx.GameConfig.GM_INFO.level == undefined){
|
// if(cc.fx.GameConfig.GM_INFO.level <= 0 || cc.fx.GameConfig.GM_INFO.level == undefined){
|
||||||
// console.log("等级重置为0");
|
// console.log("等级重置为0");
|
||||||
|
@ -682,6 +691,7 @@ var GameTool = {
|
||||||
|
|
||||||
//获取用户关卡数
|
//获取用户关卡数
|
||||||
getUserProp(callback: Function) {
|
getUserProp(callback: Function) {
|
||||||
|
//@ts-ignore
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx!== 'undefined' && wx!== null) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.cloud.callFunction({
|
wx.cloud.callFunction({
|
||||||
|
@ -709,6 +719,7 @@ var GameTool = {
|
||||||
|
|
||||||
//改变用户道具
|
//改变用户道具
|
||||||
setUserProp(propid,amount,callback){
|
setUserProp(propid,amount,callback){
|
||||||
|
//@ts-ignore
|
||||||
if (typeof wx!== 'undefined' && wx!== null) {
|
if (typeof wx!== 'undefined' && wx!== null) {
|
||||||
let newPropData = null;
|
let newPropData = null;
|
||||||
if(propid == 0){
|
if(propid == 0){
|
||||||
|
|
|
@ -54,6 +54,8 @@ export default class setUi extends cc.Component {
|
||||||
cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
|
cc.fx.GameConfig.GM_INFO.musicOpen = this.musicState;
|
||||||
|
|
||||||
this.setMusicConfig();
|
this.setMusicConfig();
|
||||||
|
|
||||||
|
//如果音乐关闭了,则停止音乐
|
||||||
cc.fx.AudioManager._instance.stopMusic();
|
cc.fx.AudioManager._instance.stopMusic();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -83,8 +85,10 @@ export default class setUi extends cc.Component {
|
||||||
this.effectState = true;
|
this.effectState = true;
|
||||||
cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
|
cc.fx.GameConfig.GM_INFO.effectOpen = this.effectState;
|
||||||
this.setMusicConfig();
|
this.setMusicConfig();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
console.log("音效状态", this.effectState);
|
||||||
}
|
}
|
||||||
|
|
||||||
clickVibrate() {
|
clickVibrate() {
|
||||||
|
@ -98,8 +102,10 @@ export default class setUi extends cc.Component {
|
||||||
this.vibrateState = true;
|
this.vibrateState = true;
|
||||||
cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
|
cc.fx.GameConfig.GM_INFO.vibrateOpen = this.vibrateState;
|
||||||
this.setMusicConfig();
|
this.setMusicConfig();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
console.log("震动状态", this.vibrateState);
|
||||||
}
|
}
|
||||||
syncToggleState() {
|
syncToggleState() {
|
||||||
this.music.getComponent(cc.Toggle).isChecked = !this.musicState;
|
this.music.getComponent(cc.Toggle).isChecked = !this.musicState;
|
||||||
|
@ -109,6 +115,7 @@ export default class setUi extends cc.Component {
|
||||||
|
|
||||||
//关闭ui
|
//关闭ui
|
||||||
closeUi() {
|
closeUi() {
|
||||||
|
cc.fx.AudioManager._instance.playEffect("anniu_little", null);
|
||||||
this.node.active = false;
|
this.node.active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user