初次提交
This commit is contained in:
commit
6dc4cbded8
13
assets/Scene.meta
Normal file
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": {}
|
||||
}
|
9033
assets/Scene/GameScene.fire
Normal file
9033
assets/Scene/GameScene.fire
Normal file
File diff suppressed because it is too large
Load Diff
8
assets/Scene/GameScene.fire.meta
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": {}
|
||||
}
|
5745
assets/Scene/GuideScene.fire
Normal file
5745
assets/Scene/GuideScene.fire
Normal file
File diff suppressed because it is too large
Load Diff
8
assets/Scene/GuideScene.fire.meta
Normal file
8
assets/Scene/GuideScene.fire.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "774829bb-123e-48b6-930e-6b3e02491506",
|
||||
"importer": "scene",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
12023
assets/Scene/LoadScene.fire
Normal file
12023
assets/Scene/LoadScene.fire
Normal file
File diff suppressed because it is too large
Load Diff
8
assets/Scene/LoadScene.fire.meta
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": {}
|
||||
}
|
5295
assets/Scene/OverScene.fire
Normal file
5295
assets/Scene/OverScene.fire
Normal file
File diff suppressed because it is too large
Load Diff
8
assets/Scene/OverScene.fire.meta
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": false,
|
||||
"subMetas": {}
|
||||
}
|
4681
assets/Scene/RankScene.fire
Normal file
4681
assets/Scene/RankScene.fire
Normal file
File diff suppressed because it is too large
Load Diff
8
assets/Scene/RankScene.fire.meta
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": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script.meta
Normal file
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": {}
|
||||
}
|
315
assets/Script/BallAudioManager.js
Normal file
315
assets/Script/BallAudioManager.js
Normal file
|
@ -0,0 +1,315 @@
|
|||
cc.Class({
|
||||
extends: cc.Component,
|
||||
properties:{
|
||||
//背景音乐
|
||||
audioGameBgm0:{
|
||||
default:null,
|
||||
type:cc.AudioClip
|
||||
},
|
||||
// 按钮点击
|
||||
audioButtonClick:{
|
||||
default:null,
|
||||
type:cc.AudioClip
|
||||
},
|
||||
// 报警音效
|
||||
audioWarning:{
|
||||
default:null,
|
||||
type:cc.AudioClip
|
||||
},
|
||||
|
||||
//游戏开始音效
|
||||
audioWin:{
|
||||
default:null,
|
||||
type:cc.AudioClip
|
||||
},
|
||||
|
||||
reward: false,
|
||||
finish: false,
|
||||
rewardCount: 0
|
||||
|
||||
},
|
||||
ctor: function () {
|
||||
this.mAudioMap = {};
|
||||
|
||||
/**
|
||||
* 默认音量大小
|
||||
* @type {number}
|
||||
*/
|
||||
this.bgMusicVolume = 0.1;
|
||||
this.effectMusicVolume = 1;
|
||||
|
||||
this.mMusicSwitch = 1;
|
||||
this.mEffectSwitch = 1;
|
||||
},
|
||||
play : function(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;
|
||||
}
|
||||
var context = cc.audioEngine.play(audioSource, loop, volume);
|
||||
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 {
|
||||
var context = wx.createInnerAudioContext();
|
||||
context.autoplay = true;
|
||||
context.loop = loop;
|
||||
context.obeyMuteSwitch = true;
|
||||
context.volume = volume;
|
||||
|
||||
if (callback) {
|
||||
context.onEnded(function() {
|
||||
callback.call(this);
|
||||
}.bind(this));
|
||||
} else {
|
||||
context.offEnded();
|
||||
}
|
||||
|
||||
// var audioPath = cc.url.raw("resources/BallMaster/sounds" + audioSource.name + ".mp3");
|
||||
context.src = audioSource.nativeUrl;
|
||||
context.play()
|
||||
this.mAudioMap[audioSource] = context;
|
||||
|
||||
// cc.wwx.OutPut.log('play audio effect wx: ' + audioSource.nativeUrl);
|
||||
|
||||
return audioSource;
|
||||
}
|
||||
},
|
||||
|
||||
save: function () {
|
||||
// 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);
|
||||
},
|
||||
onLoad() {
|
||||
// cc.wwx.Storage.getItem(cc.wwx.Storage.Key_Setting_Music_Volume, function(volume) {
|
||||
// this.mMusicSwitch = parseInt(volume);
|
||||
// }.bind(this), 1);
|
||||
|
||||
// cc.wwx.Storage.getItem(cc.wwx.Storage.Key_Setting_Effect_Volume, function(volume) {
|
||||
// this.mEffectSwitch = parseInt(volume);
|
||||
// }.bind(this), 1);
|
||||
|
||||
|
||||
this.reward = false;
|
||||
this.finish = false;
|
||||
this.rewardCount = 0;
|
||||
window.addEventListener('rewardCanUse', () => {
|
||||
// 此时激励可用 游戏内部逻辑
|
||||
this.reward = true;
|
||||
});
|
||||
|
||||
'undefined' != typeof window['reward'] ?
|
||||
window.dispatchEvent(window['reward']):""
|
||||
|
||||
this.preload();
|
||||
},
|
||||
preload : function() {
|
||||
if (!(cc.sys.platform === cc.sys.WECHAT_GAME)) { return; }
|
||||
|
||||
var musics = [
|
||||
this.audioGameBgm0,
|
||||
];
|
||||
musics.forEach(function(path) {
|
||||
// var musicPath = wxDownloader.REMOTE_SERVER_ROOT + path;
|
||||
// if (musicPath != wxDownloader.REMOTE_SERVER_ROOT && musicPath.endsWith('.mp3')) {
|
||||
// cc.loader.load(musicPath, function(err, remoteUrl) {
|
||||
// if (err) {
|
||||
// cc.error(err.message || err);
|
||||
// return;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
})
|
||||
},
|
||||
|
||||
getAudioMusicSwitch()
|
||||
{
|
||||
return this.mMusicSwitch;
|
||||
|
||||
},
|
||||
getAudioEffectSwitch()
|
||||
{
|
||||
return this.mEffectSwitch;
|
||||
},
|
||||
trunAudioSound(on)
|
||||
{
|
||||
this.switchMusic(on);
|
||||
this.switchEffect(on)
|
||||
},
|
||||
switchMusic : function(on) {
|
||||
if (this.mMusicSwitch != (on?1:0))
|
||||
{
|
||||
this.mMusicSwitch = 1-this.mMusicSwitch;
|
||||
// this.save();
|
||||
|
||||
}
|
||||
if(on)
|
||||
{
|
||||
this.playMusicGame();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.stopMusic();
|
||||
}
|
||||
},
|
||||
switchEffect : function(on) {
|
||||
if (this.mEffectSwitch != (on?1:0)){
|
||||
this.mEffectSwitch = 1-this.mEffectSwitch;
|
||||
// this.save();
|
||||
|
||||
}
|
||||
},
|
||||
onHide () {
|
||||
cc.audioEngine.pauseAll();
|
||||
|
||||
// if (CC_JSB) {
|
||||
// } else {
|
||||
// for (var key in this.mAudioMap) {
|
||||
// if (key === this.mMusicKey) {
|
||||
// this.mAudioMap[key].pause();
|
||||
// } else {
|
||||
// this.mAudioMap[key].stop();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
},
|
||||
|
||||
onShow () {
|
||||
cc.audioEngine.resumeAll();
|
||||
|
||||
// if (CC_JSB) {
|
||||
// } else {
|
||||
// if (!this.mMusicSwitch) return;
|
||||
// var context = this.mAudioMap[this.mMusicKey];
|
||||
// if (context) {
|
||||
// context.play();
|
||||
// }
|
||||
// }
|
||||
},
|
||||
playMusic : function(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);
|
||||
},
|
||||
/**
|
||||
* 停止背景音乐播放
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
},
|
||||
// 炸弹、火箭爆炸音效
|
||||
playBomb () {
|
||||
return this.play(this.audioBomb, false);
|
||||
},
|
||||
//激光音效
|
||||
playJiGuang()
|
||||
{
|
||||
return this.play(this.audioJiGuang, false);
|
||||
},
|
||||
//技能音效
|
||||
playItem1()
|
||||
{
|
||||
return this.play(this.audioItem1, false);
|
||||
},
|
||||
/*
|
||||
* 游戏开始音效
|
||||
*
|
||||
*/
|
||||
playGameStart()
|
||||
{
|
||||
return this.play(this.audioGameStart, false);
|
||||
},
|
||||
/*
|
||||
* 失败的游戏结束
|
||||
*/
|
||||
playGameOver()
|
||||
{
|
||||
return this.play(this.audioGameOver,false);
|
||||
},
|
||||
/*
|
||||
* 成功的游戏结束
|
||||
*/
|
||||
playGameResultFailed()
|
||||
{
|
||||
return this.play(this.audioGameResultFail,false);
|
||||
},
|
||||
/*
|
||||
* 成功的游戏结束
|
||||
*/
|
||||
playGameResultSuccess()
|
||||
{
|
||||
return this.play(this.audioGameResultSuccess,false);
|
||||
},
|
||||
/**
|
||||
* 报警的音效
|
||||
*/
|
||||
playWarning()
|
||||
{
|
||||
return this.play(this.audioWarning,false);
|
||||
|
||||
},
|
||||
|
||||
playWin()
|
||||
{
|
||||
return this.play(this.audioWin,false);
|
||||
},
|
||||
|
||||
/*
|
||||
* 方块碰撞的声音
|
||||
*/
|
||||
playBrick()
|
||||
{
|
||||
return this.play(this.brickSound,false);
|
||||
},
|
||||
//方块破碎的声音
|
||||
brickBoom(){
|
||||
return this.play(this.audioObj,false);
|
||||
},
|
||||
/**
|
||||
* 按钮
|
||||
*/
|
||||
playAudioButton () {
|
||||
return this.play(this.audioButtonClick, false);
|
||||
},
|
||||
|
||||
playRandomMatch()
|
||||
{
|
||||
this.playMusic(this.randomMatchSound);
|
||||
},
|
||||
playMatchFoundSound()
|
||||
{
|
||||
this.stopMusic();
|
||||
return this.play(this.matchFoundSound, false);
|
||||
}
|
||||
});
|
10
assets/Script/BallAudioManager.js.meta
Normal file
10
assets/Script/BallAudioManager.js.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "bd9f7f17-383e-4f98-b4e3-936acb6018b3",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
94
assets/Script/CtrlFluxayTexture.js
Normal file
94
assets/Script/CtrlFluxayTexture.js
Normal file
|
@ -0,0 +1,94 @@
|
|||
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
m_delayTime: {
|
||||
default: 0,
|
||||
},
|
||||
m_fluxayTime: {
|
||||
default: 1,
|
||||
},
|
||||
m_intervalTime: {
|
||||
default: 1,
|
||||
},
|
||||
m_scale: {
|
||||
default: 1,
|
||||
},
|
||||
m_angle: {
|
||||
default: 0,
|
||||
},
|
||||
m_reviseStartTime:{
|
||||
default: 0,
|
||||
},
|
||||
m_reviseTimeScale:{
|
||||
default: 1,
|
||||
},
|
||||
},
|
||||
|
||||
ctor(){
|
||||
this._time = 0;
|
||||
},
|
||||
onLoad () {
|
||||
this._time -= this.m_delayTime;
|
||||
|
||||
let sprite = this.node.getComponent(cc.Sprite);
|
||||
this._material = sprite.getMaterial(0);
|
||||
this._material.setProperty("u_scale", this.m_scale);
|
||||
this._material.setProperty("u_angle", this.m_angle);
|
||||
|
||||
this.refreshSpriteFrameData();
|
||||
},
|
||||
|
||||
update(dt) {
|
||||
if (this._time > (this.m_fluxayTime + this.m_intervalTime)) {
|
||||
this._time = 0;
|
||||
}
|
||||
|
||||
let u_time = this._time/this.m_fluxayTime;
|
||||
if(this._time >this.m_fluxayTime)
|
||||
{
|
||||
u_time = 1+((this._time-this.m_fluxayTime)/this.m_intervalTime);
|
||||
}
|
||||
if(this.m_reviseTimeScale != null && this.m_reviseStartTime != null)
|
||||
{
|
||||
u_time = u_time/this.m_reviseTimeScale;
|
||||
u_time -= this.m_reviseStartTime;
|
||||
}
|
||||
this._material.setProperty("u_time", u_time);
|
||||
this._time += dt;
|
||||
},
|
||||
|
||||
refreshSpriteFrameData(){
|
||||
let sprite = this.node.getComponent(cc.Sprite);
|
||||
let material = sprite.getMaterial(0);
|
||||
let frame = sprite.spriteFrame;
|
||||
|
||||
if(frame != null)
|
||||
{
|
||||
// xMin
|
||||
let l = frame.uv[0];
|
||||
// xMax
|
||||
let r = frame.uv[6];
|
||||
// yMax
|
||||
let b = frame.uv[3];
|
||||
// yMin
|
||||
let t = frame.uv[5];
|
||||
// 纹理在合图中的四个边界 uv 坐标
|
||||
let u_uvOffset = new cc.Vec4(l, t, r, b);
|
||||
// 纹理是否旋转
|
||||
let u_uvRotated = frame.isRotated() ? 1.0 : 0.0;
|
||||
// 设置材质的属性
|
||||
|
||||
if(material.getProperty("u_uvOffset") !== undefined)
|
||||
{
|
||||
material.setProperty("u_uvOffset", u_uvOffset);
|
||||
}
|
||||
if(material.getProperty("u_uvRotated") !== undefined)
|
||||
{
|
||||
material.setProperty("u_uvRotated", u_uvRotated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
10
assets/Script/CtrlFluxayTexture.js.meta
Normal file
10
assets/Script/CtrlFluxayTexture.js.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "b48a2ba4-145d-4594-9192-914707508113",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
515
assets/Script/GameData.ts
Normal file
515
assets/Script/GameData.ts
Normal file
|
@ -0,0 +1,515 @@
|
|||
// 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
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class GameData extends cc.Component {
|
||||
|
||||
@property(cc.Label)
|
||||
label: cc.Label = null;
|
||||
|
||||
@property
|
||||
text: string = 'hello';
|
||||
static _instance: any;
|
||||
GM_INFO: {};
|
||||
AudioManager: any;
|
||||
|
||||
GAME_DATA: any[];
|
||||
LEVEL_INFO: { //第一难度
|
||||
number: number; //太阳总数
|
||||
moveNumber: number; //太阳可移动个数
|
||||
moveSpeed: number; //太阳移动速度等级
|
||||
maxDistance: number; //布局后移动最大距离
|
||||
maxMove: number; //初始布局最大移动距离
|
||||
repeat: number; //是否重叠,现在0 不重叠 1 重叠1个
|
||||
}[];
|
||||
CLICK_DATA: { type: number; success: boolean; round: number; totalSunCount: number; movedSunCount: number; sunSpeed: number; overlapSunCount: number; colorList: any[]; duration: number; difficultyLevel: number; sunList: any[]; stepTimeList: any[]; remainder: number; };
|
||||
|
||||
// LEVEL_INFO: { number: number; }[];
|
||||
// LEVEL_INFO:[];
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
|
||||
onLoad () {
|
||||
if (GameData._instance == null) {
|
||||
GameData._instance = this;
|
||||
cc.game.addPersistRootNode(this.node);
|
||||
|
||||
this.AudioManager = this.node.getComponent('BallAudioManager');
|
||||
}
|
||||
else {
|
||||
this.node.destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
start () {
|
||||
this.GM_INFO = {
|
||||
// isEnd: false,
|
||||
mean_Time:0, //平均放箭速度
|
||||
total:0, //总共对的个数
|
||||
currSeed: 203213, //用于随机数种子
|
||||
gameId:'100009',
|
||||
userId:200139,
|
||||
guide:true, //是否有引导
|
||||
url:"http://api.sparkus.cn",
|
||||
success:false,
|
||||
matchId:null,
|
||||
custom: 0
|
||||
};
|
||||
this.LEVEL_INFO = [
|
||||
{ //第一难度
|
||||
number:3, //太阳总数
|
||||
moveNumber:0, //太阳可移动个数
|
||||
moveSpeed:0, //太阳移动速度等级
|
||||
maxDistance:200, //布局后移动最大距离
|
||||
maxMove:1200,
|
||||
repeat:0 //是否重叠,现在0 不重叠 1 重叠1个
|
||||
|
||||
},
|
||||
{ //第二难度
|
||||
number:4,
|
||||
moveNumber:0,
|
||||
moveSpeed:0,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //第三难度
|
||||
number:4,
|
||||
moveNumber:0,
|
||||
moveSpeed:0,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //第四难度
|
||||
number:5,
|
||||
moveNumber:1,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //第五难度
|
||||
number:5,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //第六难度
|
||||
number:6,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //第七难度
|
||||
number:6,
|
||||
moveNumber:3,
|
||||
moveSpeed:4,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //第八难度
|
||||
number:7,
|
||||
moveNumber:0,
|
||||
moveSpeed:4,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //第九难度
|
||||
number:7,
|
||||
moveNumber:3,
|
||||
moveSpeed:4,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //第十难度
|
||||
number:7,
|
||||
moveNumber:3,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //第十一难度
|
||||
number:8,
|
||||
moveNumber:3,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //第十二难度
|
||||
number:8,
|
||||
moveNumber:5,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //第十三难度
|
||||
number:9,
|
||||
moveNumber:3,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //第十四难度
|
||||
number:9,
|
||||
moveNumber:5,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //第十五难度
|
||||
number:10,
|
||||
moveNumber:5,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //11
|
||||
number:3,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //12
|
||||
number:4,
|
||||
moveNumber:0,
|
||||
moveSpeed:0,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //13
|
||||
number:4,
|
||||
moveNumber:1,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //14
|
||||
number:4,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //15
|
||||
number:4,
|
||||
moveNumber:1,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //16
|
||||
number:5,
|
||||
moveNumber:1,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //17
|
||||
number:5,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //18
|
||||
number:5,
|
||||
moveNumber:1,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //19
|
||||
number:5,
|
||||
moveNumber:2,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //20
|
||||
number:5,
|
||||
moveNumber:3,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //21
|
||||
number:5,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //22
|
||||
number:5,
|
||||
moveNumber:2,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //23
|
||||
number:6,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //24
|
||||
number:6,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //25
|
||||
number:6,
|
||||
moveNumber:2,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //26
|
||||
number:6,
|
||||
moveNumber:2,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //27
|
||||
number:6,
|
||||
moveNumber:4,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //28
|
||||
number:6,
|
||||
moveNumber:2,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //29
|
||||
number:7,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //30
|
||||
number:7,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //31
|
||||
number:7,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //32
|
||||
number:7,
|
||||
moveNumber:2,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //33
|
||||
number:7,
|
||||
moveNumber:4,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //34
|
||||
number:7,
|
||||
moveNumber:2,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //35
|
||||
number:8,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //36
|
||||
number:8,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //37
|
||||
number:8,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //38
|
||||
number:8,
|
||||
moveNumber:2,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //39
|
||||
number:8,
|
||||
moveNumber:4,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //40
|
||||
number:8,
|
||||
moveNumber:2,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //41
|
||||
number:8,
|
||||
moveNumber:4,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //42
|
||||
number:9,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
{ //43
|
||||
number:9,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //44
|
||||
number:9,
|
||||
moveNumber:5,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:1
|
||||
},
|
||||
{ //45
|
||||
number:10,
|
||||
moveNumber:0,
|
||||
moveSpeed:6,
|
||||
maxDistance:200,
|
||||
maxMove:1200,
|
||||
repeat:0
|
||||
},
|
||||
|
||||
|
||||
|
||||
]
|
||||
|
||||
this.CLICK_DATA =
|
||||
{
|
||||
type:1,
|
||||
success:false,
|
||||
round:0,
|
||||
totalSunCount:0,
|
||||
movedSunCount:0,
|
||||
sunSpeed:0,
|
||||
overlapSunCount:0,
|
||||
colorList:[],
|
||||
duration:0,
|
||||
difficultyLevel:0,
|
||||
sunList:[],
|
||||
stepTimeList:[],
|
||||
remainder:120
|
||||
}
|
||||
|
||||
this.GAME_DATA = [
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
CLICK_init(){
|
||||
this.CLICK_DATA =
|
||||
{
|
||||
type:1,
|
||||
success:false,
|
||||
round:0,
|
||||
totalSunCount:0,
|
||||
movedSunCount:0,
|
||||
sunSpeed:0,
|
||||
overlapSunCount:0,
|
||||
colorList:[],
|
||||
duration:0,
|
||||
difficultyLevel:0,
|
||||
sunList:[],
|
||||
stepTimeList:[],
|
||||
remainder:120
|
||||
}
|
||||
}
|
||||
|
||||
// update (dt) {}
|
||||
}
|
10
assets/Script/GameData.ts.meta
Normal file
10
assets/Script/GameData.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "f2f0b239-3ec5-48fa-8d7c-c45e86f8a55a",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
1143
assets/Script/GameManager.ts
Normal file
1143
assets/Script/GameManager.ts
Normal file
File diff suppressed because it is too large
Load Diff
10
assets/Script/GameManager.ts.meta
Normal file
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": {}
|
||||
}
|
167
assets/Script/GameOver.ts
Normal file
167
assets/Script/GameOver.ts
Normal file
|
@ -0,0 +1,167 @@
|
|||
// 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 GameData from "./GameData";
|
||||
import List from "./ListView/List";
|
||||
import HttpUtil from "./crypto/serverAPI";
|
||||
import Rq from "./crypto/serverAPI";
|
||||
|
||||
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.Node)
|
||||
selfNode: cc.Node = null;
|
||||
@property(cc.Node)
|
||||
one: cc.Node = null;
|
||||
@property(cc.Node)
|
||||
two: cc.Node = null;
|
||||
@property(cc.Node)
|
||||
three: cc.Node = null;
|
||||
@property(cc.Node)
|
||||
four: cc.Node = null;
|
||||
@property(cc.Node)
|
||||
five: cc.Node = null;
|
||||
|
||||
listData: any;
|
||||
selfData: any;
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {}
|
||||
|
||||
start () {
|
||||
this.count.string = GameData._instance.GM_INFO.total;
|
||||
this.time.string = GameData._instance.GM_INFO.mean_Time + "s";
|
||||
this.listData = [];
|
||||
this.selfData = null;
|
||||
this.one.active = false;
|
||||
this.two.active = false;
|
||||
this.three.active = false;
|
||||
this.four.active = false;
|
||||
this.five.active = false;
|
||||
// this.setData();
|
||||
this.getRank();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
success(data){
|
||||
}
|
||||
|
||||
|
||||
|
||||
back(){
|
||||
cc.director.loadScene("RankScene");
|
||||
}
|
||||
|
||||
again(){
|
||||
cc.director.loadScene("GameScene");
|
||||
}
|
||||
|
||||
getRank(){
|
||||
let postData = {
|
||||
"page":1,
|
||||
"pageSize":100
|
||||
};
|
||||
HttpUtil.rankData(2,this.getRankData.bind(this),postData);
|
||||
}
|
||||
|
||||
getRankData(data){
|
||||
if(data){
|
||||
this.listData = data.data.list;
|
||||
this.selfData = data.data.info;
|
||||
let rankData = [];
|
||||
let self = false;
|
||||
if(this.selfData.nickName.length > 4){
|
||||
this.selfData.nickName= this.selfData.nickName.substring(0,4) + "..."
|
||||
}
|
||||
this.selfNode.getChildByName("name").getComponent(cc.Label).string = this.selfData.nickName;
|
||||
this.selfNode.getChildByName("total").getComponent(cc.Label).string = this.selfData.totalSunCount;
|
||||
this.setPic(this.selfNode.getChildByName("pic").getChildByName("icon"),this.selfData.pic);
|
||||
for(let i=0;i<=this.listData.length-1;i++){
|
||||
rankData.push({rank:(i+1), name:this.listData[i].nickName, total:this.listData[i].totalSunCount, pic:this.listData[i].pic});
|
||||
if(GameData._instance.GM_INFO.userId == this.listData[i].userId){
|
||||
self = true;
|
||||
this.selfNode.getChildByName("rank").getComponent(cc.Label).string =(i+1) + "";
|
||||
}
|
||||
if(i == (this.listData.length-1) && self == false){
|
||||
this.selfNode.getChildByName("rank").getComponent(cc.Label).string = "99+";
|
||||
}
|
||||
if(i<5) this.setRank(i,this.listData[i]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
setRank(num,data){
|
||||
var hitNode = null;
|
||||
if(num == 0){
|
||||
hitNode = this.one;
|
||||
}
|
||||
else if(num == 1){
|
||||
hitNode = this.two;
|
||||
}
|
||||
else if(num == 2){
|
||||
hitNode = this.three;
|
||||
}
|
||||
else if(num == 3){
|
||||
hitNode = this.four;
|
||||
}
|
||||
else if(num == 4){
|
||||
hitNode = this.five;
|
||||
}
|
||||
if(hitNode){
|
||||
hitNode.active = true;
|
||||
if(data.nickName.length > 4){
|
||||
data.nickName= data.nickName.substring(0,4) + "..."
|
||||
}
|
||||
hitNode.getChildByName("name").getComponent(cc.Label).string = data.nickName;
|
||||
hitNode.getChildByName("total").getComponent(cc.Label).string = data.totalSunCount;
|
||||
this.setPic(hitNode.getChildByName("pic").getChildByName("icon"),data.pic);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public 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:'.jpg'},(err, texture:cc.Texture2D) => {
|
||||
if(texture){
|
||||
node.active = true;
|
||||
node.getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
|
||||
}
|
||||
else{
|
||||
console.log(err,texture)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// update (dt) {}
|
||||
}
|
10
assets/Script/GameOver.ts.meta
Normal file
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": {}
|
||||
}
|
353
assets/Script/GuideManager.ts
Normal file
353
assets/Script/GuideManager.ts
Normal file
|
@ -0,0 +1,353 @@
|
|||
// 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 GameData from './GameData';
|
||||
import { Notification } from './Notification';
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class NewClass extends cc.Component {
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
@property(cc.Node)
|
||||
dialog: cc.Node = null;
|
||||
@property(cc.Node)
|
||||
ball: cc.Node = null;
|
||||
@property(cc.Prefab)
|
||||
qiu1: cc.Prefab = null;
|
||||
@property(cc.Prefab)
|
||||
linePrefab: cc.Prefab = null;
|
||||
clickNow:number;
|
||||
custom: number;
|
||||
Pos_Array: any;
|
||||
ball_Array: any;
|
||||
begin: boolean;
|
||||
tip: cc.Node;
|
||||
// onLoad () {}
|
||||
|
||||
start () {
|
||||
this.custom = 1;
|
||||
this.init();
|
||||
this.startGuide(0);
|
||||
}
|
||||
|
||||
init(){
|
||||
this.ball.zIndex = 100;
|
||||
this.Pos_Array = [];
|
||||
this.ball_Array = [];
|
||||
this.begin = false;
|
||||
this.clickNow = 0;
|
||||
this.tip = null;
|
||||
}
|
||||
|
||||
startGuide(type){
|
||||
let num = this.custom;
|
||||
let time = 0.5;
|
||||
let delay = 1.5;
|
||||
let name = "tip" + num;
|
||||
|
||||
if(type!=0){
|
||||
cc.tween(this.node)
|
||||
.to(time,{opacity:255})
|
||||
.call(() =>{
|
||||
this.custom += 1;
|
||||
if(type != 0) this.custom = 2;
|
||||
if( this.custom == 2) this.createSun1();
|
||||
else if( this.custom == 3) this.createSun2();
|
||||
else if( this.custom == 4){
|
||||
|
||||
this.begin = true;
|
||||
}
|
||||
else if( this.custom == 5) cc.director.loadScene("GameScene");
|
||||
|
||||
})
|
||||
.start();
|
||||
}
|
||||
else{
|
||||
this.tip = this.dialog.getChildByName(name);
|
||||
this.tip.active = true; this.tip.opacity = 0;
|
||||
cc.tween(this.tip)
|
||||
.to(time,{opacity:255})
|
||||
.start();
|
||||
// cc.tween(tip)
|
||||
// .to(time,{opacity:255})
|
||||
// .delay(delay)
|
||||
// .to(time,{opacity:0})
|
||||
// .call(() =>{
|
||||
// this.custom += 1;
|
||||
// if(type != 0) this.custom = 2;
|
||||
// if( this.custom == 2) this.createSun1();
|
||||
// else if( this.custom == 3) this.createSun2();
|
||||
// else if( this.custom == 4) this.begin = true;
|
||||
// else if( this.custom == 5) cc.director.loadScene("GameScene");
|
||||
|
||||
// })
|
||||
// .start();
|
||||
}
|
||||
|
||||
}
|
||||
//创建太阳
|
||||
createSun1(){
|
||||
this.ball_Array = [];
|
||||
this.Pos_Array.push(cc.v2(-250,-216),cc.v2(200,-115),cc.v2(-35,-500));
|
||||
let time1 = this.calculateDistance(this.ball.x,this.ball.y,this.Pos_Array[0].x,this.Pos_Array[0].y)
|
||||
this.ball.opacity = 0;
|
||||
cc.tween(this.ball)
|
||||
.to(time1,{position:this.Pos_Array[0]})
|
||||
.call(() =>{
|
||||
this.createBall(0,0,0,false);
|
||||
})
|
||||
.delay(1)
|
||||
.call(() =>{
|
||||
this.startGuide(0);
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
beginClick(){
|
||||
for(let i=0; i<this.ball_Array.length; i++){
|
||||
this.ball_Array[i].getComponent("Sun").move = false;
|
||||
}
|
||||
}
|
||||
|
||||
clickBtn(){
|
||||
cc.director.loadScene("GameScene");
|
||||
}
|
||||
|
||||
next(){
|
||||
let time = 0.5;
|
||||
cc.tween(this.tip)
|
||||
.to(time,{opacity:0})
|
||||
.call(() =>{
|
||||
this.custom += 1;
|
||||
// if(type != 0) this.custom = 2;
|
||||
if( this.custom == 2) this.createSun1();
|
||||
else if( this.custom == 3) this.createSun2();
|
||||
else if( this.custom == 4) this.begin = true;
|
||||
else if( this.custom == 5) cc.director.loadScene("GameScene");
|
||||
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
createSun2(){
|
||||
let time2 = this.calculateDistance(this.Pos_Array[0].x,this.Pos_Array[0].y,this.Pos_Array[1].x,this.Pos_Array[1].y)
|
||||
let time3 = this.calculateDistance(this.Pos_Array[1].x,this.Pos_Array[1].y,this.Pos_Array[2].x,this.Pos_Array[2].y)
|
||||
this.ball.opacity = 255;
|
||||
this.createLine(cc.v2(this.ball.x,this.ball.y),cc.v2(this.Pos_Array[1].x,this.Pos_Array[1].y),
|
||||
0.5);
|
||||
cc.tween(this.ball)
|
||||
.to(time2,{position:this.Pos_Array[1]})
|
||||
.call(() =>{
|
||||
this.createBall(1,0,0,false);
|
||||
})
|
||||
.delay(0.5)
|
||||
.call(() =>{
|
||||
this.createLine(cc.v2(this.ball.x,this.ball.y),cc.v2(this.Pos_Array[2].x,this.Pos_Array[2].y),
|
||||
0.5);
|
||||
})
|
||||
.to(time3,{position:this.Pos_Array[2]})
|
||||
.call(() =>{
|
||||
this.createBall(2,0,0,false);
|
||||
this.ball.opacity = 0;
|
||||
})
|
||||
.delay(0.2)
|
||||
.call(() =>{
|
||||
this.destroyLine();
|
||||
this.startGuide(0);
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
createBall(number,color,speed,repeat){
|
||||
let ball = null;
|
||||
ball = cc.instantiate(this.qiu1);
|
||||
ball.parent = this.node.getChildByName("Sun");
|
||||
ball.zIndex = this.Pos_Array.length - number;
|
||||
ball.setPosition(this.ball.x,this.ball.y);
|
||||
ball.getComponent("Sun").init(number,color,speed,repeat);
|
||||
ball.getComponent("Sun").move = true;
|
||||
this.ball_Array.push(ball);
|
||||
}
|
||||
|
||||
calculateDistance(x1, y1, x2, y2) {
|
||||
const dx = x2 - x1;
|
||||
const dy = y2 - y1;
|
||||
var distance = Math.sqrt(dx*dx + dy*dy);
|
||||
if(distance > 800) distance = 800;
|
||||
const time = distance/800 * 0.8;
|
||||
return time;
|
||||
}
|
||||
|
||||
//移动创建下一个太阳
|
||||
moveSun(){
|
||||
|
||||
}
|
||||
|
||||
//获胜
|
||||
passLevel(){
|
||||
this.destroyLine();
|
||||
let timeArray = [];
|
||||
let timeCount = 0;
|
||||
let ball = this.ball_Array[0];
|
||||
for(let i=1; i< this.ball_Array.length; i++){
|
||||
let time = this.calculateDistance(this.ball_Array[i].x,this.ball_Array[i].y,
|
||||
this.ball_Array[i-1].x,this.ball_Array[i-1].y);
|
||||
timeArray.push(time);
|
||||
}
|
||||
for(let k=1; k< this.ball_Array.length; k++){
|
||||
setTimeout(() => {
|
||||
cc.tween(ball)
|
||||
.to(timeArray[k-1],{x:this.ball_Array[k].x,y:this.ball_Array[k].y})
|
||||
.call(() =>{
|
||||
this.ball_Array[k].active = false;
|
||||
if(k == this.ball_Array.length-1){
|
||||
setTimeout(() => {
|
||||
this.ball.opacity = 255;
|
||||
this.ball.position = cc.v3(ball.x,ball.y,0);
|
||||
this.ball.active = false;
|
||||
this.startGuide(0);
|
||||
}, 200);
|
||||
}
|
||||
})
|
||||
.start();
|
||||
}, timeCount*1000);
|
||||
timeCount += (timeArray[k-1]+0.1);
|
||||
}
|
||||
}
|
||||
|
||||
//点击太阳执行方法
|
||||
clickSun(data){
|
||||
if(this.begin == true){
|
||||
if(data == this.clickNow){
|
||||
GameData._instance.AudioManager.playAudioButton();
|
||||
if(this.clickNow > 0){
|
||||
this.createLine(cc.v2(this.ball_Array[this.clickNow-1].x,this.ball_Array[this.clickNow-1].y),
|
||||
cc.v2(this.ball_Array[this.clickNow].x,this.ball_Array[this.clickNow].y),
|
||||
0.2);
|
||||
}
|
||||
this.clickNow += 1;
|
||||
GameData._instance.GM_INFO.total += 1;
|
||||
setTimeout(() => {
|
||||
if(this.ball_Array[this.clickNow-1])
|
||||
this.ball_Array[this.clickNow-1].getChildByName("guang").active = false;
|
||||
}, 200);
|
||||
|
||||
|
||||
if(this.clickNow == 3){
|
||||
let win = this.node.getChildByName("Win");
|
||||
win.active = true; win.setScale(0);
|
||||
cc.tween(win)
|
||||
.delay(0.4)
|
||||
.to(0.01,{scale:2.5})
|
||||
.to(0.35,{scale:1})
|
||||
.delay(0.6)
|
||||
.call(() =>{
|
||||
win.active = false;
|
||||
setTimeout(() => {
|
||||
this.passLevel();
|
||||
}, 400);
|
||||
|
||||
})
|
||||
.start();
|
||||
}
|
||||
}
|
||||
else{
|
||||
GameData._instance.AudioManager.playWarning();
|
||||
this.begin = false;
|
||||
|
||||
this.loseLevel(1)
|
||||
let over = this.node.getChildByName("Over");
|
||||
cc.tween(over)
|
||||
.to(0.25,{opacity:255})
|
||||
.delay(0.1)
|
||||
.to(0.2,{opacity:0})
|
||||
.delay(0.1)
|
||||
.to(0.15,{opacity:255})
|
||||
.delay(0.1)
|
||||
.to(0.1,{opacity:0})
|
||||
.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loseLevel(type){
|
||||
this.destroyLine();
|
||||
let ball = this.ball_Array[0];
|
||||
for(let k=1; k< this.ball_Array.length; k++){
|
||||
cc.tween(this.ball_Array[k])
|
||||
.to(0.6,{x:ball.x,y:ball.y})
|
||||
.call(() =>{
|
||||
this.ball_Array[k].active = false;
|
||||
if(k == this.ball_Array.length-1){
|
||||
this.ball.opacity = 0;
|
||||
this.ball.position = cc.v3(ball.x,ball.y,0);
|
||||
this.clearSun();
|
||||
this.custom = 1;
|
||||
this.startGuide(1);
|
||||
}
|
||||
})
|
||||
.start()
|
||||
}
|
||||
}
|
||||
|
||||
clearSun(){
|
||||
for(let k=0; k< this.ball_Array.length; k++){
|
||||
this.ball_Array[k].removeFromParent();
|
||||
this.ball_Array[k] = null;
|
||||
}
|
||||
this.ball_Array = [];
|
||||
}
|
||||
|
||||
//获取时间戳
|
||||
getTime(){
|
||||
const timestamp = new Date().getTime();
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
destroyLine() {
|
||||
for(let i =0; i< this.node.getChildByName("Line").children.length;i++){
|
||||
if(this.node.getChildByName("Line").children[i]){
|
||||
this.node.getChildByName("Line").children[i].removeFromParent();
|
||||
this.node.getChildByName("Line").children[i] = null;
|
||||
}
|
||||
}
|
||||
this.node.getChildByName("Line").removeAllChildren();
|
||||
}
|
||||
|
||||
createLine(start,end,time){
|
||||
let line = cc.instantiate(this.linePrefab);
|
||||
line.parent = this.node.getChildByName("Line");
|
||||
line.setPosition(start.x,start.y);
|
||||
|
||||
const dx = end.x - start.x;
|
||||
const dy = end.y - start.y;
|
||||
var distance = Math.sqrt(dx*dx + dy*dy);
|
||||
line.height = distance;
|
||||
line.getComponent(cc.Sprite).fillRange = 0;
|
||||
line.angle = -this.calculateAngle(start.x,start.y,end.x,end.y);
|
||||
cc.tween(line.getComponent(cc.Sprite))
|
||||
.to(time,{fillRange:1})
|
||||
.start();
|
||||
}
|
||||
|
||||
calculateAngle(x1, y1, x2, y2) {
|
||||
var angle = Math.atan2(y2-y1,x2-x1)*180 / Math.PI - 90;
|
||||
return -angle;
|
||||
}
|
||||
|
||||
onEnable () {
|
||||
Notification.on("clickSun", this.clickSun, this);
|
||||
}
|
||||
|
||||
onDisable () {
|
||||
Notification.off("clickSun", this.clickSun);
|
||||
}
|
||||
|
||||
// update (dt) {}
|
||||
}
|
10
assets/Script/GuideManager.ts.meta
Normal file
10
assets/Script/GuideManager.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "3fd2f87a-bc73-4978-8494-8b35b4f716ad",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
181
assets/Script/Helloworld.ts
Normal file
181
assets/Script/Helloworld.ts
Normal file
|
@ -0,0 +1,181 @@
|
|||
import GameData from "./GameData";
|
||||
import List from "./ListView/List";
|
||||
import HttpUtil from "./crypto/serverAPI";
|
||||
// import { apiSign } from "./crypto/sign";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class Helloworld 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;
|
||||
rankTotal: number;
|
||||
|
||||
onLoad() {
|
||||
this.rankList = cc.find("ScrollView", this.node).getComponent(List);
|
||||
this.listData = [];
|
||||
this.selfData = null;
|
||||
this.rankNumber = 100;
|
||||
this.rankTotal= 100;
|
||||
this.selfNode.opacity = 0;
|
||||
}
|
||||
|
||||
start() {
|
||||
this.getRank();
|
||||
}
|
||||
|
||||
getRankData(data){
|
||||
if(data){
|
||||
console.log(data);
|
||||
this.listData = data.data.list;
|
||||
this.selfData = data.data.info;
|
||||
let rankData = [];
|
||||
let self = false;
|
||||
for(let i=0;i<=this.listData.length-1;i++){
|
||||
rankData.push({rank:(i+1), name:this.listData[i].nickName, total:this.listData[i].totalSunCount, pic:this.listData[i].pic});
|
||||
if(GameData._instance.GM_INFO.userId == this.listData[i].userId){
|
||||
self = true;
|
||||
this.rankNumber = i;
|
||||
this.selfNode.getChildByName("rankLab").getComponent(cc.Label).string =(i+1) + "";
|
||||
}
|
||||
if(i == (this.listData.length-1) && self == false){
|
||||
this.rankNumber = i;
|
||||
this.selfNode.getChildByName("rankLab").getComponent(cc.Label).string = "99+";
|
||||
}
|
||||
}
|
||||
this.rankList.setData(rankData);
|
||||
if(this.selfData.nickName.length > 6){
|
||||
this.selfData.nickName= this.selfData.nickName.substring(0,6) + "..."
|
||||
}
|
||||
this.selfNode.getChildByName("nameLab").getComponent(cc.Label).string = this.selfData.nickName;
|
||||
this.selfNode.getChildByName("totalLab").getComponent(cc.Label).string = this.selfData.totalSunCount;
|
||||
this.setPic(this.selfData.pic);
|
||||
this.setPic2(this.selfData.pic);
|
||||
if(this.selfNode.getChildByName("rankLab").getComponent(cc.Label).string == "1"){
|
||||
this.selfNode.getChildByName("rank").getChildByName("one").active = true;
|
||||
}
|
||||
else if(this.selfNode.getChildByName("rankLab").getComponent(cc.Label).string == "2"){
|
||||
this.selfNode.getChildByName("rank").getChildByName("two").active = true;
|
||||
}
|
||||
else if(this.selfNode.getChildByName("rankLab").getComponent(cc.Label).string == "3"){
|
||||
this.selfNode.getChildByName("rank").getChildByName("three").active = true;
|
||||
}
|
||||
else{
|
||||
// this.selfNode.getChildByName("four").active = true;
|
||||
}
|
||||
this.selfNode.opacity = 255;
|
||||
|
||||
}
|
||||
}
|
||||
backClick(){
|
||||
cc.director.loadScene("LoadScene");
|
||||
}
|
||||
|
||||
playerAction(){
|
||||
//-254 377 210 453
|
||||
let time = 1;
|
||||
this.tween = cc.tween(this.Player)
|
||||
.to(2,{position:cc.v3(210,453,0)})
|
||||
.start();
|
||||
time = (this.listData.length - this.rankNumber)/this.listData.length;
|
||||
if(this.listData.length >= 99){
|
||||
if(this.rankNumber >= 99){
|
||||
time = (Math.random()*49+1)/100
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
if(this.tween)this.tween.stop();
|
||||
}, time*2000);
|
||||
|
||||
}
|
||||
|
||||
getRank(){
|
||||
let postData = {
|
||||
"page":1,
|
||||
"pageSize":100
|
||||
};
|
||||
HttpUtil.rankData(2,this.getRankData.bind(this),postData);
|
||||
}
|
||||
|
||||
public setPic(pic){
|
||||
this.phone.node.parent.getChildByName("icon").active = false;
|
||||
this.phone.node.active = false;
|
||||
let url = pic;
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
return response.headers.get('Content-Length');
|
||||
})
|
||||
.then(errNo => {
|
||||
if(errNo == "5093"){
|
||||
this.phone.node.parent.getChildByName("icon").active = true;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching X-Info:', error);
|
||||
});
|
||||
var self = this;
|
||||
cc.assetManager.loadRemote(url, {ext:'.jpg'},(err, texture:cc.Texture2D) => {
|
||||
if(texture){
|
||||
this.phone.node.active = true;
|
||||
self.phone.spriteFrame = new cc.SpriteFrame(texture);
|
||||
}
|
||||
else{
|
||||
console.log(err,texture)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
public setPic2(pic){
|
||||
this.Player.getChildByName("mask").getChildByName("icon").active = false;
|
||||
this.Player.getChildByName("mask").getChildByName("phone").active = false;
|
||||
let url = pic;
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
return response.headers.get('Content-Length');
|
||||
})
|
||||
|
||||
.then(errNo => {
|
||||
if(errNo == "5093"){
|
||||
this.Player.getChildByName("mask").getChildByName("icon").active = true;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching X-Info:', error);
|
||||
});
|
||||
var self = this;
|
||||
cc.assetManager.loadRemote(url, {ext:'.jpg'},(err, texture:cc.Texture2D) => {
|
||||
if(texture){
|
||||
this.Player.getChildByName("mask").getChildByName("phone").active = true;
|
||||
this.Player.getChildByName("mask").getChildByName("phone").getComponent(cc.Sprite)
|
||||
.spriteFrame = new cc.SpriteFrame(texture);
|
||||
setTimeout(() => {
|
||||
this.playerAction();
|
||||
}, 500);
|
||||
// console.log("设置头像成功",err);
|
||||
}
|
||||
else{
|
||||
// console.log("设置头像失败",url);
|
||||
console.log(err,texture)
|
||||
setTimeout(() => {
|
||||
this.playerAction();
|
||||
}, 500);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
10
assets/Script/Helloworld.ts.meta
Normal file
10
assets/Script/Helloworld.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "e1b90feb-a217-4493-849d-9a611900d683",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/ListView.meta
Normal file
13
assets/Script/ListView.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "5a7c7479-48b8-4ee6-a003-33adfd2cb965",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
75
assets/Script/ListView/ItemRender.ts
Normal file
75
assets/Script/ListView/ItemRender.ts
Normal file
|
@ -0,0 +1,75 @@
|
|||
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(){
|
||||
if(this.data.name.length > 6){
|
||||
this.data.name = this.data.name.substring(0,6) + "..."
|
||||
}
|
||||
this.node.getChildByName("rankLab").getComponent(cc.Label).string = this.data.rank + "";
|
||||
this.node.getChildByName("nameLab").getComponent(cc.Label).string = this.data.name + "";
|
||||
this.node.getChildByName("totalLab").getComponent(cc.Label).string = this.data.total + "";
|
||||
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:'.jpg'},(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/ListView/ItemRender.ts.meta
Normal file
10
assets/Script/ListView/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/ListView/List.ts
Normal file
592
assets/Script/ListView/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/ListView/List.ts.meta
Normal file
10
assets/Script/ListView/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": {}
|
||||
}
|
95
assets/Script/Load.ts
Normal file
95
assets/Script/Load.ts
Normal file
|
@ -0,0 +1,95 @@
|
|||
// 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
|
||||
const {ccclass, property, requireComponent} = cc._decorator;
|
||||
import GameData from "./GameData";
|
||||
import HttpUtil from "./crypto/serverAPI";
|
||||
import Rq from "./crypto/serverAPI";
|
||||
// import { apiSign } from "./crypto/sign";
|
||||
|
||||
@ccclass
|
||||
export default class NewClass extends cc.Component {
|
||||
|
||||
@property(cc.Label)
|
||||
label: cc.Label = null;
|
||||
|
||||
@property
|
||||
text: string = 'hello';
|
||||
|
||||
|
||||
start () {
|
||||
GameData._instance.GM_INFO.userId = this.getUserId();
|
||||
if(GameData._instance.GM_INFO.userId == null){
|
||||
let url = "http://api.sparkus.cn/api/user/auth/login?domain=hui32579WdYPsgYq&callback=http://train.sparkus.cn/test/Sun_moves/";
|
||||
window.location.href = url;
|
||||
}
|
||||
else{
|
||||
GameData._instance.GM_INFO.userId = parseInt(GameData._instance.GM_INFO.userId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
createTexture(){
|
||||
let url = "http://static.sparkus.cn/shoot-sun/assets/resources/native/7a/7a8b41ad-9425-44e2-8f55-7740f12b0e0a.jpg";
|
||||
cc.assetManager.loadRemote(url, (err, texture:cc.Texture2D) => {
|
||||
console.log(err,texture)
|
||||
if(texture){
|
||||
var sprite = this.node.getChildByName("icon").getComponent(cc.Sprite);
|
||||
sprite.spriteFrame = new cc.SpriteFrame(texture);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private getUserId() {
|
||||
let pathStr = window.location.search;
|
||||
|
||||
let arr=pathStr.split("&");
|
||||
if (pathStr.length>= 0&&arr.length>0) {
|
||||
let arr2=[];
|
||||
arr.map(item=>{
|
||||
arr2.push(item.split("=")[1])
|
||||
})
|
||||
GameData._instance.GM_INFO.userId = arr2[0] + "";
|
||||
return arr2[0];
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
startGame(){
|
||||
GameData._instance.GM_INFO.custom = 0;
|
||||
cc.director.loadScene("GuideScene");
|
||||
}
|
||||
|
||||
clickBtn(event,data){
|
||||
GameData._instance.GM_INFO.custom = parseInt(data);
|
||||
cc.director.loadScene("GameScene");
|
||||
}
|
||||
|
||||
openLevel(){
|
||||
this.node.getChildByName("Level").active = true;
|
||||
}
|
||||
|
||||
closeBtn(){
|
||||
this.node.getChildByName("Level").active = false;
|
||||
}
|
||||
|
||||
back(data){
|
||||
// debugger;
|
||||
}
|
||||
|
||||
openBtn(){
|
||||
GameData._instance.GM_INFO.custom = 0;
|
||||
cc.director.loadScene("GuideScene");
|
||||
}
|
||||
|
||||
openRank(){
|
||||
cc.director.loadScene("RankScene");
|
||||
|
||||
}
|
||||
|
||||
// update (dt) {}
|
||||
}
|
10
assets/Script/Load.ts.meta
Normal file
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": {}
|
||||
}
|
46
assets/Script/Notification.ts
Normal file
46
assets/Script/Notification.ts
Normal file
|
@ -0,0 +1,46 @@
|
|||
//全局通知
|
||||
var Notification = {
|
||||
_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 { Notification };
|
10
assets/Script/Notification.ts.meta
Normal file
10
assets/Script/Notification.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "f2518fb4-2074-4639-8fae-788846b44780",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
428
assets/Script/RankListItem.prefab
Normal file
428
assets/Script/RankListItem.prefab
Normal file
|
@ -0,0 +1,428 @@
|
|||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "RankListItem",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 8
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 11
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "bg",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 164,
|
||||
"g": 118,
|
||||
"b": 239,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
|
||||
},
|
||||
"fileId": "6eyN1+nK5HT7svNqUsa2/+",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "rankLab",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 6
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 7
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 16,
|
||||
"g": 1,
|
||||
"b": 1,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 97.87,
|
||||
"height": 50.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
-46.832,
|
||||
22.301,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_useOriginalSize": false,
|
||||
"_string": "Label",
|
||||
"_N$string": "Label",
|
||||
"_fontSize": 40,
|
||||
"_lineHeight": 40,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_styleFlags": 0,
|
||||
"_underlineHeight": 0,
|
||||
"_N$horizontalAlign": 0,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0,
|
||||
"_N$cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
|
||||
},
|
||||
"fileId": "de4HHWkIhExrJq1+nHHMA6",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "nameLab",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 9
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 13,
|
||||
"g": 1,
|
||||
"b": 1,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100.06,
|
||||
"height": 50.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
-45.717,
|
||||
-24.531,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 8
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_useOriginalSize": false,
|
||||
"_string": "name",
|
||||
"_N$string": "name",
|
||||
"_fontSize": 40,
|
||||
"_lineHeight": 40,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_styleFlags": 0,
|
||||
"_underlineHeight": 0,
|
||||
"_N$horizontalAlign": 0,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0,
|
||||
"_N$cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
|
||||
},
|
||||
"fileId": "05c46heZhJV4sYMqYyxlB5",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "ca0f9k0oBVDbpQC+OMNTF3m",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "5aca560f-66b4-413d-95bd-73669c0bca6b"
|
||||
},
|
||||
"fileId": "55FH2q1HJAyK0hrjxGH/+q",
|
||||
"sync": false
|
||||
}
|
||||
]
|
9
assets/Script/RankListItem.prefab.meta
Normal file
9
assets/Script/RankListItem.prefab.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "5aca560f-66b4-413d-95bd-73669c0bca6b",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
34
assets/Script/Storage.js
Normal file
34
assets/Script/Storage.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
|
||||
// var jequry = require("jquery");
|
||||
// var coinManager = require("coinManager");
|
||||
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)
|
||||
// debugger;
|
||||
// var temp = cc.sys.localStorage.getItem(key);
|
||||
// debugger;
|
||||
},
|
||||
removeStorage : function(key){
|
||||
//主动删除消息接口
|
||||
if(cc.sys.localStorage.getItem(key)){
|
||||
cc.sys.localStorage.removeItem(key)
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
StorageMessage: StorageMessage,
|
||||
}
|
10
assets/Script/Storage.js.meta
Normal file
10
assets/Script/Storage.js.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "b5d92920-0919-4abb-9218-2a76863e0a1a",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
94
assets/Script/Sun.ts
Normal file
94
assets/Script/Sun.ts
Normal file
|
@ -0,0 +1,94 @@
|
|||
// 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
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
import GameManager from './GameManager';
|
||||
import { Notification } from './Notification';
|
||||
|
||||
@ccclass
|
||||
export default class NewClass extends cc.Component {
|
||||
|
||||
id_Number:number
|
||||
_speed:number
|
||||
_color:number
|
||||
touch:boolean
|
||||
_repeat:boolean
|
||||
move:boolean
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {}
|
||||
|
||||
start () {
|
||||
this.touch = true;
|
||||
this.move = false;
|
||||
this._color = 0;
|
||||
this._speed = 0;
|
||||
var shan = this.node.getChildByName("shan");
|
||||
|
||||
cc.tween(shan)
|
||||
.repeatForever(
|
||||
cc.tween()
|
||||
.to(1,{opacity:0,scale:0.5,})
|
||||
.delay(0.2)
|
||||
.to(1,{opacity:255,scale:1.2})
|
||||
.delay(0.5)
|
||||
)
|
||||
.start();
|
||||
|
||||
}
|
||||
|
||||
init(_id,color,speed,repeat){
|
||||
this.id_Number = _id;
|
||||
this._color = color;
|
||||
this._speed = speed;
|
||||
this._repeat = repeat;
|
||||
}
|
||||
|
||||
showNumber(type){
|
||||
this.node.getChildByName("number").active = type;
|
||||
if(type == true)
|
||||
this.node.getChildByName("number").getComponent(cc.Label).string = this.id_Number + "";
|
||||
}
|
||||
|
||||
clickBtn(){
|
||||
var temp = this.node.parent.parent.name;
|
||||
// console.log(temp,this.move,this.touch);
|
||||
if( this.move == false && this.touch == true){
|
||||
if(this.node.parent.parent.name == "GameNode"){
|
||||
if(this.node.parent.parent.getComponent("GameManager").begin == true){
|
||||
cc.tween(this.node.getChildByName("action"))
|
||||
.to(0.5,{opacity:0,scale:1.8})
|
||||
.start();
|
||||
cc.tween(this.node)
|
||||
.to(0.3,{scale:1.3})
|
||||
.to(0.3,{scale:1})
|
||||
.start();
|
||||
this.touch = false;
|
||||
this.node.zIndex = -1;
|
||||
Notification.emit("clickSun",this.id_Number);
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.touch = false;
|
||||
this.node.zIndex = -1;
|
||||
Notification.emit("clickSun",this.id_Number);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
clickBtn2(){
|
||||
if( this.touch == true && this.node.parent.parent.getComponent("GuideManager").begin == true){
|
||||
this.touch = false;
|
||||
this.node.zIndex = -1;
|
||||
Notification.emit("clickSun",this.id_Number);
|
||||
}
|
||||
}
|
||||
|
||||
update (dt) {
|
||||
}
|
||||
}
|
10
assets/Script/Sun.ts.meta
Normal file
10
assets/Script/Sun.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "4be67b1d-91ec-42ca-a2e5-d0d1ddf4dd5f",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/crypto.meta
Normal file
13
assets/Script/crypto.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "e8009432-4774-4831-a537-511de4498eee",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
3
assets/Script/crypto/crypto-js.min.js
vendored
Normal file
3
assets/Script/crypto/crypto-js.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
assets/Script/crypto/crypto-js.min.js.meta
Normal file
10
assets/Script/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": {}
|
||||
}
|
254
assets/Script/crypto/serverAPI.ts
Normal file
254
assets/Script/crypto/serverAPI.ts
Normal file
|
@ -0,0 +1,254 @@
|
|||
// import CryptoJS from "crypto-js";
|
||||
|
||||
|
||||
import GameData from '../GameData';
|
||||
import CryptoJS = require('./crypto-js.min.js'); //引用AES源码js
|
||||
|
||||
// import axios from 'axios'
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class HttpUtil extends cc.Component {
|
||||
//排行榜type2为获取,type1为上传
|
||||
static async rankData(type,callback,data): Promise<any> {
|
||||
data.gameId = GameData._instance.GM_INFO.gameId;
|
||||
data.userId = GameData._instance.GM_INFO.userId;
|
||||
const time = Math.floor((new Date().getTime()) / 1000)
|
||||
const url = apiSign(`/api/get/rank/data?gameId=${config.gameId}&dataType=${type}&time=${time}`, data)
|
||||
this.httpPost(url,data,callback);
|
||||
}
|
||||
|
||||
static async uploadUserLogData(data,callback): Promise<any> {
|
||||
data.gameId = GameData._instance.GM_INFO.gameId;
|
||||
data.userId = GameData._instance.GM_INFO.userId;
|
||||
const url = '/log/collect/data';
|
||||
this.httpPost(url,data,callback);
|
||||
}
|
||||
//暂时用不到
|
||||
static async getUserRecord(data,callback): Promise<any> {
|
||||
data.gameId = GameData._instance.GM_INFO.gameId;
|
||||
data.userId = GameData._instance.GM_INFO.userId;
|
||||
const time = Math.floor((new Date().getTime()) / 1000)
|
||||
const url = apiSign(`/api/get/user/data?gameId=${config.gameId}&time=${time}`, data)
|
||||
this.httpPost(url,data,callback);
|
||||
}
|
||||
|
||||
static httpPost(url,data,callBack){
|
||||
data.gameId = GameData._instance.GM_INFO.gameId;
|
||||
data.userId = GameData._instance.GM_INFO.userId;
|
||||
var urlData = "http://api.sparkus.cn" + url;
|
||||
// console.log("params:",JSON.stringify(data));
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', urlData);
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var data = xhr.responseText;
|
||||
if(!data){
|
||||
// console.log("初始化失败");
|
||||
return;
|
||||
}
|
||||
var json = JSON.parse(data);
|
||||
// console.log('http success:' + json);
|
||||
callBack(json);
|
||||
}
|
||||
else{
|
||||
// var json = JSON.parse(data);
|
||||
// console.log('http fail:' + url);
|
||||
callBack(json);
|
||||
}
|
||||
};
|
||||
xhr.send(JSON.stringify(data));
|
||||
}
|
||||
|
||||
static httpGet(url,callBack){
|
||||
var urlData = "http://api.sparkus.cn" + url;
|
||||
console.log(urlData);
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', urlData);
|
||||
xhr.setRequestHeader('Content-Type', 'text/plain');
|
||||
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
var data = xhr.responseText;
|
||||
if(data){
|
||||
var json = JSON.parse(data);
|
||||
console.info('http success:' + json);
|
||||
callBack(json);
|
||||
}
|
||||
else callBack(data);
|
||||
}
|
||||
else{
|
||||
console.info('http fail:' + url);
|
||||
callBack(null);
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
}
|
||||
|
||||
function responseHandler(response: { data: any }) {
|
||||
return response.data
|
||||
}
|
||||
// 响应拦截器
|
||||
// Rq.interceptors.response.use(responseHandler)
|
||||
const config = {
|
||||
gameId: "100009",
|
||||
secretKey: "CMNhOzBA",
|
||||
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()}`;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param url {string} 接口地址
|
||||
* @param params {object} 需要加密的参数对象
|
||||
*/
|
||||
function 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}`
|
||||
}
|
||||
|
10
assets/Script/crypto/serverAPI.ts.meta
Normal file
10
assets/Script/crypto/serverAPI.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "9830733c-b94b-4b60-a687-5cf98680259f",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
31
assets/Script/test.ts
Normal file
31
assets/Script/test.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
if(this.level == 1){
|
||||
let data = {x:-200,y:-380,time:0,timeCount:0};
|
||||
let timeCount = this.timeCount + (0.8-this.calculateDistance(this.ball.x,this.ball.y,-200,-380));
|
||||
let time = this.calculateDistance(this.ball.x,this.ball.y,-200,-380)+timeCount;
|
||||
data = {x:-200,y:-380,time:time,timeCount:timeCount};
|
||||
this.now_Array.push(data);
|
||||
|
||||
timeCount = this.timeCount + (0.8-this.calculateDistance(this.ball.x,this.ball.y,-250,-300));
|
||||
time = this.calculateDistance(this.now_Array[this.now_Array.length-1].x,
|
||||
this.now_Array[this.now_Array.length-1].y,-250,-300)+timeCount;
|
||||
data = {x:-250,y:-300,time:time,timeCount:timeCount};
|
||||
this.now_Array.push(data);
|
||||
|
||||
timeCount = this.timeCount + (0.8-this.calculateDistance(this.ball.x,this.ball.y,-300,500));
|
||||
time = this.calculateDistance(this.now_Array[this.now_Array.length-1].x,
|
||||
this.now_Array[this.now_Array.length-1].y,-300,500)+timeCount;
|
||||
data = {x:-300,y:500,time:time,timeCount:timeCount};
|
||||
this.now_Array.push(data);
|
||||
|
||||
timeCount = this.timeCount + (0.8-this.calculateDistance(this.ball.x,this.ball.y,208,280));
|
||||
time = this.calculateDistance(this.now_Array[this.now_Array.length-1].x,
|
||||
this.now_Array[this.now_Array.length-1].y,208,280)+timeCount;
|
||||
data = {x:208,y:280,time:time,timeCount:timeCount};
|
||||
this.now_Array.push(data);
|
||||
|
||||
timeCount = this.timeCount + (0.8-this.calculateDistance(this.ball.x,this.ball.y,208,-280));
|
||||
time = this.calculateDistance(this.now_Array[this.now_Array.length-1].x,
|
||||
this.now_Array[this.now_Array.length-1].y,208,-280)+timeCount;
|
||||
data = {x:208,y:-280,time:time,timeCount:timeCount};
|
||||
this.now_Array.push(data);
|
||||
}
|
10
assets/Script/test.ts.meta
Normal file
10
assets/Script/test.ts.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "f7f5d7e6-2a27-4e6d-988c-2edb817408aa",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Script/tool.meta
Normal file
13
assets/Script/tool.meta
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "4bff6e01-b411-48f4-867a-5d841f9e400f",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
10
assets/Script/tool/DynamicAtlasManager.js
Normal file
10
assets/Script/tool/DynamicAtlasManager.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
},
|
||||
|
||||
onLoad () {
|
||||
cc.dynamicAtlasManager.enabled = false;
|
||||
},
|
||||
});
|
10
assets/Script/tool/DynamicAtlasManager.js.meta
Normal file
10
assets/Script/tool/DynamicAtlasManager.js.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "3ffac3a7-78e4-427f-a05c-d4b1614c2090",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
588
assets/Script/tool/GameTool.js
Normal file
588
assets/Script/tool/GameTool.js
Normal file
|
@ -0,0 +1,588 @@
|
|||
var StorageMessage = require("Storage").StorageMessage;
|
||||
window.GameTool = {
|
||||
_startTime: 0,
|
||||
_endTime: 0,
|
||||
_totalTime: 0,
|
||||
getSeedRandom: function (min, max) {//包含min 不包含max
|
||||
max = max || 1;
|
||||
min = min || 0;
|
||||
GM_INFO.currSeed = (GM_INFO.currSeed * 9301 + 49297) % 233280;
|
||||
let rnd = GM_INFO.currSeed / 233280.0;
|
||||
let tmp = min + rnd * (max - min);
|
||||
return parseInt(tmp);
|
||||
},
|
||||
|
||||
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 = GameTool.getSetScreenResolutionFlag();
|
||||
if (flag) {
|
||||
// console.log("不是全面屏");
|
||||
// canvas.fitWidth = false;
|
||||
// canvas.fitHeight = true;
|
||||
} else {
|
||||
// console.log("是全面屏");
|
||||
// canvas.fitWidth = true;
|
||||
// canvas.fitHeight = false;
|
||||
}
|
||||
return flag;
|
||||
},
|
||||
|
||||
// submitScoreButtonFunc: function(score1,fen1){
|
||||
// console.log("上传分数:",score1,fen1)
|
||||
// // var score = score1;
|
||||
// // var fen = fen1;
|
||||
// // if (CC_WECHATGAME) {
|
||||
// // window.wx.postMessage({
|
||||
// // messageType: 3,
|
||||
// // MAIN_MENU_NUM: "guan",
|
||||
// // score: score,
|
||||
// // MAIN_MENU_FEN: "score",
|
||||
// // fen: fen,
|
||||
// // });
|
||||
// // } else {
|
||||
// // cc.log("提交得分: x1 : " + score)
|
||||
// // }
|
||||
// // return true;
|
||||
// },
|
||||
|
||||
|
||||
submitScoreButtonFunc: function(fen2,number){
|
||||
console.log("number=",number)
|
||||
if(number == 0){
|
||||
console.log("上传分数:",fen2)
|
||||
var fen = fen2;
|
||||
if (CC_WECHATGAME) {
|
||||
window.wx.postMessage({
|
||||
messageType: 3,
|
||||
MAIN_MENU_FEN: "score",
|
||||
MAIN_MENU_NUM: "fen",
|
||||
score: fen,
|
||||
fen: 0,
|
||||
});
|
||||
} else {
|
||||
cc.log("提交得分: x1 : " + fen)
|
||||
}
|
||||
}
|
||||
else{
|
||||
console.log("上传特殊分数:",fen2)
|
||||
var fen = fen2;
|
||||
if (CC_WECHATGAME) {
|
||||
window.wx.postMessage({
|
||||
messageType: 7,
|
||||
MAIN_MENU_FEN: "score",
|
||||
MAIN_MENU_NUM: "fen",
|
||||
score: 0,
|
||||
fen: fen,
|
||||
});
|
||||
} else {
|
||||
cc.log("提交得分: x1 : " + fen)
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
getTip: function () {
|
||||
let index = Math.floor(Math.random() * 4) + 1;
|
||||
switch (index) {
|
||||
case 1: {
|
||||
return "根据小球的位置,合理晃动手机,确保小球不掉出木板。"
|
||||
}
|
||||
case 2: {
|
||||
return "根据小球位置控制晃动幅度,过大或过小都不是个好选择。"
|
||||
}
|
||||
case 3: {
|
||||
return "不要被天上掉落的障碍吓到,有时候它反而会帮你保持平衡。"
|
||||
}
|
||||
case 4: {
|
||||
return "尝试着顶开掉落的障碍,是个很酷的玩法。"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
beginTiming: function () {
|
||||
this._startTime = new Date().getTime();
|
||||
},
|
||||
|
||||
endTiming: function () {
|
||||
this._endTime = new Date().getTime();
|
||||
// this._totalTime = endTime - this._startTime;
|
||||
},
|
||||
//如果是判断时常的游戏 调用此方法
|
||||
updateScoreTime: function () {
|
||||
let endTime = new Date().getTime();
|
||||
let tempTime = endTime - this._startTime;
|
||||
if (tempTime < 0 || tempTime > 500) {
|
||||
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
|
||||
}
|
||||
this._endTime += tempTime / 1000;
|
||||
this._totalTime = this._endTime.toFixed(2);
|
||||
GM_INFO.currScore = this._totalTime;
|
||||
this._startTime = endTime;
|
||||
},
|
||||
//倒计时调用此方法
|
||||
countDown: function () {
|
||||
this._endTime = new Date().getTime();
|
||||
this._totalTime = parseInt((this._endTime - this._startTime) / 1000);
|
||||
GM_INFO.remainingTime = GM_INFO.totalTime - this._totalTime;
|
||||
},
|
||||
|
||||
httpRequest(url, data, success, fail) {
|
||||
console.log("进入网络请求:");
|
||||
wx.getNetworkType({
|
||||
success(res) {
|
||||
var networkType = res.networkType;
|
||||
// console.log(networkType);
|
||||
//有网络状态下
|
||||
if(networkType == "wifi" ||networkType == "4g" || networkType == "3g" || networkType =="unknown"){
|
||||
wx.request({
|
||||
url: window.globalData.requestAPI + url,
|
||||
data: data,
|
||||
header: {
|
||||
'content-type': 'application/json', // 默认值
|
||||
'Authorization':window.globalData.BASE64_JWT_TOKEN?'Bearer '+window.globalData.BASE64_JWT_TOKEN:''
|
||||
},
|
||||
method: 'POST',
|
||||
success(res) {
|
||||
console.log('httpRequest:::::success',res);
|
||||
success(res);
|
||||
},
|
||||
fail(res) {
|
||||
console.log('httpRequest:::::fail', res,"失败url为",url);
|
||||
fail(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
fail(res)
|
||||
}
|
||||
},
|
||||
fail(res){
|
||||
fail(res)
|
||||
}
|
||||
})
|
||||
// console.log('httpRequest:::::', url, data, success, fail)
|
||||
|
||||
},
|
||||
|
||||
httpRequest_Notoken(url, data, success, fail) {
|
||||
// console.log('httpRequest:::::', url, data, success, fail)
|
||||
wx.getNetworkType({
|
||||
success(res) {
|
||||
var networkType = res.networkType;
|
||||
// console.log(networkType);
|
||||
//有网络状态下
|
||||
if(networkType == "wifi" ||networkType == "4g" || networkType == "3g" || networkType =="unknown"){
|
||||
wx.request({
|
||||
url: window.globalData.requestAPI + url,
|
||||
data: data,
|
||||
header: {
|
||||
'content-type': 'application/json', // 默认值
|
||||
},
|
||||
method: 'POST',
|
||||
success(res) {
|
||||
console.log('httpRequest:::::success',res);
|
||||
success(res);
|
||||
},
|
||||
fail(res) {
|
||||
console.log('httpRequest:::::fail', res,"失败url为",url);
|
||||
fail(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
fail(res)
|
||||
}
|
||||
},
|
||||
fail(res){
|
||||
fail(res)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
getGameInfo: function(node){
|
||||
var jg = false;
|
||||
var nodes = node;
|
||||
let data = {
|
||||
'appid': window.globalData.appid
|
||||
}
|
||||
window.GameTool.httpRequest(window.globalData.getUserInfoUrl, data, function (res) {
|
||||
window.globalData.gameUserInfo = res.data.king_user; //user_id在这里
|
||||
console.log("拿到服务器的信息",res.data);
|
||||
|
||||
if(window.globalData.gameUserInfo){
|
||||
console.log("获得服务器游戏信息成功:",window.globalData.gameUserInfo);
|
||||
if(window.globalData.gameUserInfo.unlock_1)
|
||||
window.GM_INFO.unlock_1 = window.globalData.gameUserInfo.unlock_1;
|
||||
if(window.globalData.gameUserInfo.unlock_2)
|
||||
window.GM_INFO.unlock_2 = window.globalData.gameUserInfo.unlock_2;
|
||||
//如果服务器有金币信息
|
||||
if(window.globalData.gameUserInfo.coin){
|
||||
//本地也有金币信息, 以本地为主,把本地金币信息同步到服务器
|
||||
if(StorageMessage.getStorage("Coin")){
|
||||
if(window.globalData.gameUserInfo.coin != StorageMessage.getStorage("Coin")){
|
||||
window.GM_INFO.coin = StorageMessage.getStorage("Coin");
|
||||
StorageMessage.setStorage("Coin",window.GM_INFO.coin);
|
||||
}
|
||||
} //如果本地没有金币信息 , 以服务器金币信息为主
|
||||
else{
|
||||
window.GM_INFO.coin = window.globalData.gameUserInfo.coin;
|
||||
StorageMessage.setStorage("Coin",window.GM_INFO.coin);
|
||||
}
|
||||
}
|
||||
else{
|
||||
//本地也有金币信息, 以本地为主,把本地金币信息同步到服务器
|
||||
if(StorageMessage.getStorage("Coin")){
|
||||
window.GM_INFO.coin = StorageMessage.getStorage("Coin");
|
||||
StorageMessage.setStorage("Coin",window.GM_INFO.coin);
|
||||
} //如果本地没有金币信息 , 以服务器金币信息为主
|
||||
else{
|
||||
window.GM_INFO.coin = 200;
|
||||
StorageMessage.setStorage("Coin",window.GM_INFO.coin);
|
||||
}
|
||||
}
|
||||
|
||||
cc.director.loadScene('GameBegin');
|
||||
// console.log("即将进入这里");
|
||||
// if(StorageMessage.getStorage("level")){
|
||||
// // console.log("本地有等级信息;");
|
||||
// // console.log("服务器信息等级为:",window.globalData.gameUserInfo.level);
|
||||
// window.GM_INFO.level = StorageMessage.getStorage("level");
|
||||
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
|
||||
// // console.log("本地等级信息为:",window.GM_INFO.level);
|
||||
// //本地存储等级 小于服务器等级, 等于本地数据丢失,这时以服务器数据为主重新构建游戏
|
||||
// if(window.GM_INFO.level < window.globalData.gameUserInfo.level){
|
||||
// // nodes.active = true;
|
||||
// window.GM_INFO.level = window.globalData.gameUserInfo.level;
|
||||
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
|
||||
// window.GameTool.reset();
|
||||
// }
|
||||
// //正常进入游戏,以本地数据为主,服务器数据为辅
|
||||
// else{
|
||||
// console.log("本地数据大以本地主数据为主");
|
||||
// // window.GameTool.setGameInfo(true);
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// console.log("笨地没等级数据");
|
||||
// // nodes.active = true;
|
||||
// window.GM_INFO.level = window.globalData.gameUserInfo.level;
|
||||
// var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
|
||||
// window.GameTool.reset();
|
||||
// }
|
||||
if (CC_WECHATGAME) {
|
||||
wx.onShow(function(res){
|
||||
if(res){
|
||||
if(res.query){
|
||||
console.log("分享中带的信息",res.query);
|
||||
if(res.query.key1){
|
||||
window.GameTool.setFrindHelp(res.query.key1);
|
||||
}
|
||||
if(res.query.key2){
|
||||
window.GameTool.setFrindBlock(res.query.key2);
|
||||
}
|
||||
if(res.query.key3){
|
||||
window.GameTool.setFrindBlockMax(res.query.key3);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
wx.onHide(function(res){
|
||||
console.log("检测退出游戏");
|
||||
// window.arm = [];
|
||||
// for(var i=0; i<12; i++){
|
||||
// window.arm[i] = null;
|
||||
// window.arm[i] = {error:"error"};
|
||||
// }
|
||||
// window.arm = StorageMessage.setStorage("arm",window.arm);
|
||||
var temp = window.GameTool.submitScoreButtonFunc(window.GM_INFO.level,window.GM_INFO.coin);
|
||||
window.GameTool.setGameInfo();
|
||||
});
|
||||
}
|
||||
jg = true;
|
||||
}
|
||||
else{
|
||||
console.log("拿到服务器信息失败");
|
||||
cc.director.loadScene("LoadScene");
|
||||
}
|
||||
|
||||
},function(){
|
||||
jg = false;
|
||||
console.log("get用户信息失败",res);
|
||||
})
|
||||
return jg;
|
||||
},
|
||||
//根据服务器数据重置所需要所有数据
|
||||
reset: function(){
|
||||
// if(window.globalData.gameUserInfo.arm)
|
||||
// StorageMessage.setStorage("arm",window.globalData.gameUserInfo.arm);
|
||||
// if(window.globalData.gameUserInfo.richest_coin)
|
||||
// StorageMessage.setStorage("coin",parseInt(window.globalData.gameUserInfo.richest_coin));
|
||||
// if(window.globalData.gameUserInfo.dimond)
|
||||
// StorageMessage.setStorage("dimond",window.globalData.gameUserInfo.dimond);
|
||||
// if(window.globalData.gameUserInfo.buy_time)
|
||||
// StorageMessage.setStorage("buy_Time",window.globalData.gameUserInfo.buy_time);
|
||||
// if(window.globalData.gameUserInfo.dimond_time)
|
||||
// StorageMessage.setStorage("dimond_Time",window.globalData.gameUserInfo.dimond_time);
|
||||
// if(window.globalData.gameUserInfo.level)
|
||||
// StorageMessage.setStorage("level",window.globalData.gameUserInfo.level);
|
||||
// if(window.globalData.gameUserInfo.total_Speed)
|
||||
// StorageMessage.setStorage("total_Speed",parseInt(window.globalData.gameUserInfo.total_Speed));
|
||||
// if(window.globalData.gameUserInfo.leave_time)
|
||||
// StorageMessage.setStorage("leave_time",window.globalData.gameUserInfo.leave_time);
|
||||
// if(window.globalData.gameUserInfo.reward1)
|
||||
// StorageMessage.setStorage("share_Array",window.globalData.gameUserInfo.reward1);
|
||||
// if(window.globalData.gameUserInfo.reward2)
|
||||
// StorageMessage.setStorage("share_100",window.globalData.gameUserInfo.reward2);
|
||||
|
||||
// StorageMessage.setStorage("GM_INFO",window.GM_INFO);
|
||||
console.log("本地数据丢失,重新启动游戏");
|
||||
cc.director.loadScene('LoadScene');
|
||||
},
|
||||
|
||||
setGameInfo: function(pd){
|
||||
let data = {
|
||||
// "richest_coin":window.coin+"",
|
||||
// "arm":window.arm,
|
||||
// "buy_time":window.buy_Time,
|
||||
// "dimond":parseInt(window.dimond),
|
||||
// "dimond_time":window.dimond_Time,
|
||||
// "level":window.GM_INFO.level,
|
||||
// "total_speed":window.total_Speed+"",
|
||||
// "reward_1":window.GM_INFO.share_Array, //用于存储6个红包的领取信息
|
||||
// "reward_2":window.share_100 //用于存储100个红包的领取信息
|
||||
}
|
||||
// console.log("存储之前检测:",window.arm,arms);
|
||||
window.GameTool.httpRequest(window.globalData.richest, data, function (res) {
|
||||
console.log('存储userInfo成功', res);
|
||||
if(!pd){
|
||||
window.GM_INFO.leave_time = res.data.leave_time;
|
||||
StorageMessage.setStorage("leave_time",window.GM_INFO.leave_time);
|
||||
}
|
||||
|
||||
},function(res){
|
||||
console.log('存储userInfo失败', res);
|
||||
if(!pd){
|
||||
window.GM_INFO.leave_time = parseInt(new Date().valueOf()/1000);
|
||||
StorageMessage.setStorage("leave_time",data);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
//输入秒,返回需要展示时间格式
|
||||
getTimeMargin:(second) => {
|
||||
let total = second;
|
||||
let hour = parseInt(total / (60 * 60));//计算整数小时数
|
||||
let afterHour = total - hour * 60 * 60;//取得算出小时数后剩余的秒数
|
||||
let min = parseInt(afterHour / 60);//计算整数分
|
||||
let afterMin = total - hour * 60 * 60 - min * 60;//取得算出分后剩余的秒数
|
||||
return '剩余:' + hour + ':' + min + ':' + afterMin
|
||||
},
|
||||
|
||||
getTimeMargin2:(second) => {
|
||||
let total = second;
|
||||
let hour = parseInt(total / (60 * 60));//计算整数小时数
|
||||
let afterHour = total - hour * 60 * 60;//取得算出小时数后剩余的秒数
|
||||
let min = parseInt(afterHour / 60);//计算整数分
|
||||
if(min < 10) min = "0"+min;
|
||||
let afterMin = total - hour * 60 * 60 - min * 60;//取得算出分后剩余的秒数
|
||||
if(afterMin < 10) afterMin = "0" + afterMin;
|
||||
return '剩余:' + min + ':' + afterMin
|
||||
},
|
||||
|
||||
setFrindBlock: function(userid){
|
||||
// console.log("添加时候的userid");
|
||||
let data = {
|
||||
user_id:userid
|
||||
}
|
||||
// if(userid != window.globalData.gameUserInfo.user_id){
|
||||
// console.log("进分享的不是自己");
|
||||
// {
|
||||
window.GameTool.httpRequest(window.globalData.entryBlock, data, function (res) {
|
||||
console.log('添加红包助力信息成功', res)
|
||||
}, function (res) {
|
||||
console.log('添加红包助力信息失败', res)
|
||||
})
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// console.log("进入分享的是自己");
|
||||
// }
|
||||
},
|
||||
|
||||
// setFrindBlockMax: function(userid){
|
||||
// // console.log("添加时候的userid");
|
||||
// let data = {
|
||||
// user_id:userid
|
||||
// }
|
||||
// // if(userid != window.globalData.gameUserInfo.user_id){
|
||||
// // console.log("进分享的不是自己");
|
||||
// // {
|
||||
// window.GameTool.httpRequest(window.globalData.entryBlockMax, data, function (res) {
|
||||
// console.log('添加最后的好友信息成功', res)
|
||||
// }, function (res) {
|
||||
// console.log('添加最后的好友信息信息失败', res)
|
||||
// })
|
||||
// // }
|
||||
// // }
|
||||
// // else{
|
||||
// // console.log("进入分享的是自己");
|
||||
// // }
|
||||
// },
|
||||
|
||||
|
||||
getSeedRandom: function (min, max) {//包含min 不包含max
|
||||
max = max || 1;
|
||||
min = min || 0;
|
||||
GM_INFO.currSeed = (GM_INFO.currSeed * 9301 + 49297) % 233280;
|
||||
let rnd = GM_INFO.currSeed / 233280.0;
|
||||
let tmp = min + rnd * (max - min);
|
||||
return parseInt(tmp);
|
||||
},
|
||||
|
||||
//将时间转换为59:23
|
||||
getTime: function(time){
|
||||
var label = "";
|
||||
var number_1 = parseInt(time/60);
|
||||
var number_2 = time-number_1*60;
|
||||
if(number_1 < 10){
|
||||
number_1 = "0"+number_1;
|
||||
}
|
||||
if(number_2 < 10){
|
||||
number_2 = "0"+number_2;
|
||||
}
|
||||
label = number_1 + ":" + number_2;
|
||||
|
||||
return label;
|
||||
},
|
||||
//number 为传进来的数值,type为最多显示几位数
|
||||
getNumber: function(number,type){
|
||||
// console.log(type,"需要转换的数字为:",number);
|
||||
var count = 1000;
|
||||
var place = type - 3;
|
||||
if(number > Math.pow(count,8)*Math.pow(10,place)){
|
||||
if(number/Math.pow(count,8) < 100)
|
||||
number = parseInt(number/Math.pow(count,8)*10)/10+"S";
|
||||
else
|
||||
number = parseInt(number/Math.pow(count,8))+"S";
|
||||
}
|
||||
else if(number > Math.pow(count,7)*Math.pow(10,place)){
|
||||
if(number/Math.pow(count,7) < 100)
|
||||
number = parseInt(number/Math.pow(count,7)*10)/10+"s";
|
||||
else
|
||||
number = parseInt(number/Math.pow(count,7))+"s";
|
||||
}
|
||||
else if(number > Math.pow(count,6)*Math.pow(10,place)){
|
||||
if(number/Math.pow(count,6) < 100)
|
||||
number = parseInt(number/Math.pow(count,6)*10)/10+"Q";
|
||||
else
|
||||
number = parseInt(number/Math.pow(count,6))+"Q";
|
||||
}
|
||||
else if(number > Math.pow(count,5)*Math.pow(10,place)){
|
||||
if(number/Math.pow(count,5) < 100)
|
||||
number = parseInt(number/Math.pow(count,5)*10)/10+"q";
|
||||
else
|
||||
number = parseInt(number/Math.pow(count,5))+"q";
|
||||
|
||||
}
|
||||
else if(number > Math.pow(count,4)*Math.pow(10,place)){
|
||||
if(number/Math.pow(count,4) < 100)
|
||||
number = parseInt(number/Math.pow(count,4)*10)/10+"t";
|
||||
else
|
||||
number = parseInt(number/Math.pow(count,4))+"t";
|
||||
}
|
||||
else if(number > Math.pow(count,3)*Math.pow(10,place)){
|
||||
if(number/Math.pow(count,3) < 100)
|
||||
number = parseInt(number/Math.pow(count,3)*10)/10+"b";
|
||||
else
|
||||
number = parseInt(number/Math.pow(count,3))+"b";
|
||||
}
|
||||
else if(number > Math.pow(count,2)*Math.pow(10,place)){
|
||||
if(number/Math.pow(count,2) < 100)
|
||||
number = parseInt(number/Math.pow(count,2)*10)/10+"m";
|
||||
else
|
||||
number = parseInt(number/Math.pow(count,2))+"m";
|
||||
}
|
||||
else if(number > Math.pow(count,1)*Math.pow(10,place)){
|
||||
if(number/Math.pow(count,1) < 100){
|
||||
number = parseInt(number/Math.pow(count,1)*10)/10+"k";
|
||||
}
|
||||
else
|
||||
number = parseInt(number/Math.pow(count,1))+"k";
|
||||
}
|
||||
else{
|
||||
number = parseInt(number/Math.pow(count,0))+"";
|
||||
}
|
||||
// console.log("结果为"+type+"位数",number);
|
||||
return number;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
begainTiming: function () {
|
||||
this._startTime = new Date().getTime();
|
||||
},
|
||||
|
||||
endTiming: function () {
|
||||
let endTime = new Date().getTime();
|
||||
this._endTime = endTime;
|
||||
this._totalTime = endTime - this._startTime;
|
||||
},
|
||||
|
||||
getScoreTime: function () {
|
||||
let endTime = new Date().getTime();
|
||||
let tempTime = endTime - this._startTime;
|
||||
if (tempTime < 0 || tempTime > 500) {
|
||||
tempTime = Math.round(cc.director.getAnimationInterval() * 1000);
|
||||
}
|
||||
GM_INFO.currScore += tempTime;
|
||||
this._startTime = endTime;
|
||||
},
|
||||
|
||||
getFormatTime: function (time) {
|
||||
|
||||
let date = new Date();
|
||||
date.setTime(time);
|
||||
|
||||
let ms = date.getMilliseconds();
|
||||
// let msString = date.getMilliseconds();
|
||||
let msString = parseInt(ms / 10) % 100;
|
||||
|
||||
let secondString = date.getSeconds();
|
||||
|
||||
let minString = date.getMinutes();
|
||||
|
||||
if (msString < 10) {
|
||||
msString = "0" + msString;
|
||||
}
|
||||
if (secondString < 10) {
|
||||
secondString = "0" + secondString;
|
||||
}
|
||||
secondString = secondString + ":";
|
||||
|
||||
if (minString < 10) {
|
||||
minString = "0" + minString;
|
||||
}
|
||||
minString = minString + ":";
|
||||
|
||||
return minString + secondString + msString;
|
||||
|
||||
},
|
||||
pushLister:function () {
|
||||
|
||||
},
|
||||
removeAllLister:function () {
|
||||
|
||||
},
|
||||
|
||||
};
|
10
assets/Script/tool/GameTool.js.meta
Normal file
10
assets/Script/tool/GameTool.js.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "a1dd7a8c-882a-4e2c-bdc5-0d725df431b2",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
45
assets/Script/tool/Shake.js
Normal file
45
assets/Script/tool/Shake.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* 自定义抖动效果
|
||||
*/
|
||||
var Shake = cc.Class({
|
||||
extends: cc.Component,
|
||||
|
||||
properties: {
|
||||
//抖动时间
|
||||
duration: 0,
|
||||
//X轴抖动范围
|
||||
shakeX: 0,
|
||||
shakeY: 0,
|
||||
},
|
||||
|
||||
shake: function (callback) {
|
||||
if(this.shaking){
|
||||
return;
|
||||
}
|
||||
this.callback = callback;
|
||||
this.shaking = true;
|
||||
this.dtCost = 0;
|
||||
this.nodeInitialPos = this.node.getPosition();
|
||||
this.unschedule(this.doSchedule);
|
||||
this.schedule(this.doSchedule, 0, cc.macro.REPEAT_FOREVER, 0);
|
||||
},
|
||||
doSchedule: function (dt) {
|
||||
var dt2 = dt * 50;
|
||||
var randX = this.getRandomStrength(-this.shakeX, this.shakeX) * dt2;
|
||||
var randY = this.getRandomStrength(-this.shakeY, this.shakeY) * dt2;
|
||||
this.node.setPosition(cc.pAdd(this.nodeInitialPos, cc.v2(randX, randY)));
|
||||
this.dtCost += dt;
|
||||
if (this.dtCost >= this.duration) {
|
||||
this.unschedule(this.doSchedule);
|
||||
this.node.setPosition(this.nodeInitialPos);
|
||||
this.shaking = false;
|
||||
if(this.callback){
|
||||
this.callback();
|
||||
}
|
||||
}
|
||||
},
|
||||
//获取两个数间的随机值
|
||||
getRandomStrength: function (min, max) {
|
||||
return Math.random() * (max - min + 1) + min;
|
||||
},
|
||||
});
|
10
assets/Script/tool/Shake.js.meta
Normal file
10
assets/Script/tool/Shake.js.meta
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "61aff0f9-48ef-48a6-8d1f-1a621e4c54d9",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Shader.meta
Normal file
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": {}
|
||||
}
|
BIN
assets/Shader/Effect_fluid.png
Normal file
BIN
assets/Shader/Effect_fluid.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 832 B |
38
assets/Shader/Effect_fluid.png.meta
Normal file
38
assets/Shader/Effect_fluid.png.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "d480c86c-c0a4-49ba-8b45-5f00deb51178",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 128,
|
||||
"height": 128,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"Effect_fluid": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "38b9017e-ef9d-4890-a459-350f3be901a4",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "d480c86c-c0a4-49ba-8b45-5f00deb51178",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": -0.5,
|
||||
"offsetY": 0,
|
||||
"trimX": 5,
|
||||
"trimY": 0,
|
||||
"width": 117,
|
||||
"height": 128,
|
||||
"rawWidth": 128,
|
||||
"rawHeight": 128,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
BIN
assets/Shader/Effect_fluid2.png
Normal file
BIN
assets/Shader/Effect_fluid2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
38
assets/Shader/Effect_fluid2.png.meta
Normal file
38
assets/Shader/Effect_fluid2.png.meta
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"ver": "2.3.7",
|
||||
"uuid": "afa85bd2-7b47-4171-b74f-2e72c7cbb9ff",
|
||||
"importer": "texture",
|
||||
"type": "sprite",
|
||||
"wrapMode": "clamp",
|
||||
"filterMode": "bilinear",
|
||||
"premultiplyAlpha": false,
|
||||
"genMipmaps": false,
|
||||
"packable": true,
|
||||
"width": 100,
|
||||
"height": 128,
|
||||
"platformSettings": {},
|
||||
"subMetas": {
|
||||
"Effect_fluid2": {
|
||||
"ver": "1.0.6",
|
||||
"uuid": "5726e9d2-3cc2-489c-a93e-2ca52201e653",
|
||||
"importer": "sprite-frame",
|
||||
"rawTextureUuid": "afa85bd2-7b47-4171-b74f-2e72c7cbb9ff",
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 100,
|
||||
"height": 128,
|
||||
"rawWidth": 100,
|
||||
"rawHeight": 128,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"subMetas": {}
|
||||
}
|
||||
}
|
||||
}
|
148
assets/Shader/fluxay_texture_angle.effect
Normal file
148
assets/Shader/fluxay_texture_angle.effect
Normal file
|
@ -0,0 +1,148 @@
|
|||
//扫光-纹理
|
||||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
u_fluxayTexture: { value: white }
|
||||
u_time: { value: 0 }
|
||||
u_scale: { value: 1.0 }
|
||||
u_angle: { value: 30.0 }
|
||||
}%
|
||||
|
||||
// Vertex Shader(顶点着色器)
|
||||
// 将顶点从模型空间坐标系统转化到屏幕空间坐标系统
|
||||
// 顶点着色器分为输入和输出两部分
|
||||
// 负责的功能是把输入的数据进行矩阵变换位置,计算光照公式生成逐顶点颜⾊,⽣成/变换纹理坐标
|
||||
// 并且把位置和纹理坐标这样的参数发送到片段着色器
|
||||
CCProgram vs %{
|
||||
precision highp float;
|
||||
|
||||
#include <cc-global>
|
||||
#include <cc-local>
|
||||
|
||||
// 输入的顶点坐标
|
||||
in vec3 a_position;
|
||||
// 输入的顶点颜色
|
||||
in vec4 a_color;
|
||||
// 输出的顶点颜色
|
||||
out vec4 v_color;
|
||||
|
||||
#if USE_TEXTURE
|
||||
// 输入的纹理坐标
|
||||
// UV坐标:原点在左上角,u轴是向右,v轴是向下,范围是0-1
|
||||
in vec2 a_uv0;
|
||||
// 输出的纹理坐标
|
||||
out vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
void main () {
|
||||
mat4 mvp;
|
||||
|
||||
#if CC_USE_MODEL
|
||||
mvp = cc_matViewProj * cc_matWorld;
|
||||
#else
|
||||
mvp = cc_matViewProj;
|
||||
#endif
|
||||
|
||||
v_uv0 = a_uv0;
|
||||
|
||||
v_color = a_color;
|
||||
|
||||
gl_Position = mvp * vec4(a_position, 1);
|
||||
}
|
||||
}%
|
||||
|
||||
// Fragment Shader(片段着色器)
|
||||
// 片元着色器的作用是处理由光栅化阶段生成的每个片元,最终计算出每个像素的最终颜色(RGBA)
|
||||
CCProgram fs %{
|
||||
precision highp float;
|
||||
|
||||
#include <alpha-test>
|
||||
#include <texture>
|
||||
|
||||
in vec4 v_color;
|
||||
|
||||
in vec2 v_uv0;
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
uniform sampler2D u_fluxayTexture; //流光纹理
|
||||
|
||||
// 自定义属性
|
||||
// 所有非 sampler 的 uniform 都必须以 UBO 形式声明
|
||||
// UBO 成员声明类型和顺序有严格的校验机制,以排除 GL 标准下隐式布局对齐带来的内存消耗
|
||||
uniform ARGS {
|
||||
float u_time;
|
||||
float u_scale;
|
||||
float u_angle;
|
||||
};
|
||||
|
||||
vec2 transformUV(vec2 UV,float angle){
|
||||
float rotate = (angle * 3.1415926) / 180.0;
|
||||
vec2 di = vec2(0.5, 0.5); // 旋转的中心位置
|
||||
//float a = cos(rotate);
|
||||
mat3 m = mat3(cos(rotate), -sin(rotate), 0.0,sin(rotate), cos(rotate), 0.0,0.0, 0.0, 1.0);
|
||||
//vec3 uv = vec3(UV.x-di.x,UV.y+di.y, 1.0)* m;
|
||||
//return vec2(uv.x,uv.y)+vec2(di.x,-di.y);
|
||||
vec3 uv = vec3(UV.x,UV.y, 1.0)* m;
|
||||
return vec2(uv.x,uv.y);
|
||||
}
|
||||
|
||||
void main () {
|
||||
vec4 o = vec4(1, 1, 1, 1);
|
||||
|
||||
#if USE_TEXTURE
|
||||
// texture.inc 核心函数
|
||||
// o = texture2D(texture, v_uv0);
|
||||
// texture: 纹理,v_uv0: 纹理坐标,通过 GLSL 的内建函数 texture2D 来获取纹理上对应UV坐标的颜色(RGBA)
|
||||
o = texture2D(texture, v_uv0);
|
||||
#endif
|
||||
|
||||
// 纹理颜色和顶点颜色(节点颜色)叠加得到最终颜色
|
||||
o *= v_color;
|
||||
|
||||
// alpha-test.inc 核心函数
|
||||
// if (color.a < alphaThreshold) discard;
|
||||
// discard:退出片段着色器,不执行后面的片段着色操作,片段也不会写入帧缓冲区
|
||||
ALPHA_TEST(o);
|
||||
|
||||
|
||||
// 在底图不透明的地方叠加流光纹理的颜色
|
||||
if(o.a >= 1.0) {
|
||||
// 根据时间设置流光纹理的UV
|
||||
vec2 fluxayUV = vec2(v_uv0.x, v_uv0.y);
|
||||
//fluxayUV.x -= u_time - 1.0;
|
||||
fluxayUV.x -= u_time;
|
||||
fluxayUV = transformUV(fluxayUV,u_angle);
|
||||
|
||||
if(fluxayUV.x > 0.0 && fluxayUV.x <u_scale)
|
||||
{
|
||||
// 获取流光纹理上UV的颜色
|
||||
fluxayUV.x = fluxayUV.x / u_scale;
|
||||
//fluxayUV = transformUV(fluxayUV,u_angle);
|
||||
vec4 fluxay = texture2D(u_fluxayTexture, fluxayUV);
|
||||
o.a = fluxay.a;
|
||||
// 叠加颜色
|
||||
gl_FragColor = o;
|
||||
}
|
||||
else {
|
||||
o.a = 0.0;
|
||||
gl_FragColor = o;
|
||||
}
|
||||
} else {
|
||||
o.a = 0.0;
|
||||
gl_FragColor = o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}%
|
18
assets/Shader/fluxay_texture_angle.effect.meta
Normal file
18
assets/Shader/fluxay_texture_angle.effect.meta
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"ver": "1.0.27",
|
||||
"uuid": "70ca6f7c-88f0-44f1-9ab3-3b1c0d042995",
|
||||
"importer": "effect",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\n attribute vec2 a_uv0;\n varying vec2 v_uv0;\n#endif\nvoid main () {\n mat4 mvp;\n #if CC_USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = mvp * vec4(a_position, 1);\n}",
|
||||
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\nvarying vec2 v_uv0;\nuniform sampler2D texture;\nuniform sampler2D u_fluxayTexture;\nuniform float u_time;\nuniform float u_scale;\nuniform float u_angle;\nvec2 transformUV(vec2 UV,float angle){\n float rotate = (angle * 3.1415926) / 180.0;\n vec2 di = vec2(0.5, 0.5);\n mat3 m = mat3(cos(rotate), -sin(rotate), 0.0,sin(rotate), cos(rotate), 0.0,0.0, 0.0, 1.0);\n vec3 uv = vec3(UV.x,UV.y, 1.0)* m;\n return vec2(uv.x,uv.y);\n}\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o = texture2D(texture, v_uv0);\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n if(o.a >= 1.0) {\n vec2 fluxayUV = vec2(v_uv0.x, v_uv0.y);\n fluxayUV.x -= u_time;\n fluxayUV = transformUV(fluxayUV,u_angle);\n if(fluxayUV.x > 0.0 && fluxayUV.x <u_scale)\n {\n fluxayUV.x = fluxayUV.x / u_scale;\n vec4 fluxay = texture2D(u_fluxayTexture, fluxayUV);\n o.a = fluxay.a;\n gl_FragColor = o;\n }\n else {\n o.a = 0.0;\n gl_FragColor = o;\n }\n } else {\n o.a = 0.0;\n gl_FragColor = o;\n }\n}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\n in vec2 a_uv0;\n out vec2 v_uv0;\n#endif\nvoid main () {\n mat4 mvp;\n #if CC_USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = mvp * vec4(a_position, 1);\n}",
|
||||
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\nin vec2 v_uv0;\nuniform sampler2D texture;\nuniform sampler2D u_fluxayTexture;\nuniform ARGS {\n float u_time;\n float u_scale;\n float u_angle;\n};\nvec2 transformUV(vec2 UV,float angle){\n float rotate = (angle * 3.1415926) / 180.0;\n vec2 di = vec2(0.5, 0.5);\n mat3 m = mat3(cos(rotate), -sin(rotate), 0.0,sin(rotate), cos(rotate), 0.0,0.0, 0.0, 1.0);\n vec3 uv = vec3(UV.x,UV.y, 1.0)* m;\n return vec2(uv.x,uv.y);\n}\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o = texture2D(texture, v_uv0);\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n if(o.a >= 1.0) {\n vec2 fluxayUV = vec2(v_uv0.x, v_uv0.y);\n fluxayUV.x -= u_time;\n fluxayUV = transformUV(fluxayUV,u_angle);\n if(fluxayUV.x > 0.0 && fluxayUV.x <u_scale)\n {\n fluxayUV.x = fluxayUV.x / u_scale;\n vec4 fluxay = texture2D(u_fluxayTexture, fluxayUV);\n o.a = fluxay.a;\n gl_FragColor = o;\n }\n else {\n o.a = 0.0;\n gl_FragColor = o;\n }\n } else {\n o.a = 0.0;\n gl_FragColor = o;\n }\n}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
22
assets/Shader/fluxay_texture_angle.mtl
Normal file
22
assets/Shader/fluxay_texture_angle.mtl
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "fluxay_texture_angle",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "70ca6f7c-88f0-44f1-9ab3-3b1c0d042995"
|
||||
},
|
||||
"_techniqueIndex": 0,
|
||||
"_techniqueData": {
|
||||
"0": {
|
||||
"props": {
|
||||
"u_fluxayTexture": {
|
||||
"__uuid__": "d480c86c-c0a4-49ba-8b45-5f00deb51178"
|
||||
}
|
||||
},
|
||||
"defines": {
|
||||
"USE_TEXTURE": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
assets/Shader/fluxay_texture_angle.mtl.meta
Normal file
7
assets/Shader/fluxay_texture_angle.mtl.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "6b74e4c6-15c5-4566-8dd4-fa523a15898b",
|
||||
"importer": "material",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
172
assets/Shader/fluxay_texture_angle2.effect
Normal file
172
assets/Shader/fluxay_texture_angle2.effect
Normal file
|
@ -0,0 +1,172 @@
|
|||
//扫光-纹理
|
||||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
u_fluxayTexture: { value: white }
|
||||
u_time: { value: 0 }
|
||||
u_scale: { value: 1.0 }
|
||||
u_angle: { value: 30.0 }
|
||||
u_uvRotated: { value: 0.0 }
|
||||
u_uvOffset: { value: [0.0,0.0,1.0,1.0] }
|
||||
}%
|
||||
|
||||
// Vertex Shader(顶点着色器)
|
||||
// 将顶点从模型空间坐标系统转化到屏幕空间坐标系统
|
||||
// 顶点着色器分为输入和输出两部分
|
||||
// 负责的功能是把输入的数据进行矩阵变换位置,计算光照公式生成逐顶点颜⾊,⽣成/变换纹理坐标
|
||||
// 并且把位置和纹理坐标这样的参数发送到片段着色器
|
||||
CCProgram vs %{
|
||||
precision highp float;
|
||||
|
||||
#include <cc-global>
|
||||
#include <cc-local>
|
||||
|
||||
// 输入的顶点坐标
|
||||
in vec3 a_position;
|
||||
// 输入的顶点颜色
|
||||
in vec4 a_color;
|
||||
// 输出的顶点颜色
|
||||
out vec4 v_color;
|
||||
|
||||
#if USE_TEXTURE
|
||||
// 输入的纹理坐标
|
||||
// UV坐标:原点在左上角,u轴是向右,v轴是向下,范围是0-1
|
||||
in vec2 a_uv0;
|
||||
// 输出的纹理坐标
|
||||
out vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
void main () {
|
||||
mat4 mvp;
|
||||
|
||||
#if CC_USE_MODEL
|
||||
mvp = cc_matViewProj * cc_matWorld;
|
||||
#else
|
||||
mvp = cc_matViewProj;
|
||||
#endif
|
||||
|
||||
v_uv0 = a_uv0;
|
||||
|
||||
v_color = a_color;
|
||||
|
||||
gl_Position = mvp * vec4(a_position, 1);
|
||||
}
|
||||
}%
|
||||
|
||||
// Fragment Shader(片段着色器)
|
||||
// 片元着色器的作用是处理由光栅化阶段生成的每个片元,最终计算出每个像素的最终颜色(RGBA)
|
||||
CCProgram fs %{
|
||||
precision highp float;
|
||||
|
||||
#include <alpha-test>
|
||||
#include <texture>
|
||||
|
||||
in vec4 v_color;
|
||||
|
||||
in vec2 v_uv0;
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
uniform sampler2D u_fluxayTexture; //流光纹理
|
||||
|
||||
// 自定义属性
|
||||
// 所有非 sampler 的 uniform 都必须以 UBO 形式声明
|
||||
// UBO 成员声明类型和顺序有严格的校验机制,以排除 GL 标准下隐式布局对齐带来的内存消耗
|
||||
// u_uvRotated图片是否旋转
|
||||
// u_uvOffset 图片minx,miny,maxx,maxy
|
||||
|
||||
uniform ARGS {
|
||||
float u_time;
|
||||
float u_scale;
|
||||
float u_angle;
|
||||
float u_uvRotated;
|
||||
vec4 u_uvOffset;
|
||||
};
|
||||
|
||||
vec2 transformUV(vec2 UV,float angle){
|
||||
float rotate = (angle * 3.1415926) / 180.0;
|
||||
vec2 di = vec2(0.5, 0.5); // 旋转的中心位置
|
||||
//float a = cos(rotate);
|
||||
mat3 m = mat3(cos(rotate), -sin(rotate), 0.0,sin(rotate), cos(rotate), 0.0,0.0, 0.0, 1.0);
|
||||
//vec3 uv = vec3(UV.x-di.x,UV.y+di.y, 1.0)* m;
|
||||
//return vec2(uv.x,uv.y)+vec2(di.x,-di.y);
|
||||
vec3 uv = vec3(UV.x,UV.y, 1.0)* m;
|
||||
return vec2(uv.x,uv.y);
|
||||
}
|
||||
|
||||
void main () {
|
||||
vec4 o = vec4(1, 1, 1, 1);
|
||||
|
||||
#if USE_TEXTURE
|
||||
// texture.inc 核心函数
|
||||
// o = texture2D(texture, v_uv0);
|
||||
// texture: 纹理,v_uv0: 纹理坐标,通过 GLSL 的内建函数 texture2D 来获取纹理上对应UV坐标的颜色(RGBA)
|
||||
o = texture2D(texture, v_uv0);
|
||||
#endif
|
||||
|
||||
// 纹理颜色和顶点颜色(节点颜色)叠加得到最终颜色
|
||||
o *= v_color;
|
||||
|
||||
// alpha-test.inc 核心函数
|
||||
// if (color.a < alphaThreshold) discard;
|
||||
// discard:退出片段着色器,不执行后面的片段着色操作,片段也不会写入帧缓冲区
|
||||
ALPHA_TEST(o);
|
||||
|
||||
|
||||
//纹理的xMin
|
||||
float xMin = u_uvOffset.x;
|
||||
float xWidth = u_uvOffset.z - u_uvOffset.x;
|
||||
//x 转换成扫光图片上的位置
|
||||
float x = (v_uv0.x - xMin)/xWidth;
|
||||
|
||||
float yMin = u_uvOffset.y;
|
||||
float yWidth = u_uvOffset.w- u_uvOffset.y;
|
||||
//y 转换成扫光图片上的位置
|
||||
float y = (v_uv0.y - yMin)/yWidth;
|
||||
float angle = u_angle;
|
||||
if(u_uvRotated >= 1.0)
|
||||
{
|
||||
x = (v_uv0.y - yMin)/yWidth;
|
||||
y = (v_uv0.x - xMin)/xWidth;
|
||||
angle = -u_angle;
|
||||
}
|
||||
|
||||
// 在底图不透明的地方叠加流光纹理的颜色
|
||||
if(o.a >= 1.0) {
|
||||
// 根据时间设置流光纹理的UV
|
||||
vec2 fluxayUV = vec2(x, y);
|
||||
x += u_scale;
|
||||
float time = u_time*(1.0+u_scale);
|
||||
//if(fluxayUV.x > u_time-u_scale && fluxayUV.x <u_time)
|
||||
if(o.a >= 1.0)
|
||||
{
|
||||
// 获取流光纹理上UV的颜色
|
||||
fluxayUV.x = (x-time)/ u_scale;
|
||||
fluxayUV = transformUV(fluxayUV,angle);
|
||||
vec4 fluxay = texture2D(u_fluxayTexture, fluxayUV);
|
||||
o.a = fluxay.a;
|
||||
// 叠加颜色
|
||||
gl_FragColor = o;
|
||||
}
|
||||
else {
|
||||
o.a = 0.0;
|
||||
gl_FragColor = o;
|
||||
}
|
||||
} else {
|
||||
o.a = 0.0;
|
||||
gl_FragColor = o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}%
|
18
assets/Shader/fluxay_texture_angle2.effect.meta
Normal file
18
assets/Shader/fluxay_texture_angle2.effect.meta
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"ver": "1.0.27",
|
||||
"uuid": "ccd9fbe1-b0af-4e37-966a-18927c87f434",
|
||||
"importer": "effect",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\n attribute vec2 a_uv0;\n varying vec2 v_uv0;\n#endif\nvoid main () {\n mat4 mvp;\n #if CC_USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = mvp * vec4(a_position, 1);\n}",
|
||||
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\nvarying vec2 v_uv0;\nuniform sampler2D texture;\nuniform sampler2D u_fluxayTexture;\nuniform float u_time;\nuniform float u_scale;\nuniform float u_angle;\nuniform float u_uvRotated;\nuniform vec4 u_uvOffset;\nvec2 transformUV(vec2 UV,float angle){\n float rotate = (angle * 3.1415926) / 180.0;\n vec2 di = vec2(0.5, 0.5);\n mat3 m = mat3(cos(rotate), -sin(rotate), 0.0,sin(rotate), cos(rotate), 0.0,0.0, 0.0, 1.0);\n vec3 uv = vec3(UV.x,UV.y, 1.0)* m;\n return vec2(uv.x,uv.y);\n}\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o = texture2D(texture, v_uv0);\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n float xMin = u_uvOffset.x;\n float xWidth = u_uvOffset.z - u_uvOffset.x;\n float x = (v_uv0.x - xMin)/xWidth;\n float yMin = u_uvOffset.y;\n float yWidth = u_uvOffset.w- u_uvOffset.y;\n float y = (v_uv0.y - yMin)/yWidth;\n float angle = u_angle;\n if(u_uvRotated >= 1.0)\n {\n x = (v_uv0.y - yMin)/yWidth;\n y = (v_uv0.x - xMin)/xWidth;\n angle = -u_angle;\n }\n if(o.a >= 1.0) {\n vec2 fluxayUV = vec2(x, y);\n x += u_scale;\n float time = u_time*(1.0+u_scale);\n if(o.a >= 1.0)\n {\n fluxayUV.x = (x-time)/ u_scale;\n fluxayUV = transformUV(fluxayUV,angle);\n vec4 fluxay = texture2D(u_fluxayTexture, fluxayUV);\n o.a = fluxay.a;\n gl_FragColor = o;\n }\n else {\n o.a = 0.0;\n gl_FragColor = o;\n }\n } else {\n o.a = 0.0;\n gl_FragColor = o;\n }\n}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\n in vec2 a_uv0;\n out vec2 v_uv0;\n#endif\nvoid main () {\n mat4 mvp;\n #if CC_USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n v_uv0 = a_uv0;\n v_color = a_color;\n gl_Position = mvp * vec4(a_position, 1);\n}",
|
||||
"frag": "\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\nin vec2 v_uv0;\nuniform sampler2D texture;\nuniform sampler2D u_fluxayTexture;\nuniform ARGS {\n float u_time;\n float u_scale;\n float u_angle;\n float u_uvRotated;\n vec4 u_uvOffset;\n};\nvec2 transformUV(vec2 UV,float angle){\n float rotate = (angle * 3.1415926) / 180.0;\n vec2 di = vec2(0.5, 0.5);\n mat3 m = mat3(cos(rotate), -sin(rotate), 0.0,sin(rotate), cos(rotate), 0.0,0.0, 0.0, 1.0);\n vec3 uv = vec3(UV.x,UV.y, 1.0)* m;\n return vec2(uv.x,uv.y);\n}\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n o = texture2D(texture, v_uv0);\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n float xMin = u_uvOffset.x;\n float xWidth = u_uvOffset.z - u_uvOffset.x;\n float x = (v_uv0.x - xMin)/xWidth;\n float yMin = u_uvOffset.y;\n float yWidth = u_uvOffset.w- u_uvOffset.y;\n float y = (v_uv0.y - yMin)/yWidth;\n float angle = u_angle;\n if(u_uvRotated >= 1.0)\n {\n x = (v_uv0.y - yMin)/yWidth;\n y = (v_uv0.x - xMin)/xWidth;\n angle = -u_angle;\n }\n if(o.a >= 1.0) {\n vec2 fluxayUV = vec2(x, y);\n x += u_scale;\n float time = u_time*(1.0+u_scale);\n if(o.a >= 1.0)\n {\n fluxayUV.x = (x-time)/ u_scale;\n fluxayUV = transformUV(fluxayUV,angle);\n vec4 fluxay = texture2D(u_fluxayTexture, fluxayUV);\n o.a = fluxay.a;\n gl_FragColor = o;\n }\n else {\n o.a = 0.0;\n gl_FragColor = o;\n }\n } else {\n o.a = 0.0;\n gl_FragColor = o;\n }\n}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
22
assets/Shader/fluxay_texture_angle2.mtl
Normal file
22
assets/Shader/fluxay_texture_angle2.mtl
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "fluxay_texture_angle2",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "ccd9fbe1-b0af-4e37-966a-18927c87f434"
|
||||
},
|
||||
"_techniqueIndex": 0,
|
||||
"_techniqueData": {
|
||||
"0": {
|
||||
"defines": {
|
||||
"USE_TEXTURE": true
|
||||
},
|
||||
"props": {
|
||||
"u_fluxayTexture": {
|
||||
"__uuid__": "afa85bd2-7b47-4171-b74f-2e72c7cbb9ff"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
assets/Shader/fluxay_texture_angle2.mtl.meta
Normal file
7
assets/Shader/fluxay_texture_angle2.mtl.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "2e1288a2-ace1-42df-8d05-bf74722fa478",
|
||||
"importer": "material",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
104
assets/Shader/fntOutline.effect
Normal file
104
assets/Shader/fntOutline.effect
Normal file
|
@ -0,0 +1,104 @@
|
|||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
# 描边颜色
|
||||
outlineColor: {
|
||||
value: [1.0, 0.0, 0.0, 1.0],
|
||||
editor: {
|
||||
type: color,
|
||||
tooltip: "描边颜色",
|
||||
}
|
||||
}
|
||||
|
||||
fntColor: {
|
||||
value: [1.0, 0.0, 0.0, 1.0],
|
||||
editor: {
|
||||
type: color,
|
||||
tooltip: "字体颜色",
|
||||
}
|
||||
}
|
||||
}%
|
||||
|
||||
CCProgram vs %{
|
||||
|
||||
precision highp float;
|
||||
|
||||
#include <cc-global>
|
||||
|
||||
in vec3 a_position;
|
||||
|
||||
in mediump vec2 a_uv0;
|
||||
out mediump vec2 v_uv0;
|
||||
|
||||
in vec4 a_color;
|
||||
out vec4 v_color;
|
||||
|
||||
void main () {
|
||||
gl_Position = cc_matViewProj * vec4(a_position, 1);
|
||||
v_uv0 = a_uv0;
|
||||
v_color = a_color;
|
||||
}
|
||||
|
||||
}%
|
||||
|
||||
CCProgram fs %{
|
||||
|
||||
precision highp float;
|
||||
|
||||
#include <texture>
|
||||
|
||||
uniform sampler2D texture;
|
||||
in mediump vec2 v_uv0;
|
||||
in vec4 v_color;
|
||||
|
||||
#if SHOW_OUT_LINE
|
||||
|
||||
uniform Outline {
|
||||
// 描边颜色
|
||||
vec4 outlineColor;
|
||||
// 字体颜色
|
||||
vec4 fntColor;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
void main () {
|
||||
vec4 color = v_color;
|
||||
CCTexture(texture, v_uv0, color);
|
||||
//float gray = 0.2126*color.r + 0.7152*color.g + 0.0722*color.b;
|
||||
float temp = 1.0;
|
||||
|
||||
|
||||
if(color.a == 0.0)
|
||||
{
|
||||
|
||||
}
|
||||
if(color.r ==1.0 && color.g ==1.0 && color.b == 1.0 )
|
||||
{
|
||||
color = vec4(fntColor.r*temp, fntColor.g*temp, fntColor.b*temp, color.a);
|
||||
}
|
||||
else if(color.r ==0.0 && color.g ==0.0 && color.b == 0.0)
|
||||
{
|
||||
color = vec4(outlineColor.r*temp, outlineColor.g*temp, outlineColor.b*temp, color.a);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = 1.0-(color.r /1.0 + color.g / 1.0 + color.b /1.0)/3.0;
|
||||
color = vec4(outlineColor.r*temp+(fntColor.r)*(1.0-temp), outlineColor.g*temp+(fntColor.g)*(1.0-temp), outlineColor.b*temp+(fntColor.b)*(1.0-temp), color.a);
|
||||
//color = outlineColor.r*temp + vec4(1.0,1.0,1.0,1.0)*(1.0-temp);
|
||||
}
|
||||
|
||||
gl_FragColor =color;
|
||||
}
|
||||
|
||||
}%
|
18
assets/Shader/fntOutline.effect.meta
Normal file
18
assets/Shader/fntOutline.effect.meta
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"ver": "1.0.27",
|
||||
"uuid": "a8d4595f-5f4f-4b84-a3b7-988103168a7a",
|
||||
"importer": "effect",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nattribute vec3 a_position;\nattribute mediump vec2 a_uv0;\nvarying mediump vec2 v_uv0;\nattribute vec4 a_color;\nvarying vec4 v_color;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n v_uv0 = a_uv0;\n v_color = a_color;\n}",
|
||||
"frag": "\nprecision highp float;\nuniform sampler2D texture;\nvarying mediump vec2 v_uv0;\nvarying vec4 v_color;\n#if SHOW_OUT_LINE\n uniform vec4 outlineColor;\nuniform vec4 fntColor;\n#endif\nvoid main () {\n vec4 color = v_color;\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n color.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n color.a *= texture_tmp.a;\n #else\n color *= texture_tmp;\n #endif\n float temp = 1.0;\n if(color.a == 0.0)\n {\n }\n if(color.r ==1.0 && color.g ==1.0 && color.b == 1.0 )\n {\n color = vec4(fntColor.r*temp, fntColor.g*temp, fntColor.b*temp, color.a);\n }\n else if(color.r ==0.0 && color.g ==0.0 && color.b == 0.0)\n {\n color = vec4(outlineColor.r*temp, outlineColor.g*temp, outlineColor.b*temp, color.a);\n }\n else\n {\n temp = 1.0-(color.r /1.0 + color.g / 1.0 + color.b /1.0)/3.0;\n color = vec4(outlineColor.r*temp+(fntColor.r)*(1.0-temp), outlineColor.g*temp+(fntColor.g)*(1.0-temp), outlineColor.b*temp+(fntColor.b)*(1.0-temp), color.a);\n }\n gl_FragColor =color;\n}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nin vec3 a_position;\nin mediump vec2 a_uv0;\nout mediump vec2 v_uv0;\nin vec4 a_color;\nout vec4 v_color;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n v_uv0 = a_uv0;\n v_color = a_color;\n}",
|
||||
"frag": "\nprecision highp float;\nuniform sampler2D texture;\nin mediump vec2 v_uv0;\nin vec4 v_color;\n#if SHOW_OUT_LINE\n uniform Outline {\n vec4 outlineColor;\n vec4 fntColor;\n };\n#endif\nvoid main () {\n vec4 color = v_color;\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n color.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n color.a *= texture_tmp.a;\n #else\n color *= texture_tmp;\n #endif\n float temp = 1.0;\n if(color.a == 0.0)\n {\n }\n if(color.r ==1.0 && color.g ==1.0 && color.b == 1.0 )\n {\n color = vec4(fntColor.r*temp, fntColor.g*temp, fntColor.b*temp, color.a);\n }\n else if(color.r ==0.0 && color.g ==0.0 && color.b == 0.0)\n {\n color = vec4(outlineColor.r*temp, outlineColor.g*temp, outlineColor.b*temp, color.a);\n }\n else\n {\n temp = 1.0-(color.r /1.0 + color.g / 1.0 + color.b /1.0)/3.0;\n color = vec4(outlineColor.r*temp+(fntColor.r)*(1.0-temp), outlineColor.g*temp+(fntColor.g)*(1.0-temp), outlineColor.b*temp+(fntColor.b)*(1.0-temp), color.a);\n }\n gl_FragColor =color;\n}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
33
assets/Shader/fntOutline.mtl
Normal file
33
assets/Shader/fntOutline.mtl
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "fntOutline",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "a8d4595f-5f4f-4b84-a3b7-988103168a7a"
|
||||
},
|
||||
"_techniqueIndex": 0,
|
||||
"_techniqueData": {
|
||||
"0": {
|
||||
"props": {
|
||||
"outlineColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"fntColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
}
|
||||
},
|
||||
"defines": {
|
||||
"SHOW_OUT_LINE": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
assets/Shader/fntOutline.mtl.meta
Normal file
7
assets/Shader/fntOutline.mtl.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "ff207936-86fd-4d7a-93af-1a930cf6c6c2",
|
||||
"importer": "material",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
104
assets/Shader/shader_005E.effect
Normal file
104
assets/Shader/shader_005E.effect
Normal file
|
@ -0,0 +1,104 @@
|
|||
// Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
CCEffect %{
|
||||
techniques:
|
||||
- passes:
|
||||
- vert: vs
|
||||
frag: fs
|
||||
blendState:
|
||||
targets:
|
||||
- blend: true
|
||||
rasterizerState:
|
||||
cullMode: none
|
||||
properties:
|
||||
texture: { value: white }
|
||||
alphaThreshold: { value: 0.5 }
|
||||
}%
|
||||
|
||||
|
||||
CCProgram vs %{
|
||||
precision highp float;
|
||||
|
||||
#include <cc-global>
|
||||
#include <cc-local>
|
||||
|
||||
in vec3 a_position;
|
||||
in vec4 a_color;
|
||||
out vec4 v_color;
|
||||
|
||||
#if USE_TEXTURE
|
||||
in vec2 a_uv0;
|
||||
out vec2 v_uv0;
|
||||
#endif
|
||||
|
||||
void main () {
|
||||
vec4 pos = vec4(a_position, 1);
|
||||
|
||||
#if CC_USE_MODEL
|
||||
pos = cc_matViewProj * cc_matWorld * pos;
|
||||
#else
|
||||
pos = cc_matViewProj * pos;
|
||||
#endif
|
||||
|
||||
#if USE_TEXTURE
|
||||
v_uv0 = a_uv0;
|
||||
#endif
|
||||
|
||||
v_color = a_color;
|
||||
|
||||
gl_Position = pos;
|
||||
}
|
||||
}%
|
||||
|
||||
|
||||
CCProgram fs %{
|
||||
precision highp float;
|
||||
|
||||
#include <cc-global>
|
||||
#include <alpha-test>
|
||||
#include <texture>
|
||||
|
||||
in vec4 v_color;
|
||||
|
||||
#if USE_TEXTURE
|
||||
in vec2 v_uv0;
|
||||
uniform sampler2D texture;
|
||||
#endif
|
||||
|
||||
|
||||
vec2 getSt(){
|
||||
vec4 o = vec4(1, 1, 1, 1);
|
||||
|
||||
#if USE_TEXTURE
|
||||
CCTexture(texture, v_uv0, o);
|
||||
#endif
|
||||
|
||||
o *= v_color;
|
||||
|
||||
ALPHA_TEST(o);
|
||||
|
||||
return v_uv0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main () {
|
||||
vec2 st = getSt();
|
||||
vec2 uv = st;
|
||||
//设置中心点
|
||||
vec2 position = vec2(0.5) - st;
|
||||
float time = cc_time.x;
|
||||
|
||||
//灯光强度
|
||||
float strength = 0.2;
|
||||
//太阳大小
|
||||
float scale = 8.0;
|
||||
|
||||
float l = abs(sin(1.1)*0.1) / length(position);
|
||||
float l2 = abs(sin(1.2)*0.1) / length(position);
|
||||
float l3 = abs(sin(1.3)*0.1) / length(position);
|
||||
|
||||
vec4 fragColor = vec4(l,l2,l3, 1.0);
|
||||
gl_FragColor = scale * vec4(fragColor.xyz,smoothstep(strength,1.0,fragColor.xyz));
|
||||
}
|
||||
}%
|
18
assets/Shader/shader_005E.effect.meta
Normal file
18
assets/Shader/shader_005E.effect.meta
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"ver": "1.0.27",
|
||||
"uuid": "81f30e9d-18f4-47fa-b5db-f0a0d38c382a",
|
||||
"importer": "effect",
|
||||
"compiledShaders": [
|
||||
{
|
||||
"glsl1": {
|
||||
"vert": "\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
||||
"frag": "\nprecision highp float;\nuniform vec4 cc_time;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvec2 getSt(){\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n return v_uv0;\n}\nvoid main () {\n vec2 st = getSt();\n vec2 uv = st;\n vec2 position = vec2(0.5) - st;\n float time = cc_time.x;\n float strength = 0.2;\n float scale = 8.0;\n float l = abs(sin(1.1)*0.1) / length(position);\n float l2 = abs(sin(1.2)*0.1) / length(position);\n float l3 = abs(sin(1.3)*0.1) / length(position);\n vec4 fragColor = vec4(l,l2,l3, 1.0);\n gl_FragColor = scale * vec4(fragColor.xyz,smoothstep(strength,1.0,fragColor.xyz));\n}"
|
||||
},
|
||||
"glsl3": {
|
||||
"vert": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}",
|
||||
"frag": "\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvec2 getSt(){\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n return v_uv0;\n}\nvoid main () {\n vec2 st = getSt();\n vec2 uv = st;\n vec2 position = vec2(0.5) - st;\n float time = cc_time.x;\n float strength = 0.2;\n float scale = 8.0;\n float l = abs(sin(1.1)*0.1) / length(position);\n float l2 = abs(sin(1.2)*0.1) / length(position);\n float l3 = abs(sin(1.3)*0.1) / length(position);\n vec4 fragColor = vec4(l,l2,l3, 1.0);\n gl_FragColor = scale * vec4(fragColor.xyz,smoothstep(strength,1.0,fragColor.xyz));\n}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
17
assets/Shader/shader_005M.mtl
Normal file
17
assets/Shader/shader_005M.mtl
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"__type__": "cc.Material",
|
||||
"_name": "shader_005M",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_effectAsset": {
|
||||
"__uuid__": "81f30e9d-18f4-47fa-b5db-f0a0d38c382a"
|
||||
},
|
||||
"_techniqueIndex": 0,
|
||||
"_techniqueData": {
|
||||
"0": {
|
||||
"defines": {
|
||||
"USE_TEXTURE": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
assets/Shader/shader_005M.mtl.meta
Normal file
7
assets/Shader/shader_005M.mtl.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "4ceedcc6-0953-4a13-9caf-3a6ceee025ed",
|
||||
"importer": "material",
|
||||
"dataAsSubAsset": null,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/Texture.meta
Normal file
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
BIN
assets/Texture/HelloWorld.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
38
assets/Texture/HelloWorld.png.meta
Normal file
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
BIN
assets/Texture/singleColor.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 82 B |
38
assets/Texture/singleColor.png.meta
Normal file
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
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": {}
|
||||
}
|
29
assets/animation/action1.anim
Normal file
29
assets/animation/action1.anim
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"__type__": "cc.AnimationClip",
|
||||
"_name": "action1",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"_duration": 0.6666666666666666,
|
||||
"sample": 60,
|
||||
"speed": 0.1,
|
||||
"wrapMode": 38,
|
||||
"curveData": {
|
||||
"props": {
|
||||
"angle": [
|
||||
{
|
||||
"frame": 0,
|
||||
"value": 0
|
||||
},
|
||||
{
|
||||
"frame": 0.3333333333333333,
|
||||
"value": 180
|
||||
},
|
||||
{
|
||||
"frame": 0.6666666666666666,
|
||||
"value": 360
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"events": []
|
||||
}
|
6
assets/animation/action1.anim.meta
Normal file
6
assets/animation/action1.anim.meta
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"ver": "2.1.2",
|
||||
"uuid": "dd9d69fc-bc3c-4239-968e-9c6f4e54d9cf",
|
||||
"importer": "animation-clip",
|
||||
"subMetas": {}
|
||||
}
|
13
assets/migration.meta
Normal file
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
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
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
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": {}
|
||||
}
|
BIN
assets/music/arrow.mp3
Normal file
BIN
assets/music/arrow.mp3
Normal file
Binary file not shown.
8
assets/music/arrow.mp3.meta
Normal file
8
assets/music/arrow.mp3.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"ver": "2.0.3",
|
||||
"uuid": "8e64e6d7-d5e8-4990-a537-191fe13e0c9a",
|
||||
"importer": "audio-clip",
|
||||
"downloadMode": 0,
|
||||
"duration": 0.444082,
|
||||
"subMetas": {}
|
||||
}
|
BIN
assets/music/score.mp3
Normal file
BIN
assets/music/score.mp3
Normal file
Binary file not shown.
8
assets/music/score.mp3.meta
Normal file
8
assets/music/score.mp3.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"ver": "2.0.3",
|
||||
"uuid": "e70b3103-83f1-4c66-9093-1897c1a5d4ae",
|
||||
"importer": "audio-clip",
|
||||
"downloadMode": 0,
|
||||
"duration": 0.444082,
|
||||
"subMetas": {}
|
||||
}
|
BIN
assets/music/whoosh.mp3
Normal file
BIN
assets/music/whoosh.mp3
Normal file
Binary file not shown.
8
assets/music/whoosh.mp3.meta
Normal file
8
assets/music/whoosh.mp3.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"ver": "2.0.3",
|
||||
"uuid": "23088b7e-3d20-4130-9a29-36da5b7df5e1",
|
||||
"importer": "audio-clip",
|
||||
"downloadMode": 0,
|
||||
"duration": 0.20898,
|
||||
"subMetas": {}
|
||||
}
|
13
assets/prefab.meta
Normal file
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": {}
|
||||
}
|
430
assets/prefab/RankListItem.prefab
Normal file
430
assets/prefab/RankListItem.prefab
Normal file
|
@ -0,0 +1,430 @@
|
|||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "RankListItem",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 8
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 11
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "bg",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 164,
|
||||
"g": 118,
|
||||
"b": 239,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "6eyN1+nK5HT7svNqUsa2/+",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "rankLab",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 6
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 7
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 16,
|
||||
"g": 1,
|
||||
"b": 1,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 97.87,
|
||||
"height": 50.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
-46.832,
|
||||
22.301,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_string": "Label",
|
||||
"_N$string": "Label",
|
||||
"_fontSize": 40,
|
||||
"_lineHeight": 40,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_styleFlags": 0,
|
||||
"_underlineHeight": 0,
|
||||
"_N$horizontalAlign": 0,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0,
|
||||
"_N$cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "de4HHWkIhExrJq1+nHHMA6",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "nameLab",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 9
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 13,
|
||||
"g": 1,
|
||||
"b": 1,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100.06,
|
||||
"height": 50.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
-45.717,
|
||||
-24.531,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 8
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_string": "name",
|
||||
"_N$string": "name",
|
||||
"_fontSize": 40,
|
||||
"_lineHeight": 40,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_styleFlags": 0,
|
||||
"_underlineHeight": 0,
|
||||
"_N$horizontalAlign": 0,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0,
|
||||
"_N$cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "05c46heZhJV4sYMqYyxlB5",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "ca0f9k0oBVDbpQC+OMNTF3m",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "",
|
||||
"sync": false
|
||||
}
|
||||
]
|
9
assets/prefab/RankListItem.prefab.meta
Normal file
9
assets/prefab/RankListItem.prefab.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "32254f37-ac95-4912-a787-b8e0429ba0f1",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
121
assets/prefab/line.prefab
Normal file
121
assets/prefab/line.prefab
Normal file
|
@ -0,0 +1,121 @@
|
|||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "line",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 2
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 16,
|
||||
"height": 1334
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "0c17b08e-8339-4544-a683-9da549ace3ad"
|
||||
},
|
||||
"_type": 3,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 1,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": {
|
||||
"__uuid__": "f683b01d-4d4a-4b64-a054-741e0785d512"
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "",
|
||||
"sync": false
|
||||
}
|
||||
]
|
9
assets/prefab/line.prefab.meta
Normal file
9
assets/prefab/line.prefab.meta
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "6ea28941-931c-4fbe-87f4-cf5a73294fb0",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
983
assets/prefab/qiu1.prefab
Normal file
983
assets/prefab/qiu1.prefab
Normal file
|
@ -0,0 +1,983 @@
|
|||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "qiu1",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
},
|
||||
{
|
||||
"__id__": 11
|
||||
},
|
||||
{
|
||||
"__id__": 14
|
||||
},
|
||||
{
|
||||
"__id__": 18
|
||||
},
|
||||
{
|
||||
"__id__": 21
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 24
|
||||
},
|
||||
{
|
||||
"__id__": 25
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 27
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 150,
|
||||
"height": 150
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
-145.48,
|
||||
22.786,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "shan",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 132,
|
||||
"height": 132
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "43d8d0fc-bc63-4533-8fcf-c6dfa154b91b"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 1,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": {
|
||||
"__uuid__": "f683b01d-4d4a-4b64-a054-741e0785d512"
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "d9zEZjmopFvqHMauaByqPT",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "di",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 6
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 9
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 80,
|
||||
"height": 80
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "New Sprite",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 7
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 8
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 118,
|
||||
"height": 118
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "deab9be1-5a66-4214-9f7b-9374f9e1c674"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 1,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "f7BMdXGSdAHrhT4coa6xTA",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "8ea3e41f-b138-4d93-b6b4-afc225ae8f2a"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 1,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": {
|
||||
"__uuid__": "f683b01d-4d4a-4b64-a054-741e0785d512"
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "cb9ihGGopAkY+20ILGW9iZ",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "icon",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 12
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 13
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 66,
|
||||
"height": 66
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 11
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "d33a1397-766e-4fe0-936c-7bb5fc18c19e"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 1,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "3ezLyhgMlBwoj1LfZ8xCfs",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "guang",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 15
|
||||
},
|
||||
{
|
||||
"__id__": 16
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 17
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 173,
|
||||
"height": 174
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
5.684341886080802e-14,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "f13b9468-0e58-46ac-8ebe-ff0dcd39bad7"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 1,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Animation",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_enabled": true,
|
||||
"_defaultClip": {
|
||||
"__uuid__": "dd9d69fc-bc3c-4239-968e-9c6f4e54d9cf"
|
||||
},
|
||||
"_clips": [
|
||||
{
|
||||
"__uuid__": "dd9d69fc-bc3c-4239-968e-9c6f4e54d9cf"
|
||||
}
|
||||
],
|
||||
"playOnLoad": true,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "e5EF5v9LVFm7EbMhBwubQu",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "action",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 19
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 20
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 66,
|
||||
"height": 66
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 18
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "d33a1397-766e-4fe0-936c-7bb5fc18c19e"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 1,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "51u6/0UIBBeIqgqKc8BoZN",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "number",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": false,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 22
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 23
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 33.37,
|
||||
"height": 75.6
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 21
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_string": "9",
|
||||
"_N$string": "9",
|
||||
"_fontSize": 60,
|
||||
"_lineHeight": 60,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_styleFlags": 1,
|
||||
"_underlineHeight": 0,
|
||||
"_N$horizontalAlign": 1,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0,
|
||||
"_N$cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "ecdj27dvpMkq4us03b5VnO",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "4be67sdkexCyqLl0NHd9N1f",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Button",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_normalMaterial": null,
|
||||
"_grayMaterial": null,
|
||||
"duration": 0.1,
|
||||
"zoomScale": 1.1,
|
||||
"clickEvents": [
|
||||
{
|
||||
"__id__": 26
|
||||
}
|
||||
],
|
||||
"_N$interactable": true,
|
||||
"_N$enableAutoGrayEffect": false,
|
||||
"_N$transition": 3,
|
||||
"transition": 3,
|
||||
"_N$normalColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_N$pressedColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 211,
|
||||
"g": 211,
|
||||
"b": 211,
|
||||
"a": 255
|
||||
},
|
||||
"pressedColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 211,
|
||||
"g": 211,
|
||||
"b": 211,
|
||||
"a": 255
|
||||
},
|
||||
"_N$hoverColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"hoverColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_N$disabledColor": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 124,
|
||||
"g": 124,
|
||||
"b": 124,
|
||||
"a": 255
|
||||
},
|
||||
"_N$normalSprite": null,
|
||||
"_N$pressedSprite": null,
|
||||
"pressedSprite": null,
|
||||
"_N$hoverSprite": null,
|
||||
"hoverSprite": null,
|
||||
"_N$disabledSprite": null,
|
||||
"_N$target": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.ClickEvent",
|
||||
"target": {
|
||||
"__id__": 1
|
||||
},
|
||||
"component": "",
|
||||
"_componentId": "4be67sdkexCyqLl0NHd9N1f",
|
||||
"handler": "clickBtn",
|
||||
"customEventData": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "",
|
||||
"sync": false
|
||||
}
|
||||
]
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user