chore: 纳入项目全部源码进根仓库统一管理
删除 YouleNexus 内嵌 .git,统一由根仓库唯一管理。提交: - projects/ 旧 H5 模板 Game_Surface_3 与各子游戏源码 - cocoscreator_projects/YouleNexus 工程 + cocos-creator-mcp 扩展源码 - CLAUDE.md、.mcp.json 等配置 library/temp/node_modules/dist 等缓存由 .gitignore 排除。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
var module_card = module_card || {};
|
||||
//--------------------------
|
||||
//牌定义
|
||||
// id -> 牌的绝对id
|
||||
// score -> 牌的分值
|
||||
// dealowner -> 发牌到谁手中
|
||||
// playround -> 第几轮打出去的牌
|
||||
//--------------------------
|
||||
|
||||
//实例化一张牌
|
||||
module_card.new = function(id,score){
|
||||
try{
|
||||
var card = {};
|
||||
card.method = {};
|
||||
//牌属性
|
||||
card.id = id;
|
||||
card.score = score;
|
||||
card.dealowner = -1;
|
||||
card.playround = -1;
|
||||
//card.logicNumber = -1;
|
||||
//console.log(arguments);
|
||||
|
||||
|
||||
|
||||
card.method.getFlower = function(){
|
||||
return module_card.getFlower(card);
|
||||
}
|
||||
card.method.getNumber = function(){
|
||||
return module_card.getNumber(card);
|
||||
}
|
||||
card.method.setPlayRound = function(_round){
|
||||
return module_card.setPlayRound(card,_round);
|
||||
}
|
||||
for(var key in module_rule.card_prototype){
|
||||
//card.method.getPrototype = function(key) {return card[key]} ;
|
||||
if(module_util.isArray(module_rule.card_prototype[key])){
|
||||
card[key] = [];
|
||||
card[key].length = module_rule.card_prototype[key].length;
|
||||
for(var i=0;i < module_rule.card_prototype[key].length;i++){
|
||||
card[key][i] = module_rule.card_type[key][module_card.getPrototypeIndex(card.id)][i];
|
||||
}
|
||||
}else{
|
||||
card[key] = module_rule.card_type[key][module_card.getPrototypeIndex(card.id)];
|
||||
}
|
||||
|
||||
}
|
||||
return card;
|
||||
}catch(e){
|
||||
var _msg = {};
|
||||
_msg.id = id;
|
||||
_msg.score = score;
|
||||
_msg.func = "module_card.new";
|
||||
_msg.spyzuobiao = spyzuobiao;
|
||||
_msg.chshoupai = chshoupai;
|
||||
_msg.zshu = zshu;
|
||||
_msg.bijiao = bijiao;
|
||||
|
||||
|
||||
_msg = JSON.stringify(_msg);
|
||||
module_util.submitError(_msg,e.stack);
|
||||
}
|
||||
}
|
||||
//通过牌id列表生成card对象列表
|
||||
module_card.convertIdListToObjectList = function(_cardIdList){
|
||||
var o_card_list = [];
|
||||
for(var i=0;i<_cardIdList.length;i++){
|
||||
var _id = _cardIdList[i];
|
||||
var _score = module_algorithm.convertIdToScore(_cardIdList[i]);
|
||||
o_card_list.push(module_card.new(_id,_score));
|
||||
}
|
||||
return o_card_list;
|
||||
}
|
||||
//获得花色
|
||||
module_card.getFlower = function(o_card){
|
||||
var rt = o_card.id % 54;
|
||||
if (rt == 52 || rt == 53){ //小王大王
|
||||
return 5;
|
||||
}
|
||||
return parseInt(rt / 13) + 1;
|
||||
}
|
||||
//获得数值
|
||||
module_card.getNumber = function(o_card){
|
||||
var rt = o_card.id % 54;
|
||||
if (rt == 52){ //小王
|
||||
return 53;
|
||||
}
|
||||
if (rt == 53){ //大王
|
||||
return 54;
|
||||
}
|
||||
return rt % 13 + 1;
|
||||
}
|
||||
|
||||
//获得id所在数组的下标位置
|
||||
module_card.getPrototypeIndex = function(_id){
|
||||
var rt = _id % 54;
|
||||
if (rt == 52){ //小王
|
||||
return 13;
|
||||
}
|
||||
if (rt == 53){ //小王
|
||||
return 14;
|
||||
}
|
||||
return rt % 13;
|
||||
}
|
||||
//设置牌的出牌轮数
|
||||
module_card.setPlayRound = function(o_card,_round){
|
||||
o_card.playround = _round;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user