|
@@ -117,6 +117,7 @@ export class SlotGame extends Component {
|
|
|
private spinBtn!: Node;
|
|
private spinBtn!: Node;
|
|
|
private particleTex: SpriteFrame | null = null;
|
|
private particleTex: SpriteFrame | null = null;
|
|
|
private frameCY = 0; private frameW = 0; private frameH = 0;
|
|
private frameCY = 0; private frameW = 0; private frameH = 0;
|
|
|
|
|
+ private cellW = 90; private cellH = 90;
|
|
|
private W = 0; private H = 0;
|
|
private W = 0; private H = 0;
|
|
|
private symBaseY: number[][] = [];
|
|
private symBaseY: number[][] = [];
|
|
|
private t = 0;
|
|
private t = 0;
|
|
@@ -172,12 +173,14 @@ export class SlotGame extends Component {
|
|
|
this.frameW = fw; this.frameH = fh;
|
|
this.frameW = fw; this.frameH = fh;
|
|
|
this.frameCY = H * R.cy;
|
|
this.frameCY = H * R.cy;
|
|
|
const innerW = fw * R.holeW, innerH = fh * R.holeH;
|
|
const innerW = fw * R.holeW, innerH = fh * R.holeH;
|
|
|
- this.cell = Math.min(innerW / COLS, innerH / ROWS);
|
|
|
|
|
- this.gridX0 = -((COLS - 1) * this.cell) / 2;
|
|
|
|
|
- this.gridY0 = this.frameCY + ((ROWS - 1) * this.cell) / 2;
|
|
|
|
|
|
|
+ this.cellW = innerW / COLS;
|
|
|
|
|
+ this.cellH = innerH / ROWS;
|
|
|
|
|
+ this.cell = Math.min(this.cellW, this.cellH);
|
|
|
|
|
+ this.gridX0 = -innerW / 2 + this.cellW / 2;
|
|
|
|
|
+ this.gridY0 = this.frameCY + innerH / 2 - this.cellH / 2;
|
|
|
}
|
|
}
|
|
|
private cellPos(c: number, r: number): [number, number] {
|
|
private cellPos(c: number, r: number): [number, number] {
|
|
|
- return [this.gridX0 + c * this.cell, this.gridY0 - r * this.cell];
|
|
|
|
|
|
|
+ return [this.gridX0 + c * this.cellW, this.gridY0 - r * this.cellH];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private buildBackground(W: number, H: number) {
|
|
private buildBackground(W: number, H: number) {
|
|
@@ -456,7 +459,9 @@ export class SlotGame extends Component {
|
|
|
private fit(id: string) { return SYMFIT[id] || SYMFIT_DEFAULT; }
|
|
private fit(id: string) { return SYMFIT[id] || SYMFIT_DEFAULT; }
|
|
|
|
|
|
|
|
private buildGrid() {
|
|
private buildGrid() {
|
|
|
- const cardSize = this.cell * 0.92;
|
|
|
|
|
|
|
+ const cardW = this.cellW * 0.90;
|
|
|
|
|
+ const cardH = this.cellH * 0.90;
|
|
|
|
|
+ const cardR = Math.min(cardW, cardH) * 0.18;
|
|
|
for (let c = 0; c < COLS; c++) {
|
|
for (let c = 0; c < COLS; c++) {
|
|
|
this.cells[c] = []; this.ids[c] = []; this.symBaseY[c] = [];
|
|
this.cells[c] = []; this.ids[c] = []; this.symBaseY[c] = [];
|
|
|
for (let r = 0; r < ROWS; r++) {
|
|
for (let r = 0; r < ROWS; r++) {
|
|
@@ -465,12 +470,12 @@ export class SlotGame extends Component {
|
|
|
const card = new Node(`card_${c}_${r}`); card.parent = this.node; card.setPosition(x, y, 0); card.setSiblingIndex(5);
|
|
const card = new Node(`card_${c}_${r}`); card.parent = this.node; card.setPosition(x, y, 0); card.setSiblingIndex(5);
|
|
|
const cg = card.addComponent(Graphics);
|
|
const cg = card.addComponent(Graphics);
|
|
|
cg.fillColor = new Color(255, 255, 255, 215);
|
|
cg.fillColor = new Color(255, 255, 255, 215);
|
|
|
- this.roundRect(cg, -cardSize / 2, -cardSize / 2, cardSize, cardSize, cardSize * 0.24); cg.fill();
|
|
|
|
|
|
|
+ this.roundRect(cg, -cardW / 2, -cardH / 2, cardW, cardH, cardR); cg.fill();
|
|
|
cg.lineWidth = 3; cg.strokeColor = new Color(120, 175, 255, 240);
|
|
cg.lineWidth = 3; cg.strokeColor = new Color(120, 175, 255, 240);
|
|
|
- this.roundRect(cg, -cardSize / 2, -cardSize / 2, cardSize, cardSize, cardSize * 0.24); cg.stroke();
|
|
|
|
|
|
|
+ this.roundRect(cg, -cardW / 2, -cardH / 2, cardW, cardH, cardR); cg.stroke();
|
|
|
const f = this.fit(id);
|
|
const f = this.fit(id);
|
|
|
- const scale = this.cell * f.s;
|
|
|
|
|
- const baseY = y - this.cell * f.oyf;
|
|
|
|
|
|
|
+ const scale = Math.min(this.cellW, this.cellH) * f.s;
|
|
|
|
|
+ const baseY = y - Math.min(this.cellW, this.cellH) * f.oyf;
|
|
|
this.symBaseY[c][r] = baseY;
|
|
this.symBaseY[c][r] = baseY;
|
|
|
const node = new Node(`cell_${c}_${r}`); node.parent = this.node; node.setSiblingIndex(6);
|
|
const node = new Node(`cell_${c}_${r}`); node.parent = this.node; node.setSiblingIndex(6);
|
|
|
node.setPosition(x, baseY, 0); node.setScale(scale, scale, 1);
|
|
node.setPosition(x, baseY, 0); node.setScale(scale, scale, 1);
|
|
@@ -489,8 +494,8 @@ export class SlotGame extends Component {
|
|
|
this.ids[c][r] = id;
|
|
this.ids[c][r] = id;
|
|
|
const [x, y] = this.cellPos(c, r);
|
|
const [x, y] = this.cellPos(c, r);
|
|
|
const f = this.fit(id);
|
|
const f = this.fit(id);
|
|
|
- const scale = this.cell * f.s;
|
|
|
|
|
- const baseY = y - this.cell * f.oyf;
|
|
|
|
|
|
|
+ const scale = Math.min(this.cellW, this.cellH) * f.s;
|
|
|
|
|
+ const baseY = y - Math.min(this.cellW, this.cellH) * f.oyf;
|
|
|
this.symBaseY[c][r] = baseY;
|
|
this.symBaseY[c][r] = baseY;
|
|
|
const nd = sk.node;
|
|
const nd = sk.node;
|
|
|
nd.setScale(scale, scale, 1);
|
|
nd.setScale(scale, scale, 1);
|