神农简化版
13
assets/Scene.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "29f52784-2fca-467b-92e7-8fd9ef8c57b7",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
3795
assets/Scene/GameScene.fire
Normal file
8
assets/Scene/GameScene.fire.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "4eaf518b-35ec-4262-928d-4d497c3f2830",
|
||||
"importer": "scene",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": true,
|
||||
"subMetas": {}
|
||||
}
|
5738
assets/Scene/GuideScene.fire
Normal file
8
assets/Scene/GuideScene.fire.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "1d6bc13a-95e8-41e2-8703-441263ec00bb",
|
||||
"importer": "scene",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
1373
assets/Scene/LoadScene.fire
Normal file
8
assets/Scene/LoadScene.fire.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "9c08062d-4cf1-4b6e-a8ba-4a3881cc7e7d",
|
||||
"importer": "scene",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": true,
|
||||
"subMetas": {}
|
||||
}
|
1897
assets/Scene/OverScene.fire
Normal file
8
assets/Scene/OverScene.fire.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "4b9c5a7e-c645-48a4-9aca-5df381ce4ef5",
|
||||
"importer": "scene",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": true,
|
||||
"subMetas": {}
|
||||
}
|
5429
assets/Scene/RankScene.fire
Normal file
8
assets/Scene/RankScene.fire.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49",
|
||||
"importer": "scene",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": true,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "4734c20c-0db8-4eb2-92ea-e692f4d70934",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
45
assets/Script/Block.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
@ccclass
|
||||
export default class NewClass extends cc.Component {
|
||||
|
||||
@property(cc.Label)
|
||||
label: cc.Label = null;
|
||||
|
||||
@property
|
||||
text: string = 'hello';
|
||||
tween: cc.Tween<cc.Node>;
|
||||
speed: number; //移动速度,时间参数,位移个固定
|
||||
move: boolean; //是否在移动状态。
|
||||
num: number;
|
||||
difficulty: number;
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
onLoad () {
|
||||
|
||||
}
|
||||
|
||||
start () {
|
||||
}
|
||||
|
||||
init(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
hide(){
|
||||
cc.tween(this.node)
|
||||
.to(0.2,{opacity:0})
|
||||
.call(() =>{
|
||||
this.node.active = false;
|
||||
this.node.removeFromParent();
|
||||
this.node = null;
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
update (dt) {
|
||||
}
|
||||
}
|
10
assets/Script/Block.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "dd5bcc36-4db1-428e-a239-43ea14063b97",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
10
assets/Script/DynamicAtlasManager.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
},
|
||||
|
||||
onLoad () {
|
||||
cc.dynamicAtlasManager.enabled = false;
|
||||
},
|
||||
});
|
10
assets/Script/DynamicAtlasManager.js.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "5c9b8159-89a3-4b32-b303-b3d4f7ac1c9f",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
378
assets/Script/GameManager.ts
Normal file
|
@ -0,0 +1,378 @@
|
|||
import AudioManager from "./module/Music/AudioManager";
|
||||
|
||||
// 主游戏控制类
|
||||
const {ccclass, property} = cc._decorator;
|
||||
@ccclass
|
||||
export default class GameManager extends cc.Component {
|
||||
|
||||
@property(cc.Node)
|
||||
Btn_New: cc.Node = null;
|
||||
@property(cc.Node)
|
||||
Btn_Old: cc.Node = null;
|
||||
|
||||
|
||||
@property(cc.Node)
|
||||
Plant: cc.Node = null;
|
||||
|
||||
@property(cc.Node)
|
||||
timeNode: cc.Node = null;
|
||||
|
||||
@property(cc.SpriteAtlas)
|
||||
FoodPlist: cc.SpriteAtlas = null;
|
||||
|
||||
voiceSpriteFrame: cc.SpriteFrame; //是否可点击
|
||||
timeTween: cc.Tween;
|
||||
touchable: boolean; //是否可点击
|
||||
countTime: number; //每次游戏倒计时
|
||||
startTime: number; //游戏开始计时
|
||||
overTime: number; //游戏结束计时
|
||||
now_Food: string; //当前关卡名字信息
|
||||
result: number; //当前关卡名字信息
|
||||
choice: number; //当前关卡选择第几个按钮
|
||||
foodPicArray: any; //存放当前每一大局游戏所有植物图片
|
||||
foodAudioArray: any; //存放当前每一大局游戏所有植物声音
|
||||
customData:any; //存放当前配置
|
||||
needleTween: cc.Tween<cc.Sprite>;
|
||||
onLoad () {
|
||||
this.fit();
|
||||
this.init();
|
||||
this.startGame();
|
||||
}
|
||||
|
||||
start () {
|
||||
|
||||
}
|
||||
|
||||
//处理地图
|
||||
setMap(){
|
||||
|
||||
}
|
||||
|
||||
//初始化数据
|
||||
init(){
|
||||
this.touchable = false;
|
||||
this.result = -1;
|
||||
this.foodAudioArray = [];
|
||||
this.foodPicArray = [];
|
||||
this.timeTween = null;
|
||||
this.needleTween = null;
|
||||
this.choice = 0;
|
||||
cc.fx.GameConfig.GM_INFO.stepTimeList = 0;
|
||||
cc.fx.GameConfig.GM_INFO.successList = [];
|
||||
cc.fx.GameConfig.GM_INFO.level = 0;
|
||||
this.voiceSpriteFrame = this.Plant.getChildByName("icon").getComponent(cc.Sprite).spriteFrame;
|
||||
this.btnReset();
|
||||
}
|
||||
//开始游戏
|
||||
startGame(){
|
||||
cc.tween(this.node.getChildByName("Begin"))
|
||||
.to(0.1,{opacity:0})
|
||||
.to(0.5,{opacity:255})
|
||||
.delay(1)
|
||||
.to(0.5,{opacity:0})
|
||||
.call(() =>{
|
||||
this.createCustom();
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
//根据是否全面屏,做独立适配方面
|
||||
fit(){
|
||||
var jg = cc.fx.GameTool.setFit();
|
||||
if(!jg){
|
||||
this.Btn_Old.y = -450;
|
||||
this.Btn_New.y = -300;
|
||||
}
|
||||
}
|
||||
//创建关卡
|
||||
createCustom(){
|
||||
this.choice = 0;
|
||||
this.Plant.opacity = 0;
|
||||
this.timeNode.getChildByName("time").getComponent(cc.Sprite).fillRange = 0;
|
||||
this.timeNode.getChildByName("needle").angle = 0;
|
||||
if(cc.fx.GameConfig.GM_INFO.level >= cc.fx.GameConfig.LEVEL_INFO[cc.fx.GameConfig.GM_INFO.custom].custom.length){
|
||||
|
||||
setTimeout(() => {
|
||||
cc.director.loadScene("OverScene");
|
||||
}, 1000);
|
||||
return;
|
||||
}
|
||||
this.customData = cc.fx.GameConfig.LEVEL_INFO[cc.fx.GameConfig.GM_INFO.custom].custom[cc.fx.GameConfig.GM_INFO.level];
|
||||
|
||||
let name = this.customData.item;
|
||||
|
||||
//埋点数据设置
|
||||
cc.fx.GameConfig.CLICK_SET("round",cc.fx.GameConfig.GM_INFO.level+1);
|
||||
cc.fx.GameConfig.CLICK_SET("levelConfig",(cc.fx.GameConfig.GM_INFO.custom+1));
|
||||
cc.fx.GameConfig.CLICK_SET("item",name);
|
||||
cc.fx.GameConfig.CLICK_SET("roundType",this.customData.type);
|
||||
|
||||
if(this.customData.type == 1){
|
||||
this.Plant.getChildByName("name").getComponent(cc.Label).string = cc.fx.GameTool.getFoodName(name);
|
||||
name = "prop_"+name;
|
||||
this.Plant.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.FoodPlist["_spriteFrames"][name];
|
||||
this.now_Food = name;
|
||||
cc.tween(this.Plant)
|
||||
.to(0.2,{opacity:255})
|
||||
.call(()=>{
|
||||
this.startTimer();
|
||||
})
|
||||
.start();
|
||||
}
|
||||
else{
|
||||
this.Plant.getChildByName("name").getComponent(cc.Label).string = ""
|
||||
this.Plant.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.voiceSpriteFrame;
|
||||
let audioName = name + "_audio";
|
||||
name = "audio"+ name;
|
||||
this.now_Food = name;
|
||||
cc.fx.AudioManager._instance.playEffect(audioName);
|
||||
cc.tween(this.Plant)
|
||||
.to(0.2,{opacity:255})
|
||||
.call(()=>{
|
||||
this.startTimer();
|
||||
})
|
||||
.start();
|
||||
}
|
||||
//关卡+1
|
||||
cc.fx.GameConfig.GM_INFO.level += 1;
|
||||
|
||||
}
|
||||
//开始转圈倒计时
|
||||
startTimer(){
|
||||
this.startTime = cc.fx.GameTool.getTime();
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = true;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = true;
|
||||
|
||||
// if(this.containsNanana(this.now_Food) == true){
|
||||
// console.log("可以点火");
|
||||
|
||||
// }
|
||||
this.timeNode.getChildByName("time").getComponent(cc.Sprite).fillRange = 0;
|
||||
this.needleTween =
|
||||
cc.tween(this.timeNode.getChildByName("needle"))
|
||||
.to(8,{angle:-360})
|
||||
.start();
|
||||
this.timeTween =
|
||||
cc.tween(this.timeNode.getChildByName("time").getComponent(cc.Sprite))
|
||||
.to(8,{fillRange:1})
|
||||
.call(()=>{
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
|
||||
this.click_Choice(null,null);
|
||||
this.timeTween = null;
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
containsNanana(str) {
|
||||
return /muchai/i.test(str);
|
||||
}
|
||||
|
||||
//新植物按钮
|
||||
click_Choice(customData,data){
|
||||
//关掉计时器 处理逻辑之前,先行关掉按钮开关
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
|
||||
this.timeTween.stop();
|
||||
this.timeTween = null;
|
||||
this.needleTween.stop();
|
||||
this.needleTween = null;
|
||||
//判断是否正确,并把出现的物品存入数组
|
||||
this.result = this.judgingResult();
|
||||
if(data == "Btn_New"){
|
||||
if(this.result == -1){
|
||||
this.result = 1;
|
||||
}
|
||||
else{
|
||||
this.result = -1;
|
||||
}
|
||||
}
|
||||
var tempNode = null;
|
||||
if(data != null) tempNode = this[data]
|
||||
//设置按钮状态
|
||||
this.setBtnState(tempNode,data);
|
||||
//获取反应时间
|
||||
this.setTimeData();
|
||||
//根据答题,设置上传数据
|
||||
this.setData(data);
|
||||
//进行下一关
|
||||
this.nextLevel();
|
||||
}
|
||||
|
||||
//点火按钮
|
||||
click_Ignition(){
|
||||
|
||||
}
|
||||
|
||||
//判断是否有过的结果 type只为new hear see 三选一
|
||||
judgingResult(){
|
||||
let result = -1;
|
||||
let name = this.now_Food.substring(5,this.now_Food.length);
|
||||
//再检查图盘
|
||||
if(this.foodPicArray.length > 0){
|
||||
for(let i=0; i<this.foodPicArray.length;i++){
|
||||
console.log(name,this.foodPicArray[i].substring(5,this.foodPicArray[i].length));
|
||||
if(name == this.foodPicArray[i].substring(5,this.foodPicArray[i].length)){
|
||||
//如果图片里面有
|
||||
result = 2;
|
||||
console.log("出现过",name);
|
||||
cc.fx.GameConfig.CLICK_SET("rightChoice",2);
|
||||
i = 10000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(result != 2 ){
|
||||
console.log("没出险过",name);
|
||||
cc.fx.GameConfig.CLICK_SET("rightChoice",1);
|
||||
//把新生成的存放进数组里
|
||||
this.foodPicArray.push(this.now_Food);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//计算反应时间
|
||||
setTimeData(){
|
||||
this.overTime = cc.fx.GameTool.getTime();
|
||||
let time = this.overTime - this.startTime;
|
||||
//防止溢出
|
||||
if(time < 0 || time > 8000) time = 8000;
|
||||
cc.fx.GameConfig.CLICK_SET("stepTime",time);
|
||||
cc.fx.GameConfig.GM_INFO.stepTimeList += time;
|
||||
}
|
||||
|
||||
//设置按钮状态
|
||||
setBtnState(node,data){
|
||||
if(data == "Btn_New") this.choice = 1;
|
||||
else if(data == "Btn_Old") this.choice = 2;
|
||||
// else if(data == "Btn_See") this.choice = 3;
|
||||
|
||||
if(data == null){
|
||||
this.choice = 0;
|
||||
}
|
||||
|
||||
if(this.choice != cc.fx.GameConfig.CLICK_DATA.rightChoice){
|
||||
if(node){
|
||||
cc.fx.AudioManager._instance.playEffect("err",null);
|
||||
node.getChildByName("err").active = true;
|
||||
node.getChildByName("correct").active = false;
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
if(node){
|
||||
cc.fx.AudioManager._instance.playEffect("yes",null);
|
||||
node.getChildByName("err").active = false;
|
||||
node.getChildByName("correct").active = true;
|
||||
}
|
||||
|
||||
}
|
||||
if(node) node.getChildByName("nomal").active = false;
|
||||
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
|
||||
}
|
||||
|
||||
//下一轮 首先重置按钮状态
|
||||
nextLevel(){
|
||||
cc.tween(this.Plant)
|
||||
.delay(1)
|
||||
.call(()=>{
|
||||
this.btnReset();
|
||||
})
|
||||
.to(0.5,{opacity:0})
|
||||
.call(()=>{
|
||||
this.createCustom();
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
btnReset(){
|
||||
this.Btn_New.getChildByName("nomal").active = true;
|
||||
this.Btn_New.getChildByName("err").active = false;
|
||||
this.Btn_New.getChildByName("correct").active = false;
|
||||
this.Btn_Old.getChildByName("nomal").active = true;
|
||||
this.Btn_Old.getChildByName("err").active = false;
|
||||
this.Btn_Old.getChildByName("correct").active = false;
|
||||
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
|
||||
}
|
||||
|
||||
//返回首页
|
||||
backScene(){
|
||||
cc.director.loadScene("LoadScene");
|
||||
}
|
||||
//下一关,或者重新开始,或者返回上一关,根据level决定
|
||||
reStart(type){
|
||||
|
||||
}
|
||||
//获取时间戳
|
||||
getTime(){
|
||||
const timestamp = new Date().getTime();
|
||||
return timestamp;
|
||||
}
|
||||
//获胜
|
||||
passLevel(){
|
||||
|
||||
}
|
||||
//失败
|
||||
loseLevel(type){
|
||||
|
||||
}
|
||||
|
||||
//如果是倒计时 调用此方法
|
||||
startCountDownTime () {
|
||||
this.timeNode.getChildByName("time").getComponent(cc.Sprite).fillRange = 0;
|
||||
this.timeNode.getChildByName("needle").angle = 0;
|
||||
}
|
||||
//上传每次操作数据
|
||||
setData(data){
|
||||
console.log("进入上传埋点");
|
||||
if(data == "Btn_New") this.choice = 1;
|
||||
else if(data == "Btn_Old") this.choice = 2;
|
||||
// else if(data == "Btn_See") this.choice = 3;
|
||||
else if(data == null){
|
||||
this.choice = 0;
|
||||
cc.fx.GameConfig.CLICK_SET("stepTime",5000);
|
||||
}
|
||||
var jg = false;
|
||||
if(this.choice == cc.fx.GameConfig.CLICK_DATA.rightChoice){
|
||||
jg = true;
|
||||
cc.fx.GameConfig.GM_INFO.successList.push(jg);
|
||||
}
|
||||
cc.fx.GameConfig.CLICK_SET("choice",this.choice);
|
||||
cc.fx.GameConfig.CLICK_SET("success",jg);
|
||||
console.log("进入GameTool.setGameData",cc.fx.GameConfig.CLICK_DATA);
|
||||
cc.fx.GameTool.setGameData();
|
||||
}
|
||||
//上传排行榜数据
|
||||
gameOver(time){
|
||||
cc.fx.GameTool.setRank(time);
|
||||
this.node.getChildByName("GameOver").active = true;
|
||||
this.node.getChildByName("GameOver").opacity = 0;
|
||||
cc.tween(this.node.getChildByName("GameOver"))
|
||||
.to(0.4,{opacity:255})
|
||||
.delay(2)
|
||||
.to(0.4,{opacity:50})
|
||||
.call(() =>{
|
||||
cc.director.loadScene("OverScene");
|
||||
})
|
||||
.start()
|
||||
}
|
||||
|
||||
onEnable () {
|
||||
// cc.fx.Notifications.on("clickSun", this.clickSun, this);
|
||||
}
|
||||
onDisable () {
|
||||
// cc.fx.Notifications.off("clickSun", this.clickSun);
|
||||
}
|
||||
update (dt) {
|
||||
}
|
||||
}
|
10
assets/Script/GameManager.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "b0432040-dbde-438c-839c-ba2b5d18a3b5",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
151
assets/Script/GameOver.ts
Normal file
|
@ -0,0 +1,151 @@
|
|||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class NewClass extends cc.Component {
|
||||
@property(cc.Label)
|
||||
count: cc.Label = null;
|
||||
@property(cc.Label)
|
||||
time: cc.Label = null;
|
||||
@property(cc.Sprite)
|
||||
finishiTime: cc.Sprite = null;
|
||||
listData: any;
|
||||
selfData: any;
|
||||
accuracy:number;
|
||||
|
||||
// onLoad () {}
|
||||
start () {
|
||||
this.count.string = 0 + "";
|
||||
this.init();
|
||||
|
||||
// success_${today}_${code}_${matchedReferrer.gameId}
|
||||
// const today = new Date().toLocaleDateString();
|
||||
// const data = "success_${today}_${code}_${matchedReferrer.gameId}"
|
||||
|
||||
}
|
||||
//初始化数据
|
||||
init(){
|
||||
//展示准确率
|
||||
this.showAccuracy();
|
||||
//展示完成时间
|
||||
this.showFinishiTime();
|
||||
//上传排行榜
|
||||
this.setRank();
|
||||
//删除本关卡
|
||||
setTimeout(() => {
|
||||
cc.fx.GameTool.getCustom(true);
|
||||
}, 100);
|
||||
|
||||
var urlNow = window.location.href;
|
||||
if(this.containsTrain(urlNow)){
|
||||
this.node.getChildByName("btn").getChildByName("again").active = false;
|
||||
this.node.getChildByName("btn").getChildByName("rank").active = false;
|
||||
this.node.getChildByName("btn").getChildByName("finishi").active = true;
|
||||
this.setLocalStorage();
|
||||
|
||||
}
|
||||
else{
|
||||
this.node.getChildByName("btn").getChildByName("again").active = true;
|
||||
this.node.getChildByName("btn").getChildByName("rank").active = true;
|
||||
this.node.getChildByName("btn").getChildByName("finishi").active = false;
|
||||
}
|
||||
}
|
||||
|
||||
setLocalStorage(){
|
||||
const today = new Date().toLocaleDateString();
|
||||
var name = `success_${today}_${cc.fx.GameConfig.GM_INFO.scode}_${cc.fx.GameConfig.GM_INFO.gameId}`
|
||||
localStorage.setItem(name, JSON.stringify({success:true}));
|
||||
}
|
||||
|
||||
setRank(){
|
||||
let data = {
|
||||
"totleTimes": cc.fx.GameConfig.GM_INFO.stepTimeList,
|
||||
"accuracy": this.accuracy,
|
||||
}
|
||||
cc.fx.GameTool.setRank(data);
|
||||
}
|
||||
|
||||
showFinishiTime(){
|
||||
cc.tween(this.finishiTime)
|
||||
.delay(1.5)
|
||||
.to(0.5,{fillRange:1})
|
||||
.start();
|
||||
cc.tween(this.time.node)
|
||||
.delay(1.7)
|
||||
.to(0.3,{opacity:255})
|
||||
.call(()=>{
|
||||
this.conversionTime();
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
conversionTime(){
|
||||
var minute = 0;
|
||||
var second = 0;
|
||||
let obj = {a:100};
|
||||
let time = parseInt(cc.fx.GameConfig.GM_INFO.stepTimeList/1000 + "");
|
||||
cc.tween(obj)
|
||||
// .delay(0.1)
|
||||
.to(1,{a:time},{
|
||||
progress: (start,end,current,ratio)=>{
|
||||
current = end*ratio;
|
||||
second = current.toFixed(0);
|
||||
if(second >= 60){
|
||||
minute = parseInt(second/60+"");
|
||||
second -= 60*minute;
|
||||
}
|
||||
this.time.string = minute + "分" + second + "秒";
|
||||
}
|
||||
})
|
||||
.call(()=>{
|
||||
this.node.getChildByName("btn").active = true;
|
||||
cc.tween(this.node.getChildByName("btn"))
|
||||
.to(0.3,{opacity:255})
|
||||
.start();
|
||||
})
|
||||
.start()
|
||||
}
|
||||
|
||||
showAccuracy(){
|
||||
this.accuracy = parseInt(cc.fx.GameConfig.GM_INFO.successList.length/
|
||||
cc.fx.GameConfig.GM_INFO.level*100+"");
|
||||
|
||||
console.log("答对的个数:",cc.fx.GameConfig.GM_INFO.successList.length);
|
||||
console.log("总数:",cc.fx.GameConfig.GM_INFO.level);
|
||||
console.log("准确率:",this.accuracy);
|
||||
let obj = {a:100};
|
||||
cc.tween(obj)
|
||||
.delay(0.5)
|
||||
.to(1,{a:this.accuracy},{
|
||||
progress: (start,end,current,ratio)=>{
|
||||
current = end*ratio;
|
||||
current = current.toFixed(0);
|
||||
this.count.string = current + "";
|
||||
}
|
||||
})
|
||||
.start()
|
||||
}
|
||||
|
||||
jumpFinishi(){
|
||||
let url = "https://train.sparkus.cn/poster/game/" + cc.fx.GameConfig.GM_INFO.scode + "?suc=1";
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
//判断来源
|
||||
containsTrain(str) {
|
||||
return /from=train/i.test(str);
|
||||
}
|
||||
|
||||
//打开排行榜
|
||||
openRank(){
|
||||
cc.director.loadScene("RankScene");
|
||||
}
|
||||
//重新开始玩
|
||||
again(){
|
||||
cc.director.loadScene("GameScene");
|
||||
}
|
||||
|
||||
update(dt: number): void {
|
||||
// this.count.string = this.accuracy + "";
|
||||
}
|
||||
}
|
10
assets/Script/GameOver.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "805c69df-dfdf-4759-97ae-5a7341f424c7",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
48
assets/Script/GameScene.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
|
||||
// cc.Class({
|
||||
// extends: cc.Component,
|
||||
// properties: {
|
||||
// localTest: {
|
||||
// default: false,
|
||||
// tooltip: '本地测试时勾选,避免tz_url和Configure报错,提交前勾掉'
|
||||
// },
|
||||
// clientTest: {
|
||||
// default: false,
|
||||
// tooltip: '客户端测试时勾选,展示版本标记方便测试区分,上线前勾掉'
|
||||
// },
|
||||
// clientTestVersion: {
|
||||
// default: '',
|
||||
// tooltip: '版本标记'
|
||||
// },
|
||||
// testVersion: cc.Label,
|
||||
// score: cc.Label,
|
||||
// double_hit: cc.Node,
|
||||
// add: cc.Node,
|
||||
// add2: cc.Node,
|
||||
// double_title: cc.Node,
|
||||
// count_time: cc.Node,
|
||||
// beginNode: cc.Node,
|
||||
// ball_nomal: [cc.SpriteFrame],
|
||||
// bg_nomal: [cc.SpriteFrame],
|
||||
// ball_light: [cc.SpriteFrame],
|
||||
// kuang_Frame: [cc.SpriteFrame],
|
||||
// daojishi: cc.Label,
|
||||
// pause_anniu: cc.Sprite,
|
||||
// mask: cc.Node,
|
||||
|
||||
// flashUI: {
|
||||
// default: null,
|
||||
// type: cc.SpriteAtlas
|
||||
// },
|
||||
// },
|
||||
|
||||
// onLoad() {
|
||||
|
||||
|
||||
// },
|
||||
|
||||
// update(dt) {
|
||||
|
||||
// },
|
||||
|
||||
// });
|
10
assets/Script/GameScene.js.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "e8b23e56-8d10-44ad-a8f0-2e637cc45533",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
298
assets/Script/GuideManager.ts
Normal file
|
@ -0,0 +1,298 @@
|
|||
import AudioManager from "./module/Music/AudioManager";
|
||||
|
||||
// 主游戏控制类
|
||||
const {ccclass, property} = cc._decorator;
|
||||
@ccclass
|
||||
export default class GuideManager extends cc.Component {
|
||||
|
||||
@property(cc.Node)
|
||||
Tip: cc.Node = null;
|
||||
|
||||
@property(cc.SpriteAtlas)
|
||||
FoodPlist: cc.SpriteAtlas = null;
|
||||
|
||||
@property(cc.Node)
|
||||
Btn_New: cc.Node = null;
|
||||
@property(cc.Node)
|
||||
Btn_Old: cc.Node = null;
|
||||
|
||||
|
||||
@property(cc.Node)
|
||||
Plant: cc.Node = null;
|
||||
voiceSpriteFrame: cc.SpriteFrame; //是否可点击
|
||||
|
||||
needleTween: cc.Tween<cc.Sprite>;
|
||||
func: () => void;
|
||||
|
||||
custom:number;
|
||||
|
||||
now_Food: string; //当前关卡名字信息
|
||||
customData: { item: string; type: number; right: number; }[];
|
||||
choice: number;
|
||||
|
||||
onLoad () {
|
||||
this.custom = 1;
|
||||
}
|
||||
|
||||
start () {
|
||||
this.fit();
|
||||
}
|
||||
|
||||
fit(){
|
||||
var jg = cc.fx.GameTool.setFit();
|
||||
if(!jg){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//初始化数据
|
||||
init(){
|
||||
this.voiceSpriteFrame = this.Plant.getChildByName("icon").getComponent(cc.Sprite).spriteFrame;``
|
||||
this.node.getChildByName("nextBtn").active = false;
|
||||
let name = cc.fx.GameConfig.GM_INFO.gameId + "_guide";
|
||||
if(cc.fx.StorageMessage.getStorage(name) != null)
|
||||
cc.fx.GameConfig.GM_INFO.guide = cc.fx.StorageMessage.getStorage(name);
|
||||
if(cc.fx.GameConfig.GM_INFO.guide == false){
|
||||
this.node.getChildByName("jumpBtn").active = true;
|
||||
cc.tween(this.node.getChildByName("jumpBtn"))
|
||||
.to(0.35,{opacity:255})
|
||||
.start();
|
||||
}
|
||||
|
||||
let tip = cc.fx.tipType.tipOne;
|
||||
|
||||
let label = this.node.getChildByName("tip1").getComponent(cc.Label);
|
||||
cc.fx.GameTool.typingAni(label,tip,this.startGame.bind(this),this);
|
||||
|
||||
this.initData();
|
||||
}
|
||||
|
||||
initData(){
|
||||
this.customData = [
|
||||
{
|
||||
"item": "putao",
|
||||
"type": 1,
|
||||
"right":1,
|
||||
},
|
||||
{
|
||||
"item": "taozi",
|
||||
"type": 2,
|
||||
"right":1,
|
||||
},
|
||||
{
|
||||
"item": "putao",
|
||||
"type": 2,
|
||||
"right":2,
|
||||
},
|
||||
{
|
||||
"item": "taozi",
|
||||
"type": 1,
|
||||
"right":2,
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
passVoice(){
|
||||
// cc.fx.AudioManager._instance.playMusicGame();
|
||||
let voice = this.node.getChildByName("voiceTip");
|
||||
voice.getChildByName("startBtn").getComponent(cc.Button).interactable = false;
|
||||
voice.getChildByName("playBtn").getComponent(cc.Button).interactable = false;
|
||||
cc.tween(voice)
|
||||
.to(0.5,{opacity:0})
|
||||
.call(()=>{
|
||||
voice.active = false;
|
||||
})
|
||||
.start();
|
||||
setTimeout(() => {
|
||||
this.init();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
playVoice(){
|
||||
cc.fx.AudioManager._instance.playEffect("taozi_audio",null);
|
||||
}
|
||||
|
||||
jumpClick(){
|
||||
cc.director.loadScene("GameScene");
|
||||
}
|
||||
|
||||
nextClick(){
|
||||
//第一步
|
||||
this.node.getChildByName("nextBtn").active = false;
|
||||
let label = this.node.getChildByName("tip1").getComponent(cc.Label);
|
||||
|
||||
if(this.custom == 0){
|
||||
cc.tween(this.node.getChildByName("tip1"))
|
||||
.to(0.2,{opacity:0})
|
||||
.call(() =>{
|
||||
label.string = "";
|
||||
})
|
||||
.to(0.1,{opacity:255})
|
||||
.call(() =>{
|
||||
let tip = cc.fx.tipType.tipTwo;
|
||||
cc.fx.GameTool.typingAni(label,tip,this.startGame.bind(this),this);
|
||||
})
|
||||
.start();
|
||||
}
|
||||
else if(this.custom == 1){
|
||||
this.node.getChildByName("nextBtn").active = false;
|
||||
this.node.getChildByName("jumpBtn").active = false;
|
||||
cc.tween(this.node.getChildByName("tip1"))
|
||||
.to(0.2,{opacity:0})
|
||||
.call(() =>{
|
||||
label.string = "";
|
||||
this.nextLevel();
|
||||
})
|
||||
.start();
|
||||
}
|
||||
this.custom += 1;
|
||||
}
|
||||
|
||||
nextLevel(){
|
||||
this.choice = 0;
|
||||
this.Btn_Old.active = true;
|
||||
this.Btn_New.active = true;
|
||||
|
||||
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
|
||||
|
||||
let name = this.customData[this.custom-2].item;
|
||||
if(this.customData[this.custom-2].type == 1){
|
||||
this.Plant.getChildByName("name").getComponent(cc.Label).string = cc.fx.GameTool.getFoodName(name);
|
||||
name = "prop_"+name;
|
||||
this.Plant.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.FoodPlist["_spriteFrames"][name];
|
||||
this.now_Food = name;
|
||||
cc.tween(this.Plant)
|
||||
.to(0.2,{opacity:255})
|
||||
.call(()=>{
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = true;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = true;
|
||||
})
|
||||
.start();
|
||||
}
|
||||
else{
|
||||
this.Plant.getChildByName("name").getComponent(cc.Label).string = ""
|
||||
this.Plant.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = this.voiceSpriteFrame;
|
||||
let audioName = name + "_audio";
|
||||
name = "audio"+ name;
|
||||
this.now_Food = name;
|
||||
cc.fx.AudioManager._instance.playEffect(audioName,null);
|
||||
cc.tween(this.Plant)
|
||||
.to(0.2,{opacity:255})
|
||||
.call(()=>{
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = true;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = true;
|
||||
|
||||
})
|
||||
.start();
|
||||
}
|
||||
//关卡+1
|
||||
|
||||
}
|
||||
|
||||
//新植物按钮
|
||||
click_Btn(customData,data){
|
||||
//关掉计时器 处理逻辑之前,先行关掉按钮开关
|
||||
if(data == "Btn_New"){
|
||||
this.choice = 1;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
}
|
||||
else if(data == "Btn_Old"){
|
||||
this.choice = 2;
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
}
|
||||
|
||||
let target = this[data];
|
||||
var label = this.Tip.getChildByName("content").getComponent(cc.Label);
|
||||
//正确
|
||||
if(this.choice == this.customData[this.custom-2].right){
|
||||
cc.fx.AudioManager._instance.playEffect("yes",null);
|
||||
this.Tip.stopAllActions();
|
||||
this.Tip.active = false;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
|
||||
target.getChildByName("err").active = false;
|
||||
target.getChildByName("correct").active = true;
|
||||
setTimeout(() => {
|
||||
this.Btn_New.getChildByName("nomal").active = true;
|
||||
this.Btn_New.getChildByName("err").active = false;
|
||||
this.Btn_New.getChildByName("correct").active = false;
|
||||
this.Btn_Old.getChildByName("nomal").active = true;
|
||||
this.Btn_Old.getChildByName("err").active = false;
|
||||
this.Btn_Old.getChildByName("correct").active = false;
|
||||
|
||||
this.Btn_Old.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
this.Btn_New.getChildByName("nomal").getComponent(cc.Button).interactable = false;
|
||||
|
||||
this.custom += 1;
|
||||
if(this.custom >= 6){
|
||||
this.node.getChildByName("againBtn").active = true;
|
||||
this.node.getChildByName("startBtn").active = true;
|
||||
this.Btn_Old.active = false;
|
||||
this.Btn_New.active = false;
|
||||
cc.fx.GameConfig.GM_INFO.guide = false;
|
||||
let name = cc.fx.GameConfig.GM_INFO.gameId + "_guide";
|
||||
cc.fx.StorageMessage.setStorage(name,cc.fx.GameConfig.GM_INFO.guide);
|
||||
}
|
||||
else this.nextLevel();
|
||||
}, 1000);
|
||||
}
|
||||
else{
|
||||
cc.fx.AudioManager._instance.playEffect("yes",null);
|
||||
var tipTemp = '葡萄刚才出现过呢'
|
||||
this.Tip.active = true;
|
||||
target.getChildByName("err").active = true;
|
||||
target.getChildByName("correct").active = false;
|
||||
|
||||
switch((this.custom-2)){
|
||||
case 0:
|
||||
tipTemp = "这是这局游戏第一次出现葡萄";
|
||||
break;
|
||||
case 1:
|
||||
tipTemp = "这是这局游戏第一次出现桃子";
|
||||
break;
|
||||
case 2:
|
||||
tipTemp = '这不是这局游戏第一次出现葡萄';
|
||||
break;
|
||||
case 3:
|
||||
tipTemp = "这不是这局游戏第一次出现桃子";
|
||||
break;
|
||||
}
|
||||
label.string = tipTemp;
|
||||
this.Tip.opacity = 255;
|
||||
this.Tip.stopAllActions();
|
||||
var self = this;
|
||||
var action = cc.callFunc(function(){
|
||||
self.Tip.active = false;
|
||||
})
|
||||
this.Tip.runAction(cc.sequence(cc.delayTime(2),cc.fadeIn(0.5),action))
|
||||
}
|
||||
}
|
||||
|
||||
//开始游戏
|
||||
startGame(){
|
||||
this.node.getChildByName("nextBtn").active = true;
|
||||
cc.tween(this.node.getChildByName("nextBtn"))
|
||||
.to(0.35,{opacity:255})
|
||||
.start();
|
||||
}
|
||||
|
||||
againClick(){
|
||||
cc.director.loadScene("GuideScene");
|
||||
}
|
||||
|
||||
|
||||
|
||||
onEnable () {
|
||||
// cc.fx.Notifications.on("clickSun", this.clickSun, this);
|
||||
}
|
||||
onDisable () {
|
||||
// cc.fx.Notifications.off("clickSun", this.clickSun);
|
||||
}
|
||||
update (dt) {
|
||||
}
|
||||
}
|
10
assets/Script/GuideManager.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "effe29e5-3670-444b-81fd-b45338af7f19",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
72
assets/Script/Load.ts
Normal file
|
@ -0,0 +1,72 @@
|
|||
import { WeChat } from "./module/Share/share";
|
||||
|
||||
const {ccclass, property, requireComponent} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class NewClass extends cc.Component {
|
||||
|
||||
@property(false)
|
||||
localTest: boolean = false;
|
||||
|
||||
@property("")
|
||||
clientTestVersion: string = "1.0.0";
|
||||
|
||||
@property(cc.Label)
|
||||
testVersion: cc.Label = null;
|
||||
|
||||
start () {
|
||||
|
||||
cc.debug.setDisplayStats(false);
|
||||
window.initMgr();
|
||||
// @ts-ignore
|
||||
if(window.wx !== null && window.wx !== undefined) WeChat.setShare(location.href);
|
||||
cc.fx.GameConfig.init(this.localTest);
|
||||
this.testVersion.string = this.clientTestVersion;
|
||||
|
||||
var urlNow = window.location.href;
|
||||
if(this.containsTrain(urlNow)){
|
||||
console.log("无排行版本");
|
||||
this.node.getChildByName("Rank").active = false;
|
||||
}
|
||||
else{
|
||||
console.log("有排行版本");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//判断来源
|
||||
containsTrain(str) {
|
||||
return /from=train/i.test(str);
|
||||
}
|
||||
|
||||
setRank(){
|
||||
let data = {
|
||||
"totleTimes": 8759,
|
||||
"accuracy": 80,
|
||||
}
|
||||
cc.fx.GameTool.setRank(data);
|
||||
}
|
||||
|
||||
//开始游戏,跳转至引导页面
|
||||
startGame(){
|
||||
|
||||
setTimeout(() => {
|
||||
cc.director.loadScene("GuideScene");
|
||||
}, 100);
|
||||
// cc.director.loadScene("GuideScene");
|
||||
}
|
||||
//备用,用来测试跳转 指定关卡
|
||||
clickBtn(event,data){
|
||||
// cc.fx.GameConfig.GM_INFO.custom = parseInt(data);
|
||||
cc.director.loadScene("GameScene");
|
||||
}
|
||||
//打开排行榜
|
||||
openRank(){
|
||||
setTimeout(() => {
|
||||
cc.director.loadScene("RankScene");
|
||||
}, 100);
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
}
|
||||
}
|
10
assets/Script/Load.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "454ad829-851a-40ea-8ab9-941e828357ca",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
154
assets/Script/RankManager.ts
Normal file
|
@ -0,0 +1,154 @@
|
|||
|
||||
import List from "./module/RankList/List";
|
||||
const { ccclass, property } = cc._decorator;
|
||||
//排行榜
|
||||
@ccclass
|
||||
export default class RankManager extends cc.Component {
|
||||
@property(cc.Node) //用户上方头像
|
||||
Player: cc.Node = null;
|
||||
@property(cc.Node) //用户最下方个人信息
|
||||
selfNode: cc.Node = null;
|
||||
@property(cc.Sprite) //用户头像换图
|
||||
phone: cc.Sprite = null;
|
||||
private rankList: List; //排行榜
|
||||
tween: cc.Tween<cc.Node>; //最上方用户头像动画
|
||||
listData: any; //总列表信息
|
||||
selfData: any; //自己信息
|
||||
rankNumber: number; //用户自己排名 有可能不在排行榜内99+
|
||||
rankTotal: number; //获取排行榜用户数量 现在为100
|
||||
|
||||
onLoad() {
|
||||
this.init();
|
||||
}
|
||||
//初始化数据
|
||||
init(){
|
||||
this.rankList = cc.find("ScrollView", this.node).getComponent(List);
|
||||
this.Player.getChildByName("rank").active = false;
|
||||
this.listData = [];
|
||||
this.selfData = null;
|
||||
this.rankNumber = 100;
|
||||
this.rankTotal= 100;
|
||||
this.selfNode.opacity = 0;
|
||||
this.fit();
|
||||
}
|
||||
|
||||
start() {
|
||||
this.Player.active = false;
|
||||
this.getRank();
|
||||
}
|
||||
|
||||
fit(){
|
||||
var jg = cc.fx.GameTool.setFit();
|
||||
if(!jg){
|
||||
this.node.getChildByName("ScrollView").getChildByName("view").height = 800;
|
||||
}
|
||||
}
|
||||
|
||||
//调用获取排行榜接口
|
||||
getRank(){
|
||||
let dataFile = {
|
||||
length:100
|
||||
}
|
||||
cc.fx.GameTool.getRank(dataFile,data =>this.getRankData(data));
|
||||
}
|
||||
//实际设置排行数据
|
||||
getRankData(data){
|
||||
if(data){
|
||||
//console.log(data);
|
||||
cc.fx.GameTool.getRankData(data,this,6);
|
||||
this.setPic(this.selfData.pic);
|
||||
}
|
||||
}
|
||||
//返回按钮
|
||||
backClick(){
|
||||
cc.director.loadScene("LoadScene");
|
||||
}
|
||||
//最上方用户动画
|
||||
playerAction(){
|
||||
//-254 377 210 453
|
||||
this.Player.getChildByName("rank").active = false;
|
||||
let time = 1;
|
||||
this.tween = cc.tween(this.Player)
|
||||
.to(2,{position:cc.v3(232,446,0)})
|
||||
.call(() =>{
|
||||
this.Player.getChildByName("rank").active = true;
|
||||
this.Player.getChildByName("rank").getChildByName("number")
|
||||
.getComponent(cc.Label).string = parseInt(time*100 + "") + "%";
|
||||
})
|
||||
.start();
|
||||
if(this.listData.length > 0){
|
||||
time = (this.listData.length - this.rankNumber)/this.listData.length;
|
||||
}
|
||||
|
||||
if(this.listData.length > 0){
|
||||
if(this.listData.length >= 99){
|
||||
if(this.rankNumber >= 99){
|
||||
time = (Math.random()*49+1)/100
|
||||
}
|
||||
else time = (this.listData.length - this.rankNumber)/this.listData.length;
|
||||
}
|
||||
else{
|
||||
if(this.rankNumber > 99){
|
||||
time = 0
|
||||
}
|
||||
else time = (this.listData.length - this.rankNumber)/this.listData.length;
|
||||
}
|
||||
}
|
||||
else{
|
||||
time = 0;
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if(this.tween)this.tween.stop();
|
||||
this.Player.getChildByName("rank").active = true;
|
||||
this.Player.getChildByName("rank").getChildByName("number")
|
||||
.getComponent(cc.Label).string = parseInt(time*100 + "") + "%";
|
||||
}, time*2000);
|
||||
|
||||
}
|
||||
//设置头像 处理的逻辑比较多,不用公共类的了
|
||||
public setPic(pic){
|
||||
this.phone.node.parent.getChildByName("icon").active = false;
|
||||
this.phone.node.active = false;
|
||||
this.Player.active = true;
|
||||
this.Player.opacity = 0;
|
||||
this.Player.getChildByName("mask").getChildByName("icon").active = false;
|
||||
this.Player.getChildByName("mask").getChildByName("phone").active = false;
|
||||
fetch(pic)
|
||||
.then(response => {
|
||||
return response.headers.get('Content-Length');
|
||||
})
|
||||
.then(errNo => {
|
||||
if(errNo == "5093"){
|
||||
this.phone.node.parent.getChildByName("icon").active = true;
|
||||
this.Player.getChildByName("mask").getChildByName("icon").active = true;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
// console.error('Error fetching X-Info:', error);
|
||||
});
|
||||
var self = this;
|
||||
cc.assetManager.loadRemote(pic, {ext:'.png'},(err, texture:cc.Texture2D) => {
|
||||
self.Player.opacity = 255;
|
||||
if(texture){
|
||||
self.phone.node.active = true;
|
||||
self.phone.spriteFrame = new cc.SpriteFrame(texture);
|
||||
self.Player.getChildByName("mask").getChildByName("icon").active = false;
|
||||
self.Player.getChildByName("mask").getChildByName("phone").active = true;
|
||||
self.Player.getChildByName("mask").getChildByName("phone").getComponent(cc.Sprite)
|
||||
.spriteFrame = new cc.SpriteFrame(texture);
|
||||
setTimeout(() => {
|
||||
self.playerAction();
|
||||
}, 500);
|
||||
}
|
||||
else{
|
||||
self.Player.getChildByName("mask").getChildByName("icon").active = true;
|
||||
setTimeout(() => {
|
||||
self.playerAction();
|
||||
}, 500);
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
10
assets/Script/RankManager.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "e74a9f7d-2031-4e69-bcb2-9998174088b2",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/module.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "eaa8b84d-69d0-4170-9f7d-8179ea948cde",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/module/Config.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "8848cd9b-8115-456d-a656-2abcda1dadbe",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
2687
assets/Script/module/Config/GameConfig.ts
Normal file
10
assets/Script/module/Config/GameConfig.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "c5692be7-8703-45e4-9f67-23b54d290356",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/module/Crypto.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "13a0b173-d59e-4a9d-b5e3-4dbe4dc37cc1",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
247
assets/Script/module/Crypto/HttpUtil.ts
Normal file
|
@ -0,0 +1,247 @@
|
|||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
import CryptoJS = require('./crypto-js.min.js'); //引用AES源码js
|
||||
|
||||
const BASE_URL = "https://api.sparkus.cn";
|
||||
//只负责网络接口 次类只负责和后端交互,不负责处理数据 数据处理在GameTool
|
||||
@ccclass
|
||||
export default class HttpUtil extends cc.Component {
|
||||
//排行榜
|
||||
static async rankData(type,callback,data): Promise<any> {
|
||||
const time = Math.floor((new Date().getTime()) / 1000)
|
||||
const url = HttpUtil.apiSign(`/api/get/rank/data?gameId=${config.gameId}&dataType=${type}&time=${time}`, data)
|
||||
this.post(url,data,callback,0);
|
||||
}
|
||||
|
||||
static async uploadUserLogData(data,callback): Promise<any> {
|
||||
const url = '/log/collect/data';
|
||||
this.post(url,data,callback,3);
|
||||
}
|
||||
//暂时用不到
|
||||
static async getUserRecord(data,callback): Promise<any> {
|
||||
const time = Math.floor((new Date().getTime()) / 1000)
|
||||
const url = HttpUtil.apiSign(`/api/get/user/data?gameId=${config.gameId}&time=${time}`, data)
|
||||
this.post(url,data,callback,0);
|
||||
}
|
||||
|
||||
static async get(url, callback,count) {
|
||||
let repeat = count?count:0;
|
||||
const response = await this.fetchData(url, null, 'GET',repeat);
|
||||
callback && callback(response);
|
||||
}
|
||||
|
||||
static async post(url, data, callback,count) {
|
||||
let repeat = count?count:0;
|
||||
const response = await this.fetchData(url, data, 'POST',repeat);
|
||||
callback && callback(response);
|
||||
}
|
||||
|
||||
static async fetchData(url, data, method,repeat) {
|
||||
const fullUrl = `${BASE_URL}${url}`;
|
||||
const headers = { 'Content-Type': 'application/json' };
|
||||
const options = {
|
||||
method,
|
||||
headers,
|
||||
body: data ? JSON.stringify(data) : null,
|
||||
};
|
||||
|
||||
try {
|
||||
var response = await this.fetchWithTimeout(fullUrl,options);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP_______________error! status: ${response.status}`);
|
||||
}
|
||||
return await response.json();
|
||||
} catch (error) {
|
||||
console.error('Fetch_______________error:', error);
|
||||
if(repeat > 0){
|
||||
repeat -= 1;
|
||||
const timeOut = (3-repeat)*5000;
|
||||
setTimeout(async () => {
|
||||
response = await this.fetchData(url, data, method,repeat);
|
||||
}, timeOut);
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static async fetchWithTimeout(resource, options = {}) {
|
||||
const controller = new AbortController();
|
||||
const id = setTimeout(() => controller.abort(), 5000);
|
||||
const response = await fetch(resource, {
|
||||
...options,
|
||||
signal: controller.signal
|
||||
});
|
||||
clearTimeout(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url {string} 接口地址
|
||||
* @param params {object} 需要加密的参数对象
|
||||
*/
|
||||
static apiSign(url: string, params = {}) {
|
||||
|
||||
let convertUrl = url.trim()
|
||||
if (convertUrl.indexOf('?') === -1) {
|
||||
convertUrl += '?'
|
||||
}
|
||||
|
||||
// 传入参数转换拼接字符串
|
||||
let postStr = getQueryString(params)
|
||||
|
||||
const signedStr = genSignStr(convertUrl, postStr)
|
||||
const encryptStr = `sign=${signedStr}`
|
||||
|
||||
let encryptSignStr = fxCry.encryptByDES(encryptStr, config.secretKey)
|
||||
encryptSignStr = encodeURIComponent(encryptSignStr)
|
||||
|
||||
return `${urlencode(convertUrl)}&_p=${encryptSignStr}`
|
||||
}
|
||||
}
|
||||
|
||||
function responseHandler(response: { data: any }) {
|
||||
return response.data
|
||||
}
|
||||
// 响应拦截器
|
||||
// Rq.interceptors.response.use(responseHandler)
|
||||
const config = {
|
||||
gameId: "100014",
|
||||
secretKey: "9ymg8ppY",
|
||||
EK:"hui231%1"
|
||||
};
|
||||
|
||||
interface CrypotoType {
|
||||
encryptByDES: any
|
||||
decryptByDES: any
|
||||
hmacSha256: any
|
||||
}
|
||||
|
||||
class Crypoto implements CrypotoType {
|
||||
// 加密的向明值,自己根据项目实际情况定,需要跟后端开发保持一致
|
||||
private keyHex = this.getHetKey()
|
||||
private getHetKey() {
|
||||
return CryptoJS.enc.Utf8.parse(config.EK);
|
||||
}
|
||||
|
||||
/** DES加密 */
|
||||
encryptByDES(message: string, secret?: string) {
|
||||
if(!message) {
|
||||
return message
|
||||
}
|
||||
const key = secret? CryptoJS.enc.Utf8.parse(secret): this.keyHex
|
||||
const encrypted = CryptoJS.DES.encrypt(message, key, {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
return encrypted.toString()
|
||||
}
|
||||
|
||||
/** DES解密 */
|
||||
decryptByDES(message: string, secret?: string) {
|
||||
const key = secret? CryptoJS.enc.Utf8.parse(secret): this.keyHex
|
||||
|
||||
const decrypted = CryptoJS.DES.decrypt({
|
||||
ciphertext: CryptoJS.enc.Base64.parse(message)
|
||||
}, key, {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
})
|
||||
|
||||
return decrypted.toString(CryptoJS.enc.Utf8)
|
||||
}
|
||||
|
||||
/** hmacSHA256加密 */
|
||||
hmacSha256(message: string, secret?: string) {
|
||||
const keyHex = secret? CryptoJS.enc.Utf8.parse(secret): this.keyHex
|
||||
|
||||
const hash = CryptoJS.HmacSHA256(message, keyHex);
|
||||
return hash.toString()
|
||||
}
|
||||
|
||||
/** hmacSHA256验证 */
|
||||
verifyHmacSha256(message: string, signature: string) {
|
||||
const hash = CryptoJS.HmacSHA256(message, this.keyHex);
|
||||
return hash.toString() === signature
|
||||
}
|
||||
|
||||
/** CBC加密 */
|
||||
encryptCBC(word: string) {
|
||||
if (!word) {
|
||||
return word;
|
||||
}
|
||||
const srcs = CryptoJS.enc.Utf8.parse(word);
|
||||
const encrypted = CryptoJS.AES.encrypt(srcs, this.keyHex, {
|
||||
iv: this.keyHex,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.ZeroPadding
|
||||
});
|
||||
return encrypted.toString();
|
||||
}
|
||||
|
||||
/** CBC解密 */
|
||||
decryptCBC(word: string) {
|
||||
if (!word) {
|
||||
return word;
|
||||
}
|
||||
const encryptedHexStr = CryptoJS.enc.Hex.parse(word);
|
||||
const srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr);
|
||||
const decrypt = CryptoJS.AES.decrypt(srcs, this.keyHex, {
|
||||
iv: this.keyHex,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.ZeroPadding
|
||||
});
|
||||
const decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
|
||||
return decryptedStr.toString();
|
||||
}
|
||||
}
|
||||
const fxCry = new Crypoto();
|
||||
|
||||
function isEmpty(data) {
|
||||
return data === "" || data === null || data === undefined || data.length === 0 || JSON.stringify(data) == "{}"
|
||||
}
|
||||
|
||||
function getQueryString(obj) {
|
||||
// 首先对对象的键进行排序并过滤空值
|
||||
const sortedKeys = Object.keys(obj).sort();
|
||||
const sortedObj = {};
|
||||
for (let i = 0; i < sortedKeys.length; i++) {
|
||||
if (isEmpty(obj[sortedKeys[i]])) {
|
||||
continue;
|
||||
}
|
||||
sortedObj[sortedKeys[i]] = obj[sortedKeys[i]];
|
||||
}
|
||||
|
||||
// 然后将排序后的对象转换为查询字符串
|
||||
const params = [];
|
||||
for (const key in sortedObj) {
|
||||
params.push(`${encodeURIComponent(key)}=${encodeURIComponent(sortedObj[key])}`);
|
||||
}
|
||||
return params.join('&');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 组装签名字符串
|
||||
* @param string url: 请求地址
|
||||
* @param string postStr: post参数的a=1&b=2
|
||||
* @returns
|
||||
*/
|
||||
|
||||
function genSignStr(url: string, postStr: string): string {
|
||||
let lessUrl = url.replace('?', '')
|
||||
lessUrl = lessUrl + "&" + postStr
|
||||
return encodeURIComponent(fxCry.hmacSha256(lessUrl))
|
||||
}
|
||||
// 对参数进行统一urlencode
|
||||
function urlencode(url: string): string {
|
||||
const [baseUrl, queryString] = url.split("?", 2);
|
||||
const params = new URLSearchParams(queryString);
|
||||
return `${baseUrl}?${params.toString()}`;
|
||||
}
|
||||
|
||||
|
||||
|
10
assets/Script/module/Crypto/HttpUtil.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "771a3d9a-4013-4654-a777-fbaea0c93280",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
3
assets/Script/module/Crypto/crypto-js.min.js
vendored
Normal file
10
assets/Script/module/Crypto/crypto-js.min.js.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "e64e1a97-c93f-4257-ab34-80341d8ff79d",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/module/GameStart.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "b4e113c6-a987-4133-bfa0-3355d8ab4bd1",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
119
assets/Script/module/GameStart/GameAppStart.ts
Normal file
|
@ -0,0 +1,119 @@
|
|||
import { GameConfig } from "../Config/GameConfig";
|
||||
import HttpUtil from "../Crypto/HttpUtil";
|
||||
import AudioManager from "../Music/AudioManager";
|
||||
import { Notifications } from "../Notification/Notification";
|
||||
import { StorageMessage } from "../Storage/Storage";
|
||||
import { GameTool } from "../Tool/GameTool";
|
||||
|
||||
|
||||
window.initMgr = function() {
|
||||
if(cc.fx)
|
||||
{
|
||||
return;
|
||||
}
|
||||
cc.fx = {};
|
||||
console.log("1初始化");
|
||||
|
||||
//基础状态信息
|
||||
cc.fx.StateInfo = {
|
||||
debugMode: true,
|
||||
networkConnected: true, //网络状态
|
||||
networkType: 'none', //网络类型
|
||||
isOnForeground: true //当前是否是在前台
|
||||
};
|
||||
|
||||
//应用系统信息
|
||||
//配置文件
|
||||
|
||||
cc.fx.GameConfig = GameConfig;
|
||||
cc.fx.HttpUtil = HttpUtil;
|
||||
cc.fx.GameTool = GameTool;
|
||||
cc.fx.AudioManager = AudioManager;
|
||||
cc.fx.Notifications = Notifications;
|
||||
cc.fx.StorageMessage = StorageMessage;
|
||||
|
||||
cc.fx.ShareInfo = {
|
||||
queryId : -1 //分享id
|
||||
};
|
||||
|
||||
/*
|
||||
* 客户端埋点分享类型
|
||||
*/
|
||||
cc.fx.BurialShareType = {
|
||||
Default : "default", //默认分享类型,分享到群
|
||||
Invite : "invite", // 邀请好友
|
||||
|
||||
DailyInviteRoomJoin:'invite_join_room', //邀请好友加入
|
||||
DailyInviteFriend : 'invite_friend', // 日常邀请好友
|
||||
DailyInviteGroup : 'invate_group', // 日常分享群
|
||||
DailyInviteGroupAlive: 'invate_alive', //日常分享群复活
|
||||
DailyInviteGroupReward: 'invate_rewared',//分享奖励翻倍
|
||||
DailyInviteGroupBox: 'invate_box', //宝箱分享奖励
|
||||
DailyInviteGroupBall: 'invate_ball', //分享领取球球
|
||||
|
||||
MatchResult : 'matchResult', // 比赛结算分享
|
||||
MatchFix5: 'MatchFix5', // 5元红包赛
|
||||
MatchFix20: 'MatchFix20', // 20元红包赛
|
||||
MatchFix100: 'MatchFix100', // 100元红包赛
|
||||
MatchFix500: 'MatchFix500', // 500元红包赛
|
||||
NewerRedEnvelope: 'newerRedEnvelope', // 新手红包
|
||||
CoinRoomResult: 'coinRoomResult', // 金币桌结算
|
||||
HighRate : "highRate",//高倍分享
|
||||
CoinRoomWinStreak: 'coinRoomWinStreak', // 连胜
|
||||
CoinRoomBankruptcy1: 'coinRoomBankruptcy1', // 金币桌破产
|
||||
CoinRoomBankruptcy2: 'coinRoomBankruptcy2', // 金币桌破产
|
||||
CoinRoomBankruptcy3: 'coinRoomBankruptcy3', // 金币桌破产
|
||||
};
|
||||
|
||||
/*
|
||||
* 分享到哪儿给奖励 group frined all
|
||||
*/
|
||||
cc.fx.ShareWhereReward = {
|
||||
Group :"group", //微信群
|
||||
Friend : "friend",//好友
|
||||
All : "all", //不区分
|
||||
};
|
||||
|
||||
//用于存储消息的ID
|
||||
cc.fx.storageType = cc.Enum({
|
||||
storageTypeCustom: 1000101, //用于存储关卡等级
|
||||
});
|
||||
|
||||
//用于存储提示语 按照步骤提示
|
||||
cc.fx.tipType = cc.Enum({
|
||||
tipOne: '神农氏回到家中,开始整理今天收集来的物品。当拿出或说出一种植物时,请告诉他这是新植物还是已经出现过的植物。',
|
||||
tipTwo: '', //用于存储关卡等级
|
||||
tipErrNew: '这是这局游戏第一次出现{植物}',
|
||||
tipErrOld: '{植物}刚才出现过呢',
|
||||
tipErrHear: '上次遇到{植物}时,似乎不是听到的吧',
|
||||
tipErrSee: '上次遇到{植物}时,似乎不是看到的吧',
|
||||
tipErrLast: '之前确实看到过{植物},但最近一次似乎不是看到的呢',
|
||||
|
||||
});
|
||||
//暂时不用
|
||||
// cc.fx.clickStatEventType = {
|
||||
// clickStatEventTypeVideoAD : 20173201,//视频播放完成
|
||||
// clickStatEventTypeClickAdVideo : 20173202,//视频播放为完成
|
||||
// clickStatEventTypeBannerAD : 20173203,//banner播放为完成
|
||||
// clickStatEventTypeUserFrom : 99990001,//用户来源
|
||||
// clickStatEventTypeShare : 99990002,//用户分享
|
||||
// clickStatEventTypeClickAdBtn : 99990007,//点击分流icon
|
||||
// clickStatEventTypeBannerAD2 : 67890033, // banner广告干预
|
||||
// clickStatEventTypeSubmitVersionInfo : 9999, //上报微信版本及基础库信息
|
||||
// clickStatEventTypeClickFirstAd : 99990003, //分流icon显示
|
||||
// clickStatEventTypeClickSecondAd : 99990004, //玩家点击分流按钮
|
||||
// clickStatEventTypeWxLoginStart : 10001,//微信登录开始
|
||||
// clickStatEventTypeWxLoginSuccess : 10002,//微信登录成功
|
||||
// clickStatEventTypeWxLoginFailed : 10003,//微信登录失败
|
||||
// clickStatEventTypeAuthorizationStart : 10003,//授权开始
|
||||
// clickStatEventTypeAuthorizationSuccess : 10004,//授权成功
|
||||
// clickStatEventTypeAuthorizationFailed : 10005,//授权失败
|
||||
// clickStatEventTypeLoginSDKStart : 10007,//登录SDK开始
|
||||
// clickStatEventTypeLoginSDKSuccess : 10008,//登录SDK成功
|
||||
// clickStatEventTypeLoginSDKFailed : 10009,//登录SDK时失败
|
||||
// clickStatEventTypeTCP_Start : 10009,//TCP连接开始
|
||||
// clickStatEventTypeTCP_Success : 10010,//TCP连接成功
|
||||
// clickStatEventTypeTCP_Failed : 10011,//TCP连接失败
|
||||
// };
|
||||
|
||||
};
|
10
assets/Script/module/GameStart/GameAppStart.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "61d4c718-db3b-4b31-8221-f16bea3cf030",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/module/Music.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "0487cacb-b94a-4ab6-a301-b6402ab0ac5d",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
301
assets/Script/module/Music/AudioManager.ts
Normal file
|
@ -0,0 +1,301 @@
|
|||
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
@ccclass
|
||||
export default class AudioManager extends cc.Component {
|
||||
static _instance: any;
|
||||
//背景音乐
|
||||
@property(cc.AudioClip)
|
||||
audioGameBgm0: cc.AudioClip = null;
|
||||
|
||||
@property(cc.AudioClip)
|
||||
baishao_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
cha_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
chixiaodou_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
danggui_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
danshen_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
dazao_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
gancao_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
ganjiang_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
gouqi_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
jingjie_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
jinju_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
lizhi_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
lizi_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
longyan_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
moli_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
muchai_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
mudan_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
mulan_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
pugongying_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
putao_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
renshen_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
taozi_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
zhuye_audio: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
err: cc.AudioClip = null;
|
||||
@property(cc.AudioClip)
|
||||
yes: cc.AudioClip = null;
|
||||
|
||||
|
||||
mAudioMap: {};
|
||||
bgMusicVolume: number;
|
||||
effectMusicVolume: number;
|
||||
mMusicSwitch: number;
|
||||
mEffectSwitch: number;
|
||||
brickSound: any;
|
||||
reward: boolean;
|
||||
finish: boolean;
|
||||
rewardCount: number;
|
||||
mMusicKey: any;
|
||||
|
||||
onLoad() {
|
||||
if (AudioManager._instance == null) {
|
||||
AudioManager._instance = this;
|
||||
cc.game.addPersistRootNode(this.node);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
window.addEventListener('backbutton', this.onBackButton, false);
|
||||
|
||||
// 监听浏览器的后退按钮点击事件
|
||||
window.addEventListener('popstate', this.onBackButton, false);
|
||||
|
||||
window.addEventListener('onDisable', this.onExit, false);
|
||||
|
||||
// 防止浏览器后退行为
|
||||
// history.pushState(null, null, location.href);
|
||||
// window.addEventListener('popstate', function(event) {
|
||||
// history.pushState(null, null, location.href);
|
||||
// });
|
||||
|
||||
this.reward = false;
|
||||
this.finish = false;
|
||||
this.rewardCount = 0;
|
||||
this.ctor();
|
||||
|
||||
this.preload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ctor () {
|
||||
this.mAudioMap = {};
|
||||
/**
|
||||
* 默认音量大小
|
||||
* @type {number}
|
||||
*/
|
||||
this.bgMusicVolume = 0.1;
|
||||
this.effectMusicVolume = 1;
|
||||
|
||||
this.mMusicSwitch = 1;
|
||||
this.mEffectSwitch = 1;
|
||||
}
|
||||
|
||||
onBackButton(){
|
||||
let data = [{status:"user_exit",location:"button"}];
|
||||
cc.fx.HttpUtil.uploadUserLogData(data,null);
|
||||
}
|
||||
|
||||
onExit(){
|
||||
let data = [{status:"user_exit",location:"exit"}];
|
||||
cc.fx.HttpUtil.uploadUserLogData(data,null);
|
||||
}
|
||||
|
||||
play (audioSource, loop, callback, isBgMusic) {
|
||||
// if (isBgMusic && !this.mMusicSwitch) return;
|
||||
// if (!isBgMusic && !this.mEffectSwitch) return;
|
||||
var volume = isBgMusic ? this.bgMusicVolume : this.effectMusicVolume;
|
||||
|
||||
// if (cc.sys.isBrowser) {
|
||||
// if(audioSource == this.brickSound){
|
||||
// volume = 0.1;
|
||||
// }
|
||||
volume = 1;
|
||||
cc.audioEngine.setEffectsVolume(1);
|
||||
cc.audioEngine.setMusicVolume(1);
|
||||
|
||||
var context = cc.audioEngine.playEffect(audioSource, loop);
|
||||
if (callback){
|
||||
cc.audioEngine.setFinishCallback(context, function(){
|
||||
callback.call(this);
|
||||
}.bind(this));
|
||||
}
|
||||
// cc.wwx.OutPut.log('play audio effect isBrowser: ' + context.src);
|
||||
|
||||
this.mAudioMap[audioSource] = context;
|
||||
return audioSource;
|
||||
// } else {
|
||||
// return audioSource;
|
||||
// }
|
||||
}
|
||||
|
||||
save () {
|
||||
// cc.wwx.Storage.setItem(cc.wwx.Storage.Key_Setting_Music_Volume, this.mMusicSwitch);
|
||||
// cc.wwx.Storage.setItem(cc.wwx.Storage.Key_Setting_Effect_Volume, this.mEffectSwitch);
|
||||
}
|
||||
|
||||
// static get Instance()
|
||||
// {
|
||||
// if (this._instance == null)
|
||||
// {
|
||||
// this._instance = new AudioManager();
|
||||
// }
|
||||
// return this._instance;
|
||||
// }
|
||||
|
||||
preload () {
|
||||
if (!(cc.sys.platform === cc.sys.WECHAT_GAME)) { return; }
|
||||
|
||||
var musics = [
|
||||
this.audioGameBgm0,
|
||||
];
|
||||
musics.forEach(function(path) {
|
||||
})
|
||||
}
|
||||
|
||||
getAudioMusicSwitch()
|
||||
{
|
||||
return this.mMusicSwitch;
|
||||
|
||||
}
|
||||
getAudioEffectSwitch()
|
||||
{
|
||||
return this.mEffectSwitch;
|
||||
}
|
||||
trunAudioSound(on)
|
||||
{
|
||||
this.switchMusic(on);
|
||||
this.switchEffect(on)
|
||||
}
|
||||
switchMusic (on) {
|
||||
if (this.mMusicSwitch != (on?1:0))
|
||||
{
|
||||
this.mMusicSwitch = 1-this.mMusicSwitch;
|
||||
// this.save();
|
||||
}
|
||||
if(on)
|
||||
{
|
||||
this.playMusicGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.stopMusic();
|
||||
}
|
||||
}
|
||||
switchEffect (on) {
|
||||
if (this.mEffectSwitch != (on?1:0)){
|
||||
this.mEffectSwitch = 1-this.mEffectSwitch;
|
||||
// this.save();
|
||||
|
||||
}
|
||||
}
|
||||
onHide () {
|
||||
cc.audioEngine.pauseAll();
|
||||
}
|
||||
|
||||
onShow () {
|
||||
cc.audioEngine.resumeAll();
|
||||
}
|
||||
|
||||
//播放音效
|
||||
playEffect(name,callback){
|
||||
if(this[name])
|
||||
return this.play(this[name], false,callback,this.mEffectSwitch);
|
||||
}
|
||||
playMusic (key, callback, loop) {
|
||||
loop = typeof loop == 'undefined' || loop ? true : false;
|
||||
this.stopMusic();
|
||||
this.mMusicKey = this.play(key, loop, callback, true);
|
||||
}
|
||||
/**
|
||||
* 游戏背景音乐
|
||||
*/
|
||||
playMusicGame () {
|
||||
// this.playMusic(this.audioGameBgm0,{},true);
|
||||
}
|
||||
/**
|
||||
* 停止背景音乐播放
|
||||
*/
|
||||
stopMusic () {
|
||||
// cc.wwx.OutPut.log('stopMusic audio effect wx: ' + this.mMusicKey);
|
||||
|
||||
var context = this.mAudioMap[this.mMusicKey];
|
||||
|
||||
if (typeof(context) != 'undefined') {
|
||||
if (cc.sys.isBrowser) {
|
||||
cc.audioEngine.stop(context);
|
||||
} else {
|
||||
context.stop();
|
||||
}
|
||||
cc.audioEngine.stop(context);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 游戏开始音效
|
||||
*
|
||||
*/
|
||||
playGameStart()
|
||||
{
|
||||
|
||||
}
|
||||
/*
|
||||
* 失败的游戏结束
|
||||
*/
|
||||
playGameOver()
|
||||
{
|
||||
|
||||
}
|
||||
/*
|
||||
* 成功的游戏结束
|
||||
*/
|
||||
playGameResultFailed()
|
||||
{
|
||||
|
||||
}
|
||||
/*
|
||||
* 成功的游戏结束
|
||||
*/
|
||||
playGameResultSuccess()
|
||||
{
|
||||
|
||||
}
|
||||
/**
|
||||
* 报警的音效
|
||||
*/
|
||||
|
||||
/**
|
||||
* 按钮
|
||||
*/
|
||||
playAudioButton () {
|
||||
// return this.play(this.audioButtonClick, false,null,this.mEffectSwitch);
|
||||
}
|
||||
};
|
||||
|
||||
// export { AudioManager };
|
10
assets/Script/module/Music/AudioManager.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "58403fe7-d7a2-426b-9b19-84d3236731a8",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/module/Notification.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "ff6560d9-676d-42ad-8ec7-e44acb84ad9e",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
45
assets/Script/module/Notification/Notification.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
//全局通知
|
||||
var Notifications = {
|
||||
_eventMap: [],
|
||||
on: function (masgId, callback, target) {
|
||||
if (this._eventMap[masgId] === undefined) {
|
||||
this._eventMap[masgId] = [];
|
||||
}
|
||||
this._eventMap[masgId].push({ callback: callback, target: target });
|
||||
},
|
||||
|
||||
emit: function (masgId, parameter) {
|
||||
let array = this._eventMap[masgId];
|
||||
if (array === undefined) return;
|
||||
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let element = array[i];
|
||||
if (element) element.callback.call(element.target, parameter);
|
||||
}
|
||||
},
|
||||
|
||||
off: function (masgId, callback) {
|
||||
let array = this._eventMap[masgId];
|
||||
if (array === undefined) return;
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let element = array[i];
|
||||
if (element && element.callback === callback) {
|
||||
array[i] = undefined;
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
offMasgId: function (masgId) {
|
||||
this._eventMap[masgId] = undefined;
|
||||
},
|
||||
|
||||
removeAllMsg: function () {
|
||||
for (let k in this._eventMap) {
|
||||
if (this._eventMap[k]) {
|
||||
this.offMasgId(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
export { Notifications };
|
10
assets/Script/module/Notification/Notification.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "55403563-1a5a-4f2f-9eb8-82c762641837",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/module/RankList.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "d3520299-33dc-43d2-b522-d424efb5575d",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
76
assets/Script/module/RankList/ItemRender.ts
Normal file
|
@ -0,0 +1,76 @@
|
|||
|
||||
import List, { ListType } from "./List";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class ItemRender extends cc.Component {
|
||||
/**数据 */
|
||||
public data:any = null;
|
||||
/**索引 0表示第一项*/
|
||||
public itemIndex:number = 0;
|
||||
|
||||
/**数据改变时调用 */
|
||||
public dataChanged(){
|
||||
let name = cc.fx.GameTool.subName(this.data.name,6);
|
||||
this.node.getChildByName("rankLab").getComponent(cc.Label).string = this.data.rank + "";
|
||||
this.node.getChildByName("nameLab").getComponent(cc.Label).string = name + "";
|
||||
this.node.getChildByName("totalLab").getComponent(cc.Label).string = this.data.total + "%";
|
||||
let timeTemp = cc.fx.GameTool.getTimeShenNong(this.data.time);
|
||||
this.node.getChildByName("timeLab").getComponent(cc.Label).string = timeTemp + "";
|
||||
this.node.getChildByName("rank").getChildByName("one").active = false;
|
||||
this.node.getChildByName("rank").getChildByName("two").active = false;
|
||||
this.node.getChildByName("rank").getChildByName("three").active = false;
|
||||
if(this.data.rank == 1){
|
||||
this.node.getChildByName("rank").getChildByName("one").active = true;
|
||||
this.node.getChildByName("rankLab").active = false;
|
||||
}
|
||||
else if(this.data.rank == 2){
|
||||
this.node.getChildByName("rank").getChildByName("two").active = true;
|
||||
this.node.getChildByName("rankLab").active = false;
|
||||
}
|
||||
else if(this.data.rank == 3){
|
||||
this.node.getChildByName("rank").getChildByName("three").active = true;
|
||||
this.node.getChildByName("rankLab").active = false;
|
||||
}else{
|
||||
this.node.getChildByName("rankLab").active = true;
|
||||
}
|
||||
this.setPic();
|
||||
}
|
||||
|
||||
public setPic(){
|
||||
this.node.getChildByName("pic").getChildByName("icon").active = false;
|
||||
this.node.getChildByName("pic").getChildByName("pic").active= false;
|
||||
var self = this;
|
||||
let url = this.data.pic;
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
return response.headers.get('Content-Length');
|
||||
})
|
||||
|
||||
.then(errNo => {
|
||||
// console.log(this.data.rank,'X-Info:', errNo); // 输出X-ErrNo的值
|
||||
if(errNo == "5093"){
|
||||
// console.log(this.data.rank,"没头像");
|
||||
this.node.getChildByName("pic").getChildByName("icon").active = true;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
// console.error('Error fetching X-Info:', error);
|
||||
});
|
||||
cc.assetManager.loadRemote(url, {ext:'.png'},(err, texture:cc.Texture2D) => {
|
||||
if(texture){
|
||||
this.node.getChildByName("pic").getChildByName("pic").active= true;
|
||||
var sprite = this.node.getChildByName("pic").getChildByName("pic").getComponent(cc.Sprite);
|
||||
sprite.spriteFrame = new cc.SpriteFrame(texture);
|
||||
// console.log(this.data.rank,"设置头像成功",err);
|
||||
}
|
||||
else{
|
||||
// console.log("设置头像失败",url);
|
||||
// console.log(err,texture)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
10
assets/Script/module/RankList/ItemRender.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "ca0f9934-a015-436e-9402-f8e30d4c5de6",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
592
assets/Script/module/RankList/List.ts
Normal file
|
@ -0,0 +1,592 @@
|
|||
// Learn TypeScript:
|
||||
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
|
||||
// Learn Attribute:
|
||||
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
|
||||
// Learn life-cycle callbacks:
|
||||
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
||||
|
||||
import ItemRender from "./ItemRender"
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
/**列表排列方式 */
|
||||
export enum ListType {
|
||||
/**水平排列 */
|
||||
Horizontal = 1,
|
||||
/**垂直排列 */
|
||||
Vertical = 2,
|
||||
/**网格排列 */
|
||||
Grid = 3
|
||||
}
|
||||
|
||||
/**网格布局中的方向 */
|
||||
export enum StartAxisType {
|
||||
/**水平排列 */
|
||||
Horizontal = 1,
|
||||
/**垂直排列 */
|
||||
Vertical = 2,
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* 根据cocos_example的listView改动而来
|
||||
* @author chenkai 2020.7.8
|
||||
* @example
|
||||
* 1.创建cocos的ScrollView组件,添加List,设置List属性即可
|
||||
*
|
||||
*/
|
||||
@ccclass
|
||||
export default class List extends cc.Component {
|
||||
|
||||
//==================== 属性面板 =========================
|
||||
/**列表选项 */
|
||||
@property({ type: cc.Node, tooltip: "列表项" })
|
||||
public itemRender: cc.Node = null;
|
||||
|
||||
/**排列方式 */
|
||||
@property({ type: cc.Enum(ListType), tooltip: "排列方式" })
|
||||
public type: ListType = ListType.Vertical;
|
||||
|
||||
/**网格布局中的方向 */
|
||||
@property({ type: cc.Enum(StartAxisType), tooltip: "网格布局中的方向", visible() { return this.type == ListType.Grid } })
|
||||
public startAxis: StartAxisType = StartAxisType.Horizontal;
|
||||
|
||||
/**列表项之间X间隔 */
|
||||
@property({ type: cc.Integer, tooltip: "列表项X间隔", visible() { return (this.type == ListType.Horizontal || this.type == ListType.Grid) } })
|
||||
public spaceX: number = 0;
|
||||
|
||||
/**列表项之间Y间隔 */
|
||||
@property({ type: cc.Integer, tooltip: "列表项Y间隔", visible() { return this.type == ListType.Vertical || this.type == ListType.Grid } })
|
||||
public spaceY: number = 0;
|
||||
|
||||
/**上间距 */
|
||||
@property({ type: cc.Integer, tooltip: "上间距", visible() { return (this.type == ListType.Vertical || this.type == ListType.Grid) } })
|
||||
public padding_top: number = 0;
|
||||
|
||||
/**下间距 */
|
||||
@property({ type: cc.Integer, tooltip: "下间距", visible() { return (this.type == ListType.Vertical || this.type == ListType.Grid) } })
|
||||
public padding_buttom: number = 0;
|
||||
|
||||
/**左间距 */
|
||||
@property({ type: cc.Integer, tooltip: "左间距", visible() { return (this.type == ListType.Horizontal || this.type == ListType.Grid) } })
|
||||
public padding_left: number = 0;
|
||||
|
||||
|
||||
|
||||
@property(cc.Integer)
|
||||
public _padding: number = 0;
|
||||
|
||||
/**右间距 */
|
||||
@property({ type: cc.Integer, tooltip: "右间距", visible() { return (this.type == ListType.Horizontal || this.type == ListType.Grid) } })
|
||||
public padding_right: number = 0;
|
||||
|
||||
//====================== 滚动容器 ===============================
|
||||
/**列表滚动容器 */
|
||||
public scrollView: cc.ScrollView = null;
|
||||
/**scrollView的内容容器 */
|
||||
private content: cc.Node = null;
|
||||
|
||||
//======================== 列表项 ===========================
|
||||
/**列表项数据 */
|
||||
private itemDataList: Array<any> = [];
|
||||
/**应创建的实例数量 */
|
||||
private spawnCount: number = 0;
|
||||
/**存放列表项实例的数组 */
|
||||
private itemList: Array<cc.Node> = [];
|
||||
/**item的高度 */
|
||||
private itemHeight: number = 0;
|
||||
/**item的宽度 */
|
||||
private itemWidth: number = 0;
|
||||
/**存放不再使用中的列表项 */
|
||||
private itemPool: Array<cc.Node> = [];
|
||||
|
||||
//======================= 计算参数 ==========================
|
||||
/**距离scrollView中心点的距离,超过这个距离的item会被重置,一般设置为 scrollVIew.height/2 + item.heigt/2 + space,因为这个距离item正好超出scrollView显示范围 */
|
||||
private halfScrollView: number = 0;
|
||||
/**上一次content的X值,用于和现在content的X值比较,得出是向左还是向右滚动 */
|
||||
private lastContentPosX: number = 0;
|
||||
/**上一次content的Y值,用于和现在content的Y值比较,得出是向上还是向下滚动 */
|
||||
private lastContentPosY: number = 0;
|
||||
/**网格行数 */
|
||||
private gridRow: number = 0;
|
||||
/**网格列数 */
|
||||
private gridCol: number = 0;
|
||||
/**刷新时间,单位s */
|
||||
private updateTimer: number = 0;
|
||||
/**刷新间隔,单位s */
|
||||
private updateInterval: number = 0.1;
|
||||
/**是否滚动容器 */
|
||||
private bScrolling: boolean = false;
|
||||
/**刷新的函数 */
|
||||
private updateFun: Function = function () { };
|
||||
|
||||
onLoad() {
|
||||
this.itemHeight = this.itemRender.height;
|
||||
this.itemWidth = this.itemRender.width;
|
||||
this.scrollView = this.node.getComponent(cc.ScrollView);
|
||||
this.content = this.scrollView.content;
|
||||
this.content.anchorX = 0;
|
||||
this.content.anchorY = 1;
|
||||
this.content.removeAllChildren();
|
||||
this.scrollView.node.on("scrolling", this.onScrolling, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表数据 (列表数据复制使用,如果列表数据改变,则需要重新设置一遍数据)
|
||||
* @param itemDataList item数据列表
|
||||
*/
|
||||
public setData(itemDataList: Array<any>) {
|
||||
this.itemDataList = itemDataList.slice();
|
||||
this.updateContent();
|
||||
|
||||
}
|
||||
|
||||
/**计算列表的各项参数 */
|
||||
private countListParam() {
|
||||
let dataLen = this.itemDataList.length;
|
||||
if (this.type == ListType.Vertical) {
|
||||
this.scrollView.horizontal = false;
|
||||
this.scrollView.vertical = true;
|
||||
this.content.width = this.content.parent.width;
|
||||
this.content.height = dataLen * this.itemHeight + (dataLen - 1) * this.spaceY + this.padding_top + this.padding_buttom;
|
||||
this.spawnCount = Math.round(this.scrollView.node.height / (this.itemHeight + this.spaceY)) + 2; //计算创建的item实例数量,比当前scrollView容器能放下的item数量再加上2个
|
||||
this.halfScrollView = this.scrollView.node.height / 2 + this.itemHeight / 2 + this.spaceY; //计算bufferZone,item的显示范围
|
||||
this.updateFun = this.updateV;
|
||||
} else if (this.type == ListType.Horizontal) {
|
||||
this.scrollView.horizontal = true;
|
||||
this.scrollView.vertical = false;
|
||||
this.content.width = dataLen * this.itemWidth + (dataLen - 1) * this.spaceX + this.padding_left + this.padding_right;
|
||||
this.content.height = this.content.parent.height;
|
||||
this.spawnCount = Math.round(this.scrollView.node.width / (this.itemWidth + this.spaceX)) + 2;
|
||||
this.halfScrollView = this.scrollView.node.width / 2 + this.itemWidth / 2 + this.spaceX;
|
||||
this.updateFun = this.udpateH;
|
||||
} else if (this.type == ListType.Grid) {
|
||||
if (this.startAxis == StartAxisType.Vertical) {
|
||||
this.scrollView.horizontal = false;
|
||||
this.scrollView.vertical = true;
|
||||
this.content.width = this.content.parent.width;
|
||||
//如果left和right间隔过大,导致放不下一个item,则left和right都设置为0,相当于不生效
|
||||
if (this.padding_left + this.padding_right + this.itemWidth + this.spaceX > this.content.width) {
|
||||
this.padding_left = 0;
|
||||
this.padding_right = 0;
|
||||
console.error("padding_left或padding_right过大");
|
||||
}
|
||||
|
||||
this.gridCol = Math.floor((this.content.width - this.padding_left - this.padding_right) / (this.itemWidth + this.spaceX));
|
||||
this.gridRow = Math.ceil(dataLen / this.gridCol);
|
||||
this.content.height = this.gridRow * this.itemHeight + (this.gridRow - 1) * this.spaceY + this.padding_top + this.padding_buttom;
|
||||
this.spawnCount = Math.round(this.scrollView.node.height / (this.itemHeight + this.spaceY)) * this.gridCol + this.gridCol * 2;
|
||||
this.halfScrollView = this.scrollView.node.height / 2 + this.itemHeight / 2 + this.spaceY;
|
||||
this.updateFun = this.updateGrid_V;
|
||||
} else if (this.startAxis == StartAxisType.Horizontal) {
|
||||
this.scrollView.horizontal = true;
|
||||
this.scrollView.vertical = false;
|
||||
//计算高间隔
|
||||
this.content.height = this.content.parent.height;
|
||||
//如果left和right间隔过大,导致放不下一个item,则left和right都设置为0,相当于不生效
|
||||
if (this.padding_top + this.padding_buttom + this.itemHeight + this.spaceY > this.content.height) {
|
||||
this.padding_top = 0;
|
||||
this.padding_buttom = 0;
|
||||
console.error("padding_top或padding_buttom过大");
|
||||
}
|
||||
|
||||
this.gridRow = Math.floor((this.content.height - this.padding_top - this.padding_buttom) / (this.itemHeight + this.spaceY));
|
||||
this.gridCol = Math.ceil(dataLen / this.gridRow);
|
||||
this.content.width = this.gridCol * this.itemWidth + (this.gridCol - 1) * this.spaceX + this.padding_left + this.padding_right;
|
||||
this.spawnCount = Math.round(this.scrollView.node.width / (this.itemWidth + this.spaceX)) * this.gridRow + this.gridRow * 2;
|
||||
this.halfScrollView = this.scrollView.node.width / 2 + this.itemWidth / 2 + this.spaceX;
|
||||
this.updateFun = this.updateGrid_H;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建列表
|
||||
* @param startIndex 起始显示的数据索引 0表示第一项
|
||||
* @param offset scrollView偏移量
|
||||
*/
|
||||
private createList(startIndex: number, offset: cc.Vec2) {
|
||||
//当需要显示的数据长度 > 虚拟列表长度, 删除最末尾几个数据时,列表需要重置位置到scrollView最底端
|
||||
if (this.itemDataList.length > this.spawnCount && (startIndex + this.spawnCount - 1) >= this.itemDataList.length) {
|
||||
startIndex = this.itemDataList.length - this.spawnCount;
|
||||
offset = this.scrollView.getMaxScrollOffset();
|
||||
|
||||
//当需要显示的数据长度 <= 虚拟列表长度, 隐藏多余的虚拟列表项
|
||||
} else if (this.itemDataList.length <= this.spawnCount) {
|
||||
startIndex = 0;
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.spawnCount; i++) {
|
||||
let item: cc.Node;
|
||||
//需要显示的数据索引在数据范围内,则item实例显示出来
|
||||
if (i + startIndex < this.itemDataList.length) {
|
||||
if (this.itemList[i] == null) {
|
||||
item = this.getItem();
|
||||
this.itemList.push(item);
|
||||
item.parent = this.content;
|
||||
} else {
|
||||
item = this.itemList[i];
|
||||
}
|
||||
//需要显示的数据索引超过了数据范围,则item实例隐藏起来
|
||||
} else {
|
||||
//item实例数量 > 需要显示的数据量
|
||||
if (this.itemList.length > (this.itemDataList.length - startIndex)) {
|
||||
item = this.itemList.pop();
|
||||
item.removeFromParent();
|
||||
this.itemPool.push(item);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
let itemRender: ItemRender = item.getComponent(ItemRender);
|
||||
itemRender.itemIndex = i + startIndex;
|
||||
itemRender.data = this.itemDataList[i + startIndex];
|
||||
itemRender.dataChanged();
|
||||
|
||||
if (this.type == ListType.Vertical) {
|
||||
//因为content的锚点X是0,所以item的x值是content.with/2表示居中,锚点Y是1,所以item的y值从content顶部向下是0到负无穷。所以item.y= -item.height/2时,是在content的顶部。
|
||||
item.setPosition(this.content.width / 2, -item.height * (0.5 + i + startIndex) - this.spaceY * (i + startIndex) - this.padding_top);
|
||||
} else if (this.type == ListType.Horizontal) {
|
||||
item.setPosition(item.width * (0.5 + i + startIndex) + this.spaceX * (i + startIndex) + this.padding_left, -this.content.height / 2);
|
||||
} else if (this.type == ListType.Grid) {
|
||||
if (this.startAxis == StartAxisType.Vertical) {
|
||||
var row = Math.floor((i + startIndex) / this.gridCol);
|
||||
var col = (i + startIndex) % this.gridCol;
|
||||
item.setPosition(item.width * (0.5 + col) + this.spaceX * col + this.padding_left, -item.height * (0.5 + row) - this.spaceY * row - this.padding_top);
|
||||
item.opacity = 255;
|
||||
} else if (this.startAxis == StartAxisType.Horizontal) {
|
||||
var row = (i + startIndex) % this.gridRow;
|
||||
var col = Math.floor((i + startIndex) / this.gridRow);
|
||||
item.setPosition(item.width * (0.5 + col) + this.spaceX * col + this.padding_left, -item.height * (0.5 + row) - this.spaceY * row - this.padding_top);
|
||||
item.opacity = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.scrollView.scrollToOffset(offset);
|
||||
}
|
||||
|
||||
/**获取一个列表项 */
|
||||
private getItem() {
|
||||
if (this.itemPool.length == 0) {
|
||||
return cc.instantiate(this.itemRender);
|
||||
} else {
|
||||
return this.itemPool.pop();
|
||||
}
|
||||
}
|
||||
|
||||
update(dt) {
|
||||
if (this.bScrolling == false) {
|
||||
return;
|
||||
}
|
||||
this.updateTimer += dt;
|
||||
if (this.updateTimer < this.updateInterval) {
|
||||
return;
|
||||
}
|
||||
this.updateTimer = 0;
|
||||
this.bScrolling = false;
|
||||
this.updateFun();
|
||||
}
|
||||
|
||||
onScrolling() {
|
||||
this.bScrolling = true;
|
||||
}
|
||||
|
||||
/**垂直排列 */
|
||||
private updateV() {
|
||||
let items = this.itemList;
|
||||
let item;
|
||||
let bufferZone = this.halfScrollView;
|
||||
let isUp = this.scrollView.content.y > this.lastContentPosY;
|
||||
let offset = (this.itemHeight + this.spaceY) * items.length;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
item = items[i];
|
||||
let viewPos = this.getPositionInView(item);
|
||||
if (isUp) {
|
||||
//item上滑时,超出了scrollView上边界,将item移动到下方复用,item移动到下方的位置必须不超过content的下边界
|
||||
if (viewPos.y > bufferZone && item.y - offset - this.padding_buttom > -this.content.height) {
|
||||
let itemRender: ItemRender = item.getComponent(ItemRender);
|
||||
let itemIndex = itemRender.itemIndex + items.length;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
itemRender.data = this.itemDataList[itemIndex];
|
||||
itemRender.dataChanged();
|
||||
item.y = item.y - offset;
|
||||
}
|
||||
} else {
|
||||
//item下滑时,超出了scrollView下边界,将item移动到上方复用,item移动到上方的位置必须不超过content的上边界
|
||||
if (viewPos.y < -bufferZone && item.y + offset + this.padding_top < 0) {
|
||||
let itemRender: ItemRender = item.getComponent(ItemRender);
|
||||
let itemIndex = itemRender.itemIndex - items.length;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
itemRender.data = this.itemDataList[itemIndex];
|
||||
itemRender.dataChanged();
|
||||
item.y = item.y + offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.lastContentPosY = this.scrollView.content.y;
|
||||
}
|
||||
|
||||
/**水平排列 */
|
||||
private udpateH() {
|
||||
let items = this.itemList;
|
||||
let item;
|
||||
let bufferZone = this.halfScrollView;
|
||||
let isRight = this.scrollView.content.x > this.lastContentPosX;
|
||||
let offset = (this.itemWidth + this.spaceX) * items.length;
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
item = items[i];
|
||||
let viewPos = this.getPositionInView(item);
|
||||
if (isRight) {
|
||||
//item右滑时,超出了scrollView右边界,将item移动到左方复用,item移动到左方的位置必须不超过content的左边界
|
||||
if (viewPos.x > bufferZone && item.x - offset - this.padding_left > 0) {
|
||||
let itemRender: ItemRender = item.getComponent(ItemRender);
|
||||
let itemIndex = itemRender.itemIndex - items.length;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
itemRender.data = this.itemDataList[itemIndex];
|
||||
itemRender.dataChanged();
|
||||
item.x = item.x - offset;
|
||||
}
|
||||
} else {
|
||||
//item左滑时,超出了scrollView左边界,将item移动到右方复用,item移动到右方的位置必须不超过content的右边界
|
||||
if (viewPos.x < -bufferZone && item.x + offset + this.padding_right < this.content.width) {
|
||||
let itemRender: ItemRender = item.getComponent(ItemRender);
|
||||
let itemIndex = itemRender.itemIndex + items.length;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
itemRender.data = this.itemDataList[itemIndex];
|
||||
itemRender.dataChanged();
|
||||
item.x = item.x + offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.lastContentPosX = this.scrollView.content.x;
|
||||
}
|
||||
|
||||
/**网格垂直排列 */
|
||||
private updateGrid_V() {
|
||||
let items = this.itemList;
|
||||
let item: cc.Node;
|
||||
let bufferZone = this.halfScrollView;
|
||||
let isUp = this.scrollView.content.y > this.lastContentPosY;
|
||||
let offset = (this.itemHeight + this.spaceY) * (this.spawnCount / this.gridCol);
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
item = items[i];
|
||||
let viewPos = this.getPositionInView(item);
|
||||
if (isUp) {
|
||||
//item上滑时,超出了scrollView上边界,将item移动到下方复用,item移动到下方的位置必须不超过content的下边界
|
||||
if (viewPos.y > bufferZone && item.y - offset - this.padding_buttom > -this.content.height) {
|
||||
let itemRender: ItemRender = item.getComponent(ItemRender);
|
||||
let itemIndex = itemRender.itemIndex + (this.spawnCount / this.gridCol) * this.gridCol;
|
||||
if (this.itemDataList[itemIndex] != null) {
|
||||
item.y = item.y - offset;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
itemRender.data = this.itemDataList[itemIndex];
|
||||
itemRender.dataChanged();
|
||||
item.opacity = 255;
|
||||
} else {
|
||||
item.y = item.y - offset;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
item.opacity = 0;
|
||||
}
|
||||
}
|
||||
} else {//item下滑时,超出了scrollView下边界,将item移动到上方复用,item移动到上方的位置必须不超过content的上边界
|
||||
if (viewPos.y < -bufferZone && item.y + offset + this.padding_top < 0) {
|
||||
let itemRender: ItemRender = item.getComponent(ItemRender);
|
||||
let itemIndex = itemRender.itemIndex - (this.spawnCount / this.gridCol) * this.gridCol;
|
||||
if (this.itemDataList[itemIndex] != null) {
|
||||
item.y = item.y + offset;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
itemRender.data = this.itemDataList[itemIndex];
|
||||
itemRender.dataChanged();
|
||||
item.opacity = 255;
|
||||
} else {
|
||||
item.y = item.y + offset;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
item.opacity = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.lastContentPosY = this.scrollView.content.y;
|
||||
}
|
||||
|
||||
/**网格水平排列 */
|
||||
private updateGrid_H() {
|
||||
let items = this.itemList;
|
||||
let item;
|
||||
let bufferZone = this.halfScrollView;
|
||||
let isRight = this.scrollView.content.x > this.lastContentPosX;
|
||||
let offset = (this.itemWidth + this.spaceX) * (this.spawnCount / this.gridRow);
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
item = items[i];
|
||||
let viewPos = this.getPositionInView(item);
|
||||
if (isRight) {
|
||||
//item右滑时,超出了scrollView右边界,将item移动到左方复用,item移动到左方的位置必须不超过content的左边界
|
||||
if (viewPos.x > bufferZone && item.x - offset - this.padding_left > 0) {
|
||||
let itemRender: ItemRender = item.getComponent(ItemRender);
|
||||
let itemIndex = itemRender.itemIndex - (this.spawnCount / this.gridRow) * this.gridRow;
|
||||
if (this.itemDataList[itemIndex] != null) {
|
||||
item.x = item.x - offset;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
itemRender.data = this.itemDataList[itemIndex];
|
||||
itemRender.dataChanged();
|
||||
item.opacity = 255;
|
||||
} else {
|
||||
item.x = item.x - offset;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
item.opacity = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//item左滑时,超出了scrollView左边界,将item移动到右方复用,item移动到右方的位置必须不超过content的右边界
|
||||
if (viewPos.x < -bufferZone && item.x + offset + this.padding_right < this.content.width) {
|
||||
let itemRender: ItemRender = item.getComponent(ItemRender);
|
||||
let itemIndex = itemRender.itemIndex + (this.spawnCount / this.gridRow) * this.gridRow;
|
||||
if (this.itemDataList[itemIndex] != null) {
|
||||
item.x = item.x + offset;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
itemRender.data = this.itemDataList[itemIndex];
|
||||
itemRender.dataChanged();
|
||||
item.opacity = 255;
|
||||
} else {
|
||||
item.x = item.x + offset;
|
||||
itemRender.itemIndex = itemIndex;
|
||||
item.opacity = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.lastContentPosX = this.scrollView.content.x;
|
||||
}
|
||||
|
||||
/**获取item在scrollView的局部坐标 */
|
||||
private getPositionInView(item) {
|
||||
let worldPos = item.parent.convertToWorldSpaceAR(item.position);
|
||||
let viewPos = this.scrollView.node.convertToNodeSpaceAR(worldPos);
|
||||
return viewPos;
|
||||
}
|
||||
|
||||
/**获取列表数据 */
|
||||
public getListData() {
|
||||
return this.itemDataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加一项数据到列表的末尾
|
||||
* @param data 数据
|
||||
*/
|
||||
public addItem(data: any) {
|
||||
this.itemDataList.push(data);
|
||||
this.updateContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加一项数据到列表指定位置
|
||||
* @param index 位置,0表示第1项
|
||||
* @param data 数据
|
||||
*/
|
||||
public addItemAt(index: number, data: any) {
|
||||
if (this.itemDataList[index] != null || this.itemDataList.length == index) {
|
||||
this.itemDataList.splice(index, 1, data);
|
||||
this.updateContent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除一项数据
|
||||
* @param index 删除项的位置 ,0表示第1项
|
||||
*/
|
||||
public deleteItem(index: number) {
|
||||
if (this.itemDataList[index] != null) {
|
||||
this.itemDataList.splice(index, 1);
|
||||
this.updateContent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变一项数据
|
||||
* @param index 位置,0表示第1项
|
||||
* @param data 替换的数据
|
||||
*/
|
||||
public changeItem(index: number, data: any) {
|
||||
if (this.itemDataList[index] != null) {
|
||||
this.itemDataList[index] = data;
|
||||
this.updateContent();
|
||||
}
|
||||
}
|
||||
|
||||
/**获取第一个Item的位置 */
|
||||
private updateContent() {
|
||||
//显示列表实例为0个
|
||||
if (this.itemList.length == 0) {
|
||||
this.countListParam();
|
||||
this.createList(0, new cc.Vec2(0, 0));
|
||||
//显示列表的实例不为0个,则需要重新排列item实例数组
|
||||
} else {
|
||||
if (this.type == ListType.Vertical) {
|
||||
this.itemList.sort((a: any, b: any) => {
|
||||
return b.y - a.y;
|
||||
});
|
||||
} else if (this.type == ListType.Horizontal) {
|
||||
this.itemList.sort((a: any, b: any) => {
|
||||
return a.x - b.x;
|
||||
});
|
||||
} else if (this.type == ListType.Grid) {
|
||||
if (this.startAxis == StartAxisType.Vertical) {
|
||||
this.itemList.sort((a: any, b: any) => {
|
||||
return a.x - b.x;
|
||||
});
|
||||
this.itemList.sort((a: any, b: any) => {
|
||||
return b.y - a.y;
|
||||
});
|
||||
} else if (this.startAxis == StartAxisType.Horizontal) {
|
||||
this.itemList.sort((a: any, b: any) => {
|
||||
return b.y - a.y;
|
||||
});
|
||||
this.itemList.sort((a: any, b: any) => {
|
||||
return a.x - b.x;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.countListParam();
|
||||
|
||||
//获取第一个item实例需要显示的数据索引
|
||||
var startIndex = this.itemList[0].getComponent(ItemRender).itemIndex;
|
||||
|
||||
if (this.type == ListType.Grid && this.startAxis == StartAxisType.Vertical) {
|
||||
startIndex += (startIndex + this.spawnCount) % this.gridCol;
|
||||
} else if (this.type == ListType.Grid && this.startAxis == StartAxisType.Horizontal) {
|
||||
startIndex += (startIndex + this.spawnCount) % this.gridRow;
|
||||
}
|
||||
|
||||
//getScrollOffset()和scrollToOffset()的x值是相反的
|
||||
var offset: cc.Vec2 = this.scrollView.getScrollOffset();
|
||||
offset.x = - offset.x;
|
||||
|
||||
this.createList(startIndex, offset);
|
||||
}
|
||||
}
|
||||
|
||||
/**销毁 */
|
||||
public onDestroy() {
|
||||
//清理列表项
|
||||
let len = this.itemList.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
if (cc.isValid(this.itemList[i], true)) {
|
||||
this.itemList[i].destroy();
|
||||
}
|
||||
}
|
||||
this.itemList.length = 0;
|
||||
//清理对象池
|
||||
len = this.itemPool.length;
|
||||
for (let i = 0; i < len; i++) {
|
||||
if (cc.isValid(this.itemPool[i], true)) {
|
||||
this.itemPool[i].destroy();
|
||||
}
|
||||
}
|
||||
this.itemPool.length = 0;
|
||||
//清理列表数据
|
||||
this.itemDataList.length = 0;
|
||||
}
|
||||
}
|
10
assets/Script/module/RankList/List.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "d54211e0-2d28-4528-88e3-e5fd7c9b59a2",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/module/Share.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "bdc76845-baea-4381-911e-af437cccf839",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
BIN
assets/Script/module/Share.zip
Normal file
6
assets/Script/module/Share.zip.meta
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"ver": "1.0.3",
|
||||
"uuid": "b42c4fc1-4cd1-4b12-b206-930cea3d49ca",
|
||||
"importer": "asset",
|
||||
"subMetas": {}
|
||||
}
|
103
assets/Script/module/Share/share.ts
Normal file
|
@ -0,0 +1,103 @@
|
|||
|
||||
|
||||
var shareConfig = {
|
||||
gameId: "100014",
|
||||
shareLine: "zDLsruVI",
|
||||
EK:"hui231%1"
|
||||
};
|
||||
|
||||
// 定义微信配置数据的接口
|
||||
interface IWeChatConfig {
|
||||
appId: string;
|
||||
timestamp: number;
|
||||
nonceStr: string;
|
||||
signature: string;
|
||||
jsApiList: [];
|
||||
}
|
||||
|
||||
// 微信操作类
|
||||
export class WeChat {
|
||||
static setShare(url) {
|
||||
var urlTemp = this.removeQueryParams(url);
|
||||
shareConfig.shareLine = urlTemp;
|
||||
WeChat.getSignature(url);
|
||||
}
|
||||
|
||||
static getResult(res){
|
||||
if(res){
|
||||
var data = res.data;
|
||||
// @ts-ignore
|
||||
wx.config({
|
||||
debug: false,
|
||||
appId: data.appId,
|
||||
timestamp: data.timestamp,
|
||||
nonceStr: data.nonceStr,
|
||||
signature: data.signature,
|
||||
jsApiList: ['onMenuShareTimeline','updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareAppMessage']
|
||||
});
|
||||
// @ts-ignore
|
||||
wx.checkJsApi({
|
||||
jsApiList: ['updateAppMessageShareData'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
|
||||
success: function(res) {
|
||||
setTimeout(() => {
|
||||
WeChat.changeShare();
|
||||
}, 100);
|
||||
setTimeout(() => {
|
||||
WeChat.changeShare();
|
||||
}, 200);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static changeShare(){
|
||||
// @ts-ignore
|
||||
wx.ready(() => {
|
||||
// @ts-ignore
|
||||
wx.updateAppMessageShareData({
|
||||
title: '记忆力认知测评', // 分享标题
|
||||
desc: '你的认知灵活性和选择注意有问题吗', // 分享描述
|
||||
link: shareConfig.shareLine, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
||||
imgUrl: 'https://static.sparkus.cn/public/shennong.jpg', // 分享图标
|
||||
success: function () {
|
||||
// 设置成功
|
||||
console.log("分享好友成功回调");
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
// @ts-ignore
|
||||
wx.updateTimelineShareData({
|
||||
title: '记忆力认知测评', // 分享标题
|
||||
link: shareConfig.shareLine, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
|
||||
imgUrl: 'https://static.sparkus.cn/public/shennong.jpg', // 分享图标
|
||||
success: function () {
|
||||
// 设置成功
|
||||
console.log("分享朋友圈成功回调");
|
||||
}
|
||||
})
|
||||
}, 200);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
static getSignature(url: string): Promise<IWeChatConfig> {
|
||||
return new Promise((resolve) => {
|
||||
WeChat.getShareInfo((encodeURIComponent(url)),WeChat.getResult);
|
||||
});
|
||||
}
|
||||
static async getShareInfo(shareUrl: string, callback:Function): Promise<any> {
|
||||
const time = Math.floor((new Date().getTime()) / 1000)
|
||||
const url = cc.fx.HttpUtil.apiSign(`/api/share/cfg?gameId=${shareConfig.gameId}&time=${time}&url=${shareUrl}`,{})
|
||||
return cc.fx.HttpUtil.get(url,callback,0)
|
||||
}
|
||||
|
||||
|
||||
static containsNanana(str) {
|
||||
return /test/i.test(str);
|
||||
}
|
||||
|
||||
static removeQueryParams(url) {
|
||||
return url.replace(/\?.*$/, '');
|
||||
}
|
||||
|
||||
}
|
10
assets/Script/module/Share/share.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "7290c680-dfdc-4c59-9736-a614cc2a8bcf",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/module/Storage.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "2af8f2ef-b8a0-43ad-a144-ef4a887f2fa9",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
27
assets/Script/module/Storage/Storage.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
//缓存浏览器数据
|
||||
var StorageMessage = {
|
||||
getStorage : function(key){
|
||||
var result = null;
|
||||
if(cc.sys.localStorage.getItem(key)){
|
||||
var result = cc.sys.localStorage.getItem(key);
|
||||
}
|
||||
|
||||
if(result){
|
||||
result = JSON.parse(result);
|
||||
}
|
||||
return result;
|
||||
},
|
||||
setStorage : function(key,value){
|
||||
//主动拉起分享接口
|
||||
var temp = JSON.stringify(value);
|
||||
cc.sys.localStorage.setItem(key, temp)
|
||||
},
|
||||
removeStorage : function(key){
|
||||
//主动删除消息接口
|
||||
if(cc.sys.localStorage.getItem(key)){
|
||||
cc.sys.localStorage.removeItem(key)
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export { StorageMessage };
|
10
assets/Script/module/Storage/Storage.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "10029dfc-5454-4977-bd11-8809e8f48cac",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/module/Tool.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "2a81f82d-8d16-44af-b947-44eea4dde54f",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
425
assets/Script/module/Tool/GameTool.ts
Normal file
|
@ -0,0 +1,425 @@
|
|||
|
||||
//最大工具类 各种公共方法,以及处理上传,获取后端接口数据
|
||||
var GameTool = {
|
||||
_startTime: 0,
|
||||
_endTime: 0,
|
||||
_totalTime: 0,
|
||||
//获取userId
|
||||
Authentication(){
|
||||
let name = "user_" + cc.fx.GameConfig.GM_INFO.gameId;
|
||||
var data = JSON.parse(localStorage.getItem(name));
|
||||
if(data == "undifend" || data==null || data == ""){
|
||||
let url = "https://api.sparkus.cn/api/user/auth/login?domain=hui32579WdYPsgYq&callback="+
|
||||
encodeURIComponent(location.href);
|
||||
console.log("链接没ID准备跳转",url);
|
||||
window.location.href = url;
|
||||
|
||||
}
|
||||
else{
|
||||
if(!this.isNumber(data.userId)){
|
||||
let url = "https://api.sparkus.cn/api/user/auth/login?domain=hui32579WdYPsgYq&callback="+
|
||||
encodeURIComponent(location.href);
|
||||
console.log("链接不合法",url);
|
||||
window.location.href = url;
|
||||
}
|
||||
else{
|
||||
cc.fx.StorageMessage.setStorage(name,data);
|
||||
cc.fx.GameConfig.GM_INFO.userId = parseInt(data.userId);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
isNumber(value) {
|
||||
var result = false;
|
||||
result = typeof value === 'number';
|
||||
if(result) if(value < 200000) result = false;
|
||||
return result;
|
||||
},
|
||||
|
||||
containsTrain(str) {
|
||||
return /from=train/i.test(str);
|
||||
},
|
||||
|
||||
|
||||
//埋点上传
|
||||
setGameData(){
|
||||
//GAME_DATA 初始化 每次清零
|
||||
cc.fx.GameConfig.GAME_DATA = [];
|
||||
cc.fx.GameConfig.GAME_DATA.push(cc.fx.GameConfig.CLICK_DATA);
|
||||
cc.fx.GameConfig.CLICK_init();
|
||||
let data = cc.fx.GameConfig.GAME_DATA;
|
||||
let matchId = this.getMatchId();
|
||||
let postData = {
|
||||
"gameId":cc.fx.GameConfig.GM_INFO.gameId,
|
||||
"userId":cc.fx.GameConfig.GM_INFO.userId,
|
||||
"scode":cc.fx.GameConfig.GM_INFO.scode,
|
||||
"matchId":matchId,
|
||||
"data": data
|
||||
};
|
||||
|
||||
console.log("上传数据:",postData);
|
||||
cc.fx.HttpUtil.uploadUserLogData(postData,function(){})
|
||||
},
|
||||
//上传排行榜 type为1
|
||||
setRank(data){
|
||||
//GAME_DATA 初始化 每次清零
|
||||
let postData = {
|
||||
"gameId":cc.fx.GameConfig.GM_INFO.gameId,
|
||||
"userId":cc.fx.GameConfig.GM_INFO.userId,
|
||||
"type":1,
|
||||
"totleTimes": data.totleTimes,
|
||||
"accuracy": data.accuracy,
|
||||
"success": cc.fx.GameConfig.GM_INFO.success
|
||||
};
|
||||
cc.fx.HttpUtil.rankData(1,function(){},postData);
|
||||
},
|
||||
//获取排行榜 type为2
|
||||
getRank(data,callback){
|
||||
let rankLength = data.length;
|
||||
let postData = {
|
||||
"gameId":cc.fx.GameConfig.GM_INFO.gameId,
|
||||
"userId":cc.fx.GameConfig.GM_INFO.userId,
|
||||
"page":1,
|
||||
"pageSize":rankLength
|
||||
};
|
||||
//回调进getRankData
|
||||
cc.fx.HttpUtil.rankData(2,data =>{callback(data)},postData);
|
||||
},
|
||||
//获取matchId 用于上传每次点击数据里面记录id方便查询
|
||||
getMatchId (){
|
||||
let matchId = cc.sys.localStorage.getItem("matchId");
|
||||
let tempId = matchId;
|
||||
if(matchId == "undifend" || matchId==null){
|
||||
matchId = this.setMatchId();
|
||||
}
|
||||
else{
|
||||
if(this.containsNanana(matchId) == true){
|
||||
matchId = this.setMatchId();
|
||||
}
|
||||
else{
|
||||
let char = parseInt(tempId.substring(10,tempId.length));
|
||||
if(cc.fx.GameConfig.GM_INFO.level == 1){
|
||||
char += 1;
|
||||
matchId = tempId.slice(0, 10) + char + "";
|
||||
if(this.containsNanana(matchId)) matchId = this.setMatchId();
|
||||
cc.fx.GameConfig.GM_INFO.matchId = matchId;
|
||||
cc.sys.localStorage.setItem("matchId",matchId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.containsNanana(matchId) == true){
|
||||
matchId = this.setMatchId();
|
||||
}
|
||||
return matchId;
|
||||
},
|
||||
//检测matchId 如果有缓存以前的nanana数据清除
|
||||
containsNanana(str) {
|
||||
return /na/i.test(str);
|
||||
},
|
||||
//重新设置MatchId
|
||||
setMatchId (){
|
||||
// 定义包含可用字符的字符集
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||
// 创建一个数组以保存随机字符
|
||||
const uuidArray = [];
|
||||
// 循环10次 生成10位的UUID
|
||||
for (let i = 0; i < 10; i++) {
|
||||
// 生成随机索引,范围是字符集的长度
|
||||
const randomIndex = Math.floor(Math.random() * characters.length);
|
||||
// 从字符集中获取随机字符
|
||||
const randomChar = characters.charAt(randomIndex);
|
||||
// 将字符添加到数组中
|
||||
uuidArray.push(randomChar);
|
||||
}
|
||||
let data = uuidArray.join('') + 1 + "";
|
||||
cc.sys.localStorage.setItem("matchNumber",1);
|
||||
cc.sys.localStorage.setItem("matchId",data);
|
||||
cc.fx.GameConfig.GM_INFO.matchId = data;
|
||||
return data;
|
||||
},
|
||||
//截取名字
|
||||
subName(name,length){
|
||||
if(name.length > length){
|
||||
name = name.substring(0,length) + "..."
|
||||
}
|
||||
return name;
|
||||
},
|
||||
//设置头像
|
||||
setPic(node,pic){
|
||||
node.active = false;
|
||||
let url = pic;
|
||||
setTimeout(() => {
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
return response.headers.get('Content-Length');
|
||||
})
|
||||
.then(errNo => {
|
||||
if(errNo == "5093"){
|
||||
node.active = true;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
// console.error('Error fetching X-Info:', error);
|
||||
});
|
||||
}, 100);
|
||||
cc.assetManager.loadRemote(url, {ext:'.png'},(err, texture:cc.Texture2D) => {
|
||||
if(texture){
|
||||
node.active = true;
|
||||
node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
|
||||
}
|
||||
else{
|
||||
// console.log(err,texture)
|
||||
}
|
||||
})
|
||||
},
|
||||
//第一个参数把目标带进来处理,第二个参数为名字长度,不同场景不同需求
|
||||
//名字4短,小排行,名字6长,大排行
|
||||
getRankData(data,target,nameLength){
|
||||
target.listData = data.data.list;
|
||||
target.selfData = data.data.info;
|
||||
let rankData = [];
|
||||
let self = false;
|
||||
cc.fx.GameTool.setPic(target.selfNode.getChildByName("pic").getChildByName("icon"),target.selfData.pic);
|
||||
for(let i=0;i<=target.listData.length-1;i++){
|
||||
rankData.push({rank:(i+1), name:target.listData[i].nickName, total:target.listData[i].accuracy,time:target.listData[i].totleTimes, pic:target.listData[i].pic});
|
||||
if(cc.fx.GameConfig.GM_INFO.userId == target.listData[i].userId){
|
||||
self = true;
|
||||
target.rankNumber = i;
|
||||
target.selfNode.getChildByName("rankLab").getComponent(cc.Label).string =(i+1) + "";
|
||||
}
|
||||
if(i == (target.listData.length-1) && self == false){
|
||||
target.rankNumber = i;
|
||||
target.selfNode.getChildByName("rankLab").getComponent(cc.Label).string = "99+";
|
||||
}
|
||||
}
|
||||
let name = cc.fx.GameTool.subName(target.selfData.nickName,nameLength);
|
||||
target.selfNode.getChildByName("nameLab").getComponent(cc.Label).string = name;
|
||||
target.selfNode.getChildByName("totalLab").getComponent(cc.Label).string = target.selfData.accuracy + "%";
|
||||
let timeTemp = cc.fx.GameTool.getTimeShenNong(target.selfData.totleTimes);
|
||||
target.selfNode.getChildByName("timeLab").getComponent(cc.Label).string = timeTemp + "";
|
||||
switch(target.selfNode.getChildByName("rankLab").getComponent(cc.Label).string){
|
||||
case "1":
|
||||
target.selfNode.getChildByName("rank").getChildByName("one").active = true;
|
||||
break;
|
||||
case "2":
|
||||
target.selfNode.getChildByName("rank").getChildByName("two").active = true;
|
||||
break;
|
||||
case "3":
|
||||
target.selfNode.getChildByName("rank").getChildByName("three").active = true;
|
||||
break;
|
||||
}
|
||||
// 大排行
|
||||
if(nameLength == 6){
|
||||
target.rankList.setData(rankData);
|
||||
target.selfNode.opacity = 255;
|
||||
if(target.selfData.totalSunCount == 0) target.selfNode.opacity = 0;
|
||||
}
|
||||
},
|
||||
|
||||
getSeedRandom: function (min, max) {//包含min 不包含max
|
||||
console.log("随机数:",cc.fx.GameConfig.GM_INFO.currSeed);
|
||||
max = max || 1;
|
||||
min = min || 0;
|
||||
cc.fx.GameConfig.GM_INFO.currSeed = (cc.fx.GameConfig.GM_INFO.currSeed * 9301 + 49297) % 233280;
|
||||
let rnd = cc.fx.GameConfig.GM_INFO.currSeed / 233280.0;
|
||||
let tmp = min + rnd * (max - min);
|
||||
return parseInt(tmp);
|
||||
},
|
||||
//获取关卡配置的那个关卡数
|
||||
getCustom(type){
|
||||
let custom = cc.fx.StorageMessage.getStorage(cc.fx.storageType.storageTypeCustom);
|
||||
if(custom == "undifend" || custom==null || custom == ""){
|
||||
this.setCustom();
|
||||
}
|
||||
else{
|
||||
cc.fx.GameConfig.GM_INFO_SET("custom",custom[0]);
|
||||
if(custom[0] != 0 || type == true){
|
||||
custom.shift();
|
||||
if(custom.length == 0){
|
||||
this.setCustom();
|
||||
}
|
||||
else cc.fx.StorageMessage.setStorage(cc.fx.storageType.storageTypeCustom,custom);
|
||||
}
|
||||
}
|
||||
},
|
||||
//本地没有存储到配置,或者配置用完,重新创建配置
|
||||
setCustom(){
|
||||
let arrayLength = cc.fx.GameConfig.LEVEL_INFO.length;
|
||||
let arrayList = [];
|
||||
for(let i=1; i<arrayLength;i++){
|
||||
arrayList.push(i);
|
||||
}
|
||||
arrayList.sort(() => Math.random() - 0.5);
|
||||
arrayList.unshift(0)
|
||||
cc.fx.GameConfig.GM_INFO_SET("custom",arrayList[0]);
|
||||
cc.fx.StorageMessage.setStorage(cc.fx.storageType.storageTypeCustom,arrayList);
|
||||
},
|
||||
|
||||
getFoodName(food){
|
||||
var name = "葡萄";
|
||||
switch(food){
|
||||
case "baishao":
|
||||
name = "白芍";
|
||||
break;
|
||||
case "jingjie":
|
||||
name = "荆芥";
|
||||
break;
|
||||
case "renshen":
|
||||
name = "人参";
|
||||
break;
|
||||
case "danshen":
|
||||
name = "丹参";
|
||||
break;
|
||||
case "danggui":
|
||||
name = "当归";
|
||||
break;
|
||||
case "gouqi":
|
||||
name = "枸杞";
|
||||
break;
|
||||
case "mudan":
|
||||
name = "牡丹";
|
||||
break;
|
||||
case "mulan":
|
||||
name = "木兰";
|
||||
break;
|
||||
case "pugongying":
|
||||
name = "蒲公英";
|
||||
break;
|
||||
case "moli":
|
||||
name = "茉莉";
|
||||
break;
|
||||
case "jinju":
|
||||
name = "金桔";
|
||||
break;
|
||||
case "dazao":
|
||||
name = "大枣";
|
||||
break;
|
||||
case "lizi":
|
||||
name = "李子";
|
||||
break;
|
||||
case "lizhi":
|
||||
name = "荔枝";
|
||||
break;
|
||||
case "taozi":
|
||||
name = "桃子";
|
||||
break;
|
||||
case "putao":
|
||||
name = "葡萄";
|
||||
break;
|
||||
case "muchai":
|
||||
name = "木柴";
|
||||
break;
|
||||
case "ganjiang":
|
||||
name = "干姜";
|
||||
break;
|
||||
case "zhuye":
|
||||
name = "竹叶";
|
||||
break;
|
||||
case "longyan":
|
||||
name = "龙眼";
|
||||
break;
|
||||
case "chixiaodou":
|
||||
name = "赤小豆";
|
||||
break;
|
||||
case "gancao":
|
||||
name = "甘草";
|
||||
break;
|
||||
case "cha":
|
||||
name = "茶";
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
},
|
||||
|
||||
getSetScreenResolutionFlag: function () {
|
||||
let size = cc.winSize;
|
||||
let width = size.width;
|
||||
let height = size.height;
|
||||
if ((height / width) > (16.2 / 9)) return false;
|
||||
return true;
|
||||
},
|
||||
//判断全面屏适配
|
||||
setFit: function (canvas) {
|
||||
let flag = cc.fx.GameTool.getSetScreenResolutionFlag();
|
||||
if (flag) {
|
||||
// console.log("不是全面屏");
|
||||
} else {
|
||||
// console.log("是全面屏");
|
||||
}
|
||||
return flag;
|
||||
},
|
||||
//获取游戏信息
|
||||
getGameInfo: function(node){
|
||||
var jg = false;
|
||||
return jg;
|
||||
},
|
||||
//设置游戏信息
|
||||
setGameInfo: function(pd){
|
||||
|
||||
},
|
||||
|
||||
//打字机效果
|
||||
typingAni(label,text,cb,target){
|
||||
var self = target;
|
||||
var html = '';
|
||||
var arr = text.split('');
|
||||
var len = arr.length;
|
||||
var step = 0;
|
||||
self.func = ()=>{
|
||||
html += arr[step];
|
||||
label.string = html;
|
||||
if (++step == len) {
|
||||
self.unschedule(self.func);
|
||||
cb && cb();
|
||||
}
|
||||
}
|
||||
self.schedule(self.func,0.1, cc.macro.REPEAT_FOREVER, 0)
|
||||
},
|
||||
|
||||
//输入秒,返回需要展示时间格式
|
||||
getTimeMargin:(second) => {
|
||||
let total = 0;
|
||||
total = second;
|
||||
let hour = 0;
|
||||
hour = parseInt((total / 3600) + "");//计算整数小时数
|
||||
let afterHour = total - hour * 60 * 60;//取得算出小时数后剩余的秒数
|
||||
let min = parseInt((afterHour / 60)+"");//计算整数分
|
||||
let m = "" + min;
|
||||
if(min < 10) m = "0"+min;
|
||||
let afterMin = total - hour * 60 * 60 - min * 60;//取得算出分后剩余的秒数
|
||||
let miao = afterMin + "";
|
||||
if(afterMin < 10) miao = "0" + afterMin;
|
||||
return m + ':' + miao
|
||||
},
|
||||
|
||||
//输入秒,返回需要展示时间格式
|
||||
getTimeShenNong:(second) => {
|
||||
second = parseInt(second/1000+"");
|
||||
let total = 0;
|
||||
total = second;
|
||||
let min = 0;
|
||||
if(total > 60){
|
||||
min = parseInt((total / 60)+"");//计算整数分
|
||||
}
|
||||
let m = min + "'";
|
||||
|
||||
let afterMin = total - min * 60;//取得算出分后剩余的秒数
|
||||
let miao = afterMin + "''";
|
||||
return m + miao
|
||||
},
|
||||
|
||||
//获取时间戳
|
||||
getTime(){
|
||||
const timestamp = new Date().getTime();
|
||||
return timestamp;
|
||||
},
|
||||
pushLister:function () {
|
||||
|
||||
},
|
||||
removeAllLister:function () {
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
export { GameTool };
|
10
assets/Script/module/Tool/GameTool.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "43bfc27a-ff6e-45b3-87c7-504d0f781397",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Shader.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "afa9e39a-94ca-477f-8a2a-25082d9092c3",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Texture.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
BIN
assets/Texture/HelloWorld.png
Normal file
After Width: | Height: | Size: 37 KiB |
38
assets/Texture/HelloWorld.png.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 195,
|
||||
"height": 270,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"HelloWorld": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "31bc895a-c003-4566-a9f3-2e54ae1c17dc",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 195,
|
||||
"height": 270,
|
||||
"rawWidth": 195,
|
||||
"rawHeight": 270,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/Texture/singleColor.png
Normal file
After Width: | Height: | Size: 82 B |
38
assets/Texture/singleColor.png.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "a8027877-d8d6-4645-97a0-52d4a0123dba",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 2,
|
||||
"height": 2,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"singleColor": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "410fb916-8721-4663-bab8-34397391ace7",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "a8027877-d8d6-4645-97a0-52d4a0123dba",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 2,
|
||||
"height": 2,
|
||||
"rawWidth": 2,
|
||||
"rawHeight": 2,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
13
assets/animation.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "7c1d6faa-66b9-4423-aa04-8c38a15768cf",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
79
assets/animation/fire.anim
Normal file
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
"__type__": "cc.AnimationClip",
|
||||
"_name": "fire",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_duration": 1.5166666666666666,
|
||||
"sample": 60,
|
||||
"speed": 0.8,
|
||||
"wrapMode": 1,
|
||||
"curveData": {
|
||||
"comps": {
|
||||
"cc.Sprite": {
|
||||
"spriteFrame": [
|
||||
{
|
||||
"frame": 0,
|
||||
"value": {
|
||||
"__uuid__": "419712bd-00e6-4352-97bc-105ab199d852"
|
||||
}
|
||||
},
|
||||
{
|
||||
"frame": 0.16666666666666666,
|
||||
"value": {
|
||||
"__uuid__": "eef1f6ad-ae7d-4f74-ab87-cd4c81dea072"
|
||||
}
|
||||
},
|
||||
{
|
||||
"frame": 0.3333333333333333,
|
||||
"value": {
|
||||
"__uuid__": "6999b621-4a9f-4a89-970f-4f6637f6ebe1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"frame": 0.5,
|
||||
"value": {
|
||||
"__uuid__": "24bb96d6-d160-419c-89a8-8f1a1e203491"
|
||||
}
|
||||
},
|
||||
{
|
||||
"frame": 0.6666666666666666,
|
||||
"value": {
|
||||
"__uuid__": "5fead804-1827-4c8d-9b89-c09849aeed4e"
|
||||
}
|
||||
},
|
||||
{
|
||||
"frame": 0.8333333333333334,
|
||||
"value": {
|
||||
"__uuid__": "e363a676-9b52-4402-b43a-37062f24c250"
|
||||
}
|
||||
},
|
||||
{
|
||||
"frame": 1,
|
||||
"value": {
|
||||
"__uuid__": "e363a676-9b52-4402-b43a-37062f24c250"
|
||||
}
|
||||
},
|
||||
{
|
||||
"frame": 1.1666666666666667,
|
||||
"value": {
|
||||
"__uuid__": "a67083f3-132b-4dc7-963c-af204012cd97"
|
||||
}
|
||||
},
|
||||
{
|
||||
"frame": 1.3333333333333333,
|
||||
"value": {
|
||||
"__uuid__": "5256d2df-6e2d-4cac-9ac7-bd33add06053"
|
||||
}
|
||||
},
|
||||
{
|
||||
"frame": 1.5,
|
||||
"value": {
|
||||
"__uuid__": "419712bd-00e6-4352-97bc-105ab199d852"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"events": []
|
||||
}
|
6
assets/animation/fire.anim.meta
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"ver": "2.1.2",
|
||||
"uuid": "cd606b05-2183-4a5a-ad7c-9f3464006aaa",
|
||||
"importer": "animation-clip",
|
||||
"subMetas": {}
|
||||
}
|
13
assets/migration.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "2e3d6223-9889-4122-8121-c6d837f5367e",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
17
assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* This script is automatically generated by Cocos Creator and is only used for projects compatible with the v2.1.0 ~ 2.2.1 version.
|
||||
* You do not need to manually add this script in any other project.
|
||||
* If you don't use cc.Toggle in your project, you can delete this script directly.
|
||||
* If your project is hosted in VCS such as git, submit this script together.
|
||||
*
|
||||
* 此脚本由 Cocos Creator 自动生成,仅用于兼容 v2.1.0 ~ 2.2.1 版本的工程,
|
||||
* 你无需在任何其它项目中手动添加此脚本。
|
||||
* 如果你的项目中没用到 Toggle,可直接删除该脚本。
|
||||
* 如果你的项目有托管于 git 等版本库,请将此脚本一并上传。
|
||||
*/
|
||||
|
||||
if (cc.Toggle) {
|
||||
// Whether to trigger 'toggle' and 'checkEvents' events when modifying 'toggle.isChecked' in the code
|
||||
// 在代码中修改 'toggle.isChecked' 时是否触发 'toggle' 与 'checkEvents' 事件
|
||||
cc.Toggle._triggerEventInScript_isChecked = true;
|
||||
}
|
10
assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "7a231473-d1df-4b05-8620-6376c36252c1",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/music.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "6ebfe2d9-539a-4853-8b16-fca5c89cf2ce",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
13
assets/prefab.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "bf3935ca-518a-42f4-84e4-ad96badfd1b4",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
5181
assets/prefab/Canvas.prefab
Normal file
9
assets/prefab/Canvas.prefab.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "badb56f7-1c07-4fbb-87e6-5bfd805fe81b",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
1364
assets/prefab/RankListItem.prefab
Normal file
9
assets/prefab/RankListItem.prefab.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "a264c8df-80f6-474f-9fe5-28b7ae529d95",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/res.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "2880dc26-5b38-48bd-baba-daaec97499cb",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
BIN
assets/res/btn.png
Normal file
After Width: | Height: | Size: 30 KiB |
38
assets/res/btn.png.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "ebfe6e6f-f068-4227-bfd8-16f834e7203f",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 501,
|
||||
"height": 85,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"btn": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "5890602f-470f-42ea-b785-8d5565214ada",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "ebfe6e6f-f068-4227-bfd8-16f834e7203f",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 501,
|
||||
"height": 85,
|
||||
"rawWidth": 501,
|
||||
"rawHeight": 85,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/res/err2.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
38
assets/res/err2.png.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "59302142-671f-4983-92db-e5fa8b5aee42",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 501,
|
||||
"height": 70,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"err2": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "08e5fce4-27f5-445b-a895-f47a7ffb5176",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "59302142-671f-4983-92db-e5fa8b5aee42",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -0.5,
|
||||
"offsetY": 0,
|
||||
"trimX": 194,
|
||||
"trimY": 18,
|
||||
"width": 112,
|
||||
"height": 34,
|
||||
"rawWidth": 501,
|
||||
"rawHeight": 70,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/res/icon.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
38
assets/res/icon.png.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "8084ec83-76e6-4ef4-a0e9-162a417b5c08",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 64,
|
||||
"height": 64,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"icon": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "6c6849e9-8426-4bd8-8298-194917d20da7",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "8084ec83-76e6-4ef4-a0e9-162a417b5c08",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 64,
|
||||
"height": 64,
|
||||
"rawWidth": 64,
|
||||
"rawHeight": 64,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/res/nomal2.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
38
assets/res/nomal2.png.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "adfc2f90-f674-4b11-93a1-3485c1804903",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 501,
|
||||
"height": 70,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"nomal2": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "b9472a40-1f02-4a4b-8fbc-818b4255e9ce",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "adfc2f90-f674-4b11-93a1-3485c1804903",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -0.5,
|
||||
"offsetY": 0,
|
||||
"trimX": 194,
|
||||
"trimY": 18,
|
||||
"width": 112,
|
||||
"height": 34,
|
||||
"rawWidth": 501,
|
||||
"rawHeight": 70,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/res/yes2.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
38
assets/res/yes2.png.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "ee7fc6f8-eb01-4dcb-9ddf-5c81e31b7944",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 501,
|
||||
"height": 70,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"yes2": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "33d3b1ce-0232-41d5-b379-8316ed3e442d",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "ee7fc6f8-eb01-4dcb-9ddf-5c81e31b7944",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -0.5,
|
||||
"offsetY": 0,
|
||||
"trimX": 194,
|
||||
"trimY": 18,
|
||||
"width": 112,
|
||||
"height": 34,
|
||||
"rawWidth": 501,
|
||||
"rawHeight": 70,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
25
assets/resources.meta
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "52e78fe3-9095-42ad-8e4d-f9bb12dc69ce",
|
||||
"importer": "folder",
|
||||
"isBundle": true,
|
||||
"bundleName": "resources",
|
||||
"priority": 8,
|
||||
"compressionType": {
|
||||
"web-mobile": "default",
|
||||
"wechatgame": "default"
|
||||
},
|
||||
"optimizeHotUpdate": {
|
||||
"web-mobile": false,
|
||||
"wechatgame": false
|
||||
},
|
||||
"inlineSpriteFrames": {
|
||||
"web-mobile": false,
|
||||
"wechatgame": false
|
||||
},
|
||||
"isRemoteBundle": {
|
||||
"web-mobile": false,
|
||||
"wechatgame": true
|
||||
},
|
||||
"subMetas": {}
|
||||
}
|
13
assets/resources/Bg.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "194f1f26-5bbf-43e6-b623-3af4e4c71586",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
BIN
assets/resources/Bg/bg1.jpg
Normal file
After Width: | Height: | Size: 50 KiB |
38
assets/resources/Bg/bg1.jpg.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "93b7d36e-73e3-4755-b932-ec0eb7407078",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 750,
|
||||
"height": 1660,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"bg1": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "f6cdf53a-8de8-42da-bea3-581b1a681360",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "93b7d36e-73e3-4755-b932-ec0eb7407078",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 750,
|
||||
"height": 1660,
|
||||
"rawWidth": 750,
|
||||
"rawHeight": 1660,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/resources/Bg/bg2.jpg
Normal file
After Width: | Height: | Size: 77 KiB |
38
assets/resources/Bg/bg2.jpg.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "208eb4d4-f625-47c7-a16f-853d57d0c48f",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 750,
|
||||
"height": 1660,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"bg2": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "6b86bfb2-d4d1-4474-a615-6a8a515b9201",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "208eb4d4-f625-47c7-a16f-853d57d0c48f",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 750,
|
||||
"height": 1660,
|
||||
"rawWidth": 750,
|
||||
"rawHeight": 1660,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/resources/Bg/overBg.jpg
Normal file
After Width: | Height: | Size: 43 KiB |
38
assets/resources/Bg/overBg.jpg.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "194abbe2-2c5a-4d46-8aac-957b3bb44457",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 750,
|
||||
"height": 1660,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"overBg": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "634acecc-5987-409f-8c81-28569289abb3",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "194abbe2-2c5a-4d46-8aac-957b3bb44457",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 750,
|
||||
"height": 1660,
|
||||
"rawWidth": 750,
|
||||
"rawHeight": 1660,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/resources/Bg/rank_Bg.jpg
Normal file
After Width: | Height: | Size: 58 KiB |