Skip to content

Commit

Permalink
Merge pull request #395 from Infinite-Chess/game-loader
Browse files Browse the repository at this point in the history
Merge the game-loader changes to main
  • Loading branch information
Naviary2 authored Jan 18, 2025
2 parents 8381b94 + 8c4186f commit 1378260
Show file tree
Hide file tree
Showing 87 changed files with 4,040 additions and 3,193 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
run: npm ci
- name: "Run build"
run: npm run build
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: Build
path: dist
36 changes: 15 additions & 21 deletions src/client/css/play.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ button {
/* Loading Page. A COUPLE OF THSEE CLASSES are also used for the game's loading animation page! */

.animation-container {
transition: opacity 0.4s;
z-index: 1;
pointer-events: none;
display: flex;
background-color: black;
justify-content: center; /* Center horizontally */
Expand All @@ -52,7 +55,6 @@ button {
bottom: 0;
left: 0;
right: 0;
z-index: -1;
overflow: hidden;
}

Expand Down Expand Up @@ -746,7 +748,7 @@ button.join-button, button.copy-button {

/* Top Navigation: Zoom buttons, coordinates, rewind/forward game, pause */

.navigation {
.navigation-bar {
position: absolute;
top: 0;
width: 100%;
Expand Down Expand Up @@ -826,7 +828,7 @@ button.join-button, button.copy-button {
margin: 0;
}

.navigation .button {
.navigation-bar .button {
position: relative;
width: 0.74em;
height: 0.74em;
Expand All @@ -839,28 +841,28 @@ button.join-button, button.copy-button {
-webkit-tap-highlight-color: transparent; /* No more blue highlight when tapping buttons on mobile */
}

.navigation .button:hover {
.navigation-bar .button:hover {
transform: scale(1.07);
}

.navigation .button:active {
.navigation-bar .button:active {
transform: scale(1);
}

.navigation svg {
.navigation-bar svg {
position: absolute;
}

/* Start shrinking top navigation bar */
@media only screen and (max-width: 700px) { /* 700px needs to be updated within camera.updatePIXEL_HEIGHT_OF_NAVS() !!! */
.navigation {
@media only screen and (max-width: 700px) {
.navigation-bar {
font-size: 12vw; /* Update with doc!! */
}
}

/* Small screens. HIDE the coords and make the buttons bigger! */
@media only screen and (max-width: 550px) { /* 550 needs to be updated within camera.updatePIXEL_HEIGHT_OF_NAVS() !!! */
.navigation {
@media only screen and (max-width: 550px) {
.navigation-bar {
justify-content: space-between;
font-size: 66px; /* Update with doc!! */
}
Expand All @@ -871,8 +873,8 @@ button.join-button, button.copy-button {
}

/* Mobile screen, start shrinking the size again */
@media only screen and (max-width: 368px) { /* 368 needs to be updated within camera.updatePIXEL_HEIGHT_OF_NAVS() !!! */
.navigation {
@media only screen and (max-width: 368px) {
.navigation-bar {
font-size: 17.9vw; /* Update with doc!! */
}
}
Expand All @@ -881,7 +883,7 @@ button.join-button, button.copy-button {

/* Bottom Navigation: Color to move, clocks, player names, draw offer UI */

.footer {
.game-info-bar {
position: absolute;
bottom: 0;
width: 100%;
Expand Down Expand Up @@ -1208,14 +1210,6 @@ a {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0.099);
}

.unavailable {
color: rgb(190, 190, 190);
}

.flex {
display: flex;
}

.hidden {
display: none;
}
Expand Down
8 changes: 5 additions & 3 deletions src/client/scripts/esm/chess/logic/backcompatible.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ function getLongformatInNewNotation(longformat) {
// // koth: 'both'
// }
// }
const newGameRules = {};
newGameRules.turnOrder = turnOrder;
if (longformat.gameRules.slideLimit && longformat.gameRules.slideLimit !== "Infinity") newGameRules.slideLimit = longformat.gameRules.slideLimit;
const newGameRules = {
turnOrder,
winConditions: { white: ['checkmate'], black: ['checkmate'] }
};
if (longformat.gameRules.winConditions) {
const newWinConditions = { white: [], black: [] };
for (const condition in longformat.gameRules.winConditions) {
Expand All @@ -103,6 +104,7 @@ function getLongformatInNewNotation(longformat) {
// The old gamefiles did not specify promotions allowed, because it's determined by the pieces the game starts with
newGameRules.promotionsAllowed = variant.getPromotionsAllowed(longformat.startingPosition, newGameRules.promotionRanks);
}
if (longformat.gameRules.slideLimit && longformat.gameRules.slideLimit !== "Infinity") newGameRules.slideLimit = longformat.gameRules.slideLimit;
converted.gameRules = newGameRules;
}

Expand Down
2 changes: 1 addition & 1 deletion src/client/scripts/esm/chess/logic/boardchanges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function addPiece(gamefile: gamefile, change: Change) { // desiredIndex optional
if (isPieceAtCoords) throw new Error("Can't add a piece on top of another piece!");

// Remove the undefined from the undefineds list
const deleteSuccussful = jsutil.deleteValueFromOrganizedArray(gamefile.ourPieces[piece.type].undefineds, piece.index) !== undefined;
const deleteSuccussful = jsutil.deleteElementFromOrganizedArray(gamefile.ourPieces[piece.type].undefineds, piece.index) !== undefined;
if (!deleteSuccussful) throw new Error("Index to add a piece has an existing piece on it!");

list[piece.index] = piece.coords;
Expand Down
6 changes: 0 additions & 6 deletions src/client/scripts/esm/chess/logic/checkdetection.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,6 @@ function appendBlockingMoves(square1, square2, moves, coords) { // coords is of
const c2 = organizedlines.getCFromLine(direction,square2); // Line between our 2 squares
const blockPoint = math.getLineIntersection(line[0], line[1], c1, direction[0], direction[1], c2); // The intersection point of the 2 lines.

// Idon us's old code
// if (!math.isAproxEqual(blockPoint[0],Math.round(blockPoint[0])) ||
// !math.isAproxEqual(blockPoint[1],Math.round(blockPoint[1]))) {console.log("A"); continue}; // Block is off grid so probably not valid
// blockPoint=[Math.round(blockPoint[0]), Math.round(blockPoint[1])]
// if (organizedlines.getKeyFromLine(line,blockPoint)!==organizedlines.getKeyFromLine(line, coords)) {console.log("C"); continue}; // stop line multiples being annoying

// Naviary's new code
if (blockPoint === null) continue; // None (or infinite) intersection points!
if (!math.boxContainsSquare(box, blockPoint)) continue; // Intersection point not between our 2 points, but outside of them.
Expand Down
165 changes: 0 additions & 165 deletions src/client/scripts/esm/chess/logic/clock.js

This file was deleted.

Loading

0 comments on commit 1378260

Please sign in to comment.