[add] 在來一局機制
This commit is contained in:
parent
4d9134d381
commit
14505e26ee
@ -1,29 +1,29 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
MIIE4zCCA8ugAwIBAgISBKkroyiDI8s2UhriA6ELDJ3dMA0GCSqGSIb3DQEBCwUA
|
MIIE4zCCA8ugAwIBAgISBAWtfXO4m+fOSxIBprZ/dGV3MA0GCSqGSIb3DQEBCwUA
|
||||||
MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD
|
MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD
|
||||||
EwJSMzAeFw0yMzA2MjAwOTIyMjRaFw0yMzA5MTgwOTIyMjNaMBYxFDASBgNVBAMT
|
EwJSMzAeFw0yMzEwMjYyMzMxNDlaFw0yNDAxMjQyMzMxNDhaMBYxFDASBgNVBAMT
|
||||||
C2ppYW5taWF1LnRrMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzLvv
|
C2ppYW5taWF1LnRrMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtZUS
|
||||||
hFbHHrHnuFiq1/FLa5uGOq+uMP0MJFUcEwBri64PplXnzyH9bLjI13iBXijwsM+B
|
uEOMp089fvgYY7qib+zODa/e2voRA8eEd/Ta0toTm9zvc8JLa8ji5gRiXs/0CCz5
|
||||||
YjnInFzWuqArOg7N9/w+F+j9RlNCXhiLRFt9ahCduFwboa+V0/AsWnb6v40EqLHt
|
i7p+Moq5a774m81Oxw4EyXuod2tDpwvJSr+sQB/i9RFDh8M4KXbCSkf0pqwpbmHY
|
||||||
BfPWNfpCK3gat7gDNlEMVS3Ye53CLXlRLnMtOEieLNT7Wqqttmk9cfs+9P7tgLxQ
|
ZXGIeLj3AVSAlGW19k4Ktn5i+wn9mJCvqjh51UIDan3j1Zfn4naqltY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
|
A+edMYC2SVBtbAlNCi3hfmnPvTJXtFBsx2hq3aC20pOIuiRN8y9h3fqvGR5H5Qef
|
||||||
jmVSXutFOiEv35FVDGXV2RMrSOd3LALkqA/qepiJ7RoSdDmZwH0NKGeyUWg818oe
|
Q7voM3YvEgThvx2/wrCobSk8vp5ljt9BFXFojv6mwfnp5dWHejOXpQDpB5tGv5pG
|
||||||
avQlXeh7Xy/wHPpyQPxOfD0ouodNi8mhL4cGHbDWPpXPPJ1WY2khKpFR79FHQb3O
|
7OeGN+jeZ+VKUnFaj5+BZ+pv8LXPeszBuOvqid4CGKYx6i0I0H9HIQKwhDHA10y1
|
||||||
wEug4uvMeMEyYp0ZIKlSjQsF+JbgdCDW2qu8MZKM+CdGoUVpgHEYZ7wVK2UhdJDV
|
Fx/ZgmvuIm6MHNklCfUw5dTqgHfml7J+yEamHPXGRmofsVisJ6sC/l3fzTte2mZY
|
||||||
QW5H+GVZyg==
|
Dcio0jTFBw==
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
@ -1,28 +1,28 @@
|
|||||||
-----BEGIN PRIVATE KEY-----
|
-----BEGIN PRIVATE KEY-----
|
||||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDMu++EVscesee4
|
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC1lRK4Q4ynTz1+
|
||||||
WKrX8Utrm4Y6r64w/QwkVRwTAGuLrg+mVefPIf1suMjXeIFeKPCwz4FiOcicXNa6
|
+BhjuqJv7M4Nr97a+hEDx4R39NrS2hOb3O9zwktryOLmBGJez/QILPmLun4yirlr
|
||||||
oCs6Ds33/D4X6P1GU0JeGItEW31qEJ24XBuhr5XT8Cxadvq/jQSose0F89Y1+kIr
|
vvibzU7HDgTJe6h3a0OnC8lKv6xAH+L1EUOHwzgpdsJKR/SmrCluYdhlcYh4uPcB
|
||||||
eBq3uAM2UQxVLdh7ncIteVEucy04SJ4s1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Rp0R5b0t2dCz5x0Qg/1H3A685natvhEUVGgNnb7m0+HhUA2C9
|
||||||
BS+DO8qgS7rOs3lYFq+c0po2TJOiz3JywuzgpYhdUt+ovzGFigKYBjcxAoGBALjk
|
agU57mAPvjYBrJnagNi18ElZxyhSII0AEJnuSW/ZCyZ8Z06oCbBVpWVJAoGBAJI0
|
||||||
4WV8M5rfCXHBHBALdZwT3SIkxHuwW1/bRaqVLPGUIyK6vIsfZyzFEWIkzJm/RkPR
|
ConpGgEdALUiggL9bTXNQe8CTx762/RzbRJI9o3CvAXo84zvycSqyf+GZAcrBIC3
|
||||||
fUmSYMJhX4UYpSBFgHpVKHp4UNXqHoDuR43O9lIG9EED0X5XOm3mG3EsnbEEuqvR
|
Da2r7oEzYXS7IvIv5maW/q95lA0JZpQqtlifafVTwWqmN/M9rKI4ZocHGE5BzhTB
|
||||||
z2HpYiTn/FWEHf/MMXeS3Cn+Ic0VMn90Y1gKAMHPAoGAD3g4Yx+pM5QX1yTO3gLs
|
9tf2Mr9mqLc/JpUCZSxw73pSJ6wx0rijIvx6AQ4BAoGAdxwdKeJUXCq2alk+n3uO
|
||||||
G3OlVJ1q5FyOFO/tQypHIkuJ24qndj98RkwGmwhH0RpoaOMFCK7ctPxlxRYLigwH
|
hdp76TKLrmJE219ZMCg0hbACTchE8RgbOiPFcx8l9/tCNPytKL4GeeH5RUSE27Qy
|
||||||
RG92Bb4Ysfj6tf4+/9VtxiKIOLMtX+oCEOpjEzBkixpRg1s4ppRRcUiFfTOXVceH
|
+jP0vck4Q4+QuUNCmzD4HpFtLLfEx2O4qRoPDd3C1NPc1qSlYIOJj89VoYwy52pr
|
||||||
XoLPM/VWHQlZS1kmi7+wblE=
|
7/Bwa9Ci20NJo61Pit7Ghf4=
|
||||||
-----END PRIVATE KEY-----
|
-----END PRIVATE KEY-----
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
import { ApiCall } from "tsrpc";
|
import { ApiCall, BaseConnection } from "tsrpc";
|
||||||
|
import Room from "../../component/Room/Room";
|
||||||
import { ReqExit, ResExit } from "../../shared/protocols/room/PtlExit";
|
import { ReqExit, ResExit } from "../../shared/protocols/room/PtlExit";
|
||||||
|
import { ServiceType } from "../../shared/protocols/serviceProto";
|
||||||
|
|
||||||
export default async function (call: ApiCall<ReqExit, ResExit>) {
|
export default async function (call: ApiCall<ReqExit, ResExit>) {
|
||||||
// TODO
|
call.succ(0);
|
||||||
call.error("API Not Implemented");
|
const conn: BaseConnection<ServiceType> = call.conn;
|
||||||
|
const room: Room = conn.Room;
|
||||||
|
room.Exit(conn);
|
||||||
}
|
}
|
@ -28,12 +28,10 @@ export default class Lobby {
|
|||||||
|
|
||||||
/** DelConns */
|
/** DelConns */
|
||||||
public static DelConns(conn: BaseConnection): void {
|
public static DelConns(conn: BaseConnection): void {
|
||||||
for (let i: number = 0; i < this.conns.length; i++) {
|
if (conn.Room) {
|
||||||
if (this.conns[i] === conn) {
|
conn.Room.Exit(conn);
|
||||||
this.conns.splice(i, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
this.conns.splice(this.conns.indexOf(conn), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /** List */
|
// /** List */
|
||||||
|
@ -60,7 +60,10 @@ export default class Room {
|
|||||||
|
|
||||||
/** Exit */
|
/** Exit */
|
||||||
public Exit(conn: BaseConnection): void {
|
public Exit(conn: BaseConnection): void {
|
||||||
|
this.conns.splice(this.conns.indexOf(conn), 1);
|
||||||
server.broadcastMsg("room/Exit", 0, <WsConnection<ServiceType>[]>this.conns);
|
server.broadcastMsg("room/Exit", 0, <WsConnection<ServiceType>[]>this.conns);
|
||||||
|
Room.rooms[this.RoomId] = null;
|
||||||
|
delete Room.rooms[this.RoomId];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** GotoGame */
|
/** GotoGame */
|
||||||
@ -102,6 +105,13 @@ export default class Room {
|
|||||||
}
|
}
|
||||||
server.broadcastMsg("room/ChangeState", data, target);
|
server.broadcastMsg("room/ChangeState", data, target);
|
||||||
});
|
});
|
||||||
|
if (conn) {
|
||||||
|
this.setState(conn, state);
|
||||||
|
} else {
|
||||||
|
this.conns.forEach((conn: BaseConnection) => {
|
||||||
|
this.setState(conn, state);
|
||||||
|
});
|
||||||
|
}
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case EGameState.Ready:
|
case EGameState.Ready:
|
||||||
this.Ready(conn);
|
this.Ready(conn);
|
||||||
@ -111,6 +121,22 @@ export default class Room {
|
|||||||
this.TurnEnd(conn);
|
this.TurnEnd(conn);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EGameState.WaitNewGame: {
|
||||||
|
let canStart: boolean = true;
|
||||||
|
this.connData.forEach((connData: RoomConnData) => {
|
||||||
|
if (connData.state !== EGameState.WaitNewGame) {
|
||||||
|
canStart = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (canStart) {
|
||||||
|
this.conns.forEach((conn: BaseConnection) => {
|
||||||
|
this.setState(conn, EGameState.Ready);
|
||||||
|
});
|
||||||
|
this.Ready(conn);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -138,9 +164,7 @@ export default class Room {
|
|||||||
public Ready(conn: BaseConnection): void {
|
public Ready(conn: BaseConnection): void {
|
||||||
const self: this = this;
|
const self: this = this;
|
||||||
const cardCount: number = 24;
|
const cardCount: number = 24;
|
||||||
const data: RoomConnData = this.connData.get(conn);
|
this.setState(conn, EGameState.Ready);
|
||||||
data.state = EGameState.Ready;
|
|
||||||
this.connData.set(conn, data);
|
|
||||||
let canStart: boolean = true;
|
let canStart: boolean = true;
|
||||||
this.connData.forEach((connData: RoomConnData) => {
|
this.connData.forEach((connData: RoomConnData) => {
|
||||||
if (connData.state === undefined || connData.state !== EGameState.Ready) {
|
if (connData.state === undefined || connData.state !== EGameState.Ready) {
|
||||||
@ -179,6 +203,13 @@ export default class Room {
|
|||||||
|
|
||||||
//#region Custom
|
//#region Custom
|
||||||
|
|
||||||
|
/** setState */
|
||||||
|
private setState(conn: BaseConnection, state: EGameState): void {
|
||||||
|
const data: RoomConnData = this.connData.get(conn);
|
||||||
|
data.state = state;
|
||||||
|
this.connData.set(conn, data);
|
||||||
|
}
|
||||||
|
|
||||||
/** Join */
|
/** Join */
|
||||||
public Join(conn: BaseConnection): void {
|
public Join(conn: BaseConnection): void {
|
||||||
this.conns.push(conn);
|
this.conns.push(conn);
|
||||||
|
Loading…
Reference in New Issue
Block a user