Files
youle_cocos/projects/erqiwang/js/02_erqiwang/05_eqw_Player.js
T
joywayerandClaude Opus 4.8 7ab748919a 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>
2026-06-28 11:55:13 +08:00

184 lines
4.1 KiB
JavaScript

var eqw_Player=eqw_Player||{};
function eqw_HandCard(id){
this.id=id;
this.isSelect=0;
this.click=1;
this.diff=0;
this.mustpush=0;
}
eqw_HandCard.prototype.GetId=function(){
return this.id;
}
eqw_HandCard.prototype.Select=function(){
this.isSelect=1;
}
eqw_HandCard.prototype.CancelSelect=function(){
this.isSelect=0;
}
eqw_HandCard.prototype.GetSelect=function(){
return this.isSelect;
}
eqw_HandCard.prototype.GetClick=function(){
return this.click;
}
eqw_HandCard.prototype.SetClick=function(){
this.click = 1;
}
eqw_HandCard.prototype.SetUnClick=function(){
this.click = 0;
}
eqw_HandCard.prototype.SetDiff=function(){
this.diff = 1;
}
eqw_HandCard.prototype.SetUnDiff=function(){
this.diff = 0;
}
eqw_HandCard.prototype.SetMust=function(){
this.mustpush = 1;
}
eqw_HandCard.prototype.SetUnMust=function(){
this.mustpush = 0;
}
///////------------------------------eqw_Player------------------------
eqw_Player.HandCards=[];
eqw_Player.call=null;//我的叫分
eqw_Player.status=0;//玩家是否是庄家
eqw_Player.BottomCards=[];//底牌只有庄家才有此属性
eqw_Player.Init=function(){
this.HandCards=[];
this.call=null;
this.status=0;
this.BottomCards=[];
}
eqw_Player.InitCards=function(){
for(var i=0;i<this.HandCards.length;i++){
this.HandCards[i].isSelect=0;
this.HandCards[i].click=1;
this.HandCards[i].diff=0;
this.HandCards[i].mustpush=0;
}
}
//选牌
eqw_Player.SelectCards=function(ind){
this.HandCards[ind].Select();
}
//取消选牌
eqw_Player.CancelSelectCards=function(ind){
this.HandCards[ind].CancelSelect();
}
//得到选中牌数量
eqw_Player.GetNumSelect=function(){
var n=0;
for(var i=0;i<this.HandCards.length;i++){
if(this.HandCards[i].GetSelect()==1){
n++;
}
}
return n;
}
//得到选中牌数量
eqw_Player.GetSelectCards=function(){
var result=[];
for(var i=0;i<this.HandCards.length;i++){
if(this.HandCards[i].GetSelect()==1){
result.push(this.HandCards[i].id);
}
}
return result;
}
//未出牌是设置手牌
eqw_Player.SetHandCards=function(CardList){
for(var i=0;i<eqw_Player.HandCards.length;i++){
eqw_Player.HandCards[i]=null;
}
eqw_Player.HandCards=[];
eqw_Player.HandCards.length=CardList.length;
for(var i=0;i<CardList.length;i++){
eqw_Player.HandCards[i]=new eqw_HandCard(CardList[i]);
}
}
//出牌
eqw_Player.PushCards=function(CardList){
for(var i=0;i<CardList.length;i++){
for(var j=0;j<this.HandCards.length;j++){
if(this.HandCards[j].GetId()==CardList[i]){
}
}
}
}
//设置手牌为未选中状态
eqw_Player.NoSelect=function(){
for(var j=0;j<this.HandCards.length;j++){
if(this.HandCards[j].GetSelect()==1){
this.HandCards[j].CancelSelect();
set_self(705+j,19,eqw_Const.Card.out_y,1,0);
}
}
}
//设置底牌
eqw_Player.SetBottomCards=function(CardList){
eqw_Player.BottomCards.length=CardList.length;
for(var i=0;i<CardList.length;i++){
eqw_Player.BottomCards[i]=CardList[i];
}
}
//获得牌列表
eqw_Player.GetCardsList=function(){
var result=[];
result.length=eqw_Player.HandCards.length;
for(var i=0;i<eqw_Player.HandCards.length;i++){
result[i]=eqw_Player.HandCards[i].id;
}
return result;
}
//设置可出不可出
eqw_Player.SetClickCards=function(CardList){
for(var i=0;i<CardList.length;i++){
for(var j=0;j<this.HandCards.length;j++){
if(this.HandCards[j].GetId()==CardList[i]){
this.HandCards[j].click=0;
}
//else{
//this.HandCards[j].click=0;
//}
}
}
for(var j=0;j<this.HandCards.length;j++){
if(this.HandCards[j].click==1){
this.HandCards[j].click=0;
}else{
this.HandCards[j].click=1;
}
}
}
//设置必出
eqw_Player.SetMustCards=function(CardList){
for(var i=0;i<CardList.length;i++){
for(var j=0;j<this.HandCards.length;j++){
if(this.HandCards[j].GetId()==CardList[i]){
set_self(705+j,19,-eqw_Const.Card.out_y,1,0);
this.HandCards[j].Select();
this.HandCards[j].SetMust();
}
}
}
}
//设置牌区别显示
eqw_Player.SetDiffCards=function(CardList){
for(var i=0;i<CardList.length;i++){
for(var j=0;j<this.HandCards.length;j++){
if(this.HandCards[j].GetId()==CardList[i]){
this.HandCards[j].SetDiff();
}
}
}
}