1、清理仓库
This commit is contained in:
@@ -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) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "23db4c01-f8bd-4086-90a1-880ded1c1dd2",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -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) );
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "f9e4f623-b154-4818-b710-1277ba672b75",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
// },
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "69fc3ecf-8cba-431c-93ee-9bed215adbbf",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
Reference in New Issue
Block a user