diff options
| author | stonedDiscord <Tukz@gmx.de> | 2021-10-04 21:05:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-04 21:05:45 +0200 |
| commit | cabbc5d69ea57589e2a31f0453aadce059aa13b5 (patch) | |
| tree | 11ba413323311c454977475fdd50bf35963084f3 /webAO/client.js | |
| parent | 410b692b612a28eb85d2bc9136163acdc11df97b (diff) | |
| parent | 4e06d17eda0c624179312e3300a64bfe816fa6fb (diff) | |
Merge pull request #87 from AttorneyOnline/fullsize-bg
Fullsize bg
Diffstat (limited to 'webAO/client.js')
| -rw-r--r-- | webAO/client.js | 104 |
1 files changed, 80 insertions, 24 deletions
diff --git a/webAO/client.js b/webAO/client.js index 34e5718..8852a9c 100644 --- a/webAO/client.js +++ b/webAO/client.js @@ -1217,6 +1217,7 @@ class Client extends EventEmitter { */ handleBN(args) { viewport.bgname = safe_tags(args[1]); + const bgfolder = viewport.bgFolder; const bg_index = getIndexFromSelect("bg_select", viewport.bgname); document.getElementById("bg_select").selectedIndex = bg_index; updateBackgroundPreview(); @@ -1224,6 +1225,19 @@ class Client extends EventEmitter { document.getElementById("bg_filename").value = viewport.bgname; } document.getElementById("bg_preview").src = AO_HOST + "background/" + encodeURI(args[1].toLowerCase()) + "/defenseempty.png"; + + document.getElementById("client_def_bench").src = bgfolder + "defensedesk.png" + document.getElementById("client_wit_bench").src = bgfolder + "stand.png" + document.getElementById("client_pro_bench").src = bgfolder + "prosecutiondesk.png" + + document.getElementById("client_court").src = bgfolder + "full.png" + + document.getElementById("client_court_def").src = bgfolder + "defenseempty.png" + document.getElementById("client_court_deft").src = bgfolder + "transition_def.png" + document.getElementById("client_court_wit").src = bgfolder + "witnessempty.png" + document.getElementById("client_court_prot").src = bgfolder + "transition_pro.png" + document.getElementById("client_court_pro").src = bgfolder + "prosecutorempty.png" + if (this.charID === -1) { viewport.changeBackground("jud"); } else { @@ -1737,8 +1751,9 @@ class Viewport { async changeBackground(position) { const bgfolder = viewport.bgFolder; - const bench = document.getElementById("client_bench"); - const court = document.getElementById("client_court"); + const view = document.getElementById("client_fullview"); + const bench = document.getElementById("client_bench_classic"); + const court = document.getElementById("client_court_classic"); const positions = { def: { @@ -1747,7 +1762,7 @@ async changeBackground(position) { speedLines: "defense_speedlines.gif" }, pro: { - bg: "prosecutorempty.png", + bg: "prosecutionempty.png", desk: { ao2: "prosecutiondesk.png", ao1: "bancoacusacion.png" }, speedLines: "prosecution_speedlines.gif" }, @@ -1797,9 +1812,6 @@ async changeBackground(position) { speedLines = "defense_speedlines.gif"; } - bench.className = position + "_bench"; - court.className = position + "_court"; - if (viewport.chatmsg.type === 5) { court.src = `${AO_HOST}themes/default/${encodeURI(speedLines)}`; bench.style.opacity = 0; @@ -1813,7 +1825,28 @@ async changeBackground(position) { bench.style.opacity = 0; } } + + if ( "def,pro,wit".includes(position)) { + bench.style.display = "none"; + view.style.display = ""; + document.getElementById("client_classicview").style.display = "none"; + switch(position) { + case "def": + view.style.left = "0"; + break; + case "wit": + view.style.left = "-200%"; + break; + case "pro": + view.style.left = "-400%"; + break; + } + } else { + bench.style.display = ""; + view.style.display = "none"; + document.getElementById("client_classicview").style.display = ""; } +} /** * Intialize testimony updater @@ -1952,14 +1985,15 @@ async changeBackground(position) { * Sets all the img tags to the right sources * @param {*} chatmsg */ - setEmote(charactername, emotename, prefix, pair) { + setEmote(charactername, emotename, prefix, pair, side) { const pairID = pair ? "pair" : "char"; const characterFolder = AO_HOST + "characters/"; + const position = "def,pro,wit".includes(side) ? side+"_" : "" - const gif_s = document.getElementById("client_" + pairID + "_gif"); - const png_s = document.getElementById("client_" + pairID + "_png"); - const apng_s = document.getElementById("client_" + pairID +"_apng"); - const webp_s = document.getElementById("client_" + pairID +"_webp"); + const gif_s = document.getElementById("client_" + position + pairID + "_gif"); + const png_s = document.getElementById("client_" + position + pairID + "_png"); + const apng_s = document.getElementById("client_" + position + pairID +"_apng"); + const webp_s = document.getElementById("client_" + position + pairID +"_webp"); if (this.lastChar !== this.chatmsg.name) { //hide the last sprite @@ -1988,6 +2022,8 @@ async changeBackground(position) { this.sfxplayed = 0; this.textTimer = 0; this._animating = true; + let charLayers = document.getElementById("client_char"); + let pairLayers = document.getElementById("client_pair_char"); // stop updater clearTimeout(this.updater); @@ -2008,8 +2044,10 @@ async changeBackground(position) { } this.lastEvi = this.chatmsg.evidence; - const charLayers = document.getElementById("client_char"); - const pairLayers = document.getElementById("client_pair_char"); + if ( "def,pro,wit".includes(this.chatmsg.side)) { + charLayers = document.getElementById("client_"+this.chatmsg.side+"_char"); + pairLayers = document.getElementById("client_"+this.chatmsg.side+"_pair_char"); + } const chatContainerBox = document.getElementById("client_chatcontainer"); const nameBoxInner = document.getElementById("client_inner_name"); @@ -2031,10 +2069,10 @@ async changeBackground(position) { checkCallword(this.chatmsg.content); - this.setEmote(this.chatmsg.name.toLowerCase(), this.chatmsg.sprite, "(a)", false); + this.setEmote(this.chatmsg.name.toLowerCase(), this.chatmsg.sprite, "(a)", false, this.chatmsg.side); if (this.chatmsg.other_name) { - this.setEmote(this.chatmsg.other_name.toLowerCase(), this.chatmsg.other_emote, "(a)", false); + this.setEmote(this.chatmsg.other_name.toLowerCase(), this.chatmsg.other_emote, "(a)", false, this.chatmsg.side); } // gets which shout shall played @@ -2093,8 +2131,8 @@ async changeBackground(position) { } // Shift by the horizontal offset - pairLayers.style.left = Number(this.chatmsg.other_offset[0]) + "%"; - charLayers.style.left = Number(this.chatmsg.self_offset[0]) + "%"; + //pairLayers.style.left = Number(this.chatmsg.other_offset[0]) + "%"; + //charLayers.style.left = Number(this.chatmsg.self_offset[0]) + "%"; // New vertical offsets pairLayers.style.top = Number(this.chatmsg.other_offset[1]) + "%"; @@ -2167,13 +2205,18 @@ async changeBackground(position) { const gamewindow = document.getElementById("client_gamewindow"); const waitingBox = document.getElementById("client_chatwaiting"); - const charLayers = document.getElementById("client_char"); - const pairLayers = document.getElementById("client_pair_char"); const eviBox = document.getElementById("client_evi"); const shoutSprite = document.getElementById("client_shout"); const chatBoxInner = document.getElementById("client_inner_chat"); const chatBox = document.getElementById("client_chat"); const effectlayer = document.getElementById("client_fg"); + let charLayers = document.getElementById("client_char"); + let pairLayers = document.getElementById("client_pair_char"); + + if ( "def,pro,wit".includes(this.chatmsg.side)) { + charLayers = document.getElementById("client_"+this.chatmsg.side+"_char"); + pairLayers = document.getElementById("client_"+this.chatmsg.side+"_pair_char"); + } const charName = this.chatmsg.name.toLowerCase(); const charEmote = this.chatmsg.sprite.toLowerCase(); @@ -2200,7 +2243,7 @@ async changeBackground(position) { shoutSprite.style.opacity = 0; shoutSprite.style.animation = ""; const preanim = this.chatmsg.preanim.toLowerCase(); - this.setEmote(charName,preanim,"",false); + this.setEmote(charName,preanim,"",false,this.chatmsg.side); charLayers.style.opacity = 1; } @@ -2250,17 +2293,17 @@ async changeBackground(position) { } if (this.chatmsg.other_name) { - this.setEmote(pairName,pairEmote,"(a)",true); + this.setEmote(pairName,pairEmote,"(a)",true,this.chatmsg.side); pairLayers.style.opacity = 1; } else { pairLayers.style.opacity = 0; } - this.setEmote(charName,charEmote,"(b)",false); + this.setEmote(charName,charEmote,"(b)",false,this.chatmsg.side); charLayers.style.opacity = 1; if (this.textnow === this.chatmsg.content) { - this.setEmote(charName,charEmote,"(a)",false); + this.setEmote(charName,charEmote,"(a)",false,this.chatmsg.side); charLayers.style.opacity = 1; waitingBox.style.opacity = 1; this._animating = false; @@ -2282,7 +2325,7 @@ async changeBackground(position) { if (this.textnow === this.chatmsg.content) { this._animating = false; - this.setEmote(charName,charEmote,"(a)",false); + this.setEmote(charName,charEmote,"(a)",false,this.chatmsg.side); charLayers.style.opacity = 1; waitingBox.style.opacity = 1; clearTimeout(this.updater); @@ -2634,6 +2677,19 @@ export async function iniedit() { window.iniedit = iniedit; /** + * Triggered by the pantilt checkbox + */ + export async function switchPanTilt() { + const background = document.getElementById("client_fullview"); + if(document.getElementById("client_pantilt").checked) { + background.style.transition = "0.5s ease-in-out"; + } else { + background.style.transition = "none" + } +} +window.switchPanTilt = switchPanTilt; + +/** * Triggered by the change aspect ratio checkbox */ export async function switchAspectRatio() { |
