1、清理仓库

This commit is contained in:
贝密游戏
2017-12-21 23:04:13 +08:00
parent eeb1c9e07b
commit b52d442381
1317 changed files with 138642 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
username: {
default: null,
type: cc.Label
},
goldcoins: {
default: null,
type: cc.Label
},
cards: {
default: null,
type: cc.Label
}
,
girl:{
default: null,
type: cc.Node
}
},
// use this for initialization
onLoad: function () {
let self = this ;
if(this.ready()){
this.username.string = cc.beimi.user.username ;
this.pva_format(cc.beimi.user.goldcoins , cc.beimi.user.cards , cc.beimi.user.diamonds , self);
this.pvalistener(self , function (context) {
context.pva_format(cc.beimi.user.goldcoins , cc.beimi.user.cards , cc.beimi.user.diamonds , context) ;
});
}
},
pva_format:function(coins, cards , diamonds , object){
if(coins > 9999){
var num = coins / 10000 ;
object.goldcoins.string = num.toFixed(2) + '万';
}else{
object.goldcoins.string = coins;
}
object.cards.string = cards + "张" ;
},
playToLeft:function(){
this._girlAnimCtrl = this.girl.getComponent(cc.Animation);
this._girlAnimCtrl.play("girl_to_left");
},
playToRight:function(){
this._girlAnimCtrl = this.girl.getComponent(cc.Animation);
this._girlAnimCtrl.play("girl_to_right");
},
onDestroy:function(){
this.cleanpvalistener() ;
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "4b325584-d64a-484e-8535-def8ddc027dd",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,44 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
roomidDialog: {
default: null,
type: cc.Prefab
}
},
// use this for initialization
onLoad: function () {
},
onClick:function(event, data){
this.loadding();
let object = this ;
setTimeout(function(){
object.scene(data , object) ;
} , 200);
},
onClickJoinRoom:function(){
if(this.roomidDialog){
cc.beimi.openwin = cc.instantiate(this.roomidDialog) ;
cc.beimi.openwin.parent = this.root();
}
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "e9bfbd50-2624-401c-964c-67528f0e9a87",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,37 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
},
// use this for initialization
onLoad: function () {
/**
* 适配屏幕尺寸
*/
this.resize();
},
onClickDizhu:function(){
this.loadding();
let object = this ;
setTimeout(function(){
object.scene("dizhu" , object) ;
} , 200);
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "6643c6e4-fba3-47e1-a574-b858b3d0a3e1",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,80 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
tag: {
default: null,
type: cc.Node
},
score: {
default: null,
type: cc.Label
},
onlineusers: {
default: null,
type: cc.Label
},
scorelimit: {
default: null,
type: cc.Label
},
atlas: {
default: null,
type: cc.SpriteAtlas
}
},
// use this for initialization
onLoad: function () {
},
init:function(playway){
/**
* 需要预先请求 在线人数
*/
if(playway){
var frameName = "初级";
if(playway.level == '2'){
frameName = "高级"
}
this.data = playway ;
if(playway.shuffle == false){
this.tag.active = false ;
}else{
this.tag.active = true;
}
frameName = frameName + playway.skin ;
this.getComponent(cc.Sprite).spriteFrame = this.atlas.getSpriteFrame(frameName);
this.onlineusers.string = playway.onlineusers + " 人 " ;
var min = parseInt(playway.mincoins/1000)+"千" ;
if(playway.mincoins >= 10000){
min = parseInt(playway.mincoins / 10000)+"万" ;
}
var max = parseInt(playway.maxcoins/1000)+"千" ;
if(playway.maxcoins >= 10000){
max = parseInt(playway.maxcoins / 10000)+"万" ;
}
this.scorelimit.string = min + "-" + max ;
this.score.string = playway.score ;
}
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "bc63746d-dd76-4d1e-ad25-aa0f02e65611",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,52 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ..
playway:{
default: null,
type: cc.Node
},
},
// use this for initialization
onLoad: function () {
},
onClick:function(){
let self = this ;
var selectPlayway = this.getCommon("SelectPlayway");
let thisplayway = this.playway.getComponent("Playway");
let extparams = {
gametype : thisplayway.data.code ,
playway : thisplayway.data.id
} ;
this.closeOpenWin();
this.preload(extparams , self);
},
createRoom:function(event,data){
let self = this ;
this.loadding();
setTimeout(function(){
self.scene(data, self) ;
},200);
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "917d5098-f678-4083-873a-929d209e2b27",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,51 @@
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
playway: {
default: null,
type: cc.Prefab
},
},
// use this for initialization
onLoad: function () {
this.playwaypool = new cc.NodePool();
for(var i=0 ; i<5 ; i++){ //最大玩法数量不能超过20种
this.playwaypool.put(cc.instantiate(this.playway));
}
this.playwayarray = new Array();
},
init:function(){
/**
* 加载预制的 玩法
*/
var gametype = cc.beimi.game.type(data);
if(gametype!=null){
for(var inx =0 ; inx < gametype.playways.length ; inx++){
/**
* 此处需要做判断,检查 对象池有足够的对象可以使用
*/
var playway = this.playwaypool.get();
var script = playway.getComponent("Playway") ;
script.init(gametype.playways[inx]);
playway.parent = this.content ;
this.playwayarray.push(playway) ;
}
}
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "ad97901d-2e7f-4277-a161-c18d05e512b3",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,52 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
atlas: {
default: null,
type: cc.SpriteAtlas
},
gametype:{
default:null ,
type : cc.Node
},
roomoption:{
default:null ,
type : cc.Prefab
}
},
// use this for initialization
onLoad: function () {
},
init:function(playway){
/**
* 需要预先请求 在线人数
*/
if(playway){
this.data = playway ;
}
if(playway.code == "dizhu"){
this.gametype.getComponent(cc.Sprite).spriteFrame = this.atlas.getSpriteFrame("斗地主");
}else if(playway.code == "majiang"){
this.gametype.getComponent(cc.Sprite).spriteFrame = this.atlas.getSpriteFrame("广东麻将");
}else if(playway.code == "poker"){
this.gametype.getComponent(cc.Sprite).spriteFrame = this.atlas.getSpriteFrame("德州扑克");
}
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "3086de3f-aa9e-45b3-8947-676d9c2baf07",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,160 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
first: {
default: null,
type: cc.Node
},
second: {
default: null,
type: cc.Node
},
gamepoint:{
default: null,
type: cc.Node
},
title:{
default: null,
type: cc.Node
},
global: {
default: null,
type: cc.Node
},
playway: {
default: null,
type: cc.Prefab
},
content: {
default: null,
type: cc.Node
},
},
// use this for initialization
onLoad: function () {
if(cc.beimi != null && cc.beimi.user != null){
this.disMenu("first") ;
this.playwaypool = new cc.NodePool();
for(var i=0 ; i<20 ; i++){ //最大玩法数量不能超过20种
this.playwaypool.put(cc.instantiate(this.playway));
}
this.playwayarray = new Array();
if(this.gamepoint && cc.beimi!=null && cc.beimi.games !=null){
for(var inx=0 ; inx < this.gamepoint.children.length ; inx++){
let name = this.gamepoint.children[inx].name ;
var gameenable = false ;
for(var i=0 ; i<cc.beimi.games.length ; i++){
var gamemodel = cc.beimi.games[i] ;
for(var j=0 ; j<gamemodel.types.length ; j++){
let gametype = gamemodel.types[j] ;
if(gametype.code == name){
gameenable = true ; break ;
}
}
if(gameenable == true){break ;}
}
if(gameenable == true){
this.gamepoint.children[inx].active = true ;
}else{
this.gamepoint.children[inx].active = false ;
}
}
}
}
},
onClick:function(event, data){
this.disMenu("second") ;
var girlAni = this.global.getComponent("DefaultHallDataBind");
girlAni.playToLeft();
this._secondAnimCtrl = this.second.getComponent(cc.Animation);
this._secondAnimCtrl.play("playway_display");
if(this.title){
for(var inx = 0 ; inx<this.title.children.length ; inx++){
if(this.title.children[inx].name == data){
this.title.children[inx].active = true ;
}else{
this.title.children[inx].active = false ;
}
}
}
/**
* 加载预制的 玩法
*/
var gametype = cc.beimi.game.type(data);
if(gametype!=null){
for(var inx =0 ; inx < gametype.playways.length ; inx++){
/**
* 此处需要做判断,检查 对象池有足够的对象可以使用
*/
var playway = this.playwaypool.get();
var script = playway.getComponent("Playway") ;
if(script == null){
script = playway.getComponent("RoomPlayway") ;
}
script.init(gametype.playways[inx]);
playway.parent = this.content ;
this.playwayarray.push(playway) ;
}
}
},
onRoomClick:function(){
this.disMenu("third") ;
this._menuDisplay = this.third.getComponent(cc.Animation);
this._menuDisplay.play("play_room_display");
},
onSecondBack:function(event ,data){
var girlAni = this.global.getComponent("DefaultHallDataBind");
girlAni.playToRight();
this.collect();
this.disMenu("first") ;
},
onThirddBack:function(event ,data){
this.disMenu("first") ;
},
collect:function(){
for(var inx =0 ; inx < this.playwayarray.length ; inx++){
this.playwaypool.put(this.playwayarray[inx]);
}
this.playwayarray.splice(0 ,this.playwayarray.length );
},
disMenu:function(order){
if(order == 'first'){
this.first.active = true ;
this.second.active = false ;
if(this.third != null){
this.third.active = false ;
}
}else if(order == 'second'){
this.first.active = false;
this.second.active = true;
if(this.third != null){
this.third.active = false ;
}
}else if(order == 'third'){
this.first.active = false;
this.second.active = false;
if(this.third != null){
this.third.active = true ;
}
}
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "b0664a0c-9c79-4e2b-9a24-798594619fc1",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "5eb96024-b535-4368-a952-3c9f9e9d503d",
"subMetas": {}
}

