|
|
@ -1,4 +1,4 @@ |
|
|
|
import { Component, Node, Tween, UITransform, Vec3, _decorator, find, tween, v3 } from "cc"; |
|
|
|
import { Camera, Component, Node, Quat, Tween, UITransform, Vec3, _decorator, find, macro, tween, v3 } from "cc"; |
|
|
|
import { TeenPattieEventType } from "../../tool/TeenPattieEventType"; |
|
|
|
import { TeenPattieCommData } from "../TeenPattieCommData"; |
|
|
|
import { TeenPattieCommTool } from "../../tool/TeenPattieCommTool"; |
|
|
@ -9,35 +9,14 @@ import { TeenPattiePlayerLogic } from "./TeenPattiePlayerLogic"; |
|
|
|
/**游戏发牌逻辑 */ |
|
|
|
export class TeenpattieFaPaiEffectLogic extends Component{ |
|
|
|
|
|
|
|
//牌的落点 Position
|
|
|
|
private pos_1:number[][] = [[-355.6,109,0],[-365,84,0],[-381.7,62.4,0]]; //1号位玩家
|
|
|
|
private pos_2:number[][] = [[-421.3,-72.8,0],[-406.9,-94.4,0],[-403.5,-120.6,0]]; //2号位玩家
|
|
|
|
private pos_3:number[][] = [[-42,-100,0],[-0.3,-95,0],[42,-100,0]]; //3号位玩家
|
|
|
|
private pos_4:number[][] = [[356,-126.4,0],[360.5,-100,0],[376.2,-79,0]]; //4号位玩家
|
|
|
|
private pos_5:number[][] = [[334,63.5,0],[314.8,81.6,0],[305.1,106.2,0]]; //5号位玩家
|
|
|
|
private pos_6:number[][] = [[4.5,125.7,0],[-21.4,119,0],[-48.6,123.8,0]]; //6号位玩家
|
|
|
|
/**牌的位置 */ |
|
|
|
private pos:number[][][] = []; |
|
|
|
private _pos:number[][][] = []; |
|
|
|
private pos:Vec3[][] = []; |
|
|
|
private _pos:Vec3[][] = []; |
|
|
|
|
|
|
|
//牌的旋转角度 Rotation
|
|
|
|
private rot_1:number[] = [88,68,45.6]; //1号位玩家
|
|
|
|
private rot_2:number[] = [-44,-61,-80.4]; //2号位玩家
|
|
|
|
private rot_3:number[] = [7.1,0,-10]; //3号位玩家
|
|
|
|
private rot_4:number[] = [78.8,59.4,37.6]; //4号位玩家
|
|
|
|
private rot_5:number[] = [136,115,95.8]; //5号位玩家
|
|
|
|
private rot_6:number[] = [15.2,-7,-25.2]; //6号位玩家
|
|
|
|
/**牌的旋转 */ |
|
|
|
private rot:number[][] = []; |
|
|
|
private _rot:number[][] = []; |
|
|
|
|
|
|
|
//牌的缩放 Scale
|
|
|
|
private scr_1:Vec3 = v3(0.4,0.4,1); //1号位玩家
|
|
|
|
private scr_2:Vec3 = v3(0.4,0.4,1); //2号位玩家
|
|
|
|
private scr_3:Vec3 = v3(1.2,1.2,1); //3号位玩家 自己
|
|
|
|
private scr_4:Vec3 = v3(0.4,0.4,1); //4号位玩家
|
|
|
|
private scr_5:Vec3 = v3(0.4,0.4,1); //5号位玩家
|
|
|
|
private scr_6:Vec3 = v3(0.4,0.4,1); //6号位玩家
|
|
|
|
/**牌的缩放 */ |
|
|
|
private scr:Vec3[] = []; |
|
|
|
private _scr:Vec3[] = []; |
|
|
@ -47,9 +26,6 @@ export class TeenpattieFaPaiEffectLogic extends Component{ |
|
|
|
/**牌的节点 */ |
|
|
|
private cardNode:Node[] = []; |
|
|
|
|
|
|
|
private canvas:UITransform |
|
|
|
private anch:Vec3; |
|
|
|
|
|
|
|
onLoad(): void { |
|
|
|
this.fapai = find("fx_fapai",this.node); |
|
|
|
for(let i = 0;i<this.fapai.children.length;i++){ |
|
|
@ -57,13 +33,12 @@ export class TeenpattieFaPaiEffectLogic extends Component{ |
|
|
|
} |
|
|
|
|
|
|
|
this.playerTotal = TeenPattieCommData.getInstance().totalPlayer; |
|
|
|
this.canvas = this.fapai?.getComponent(UITransform); |
|
|
|
// this.canvas = find("UIRoot")?.getComponent(UITransform);
|
|
|
|
this.anch = v3(-this.canvas.width / 2,-this.canvas.height / 2,0); |
|
|
|
|
|
|
|
this.getCoinNodeWorldPosition(); |
|
|
|
} |
|
|
|
/**牌的世界坐标位置 */ |
|
|
|
private getCoinNodeWorldPosition(){ |
|
|
|
const total:number = TeenPattieCommData.getInstance().totalPlayer |
|
|
|
const total:number = TeenPattieCommData.getInstance().totalPlayer; |
|
|
|
if(this._pos.length >= total && this._rot.length >= total && this._scr.length >= total){ |
|
|
|
this.pos = this._pos; |
|
|
|
this.rot = this._rot; |
|
|
@ -72,15 +47,13 @@ export class TeenpattieFaPaiEffectLogic extends Component{ |
|
|
|
} |
|
|
|
for(let i=1;i<=total;i++){ |
|
|
|
const list = find(`Player${i}/own/card/list`,this.node); |
|
|
|
let card_pos:number[][] = []; |
|
|
|
let card_pos:Vec3[] = []; |
|
|
|
let card_rot:number[] = []; |
|
|
|
let card_scr:Vec3 = null; |
|
|
|
for(let c=1;c<=3;c++){ |
|
|
|
const card = list.getChildByName(`card${c}`); |
|
|
|
let uiTran:UITransform = card?.getComponent(UITransform); |
|
|
|
const posa = uiTran.convertToWorldSpaceAR(this.anch); |
|
|
|
const pos = card.getWorldPosition(); |
|
|
|
card_pos.push([pos.x,pos.y,pos.z]); |
|
|
|
card_pos.push(pos); |
|
|
|
const angle = card.eulerAngles; |
|
|
|
card_rot.push(angle.z); |
|
|
|
card_scr = card.scale; |
|
|
@ -101,29 +74,8 @@ export class TeenpattieFaPaiEffectLogic extends Component{ |
|
|
|
this.pos = []; |
|
|
|
this.rot = []; |
|
|
|
this.scr = []; |
|
|
|
|
|
|
|
// this.getCoinNodeWorldPosition();
|
|
|
|
|
|
|
|
this.pos.push(this.pos_1) |
|
|
|
this.pos.push(this.pos_2) |
|
|
|
this.pos.push(this.pos_3) |
|
|
|
this.pos.push(this.pos_4) |
|
|
|
this.pos.push(this.pos_5) |
|
|
|
this.pos.push(this.pos_6) |
|
|
|
|
|
|
|
this.rot.push(this.rot_1) |
|
|
|
this.rot.push(this.rot_2) |
|
|
|
this.rot.push(this.rot_3) |
|
|
|
this.rot.push(this.rot_4) |
|
|
|
this.rot.push(this.rot_5) |
|
|
|
this.rot.push(this.rot_6) |
|
|
|
|
|
|
|
this.scr.push(this.scr_1) |
|
|
|
this.scr.push(this.scr_2) |
|
|
|
this.scr.push(this.scr_3) |
|
|
|
this.scr.push(this.scr_4) |
|
|
|
this.scr.push(this.scr_5) |
|
|
|
this.scr.push(this.scr_6) |
|
|
|
|
|
|
|
this.getCoinNodeWorldPosition(); |
|
|
|
} |
|
|
|
|
|
|
|
onDestroy(): void { |
|
|
@ -188,12 +140,6 @@ export class TeenpattieFaPaiEffectLogic extends Component{ |
|
|
|
const playerCount:any[] = TeenPattieCommData.getInstance().allKanPlayerCard || []; |
|
|
|
this.playerTotal = playerCount.length; |
|
|
|
let getItemIndex = (seatId:number)=>{ |
|
|
|
// for(let i=0;i<playerCount.length;i++){
|
|
|
|
// if(playerCount[i].SeatId == seatId){
|
|
|
|
// return i
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// return -1
|
|
|
|
const playerLogic:TeenPattiePlayerLogic = find(`Player${seatId}`,this.node)?.getComponent(TeenPattiePlayerLogic); |
|
|
|
for(let i=0;i<this.playerTotal;i++){ |
|
|
|
if(playerLogic.data?.SeatId == playerCount[i].SeatId){ |
|
|
@ -203,7 +149,7 @@ export class TeenpattieFaPaiEffectLogic extends Component{ |
|
|
|
return -1; |
|
|
|
} |
|
|
|
//需要删除的
|
|
|
|
let pos_items:number[][][] = []; |
|
|
|
let pos_items:Vec3[][] = []; |
|
|
|
let rot_items:number[][] = []; |
|
|
|
let scr_items:Vec3[] = []; |
|
|
|
for(let i=1;i<=TeenPattieCommData.getInstance().totalPlayer;i++){ |
|
|
@ -294,7 +240,7 @@ export class TeenpattieFaPaiEffectLogic extends Component{ |
|
|
|
/**设置坐标 */ |
|
|
|
private setPosition(banker:number,itCard:number):Vec3{ |
|
|
|
let p:Vec3 = null; |
|
|
|
p = v3(this.pos[banker][itCard][0],this.pos[banker][itCard][1],this.pos[banker][itCard][2]); |
|
|
|
p = this.pos[banker][itCard]; |
|
|
|
return p; |
|
|
|
} |
|
|
|
/**设置旋转 */ |
|
|
@ -327,7 +273,7 @@ export class TeenpattieFaPaiEffectLogic extends Component{ |
|
|
|
const p = v3(pos); |
|
|
|
const r = v3(rot); |
|
|
|
const s = v3(sca); |
|
|
|
this.twPos = tween(node).to(time,{position:p,eulerAngles:r,scale:s},{onComplete:(target:any)=>{ |
|
|
|
this.twPos = tween(node).to(time,{worldPosition:p,eulerAngles:r,worldScale:s},{onComplete:(target:any)=>{ |
|
|
|
|
|
|
|
if(this.clockwise){ |
|
|
|
banker--; |
|
|
|