From c0b21659772b213e2e97ab9cc4c370545d47ff8b Mon Sep 17 00:00:00 2001 From: Nick Heinbaugh Date: Thu, 19 Jan 2023 17:46:18 -0800 Subject: [PATCH] hall refactor --- .../gemp-lotr-async/src/main/web/hall.html | 128 +----------------- .../src/main/web/src/Hall/GameHall.js | 86 ++++++++++++ .../src/main/web/src/Hall/index.css | 15 ++ 3 files changed, 108 insertions(+), 121 deletions(-) create mode 100644 gemp-lotr/gemp-lotr-async/src/main/web/src/Hall/GameHall.js create mode 100644 gemp-lotr/gemp-lotr-async/src/main/web/src/Hall/index.css diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/hall.html b/gemp-lotr/gemp-lotr-async/src/main/web/hall.html index 867e5535c..93a63dbd3 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/hall.html +++ b/gemp-lotr/gemp-lotr-async/src/main/web/hall.html @@ -22,16 +22,10 @@ - - - - - - @@ -60,122 +54,14 @@ - - - - - - + + - +
-
+
@@ -330,14 +216,14 @@
- - +
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/src/Hall/GameHall.js b/gemp-lotr/gemp-lotr-async/src/main/web/src/Hall/GameHall.js new file mode 100644 index 000000000..1cd6763d3 --- /dev/null +++ b/gemp-lotr/gemp-lotr-async/src/main/web/src/Hall/GameHall.js @@ -0,0 +1,86 @@ +var chat; + var hall; + + $(document).ready(function () { + + $("#main").tabs(); + //Hiding the Users tab until that feature is ready + $("#tabs > ul :nth-child(5)").hide(); + + chat = new ChatBoxUI("Game Hall", $("#chat"), "/gemp-lotr-server", true, null, false, null, true); + chat.showTimestamps = true; + + hall = new GempLotrHallUI("/gemp-lotr-server", chat); + + + var infoDialog = $("
") + .dialog({ + autoOpen:false, + closeOnEscape:true, + resizable:false, + title:"Card information", + closeText: "" + }); + + $("body").click( + function (event) { + var tar = $(event.target); + + if (tar.hasClass("cardHint")) { + var ids = tar.attr("value").split(","); + + infoDialog.html(""); + infoDialog.html("
"); + var floatCardDiv = $("
"); + + var horiz = false; + for(var i = 0; i < ids.length; i++) { + var bpid = ids[i]; + var card = new Card(bpid, "SPECIAL", "hint", ""); + horiz = horiz || card.horizontal; + floatCardDiv.append(createFullCardDiv(card.imageUrl, card.foil, card.horizontal)); + } + + infoDialog.append(floatCardDiv); + + var windowWidth = $(window).width(); + var windowHeight = $(window).height(); + + var horSpace = 30; + var vertSpace = 45; + var height = 505; + var width = 340; + + infoDialog.dialog({ + title:"Card information", + + }); + if (horiz) { + // 500x360 + infoDialog.dialog({width:Math.min((height + 10) * ids.length, windowWidth), + height:Math.min((width + 90), windowHeight)}); + } else { + // 360x500 + infoDialog.dialog({width:Math.min((width + 30) * ids.length, windowWidth), + height:Math.min((height + 45), windowHeight)}); + } + infoDialog.dialog("open"); + + event.stopPropagation(); + return false; + } else if (tar.hasClass("prizeHint")) { + var prizeDescription = tar.attr("value"); + + infoDialog.text(prizeDescription); + + infoDialog.dialog({title:"Prizes details", width:300, height: 150}); + infoDialog.dialog("open"); + + event.stopPropagation(); + return false; + } + + return true; + }); + + }); \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/src/Hall/index.css b/gemp-lotr/gemp-lotr-async/src/main/web/src/Hall/index.css new file mode 100644 index 000000000..2301d0e0c --- /dev/null +++ b/gemp-lotr/gemp-lotr-async/src/main/web/src/Hall/index.css @@ -0,0 +1,15 @@ +#timerSelect { + width: 135px; +} + +#inviteCheckbox { + min-width: fit-content; +} + +#messageArea { + justify-content: space-between; align-items:flex-end +} + +.strikethrough { + text-decoration: line-through; +} \ No newline at end of file