View File

@@ -0,0 +1,34 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
},
// use this for initialization
onLoad: function () {
},
onClick:function(event){
event.stopPropagation();
},
onCloseClick:function(){
this.closeOpenWin();
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "a07b35cb-8b05-4193-9445-cc799de741b1",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,63 @@
// Learn cc.Class:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
// Learn Attribute:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
// Learn life-cycle callbacks:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
title_feedback: {
default: null,
type: cc.Node
},
title_reply: {
default: null,
type: cc.Node
},
},
// LIFE-CYCLE CALLBACKS:
onLoad : function() {
this.title_feedback.active = true ;
this.title_reply.active = false ;
/**
* 从远程加载数据,如果加载数据失败,则显示提示消息,并注册拖动刷新事件
*/
},
onFeedBack:function(){
this.title_feedback.active = true ;
this.title_reply.active = false ;
},
onReply:function(){
this.title_feedback.active = false ;
this.title_reply.active = true ;
}
// update (dt) {},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "789dc0da-871b-45a1-a1da-000c92f392b7",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,98 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
numdata: {
default:null,
type:cc.Node
}
},
// LIFE-CYCLE CALLBACKS:
onLoad : function () {
this.roomid = new Array() ;
},
onClick:function(event,data){
if(this.roomid.length < 6){
this.roomid.push(data);
this.disRoomId();
}
if(this.roomid.length == 6){
this.closeOpenWin();
/**
* 查询服务端的房间号码 然后通过房间号码找到对应的房间游戏类型,玩法等信息
*/
if(this.ready()){
let socket = this.socket();
/**
* 发送 room请求
*/
var param = {
token:cc.beimi.authorization,
roomid:this.roomid.join(""),
orgi:cc.beimi.user.orgi,
userid:cc.beimi.user.id
} ;
socket.emit("searchroom" , JSON.stringify(param));
this.registercallback(this.roomCallBack);
}
this.loadding();
}
},
roomCallBack:function(result , self){
var data = self.parse(result) ;
if(data.result == "ok"){
var extparams = {
gametype : data.code ,
playway : data.id ,
gamemodel : "room"
} ;
/**
* 发送创建房间开始游戏的请求
*/
self.preload(extparams , self) ;
}else if(data.result == "notexist"){
self.alert("房间号不存在。");
}else if(data.result == "full"){
self.alert("房间已满员。");
}
},
onDeleteClick:function(){
this.roomid.splice(this.roomid.length-1 , this.roomid.length) ;
this.disRoomId();
},
onCleanClick:function(){
this.roomid.splice(0 , this.roomid.length) ;
this.disRoomId();
},
disRoomId:function(){
let children = this.numdata.children ;
for(var inx = 0 ; inx < 6 ; inx ++){
if(inx < this.roomid.length){
children[inx].children[0].getComponent(cc.Label).string = this.roomid[inx] ;
}else{
children[inx].children[0].getComponent(cc.Label).string = "" ;
}
}
}
// update (dt) {},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "dca01e44-3a44-43f1-be61-92135c017914",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,30 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
},
// use this for initialization
onLoad: function () {
},
onClick:function(){
this.logout();
this.scene("login", this) ;
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "c02c1c2a-7b42-45ae-b4a9-872d007a4eb6",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,72 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
setting: {
default: null,
type: cc.Prefab
},
message: {
default: null,
type: cc.Prefab
},
share: {
default: null,
type: cc.Prefab
},
playway: {
default: null,
type: cc.Prefab
},
feedback: {
default: null,
type: cc.Prefab
}
},
// use this for initialization
onLoad: function () {
},
onSettingClick:function(){
cc.beimi.openwin = cc.instantiate(this.setting) ;
cc.beimi.openwin.parent = this.root();
},
onMessageClick:function(){
cc.beimi.openwin = cc.instantiate(this.message) ;
cc.beimi.openwin.parent = this.root();
},
onShareClick:function(){
cc.beimi.openwin = cc.instantiate(this.share) ;
cc.beimi.openwin.parent = this.root();
},
onPlaywayClick:function(){
cc.beimi.openwin = cc.instantiate(this.playway) ;
cc.beimi.openwin.parent = this.root();
},
onRecordClick:function(){
cc.beimi.openwin = cc.instantiate(this.playway) ;
cc.beimi.openwin.parent = this.root();
},
onFeedBackClick:function(){
cc.beimi.openwin = cc.instantiate(this.feedback) ;
cc.beimi.openwin.parent = this.root();
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "4ee594c6-0775-4564-b42e-ba36af982c46",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,63 @@
// Learn cc.Class:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
// Learn Attribute:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
// Learn life-cycle callbacks:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
title_message: {
default: null,
type: cc.Node
},
title_contact: {
default: null,
type: cc.Node
},
},
// LIFE-CYCLE CALLBACKS:
onLoad : function() {
this.title_contact.active = false ;
this.title_message.active = true ;
/**
* 从远程加载数据,如果加载数据失败,则显示提示消息,并注册拖动刷新事件
*/
},
onContacts:function(){
this.title_contact.active = true ;
this.title_message.active = false ;
},
onMessage:function(){
this.title_contact.active = false ;
this.title_message.active = true ;
}
// update (dt) {},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "c56ed1cf-991a-4449-92b7-f1d85133c0f1",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,87 @@
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
music:{
default: null,
type: cc.Sprite
},
musicSlider:{
default: null,
type: cc.Slider
},
sound:{
default: null,
type: cc.Sprite
},
soundSlider:{
default: null,
type: cc.Slider
},
musicon:{
default: null,
type: cc.Node
},
musicoff:{
default: null,
type: cc.Node
},
soundon:{
default: null,
type: cc.Node
},
soundoff:{
default: null,
type: cc.Node
},
},
// use this for initialization
onLoad: function () {
this.musicSlider.progress = cc.beimi.audio.bgVolume;
this.music.fillRange = cc.beimi.audio.bgVolume ;
if(cc.beimi.audio.getState() == cc.audioEngine.AudioState.PLAYING){
this.musicon.active = true ;
this.musicoff.active = false;
}else{
this.musicon.active = false ;
this.musicoff.active = true
}
},
onMusicSlide:function(slider){
this.music.fillRange = slider.progress ;
cc.beimi.audio.setBGMVolume(slider.progress) ;
this.musicon.active = true ;
this.musicoff.active = false;
},
onSoundSlide:function(slider){
this.sound.fillRange = slider.progress ;
},
onMusiceBtnClick:function(){
if(cc.beimi.audio.getState() == cc.audioEngine.AudioState.PLAYING){
this.musicon.active = false ;
this.musicoff.active = true;
cc.beimi.audio.pauseAll();
}else{
this.musicon.active = true ;
this.musicoff.active = false;
cc.beimi.audio.resumeAll();
}
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "904317f6-dc98-42d0-aa13-2068294fc6fb",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,5 @@
{
"ver": "1.0.1",
"uuid": "b8fc8c7b-33bb-4dee-9b63-2811e91b2c4f",
"subMetas": {}
}

View File

@@ -0,0 +1,154 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
grouptitle:{
default:null ,
type : cc.Label
},
groupbox:{
default:null ,
type : cc.Node
},
groupbox_four:{
default:null ,
type : cc.Node
},
content:{
default:null ,
type : cc.Node
},
itemname:{
default:null ,
type : cc.Label
},
checkbox:{
default:null ,
type : cc.Node
},
checkboxnode:{
default:null ,
type : cc.Node
}
},
// use this for initialization
onLoad: function () {
let self = this ;
this.node.on('checkbox', function (event) {
if(self.checkbox!=null){
if(self.checked == false){
if(self.data.type == "radio"){
for(var inx = 0 ; inx < self.options.length ; inx++){
let script = self.options[inx] ;
script.doUnChecked() ;
}
}
self.doChecked();
}else{
if(self.data.type == "radio"){
for(var inx = 0 ; inx < self.options.length ; inx++){
let script = self.options[inx] ;
script.doUnChecked() ;
}
self.doChecked();
}else{
self.doUnChecked();
}
}
}
event.stopPropagation() ;
});
},
init:function(group , itempre , items , parentoptions){
this.data = group ;
this.options = parentoptions ;
this.groupoptions = new Array();
this.checked = false ;
this.grouptitle.string = group.name ;
if(this.groupbox!=null && itempre!=null){
let itemsnum = 0 ;
for(var inx=0 ; inx<items.length ; inx++){
if(items[inx].groupid == group.id){
itemsnum = itemsnum + 1;
let newitem = cc.instantiate(itempre) ;
if(group.style != null && group.style == "three"){
newitem.parent = this.groupbox ;
this.groupbox_four.active = false ;
this.groupbox.active = true ;
}else{
newitem.parent = this.groupbox_four ;
this.groupbox_four.active = true;
this.groupbox.active = false;
}
let script = newitem.getComponent("PlaywayGroup") ;
this.groupoptions.push(script);
script.inititem(items[inx] , group , this.groupoptions);
}
}
if(group.style != null && group.style == "three") {
if (itemsnum > 4) {
this.content.height = 35 + 50 * (parseInt((itemsnum - 1) / 3) + 1);
this.groupbox.height = 50 * (parseInt((itemsnum - 1) / 3) + 1);
}
}else{
if (itemsnum > 4) {
this.content.height = 35 + 50 * (parseInt((itemsnum - 1)/ 4) + 1);
this.groupbox_four.height = 50 * (parseInt((itemsnum - 1)/ 4) + 1);
}
}
}
},
inititem:function(item , group , parentoptions){
this.data = group ;
this.item = item ;
this.options = parentoptions;
this.itemname.string = item.name ;
/**
* 以下代码修正 OPTION超出宽度导致 点击错误的 问题
*/
if(group.style == "three"){
this.itemname.node.width = 160 ;
this.itemname.node.x = 107 ;
}else{
this.itemname.node.width = 105 ;
this.itemname.node.x = 77 ;
}
if(item.defaultvalue == true){
this.doChecked();
}else{
this.doUnChecked();
}
if(group!=null && group.style!=null && group.style == "three"){
this.checkboxnode.x = -76 ;
}
},
doChecked:function(){
this.checked = true ;
this.checkbox.active = true ;
},
doUnChecked:function(){
this.checked = false ;
this.checkbox.active = false;
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "23db4c01-f8bd-4086-90a1-880ded1c1dd2",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,37 @@
// Learn cc.Class:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
// Learn Attribute:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
// Learn life-cycle callbacks:
// - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
// - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
},
onClick:function(){
this.node.dispatchEvent( new cc.Event.EventCustom("checkbox", true) );
},
onCreateRoom:function(){
this.node.dispatchEvent( new cc.Event.EventCustom("createroom", true) );
}
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "f9e4f623-b154-4818-b710-1277ba672b75",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,129 @@
var beiMiCommon = require("BeiMiCommon");
cc.Class({
extends: beiMiCommon,
properties: {
// foo: {
// default: null, // The default value will be used only when the component attaching
// to a node for the first time
// url: cc.Texture2D, // optional, default is typeof default
// serializable: true, // optional, default is true
// visible: true, // optional, default is true
// displayName: 'Foo', // optional
// readonly: false, // optional, default is false
// },
// ...
atlas: {
default: null,
type: cc.SpriteAtlas
},
memo:{
default:null ,
type : cc.Label
},
optionsnode:{
default:null ,
type : cc.Node
},
roomtitle:{
default:null ,
type : cc.Node
},
optiongroup:{
default:null ,
type : cc.Prefab
},
optiongroupitem:{
default:null ,
type : cc.Prefab
},
memonode:{
default:null ,
type : cc.Node
},
createroom:{
default:null ,
type : cc.Node
},
freeopt:{
default:null ,
type : cc.Node
}
},
// use this for initialization
onLoad: function () {
let self = this ;
this.group = new Array();
this.node.on('createroom', function (event) {
/**
* 把参数 汇总一下, 然后转JSON以后序列化成字符串发送 创建房间的请求
*/
var extparams = {} ;
let values = new Array();
for(var inx=0 ; inx<self.group.length ; inx++){
let groupitem = self.group[inx] ;
let value = "" ;
for(var j=0 ; j<groupitem.groupoptions.length ; j++){
let option = groupitem.groupoptions[j] ;
if(option.checked == true){
if(value != ""){
value = value + "," ;
}
value = value + option.item.value ;
}
}
extparams[groupitem.data.code] = value ;
}
/**
* 藏到全局变量里去,进入场景后使用,然后把这个参数置空
* @type {{}}
*/
extparams.gametype = self.data.code ;
extparams.playway = self.data.id;
extparams.gamemodel = "room" ;
/**
* 发送创建房间开始游戏的请求
*/
event.stopPropagation() ;
self.preload(extparams , self) ;
});
},
init:function(playway){
this.data = playway ;
if(this.memo != null && playway.memo!=null && playway.memo!=""){
this.memonode.active = true ;
this.memo.string = playway.memo ;
}else if(this.memonode!=null){
this.memonode.active = false ;
}
if(playway.free == true){
this.freeopt.active = true;
this.createroom.active = false ;
}else{
this.freeopt.active = false;
this.createroom.active = true ;
}
if(playway.roomtitle!=null && playway.roomtitle!=""){
let frame = this.atlas.getSpriteFrame(playway.roomtitle);
if(frame!=null){
this.roomtitle.getComponent(cc.Sprite).spriteFrame = frame ;
}
}
if(this.optiongroup!=null && playway.groups!=null){
for(var inx = 0 ; inx < playway.groups.length ; inx++){
let group = cc.instantiate(this.optiongroup) ;
let playWayGroup = group.getComponent("PlaywayGroup") ;
playWayGroup.init(playway.groups[inx] , this.optiongroupitem , playway.items) ;
this.group.push(playWayGroup);
group.parent = this.optionsnode ;
}
}
}
// called every frame, uncomment this function to activate update callback
// update: function (dt) {
// },
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "69fc3ecf-8cba-431c-93ee-9bed215adbbf",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}