mirror of
https://gitgud.io/BondageProjects/Bondage-College.git
synced 2025-04-25 17:59:34 +00:00
Chat Room Map - Fixes & Improvments
This commit is contained in:
parent
5fb6984712
commit
baffb8d41d
8 changed files with 58 additions and 14 deletions
BondageClub
Icons
Screens/Online
Scripts
BIN
BondageClub/Icons/MapTypeAlways.png
Normal file
BIN
BondageClub/Icons/MapTypeAlways.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 13 KiB |
BIN
BondageClub/Icons/MapTypeHybrid.png
Normal file
BIN
BondageClub/Icons/MapTypeHybrid.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 21 KiB |
BIN
BondageClub/Icons/Small/Undo.png
Normal file
BIN
BondageClub/Icons/Small/Undo.png
Normal file
Binary file not shown.
After ![]() (image error) Size: 11 KiB |
|
@ -1432,13 +1432,13 @@ function ChatRoomSetLastChatRoom(room) {
|
|||
if (room !== null && ChatRoomValidateProperties(room)) {
|
||||
if (!ChatRoomNewRoomToUpdate) {
|
||||
Player.LastChatRoom = ChatRoomGetSettings(room);
|
||||
ServerAccountUpdate.QueueData({ LastChatRoom: Player.LastChatRoom });
|
||||
}
|
||||
} else {
|
||||
Player.LastChatRoom = null;
|
||||
Player.LastMapData = null;
|
||||
ServerAccountUpdate.QueueData({ LastChatRoom: null, LastMapData: null });
|
||||
}
|
||||
|
||||
// Update the server data with our new last room
|
||||
ServerAccountUpdate.QueueData({ LastChatRoom: Player.LastChatRoom });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2278,7 +2278,7 @@ function ChatRoomKeyDown(event) {
|
|||
|
||||
// If the input text is not focused and not on mobile, set the focus to it
|
||||
if (document.activeElement.id != "InputChat") {
|
||||
if (ChatRoomMapVisible) ChatRoomMapKeyDown();
|
||||
if (ChatRoomMapVisible) ChatRoomMapKeyDown(event);
|
||||
else ElementFocus("InputChat");
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ var ChatRoomMapEditStarted = false;
|
|||
var ChatRoomMapEditObject = null;
|
||||
var ChatRoomMapEditSelection = [];
|
||||
var ChatRoomMapEditRange = 1;
|
||||
var ChatRoomMapEditBackup = [];
|
||||
var ChatRoomMapUpdateRoomNext = null;
|
||||
var ChatRoomMapUpdatePlayerNext = null;
|
||||
var ChatRoomMapUpdateLastMapDataNext = null;
|
||||
|
@ -77,6 +78,7 @@ var ChatRoomMapObjectList = [
|
|||
{ ID: 2030, Type: "FloorObstacle", Style: "IronBars", Top: -1, Height: 2 },
|
||||
{ ID: 2040, Type: "FloorObstacle", Style: "OakTree", Left: -0.25, Top: -1.5, Width: 1.5, Height: 2.5 },
|
||||
{ ID: 2050, Type: "FloorObstacle", Style: "PineTree", Top: -1, Height: 2 },
|
||||
{ ID: 2060, Type: "FloorObstacle", Style: "ChristmasTree", Top: -1, Height: 2 },
|
||||
|
||||
{ ID: 3000, Type: "WallDecoration", Style: "Blank" },
|
||||
{ ID: 3010, Type: "WallDecoration", Style: "Painting" },
|
||||
|
@ -447,7 +449,7 @@ function ChatRoomMapDrawGrid(Left, Top, Width, Height) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the next update flag for the room if it's not already set, the delay is 3 seconds
|
||||
* Sets the next update flag for the room if it's not already set, the delay is 5 seconds
|
||||
* @returns {void} - Nothing
|
||||
*/
|
||||
function ChatRoomMapUpdateFlag() {
|
||||
|
@ -509,7 +511,7 @@ function ChatRoomMapUpdateFlag() {
|
|||
}
|
||||
|
||||
// Sets the flag
|
||||
if (ChatRoomMapUpdateRoomNext == null) ChatRoomMapUpdateRoomNext = CommonTime() + 3000;
|
||||
if (ChatRoomMapUpdateRoomNext == null) ChatRoomMapUpdateRoomNext = CommonTime() + 5000;
|
||||
|
||||
}
|
||||
|
||||
|
@ -603,8 +605,11 @@ function ChatRoomMapDraw() {
|
|||
DrawButton(10, 10, 60, 60, "", ((ChatRoomData.MapData != null) && (ChatRoomData.MapData.Type != null) && (ChatRoomData.MapData.Type == "Always")) ? "Pink" : "White", "Icons/Small/ShowCharacter.png");
|
||||
DrawButton(10, 80, 60, 60, "", "White", "Icons/Small/Plus.png");
|
||||
DrawButton(10, 150, 60, 60, "", "White", "Icons/Small/Minus.png");
|
||||
if (ChatRoomPlayerIsAdmin()) DrawButton(10, 220, 60, 60, "", "White", "Icons/Small/EditTile.png");
|
||||
if (ChatRoomPlayerIsAdmin()) DrawButton(10, 290, 60, 60, "", "White", "Icons/Small/EditObject.png");
|
||||
if (ChatRoomPlayerIsAdmin()) {
|
||||
DrawButton(10, 220, 60, 60, "", "White", "Icons/Small/EditTile.png");
|
||||
DrawButton(10, 290, 60, 60, "", "White", "Icons/Small/EditObject.png");
|
||||
DrawButton(10, 360, 60, 60, "", "White", "Icons/Small/Undo.png");
|
||||
}
|
||||
}
|
||||
|
||||
// In tile type selection mode, the user can select a tile type (floor, wall, etc.)
|
||||
|
@ -739,10 +744,23 @@ function ChatRoomMapMove(D) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handles keyboard keys in the chat room map screen
|
||||
* Undoes the changes made to the map, from the latest backup in the stack
|
||||
* @returns {void} - Nothing
|
||||
*/
|
||||
function ChatRoomMapKeyDown() {
|
||||
function ChatRoomMapUndo() {
|
||||
if (ChatRoomMapEditBackup.length > 0) {
|
||||
let LastMap = ChatRoomMapEditBackup.pop();
|
||||
ChatRoomData.MapData = CommonCloneDeep(LastMap);
|
||||
ChatRoomMapUpdateFlag();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles keyboard keys in the chat room map screen
|
||||
* @param {KeyboardEvent} Event - The event that triggered this
|
||||
* @returns {void} - Nothing
|
||||
*/
|
||||
function ChatRoomMapKeyDown(Event) {
|
||||
|
||||
// ENTER to go back to the chat box
|
||||
if (KeyPress == 13) ElementFocus("InputChat");
|
||||
|
@ -751,12 +769,15 @@ function ChatRoomMapKeyDown() {
|
|||
if (((KeyPress == 43) || (KeyPress == 61)) && (ChatRoomMapViewRange > ChatRoomMapViewRangeMin)) ChatRoomMapViewRange--;
|
||||
if (((KeyPress == 45) || (KeyPress == 95)) && (ChatRoomMapViewRange < ChatRoomMapViewRangeMax)) ChatRoomMapViewRange++;
|
||||
|
||||
// WASD to move
|
||||
// WASD to move, Q is A for AWERTY keyboards
|
||||
if ((KeyPress == 87) || (KeyPress == 119)) ChatRoomMapMove("North");
|
||||
if ((KeyPress == 65) || (KeyPress == 97)) ChatRoomMapMove("West");
|
||||
if ((KeyPress == 65) || (KeyPress == 97) || (KeyPress == 81) || (KeyPress == 113)) ChatRoomMapMove("West");
|
||||
if ((KeyPress == 83) || (KeyPress == 115)) ChatRoomMapMove("South");
|
||||
if ((KeyPress == 68) || (KeyPress == 100)) ChatRoomMapMove("East");
|
||||
|
||||
// Control+Z to undo map changes
|
||||
if ((KeyPress == 26) && Event.ctrlKey && ChatRoomPlayerIsAdmin()) ChatRoomMapUndo();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -792,6 +813,10 @@ function ChatRoomMapMouseDown() {
|
|||
ChatRoomMapEditSubMode = "";
|
||||
return;
|
||||
}
|
||||
if (ChatRoomPlayerIsAdmin() && MouseIn(10, 360, 60, 60)) {
|
||||
ChatRoomMapUndo();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// In tile type selection mode, the user can select a tile type (floor, wall, etc.)
|
||||
|
@ -912,6 +937,7 @@ function ChatRoomMapMouseMove() {
|
|||
|
||||
// Only in edit mode
|
||||
if ((CurrentScreen != "ChatRoom") || !ChatRoomMapVisible) return;
|
||||
let Backup = CommonCloneDeep(ChatRoomData.MapData);
|
||||
|
||||
// In tile edit mode
|
||||
if (ChatRoomMapEditStarted && (ChatRoomMapEditMode == "Tile") && (ChatRoomMapEditObject != null)) {
|
||||
|
@ -932,6 +958,13 @@ function ChatRoomMapMouseMove() {
|
|||
}
|
||||
ChatRoomMapUpdateFlag();
|
||||
}
|
||||
|
||||
// If the map was modified, we keep the previous version as backup so we can undo the changes
|
||||
if (JSON.stringify(Backup) != JSON.stringify(ChatRoomData.MapData)) {
|
||||
if (ChatRoomMapEditBackup.length > 100) ChatRoomMapEditBackup = ChatRoomMapEditBackup.slice(-100);
|
||||
ChatRoomMapEditBackup.push(Backup);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Binary file not shown.
After ![]() (image error) Size: 106 KiB |
|
@ -46,6 +46,8 @@ function ChatSearchLoad() {
|
|||
ChatRoomCustomizationClear();
|
||||
ChatRoomMapVisible = false;
|
||||
ChatRoomMapEditMode = "";
|
||||
ChatRoomMapEditBackup = [];
|
||||
delete Player.MapData;
|
||||
if (ChatSearchReturnToScreen != null) {
|
||||
CommonSetScreen("Room", ChatSearchReturnToScreen);
|
||||
ChatSearchReturnToScreen = null;
|
||||
|
@ -337,8 +339,16 @@ function ChatSearchNormalDraw() {
|
|||
var IsFull = ChatSearchResult[C].MemberCount >= ChatSearchResult[C].MemberLimit;
|
||||
var HasBlock = CharacterHasBlockedItem(Player, ChatSearchResult[C].BlockCategory);
|
||||
DrawButton(X, Y, 630, 85, "", (HasBlock && IsFull ? "#884444" : HasBlock ? "#FF9999" : HasFriends && IsFull ? "#448855" : HasFriends ? "#CFFFCF" : IsFull ? "#666" : "White"), null, null, IsFull);
|
||||
DrawTextFit((ChatSearchResult[C].Friends != null && ChatSearchResult[C].Friends.length > 0 ? "(" + ChatSearchResult[C].Friends.length + ") " : "") + ChatSearchMuffle(ChatSearchResult[C].DisplayName) + " - " + ChatSearchMuffle(ChatSearchResult[C].Creator) + " " + ChatSearchResult[C].MemberCount + "/" + ChatSearchResult[C].MemberLimit + "", X + 315, Y + 25, 620, "black");
|
||||
DrawTextFit(ChatSearchMuffle(ChatSearchResult[C].Description), X + 315, Y + 62, 620, "black");
|
||||
|
||||
// Draws a map icon if a map is present
|
||||
if ((ChatSearchResult[C].MapType === "Always") || (ChatSearchResult[C].MapType === "Hybrid")) {
|
||||
DrawImage("Icons/MapType" + ChatSearchResult[C].MapType + ".png", X + 2, Y + 2);
|
||||
DrawTextFit((ChatSearchResult[C].Friends != null && ChatSearchResult[C].Friends.length > 0 ? "(" + ChatSearchResult[C].Friends.length + ") " : "") + ChatSearchMuffle(ChatSearchResult[C].DisplayName) + " - " + ChatSearchMuffle(ChatSearchResult[C].Creator) + " " + ChatSearchResult[C].MemberCount + "/" + ChatSearchResult[C].MemberLimit + "", X + 355, Y + 25, 540, "black");
|
||||
DrawTextFit(ChatSearchMuffle(ChatSearchResult[C].Description), X + 355, Y + 62, 540, "black");
|
||||
} else {
|
||||
DrawTextFit((ChatSearchResult[C].Friends != null && ChatSearchResult[C].Friends.length > 0 ? "(" + ChatSearchResult[C].Friends.length + ") " : "") + ChatSearchMuffle(ChatSearchResult[C].DisplayName) + " - " + ChatSearchMuffle(ChatSearchResult[C].Creator) + " " + ChatSearchResult[C].MemberCount + "/" + ChatSearchResult[C].MemberLimit + "", X + 315, Y + 25, 540, "black");
|
||||
DrawTextFit(ChatSearchMuffle(ChatSearchResult[C].Description), X + 315, Y + 62, 620, "black");
|
||||
}
|
||||
|
||||
// Moves the next window position
|
||||
X = X + 660;
|
||||
|
|
1
BondageClub/Scripts/Messages.d.ts
vendored
1
BondageClub/Scripts/Messages.d.ts
vendored
|
@ -321,6 +321,7 @@ interface ServerChatRoomSearchData {
|
|||
Game: string;
|
||||
Friends: ServerFriendInfo[];
|
||||
Space: ServerChatRoomSpace;
|
||||
MapType?: string;
|
||||
}
|
||||
|
||||
type ServerChatRoomSearchResultResponse = ServerChatRoomSearchData[];
|
||||
|
|
Loading…
Add table
Reference in a new issue