Browse Source

等待玩家加入倒计时

master
cristianoxin 5 months ago
parent
commit
390b0c4c34
  1. 32
      assets/10001/10001.scene
  2. 6
      assets/10001/language/en/language.json
  3. 6
      assets/10001/language/in/language.json
  4. 2
      assets/10001/src/GameConst10001.ts
  5. 4
      assets/10001/src/game/TeenPattieGameEntity.ts
  6. 2
      assets/10001/src/game/logic/TeenPattieJieSuanLogic.ts
  7. 2
      assets/10001/src/game/logic/TeenPattiePlayerLogic.ts
  8. 2
      assets/10001/src/game/logic/TeenPattieShowTipLogic.ts
  9. 35
      assets/10001/src/game/logic/TeenPattieUpLayerLogic.ts
  10. 2
      assets/10001/src/game/logic/TeenpattieFaPaiEffectLogic.ts
  11. 34
      assets/10001/src/game/system/TeenpattieGameProxySystem.ts
  12. 2
      assets/10001/src/sdk/GameVO.ts

32
assets/10001/10001.scene

@ -21,11 +21,11 @@
"_active": true,
"_components": [],
"_prefab": {
"__id__": 18
"__id__": 19
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 19
"__id__": 20
},
"_id": "d1909322-c6a3-4ec5-a6b8-ceddf19ccd9d"
},
@ -46,14 +46,14 @@
],
"_active": true,
"_components": [
{
"__id__": 15
},
{
"__id__": 16
},
{
"__id__": 17
},
{
"__id__": 18
}
],
"_prefab": null,
@ -218,7 +218,11 @@
"__id__": 13
}
],
"removedComponents": []
"removedComponents": [
{
"__id__": 15
}
]
},
{
"__type__": "CCPropertyOverrideInfo",
@ -298,6 +302,12 @@
"92Et3YGotBRYEMrUAtjgfH"
]
},
{
"__type__": "cc.TargetInfo",
"localID": [
"4ado3qslpL/594oeaaI2wM"
]
},
{
"__type__": "cc.UITransform",
"_name": "",
@ -375,19 +385,19 @@
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 20
"__id__": 21
},
"shadows": {
"__id__": 21
"__id__": 22
},
"_skybox": {
"__id__": 22
"__id__": 23
},
"fog": {
"__id__": 23
"__id__": 24
},
"octree": {
"__id__": 24
"__id__": 25
}
},
{

6
assets/10001/language/en/language.json

@ -227,6 +227,10 @@
},
"game.net.code.status.4":{
"des":"房间已解散",
"value":"The room has been disbanded"
},
"game.net.code.status.5":{
"des":"房间不存在",
"value":"The room does not exist"
@ -405,7 +409,7 @@
},
"game.title.waiting":{
"des":"等待其他玩家加入",
"value":"Waiting for other players to join..."
"value":"Waiting for other players to join{0}"
},
"game.title.setting":{
"des":"设置",

6
assets/10001/language/in/language.json

@ -227,6 +227,10 @@
},
"game.net.code.status.4":{
"des":"房间已解散",
"value":"कमरा विच्छेद किया गया है"
},
"game.net.code.status.5":{
"des":"房间不存在",
"value":"कमरा मौजूद नहीं है"
@ -408,7 +412,7 @@
},
"game.title.waiting":{
"des":"等待其他玩家加入",
"value":"अन्य खेलाड़ियों को जोड़ने के लिए इंतजार कर रहा है..."
"value":"अन्य खेलाड़ियों को जोड़ने के लिए इंतजार कर रहा है{0}"
},
"game.title.setting":{
"des":"设置",

2
assets/10001/src/GameConst10001.ts

@ -17,7 +17,7 @@ export enum GameNetCode{
// ReStart = 10001017, //下一局游戏开始 重新开始游戏
PlayerJoin = 10001021,// 玩家加入房间
PlayerOut = 10001022,// 玩家退出 结束游戏 退出房间
Refresh = 10001023,// 刷新房间
RoomWait = 10001023,// 房间等待倒计时
GameRecord = 10001024, // 游戏记录
}

4
assets/10001/src/game/TeenPattieGameEntity.ts

@ -29,11 +29,11 @@ export class TeenPattieGameEntity extends Component{
Message.remove(SocketConst.CONNECTED,this.reconnect, this);
}
private OnGameExit(): void {
private OnGameExit(param): void {
TeenPattieCommData.getInstance().clearCommData();
UIManager.getInstance().hide(GamePanelConst.Game_Main_Panel_TeenPattie);
UIManager.getInstance().clearAllByLayer(UILayerIndex.TopLayer);
Message.send(GameConst.EXIT_SUB_GAME);
Message.send(GameConst.EXIT_SUB_GAME,param);
if(this.node){
this.node.destroy();
}

2
assets/10001/src/game/logic/TeenPattieJieSuanLogic.ts

@ -64,7 +64,7 @@ export class TeenPattieJieSuanLogic extends Component{
private async setFont(isWin:boolean){
let win = isWin ? "win_num" : "fail";
let fon = await LoaderManager.getInstance().getType(`${BundleName.BundleName}`,`res/font/${win}`,Font) as Font;
if(this.player.recordNum.isValid)this.player.recordNum.font = fon;
if(this.player.recordNum && this.player.recordNum.isValid)this.player.recordNum.font = fon;
}
}

2
assets/10001/src/game/logic/TeenPattiePlayerLogic.ts

@ -742,8 +742,6 @@ export class TeenPattiePlayerLogic extends Component {
/**重置玩家信息 */
private resetPlayerData() {
Message.send(TeenPattieEventType.GameMatchTips, false);
this.kanpaiLabel.string = Game10001Res.getInstance()?.getString(`game.tip.notcheckedCards`);
this.recordNum.string = "";
this.xiazhuNum.string = "0";

2
assets/10001/src/game/logic/TeenPattieShowTipLogic.ts

@ -70,7 +70,7 @@ export class TeenPattieShowTipLogic extends Component {
let th = this;
async function findTip(owner: TeenPattiePlayerLogic) {
let sp: SpriteFrame = await LoaderManager.getInstance().getType(`${BundleName.BundleName}`, url, SpriteFrame) as SpriteFrame;
if (owner.playerTip.isValid && owner.playerTip.node.isValid) {
if (owner.playerTip && owner.playerTip.isValid && owner.playerTip.node.isValid) {
owner.playerTip.spriteFrame = sp;
th.showEffect();
}

35
assets/10001/src/game/logic/TeenPattieUpLayerLogic.ts

@ -19,6 +19,7 @@ export class TeenPattieUpLayerLogic extends Component {
private gold: Label;
private refreshBtn: Button;
private matchTips: Node;
private matchTipsLabel:Label;
private goldNum: TeenPattieRollNumComponent;
private rollNum: TeenPattieRollNumComponent;
@ -84,6 +85,7 @@ export class TeenPattieUpLayerLogic extends Component {
this.menu.active = false;
this.matchTips = find("matchTips", this.node);
this.matchTips.active = false;
this.matchTipsLabel = find("matchTips/Label",this.node)?.getComponent(Label);
this.betNode = find("betNode", this.node);
this.chouma = find("chouma", this.node);
@ -162,8 +164,24 @@ export class TeenPattieUpLayerLogic extends Component {
*
* @param status
*/
private waitCountDown:number = 60;
public showMatchTips(status: boolean) {
this.waitCountDown = 60;
this.matchTipsLabel.string = Game10001Res.getInstance().getString("game.title.waiting").replace("{0}",`(${this.waitCountDown})`);
this.matchTips.active = status;
if(!status){
this.unschedule(this.startCountData.bind(this));
return;
}
this.schedule(this.startCountData.bind(this),1,60);
}
private startCountData(){
this.waitCountDown--;
this.matchTipsLabel.string = Game10001Res.getInstance().getString("game.title.waiting").replace("{0}",`(${this.waitCountDown})`);
if(this.waitCountDown <= 0){
this.unschedule(this.startCountData.bind(this));
return
}
}
/**发牌结束 初始化桌子数据 */
public playCutDown(gameRound:number) {
@ -173,14 +191,6 @@ export class TeenPattieUpLayerLogic extends Component {
const allBet = TeenPattieCommTool.RideThousand(number)
this.totalLabel.string = allBet.toString();
}
// private isDes: boolean = true;
// public sendNextPlayerChuPai() {
// if (!this.isDes) return;
// this.isNexOne = true;
// Network.getInstance().send(GameNetCode.StartCutdown, {});
// Network.getInstance().removehandle(GameNetCode.StartCutdown);
// TeenPattieCommData.getInstance().isGame = true;
// }
/**结算后刷新玩家金币 */
private gameRecover(){
@ -205,15 +215,6 @@ export class TeenPattieUpLayerLogic extends Component {
private onClickRefreshBth() {
this.totalLabel.string = "0";
TeenPattieGameStaticSystem.showEffect.hideBiPaiLigature();
Message.send(TeenPattieEventType.Refresh);
Network.getInstance().send(GameNetCode.Refresh, {}, (value: any) => {
Network.getInstance().removehandle(GameNetCode.Refresh)
if (value.code != 0) {
window["Toast"]?.getInstance().showToast(Game10001Res.getInstance()?.getString(`game.net.code.status.${value.code}`));
} else {
// this.sendMsg(TeenPattieEventType.Refresh);
}
});
}
private isNexOne:boolean = false;

2
assets/10001/src/game/logic/TeenpattieFaPaiEffectLogic.ts

@ -309,7 +309,7 @@ export class TeenpattieFaPaiEffectLogic extends Component{
}
/**移动时间 */
private time:number = 0.1
private time:number = 0.08
private twPos:Tween<Node>
/**
*

34
assets/10001/src/game/system/TeenpattieGameProxySystem.ts

@ -39,6 +39,7 @@ export class TeenpattieGameProxySystem extends Component {
Network.getInstance().registhandle(GameNetCode.PlayerJoin, this.onPlayerJoin.bind(this));
Network.getInstance().registhandle(GameNetCode.ForceSeeCard, this.ForceSeeCard.bind(this));
Network.getInstance().registhandle(GameNetCode.ForceCompare, this.ForceCompare.bind(this));
Network.getInstance().registhandle(GameNetCode.RoomWait,this.roomWait.bind(this));
Message.add(UIWindowMessage.CloseUI, this.onCloseUI, this);
}
@ -63,6 +64,7 @@ export class TeenpattieGameProxySystem extends Component {
Network.getInstance().removehandle(GameNetCode.PlayerJoin, this.onPlayerJoin.bind(this));
Network.getInstance().removehandle(GameNetCode.ForceSeeCard, this.ForceSeeCard.bind(this));
Network.getInstance().removehandle(GameNetCode.ForceCompare, this.ForceCompare.bind(this));
Network.getInstance().removehandle(GameNetCode.RoomWait,this.roomWait.bind(this));
Message.remove(UIWindowMessage.CloseUI, this.onCloseUI, this);
}
@ -71,10 +73,11 @@ export class TeenpattieGameProxySystem extends Component {
this.currChuPaiId = 0;
}
/**游戏等待开始倒计时 */
/**游戏等待开始 */
private onGameStart(value: any) {
this.pkData = null;
this.resData = null;
Message.send(TeenPattieEventType.GameMatchTips,false);
Message.send(TeenPattieEventType.NextGame);
this.isForceCompare = false;
TeenpattieGameProxySystem.upPlayer?.startCutDown(true,value.data);
@ -97,17 +100,14 @@ export class TeenpattieGameProxySystem extends Component {
private onPlayerJoinGame(value: any) {
switch(value.code){
case gameErrorCode.NotRoom:
window["Toast"]?.getInstance().showToast(Game10001Res.getInstance()?.getString(`game.net.code.status.5`));
Message.send(TeenPattieEventType.GameExit);
this.exitTip("game.net.code.status.5")
return
case gameErrorCode.PlayerFilled:
window["Toast"]?.getInstance().showToast(Game10001Res.getInstance()?.getString(`game.net.code.status.7`));
Message.send(TeenPattieEventType.GameExit);
this.exitTip("game.net.code.status.7")
return
}
if(value.code != 0){
window["Toast"]?.getInstance().showToast(Game10001Res.getInstance()?.getString(`game.net.code.status.5`));
Message.send(TeenPattieEventType.GameExit);
this.exitTip("game.net.code.status.5")
return;
}
if(!this.isReconnect) return;
@ -150,7 +150,8 @@ export class TeenpattieGameProxySystem extends Component {
if(value.data.data.curPlayerSeat <= 0 && value.data.data.gameRound <= 0 && value.data.data.time > 0){
TeenpattieGameProxySystem.upPlayer?.startCutDown(true,value.data.data.time);
// TeenpattieGameProxySystem.upPlayer?.startCutDown(true,value.data.data.time);
Message.send(TeenPattieEventType.GameMatchTips,true);
return;
}
@ -363,4 +364,21 @@ export class TeenpattieGameProxySystem extends Component {
}
}
/**等待开始倒计时 */
private roomWait(value:any){
const isStartCountTime:boolean = value.data == 0 ? true : false;
if(!isStartCountTime){
this.exitTip("game.net.code.status.4");
return;
}
Message.send(TeenPattieEventType.GameMatchTips,isStartCountTime);
}
private exitTip(str:string){
let param:any={}
param.msg="kickout";
param.language=Game10001Res.getInstance().getString(str)
Message.send(TeenPattieEventType.GameExit,param);
}
}

2
assets/10001/src/sdk/GameVO.ts

@ -38,7 +38,7 @@ export const UserData = window["UserData"] || {
vipLevel: 0,//VIP等级
gameID:10001,//游戏id
roomID:0,//游戏房价ID
tableID:0,//桌子ID
tableID:1,//桌子ID
gameLevel:0,//游戏等级
agentID:1,//代理id
srcRoomId:0,//房间场次ID 初级场/中级场 断线重连回来用这个

Loading…
Cancel
Save