Skip to content

Commit

Permalink
include newest updates to in-game module
Browse files Browse the repository at this point in the history
  • Loading branch information
Himyu committed Nov 26, 2023
1 parent 1034035 commit 00779ef
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 90 deletions.
10 changes: 8 additions & 2 deletions frontend/cockpit/cockpit.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@
padding: 0 1rem;
}

#show-gold {
margin: auto;
#show-gold,
#show-gold-graph {
width: 50%;
}

#map-zoom-in,
#map-zoom-out {
width: 50%;
}

#bluePlayers,
Expand Down
102 changes: 18 additions & 84 deletions frontend/cockpit/cockpit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function setLobbyData(e) {
lobby = data
displayData()
}

function setChampselectData(e) {
const data = e.state?.lcu.champselect ?? e.data ?? champselect

Expand All @@ -26,6 +27,7 @@ function setChampselectData(e) {
champselect = data
displayData()
}

function setInGameData(e) {
const data = e.state?.live ?? e.gameState ?? inGame

Expand Down Expand Up @@ -193,52 +195,52 @@ async function initUi() {
switch (lolServer) {
case 'BR1':
gameServer = 'br'
break;
break
case 'EUN1':
gameServer = 'eune'
break;
break
case 'EUW1':
gameServer = 'euw'
break;
break
case 'JP1':
gameServer = 'jp'
break;
break
case 'KR':
gameServer = 'kr'
break;
break
case 'LA1':
gameServer = 'lan'
break;
break
case 'LA2':
gameServer = 'las'
break;
break
case 'NA1':
gameServer = 'na'
break;
break
case 'TR1':
gameServer = 'tr'
break;
break
case 'RU':
gameServer = 'ru'
break;
break
case 'OC1':
gameServer = 'oce'
break;
break
case 'PH2':
gameServer = 'ph'
break;
break
case 'SG2':
gameServer = 'sg'
break;
break
case 'TH2':
gameServer = 'th'
break;
break
case 'TW2':
gameServer = 'tw'
break;
break
case 'VN2':
gameServer = 'vn'
break;
break
default:
gameServer = 'euw'
}
Expand All @@ -248,74 +250,6 @@ async function initUi() {
setInGameData(data)
}

function showPlatings() {
LPTE.emit({
meta: {
namespace: 'module-league-in-game',
type: 'show-platings',
version: 1
}
})
}
function hidePlatings() {
LPTE.emit({
meta: {
namespace: 'module-league-in-game',
type: 'hide-platings',
version: 1
}
})
}

function showGold() {
LPTE.emit({
meta: {
namespace: 'module-league-caster-cockpit',
type: 'show-gold',
version: 1
}
})
}

function mapZoomIn() {
LPTE.emit({
meta: {
namespace: 'module-vmix',
type: 'MapZoomIn',
version: 1
}
})
}
function mapZoomOut() {
LPTE.emit({
meta: {
namespace: 'module-vmix',
type: 'MapZoomOut',
version: 1
}
})
}

function showLeaderBoard(leaderboard) {
LPTE.emit({
meta: {
namespace: 'module-league-in-game',
type: 'show-leader-board',
version: 1
},
leaderboard
})
}
function hideLeaderBoard() {
LPTE.emit({
meta: {
namespace: 'module-league-in-game',
type: 'hide-leader-board',
version: 1
}
})
}

window.LPTE.onready(() => {
initUi()
window.LPTE.on('module-league-state', 'lobby-update', setLobbyData)
Expand Down
83 changes: 83 additions & 0 deletions frontend/cockpit/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
function showPlatings() {
LPTE.emit({
meta: {
namespace: 'module-league-in-game',
type: 'show-platings',
version: 1
}
})
}
function hidePlatings() {
LPTE.emit({
meta: {
namespace: 'module-league-in-game',
type: 'hide-platings',
version: 1
}
})
}

/* ----- */

function mapZoomIn() {
LPTE.emit({
meta: {
namespace: 'module-vmix',
type: 'MapZoomIn',
version: 1
}
})
}
function mapZoomOut() {
LPTE.emit({
meta: {
namespace: 'module-vmix',
type: 'MapZoomOut',
version: 1
}
})
}

/* ----- */

function showLeaderBoard(leaderboard) {
LPTE.emit({
meta: {
namespace: 'module-league-in-game',
type: 'show-leader-board',
version: 1
},
leaderboard
})
}
function hideLeaderBoard() {
LPTE.emit({
meta: {
namespace: 'module-league-in-game',
type: 'hide-leader-board',
version: 1
}
})
}

/* ----- */

function showGoldGraph() {
LPTE.emit({
meta: {
namespace: 'module-league-in-game',
type: 'show-gold-graph',
version: 1
}
})
}

function showGold() {
LPTE.emit({
meta: {
namespace: 'module-league-caster-cockpit',
type: 'show-gold',
version: 1
}
})
}
40 changes: 36 additions & 4 deletions frontend/cockpit/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ <h1>League Caster Cockpit</h1>
>
</div>
<div id="game-control">
<!--- Platings ----->
<div class="d-flex">
<div class="btn-group w-50">
<button
Expand Down Expand Up @@ -90,6 +91,7 @@ <h1>League Caster Cockpit</h1>
</div>
</div>
</div>
<!--- LeaderBoards ----->
<div class="d-flex mt-auto mb-2">
<div class="btn-group">
<button type="button" class="btn btn-warning" onclick="showLeaderBoard('gold')">
Expand Down Expand Up @@ -173,10 +175,11 @@ <h1>League Caster Cockpit</h1>
</div>
</div>
</div>
<div class="d-flex">
<!--- Gold ----->
<div class="d-flex mb-2">
<div id="show-gold" class="btn-group">
<button type="button" class="btn btn-warning" onclick="showGold()">
Show gold
Toggle Gold
</button>
<button
type="button"
Expand All @@ -199,7 +202,35 @@ <h1>League Caster Cockpit</h1>
</button>
</div>
</div>
<div id="map-zoom" class="btn-group">
<div id="show-gold-graph" class="btn-group">
<button type="button" class="btn btn-warning" onclick="showGoldGraph()">
Toggle Gold-Graph
</button>
<button
type="button"
class="btn btn-warning dropdown-toggle dropdown-toggle-split"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
>
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
<button
class="dropdown-item"
onclick="window.getActionLink(
'module-league-in-game',
'show-gold-graph'
)"
>
Copy Action-Link
</button>
</div>
</div>
</div>
<!--- MapZoom ----->
<div class="d-flex">
<div id="map-zoom-in" class="btn-group">
<button type="button" class="btn btn-success" onclick="mapZoomIn()">
Zoom In Map
</button>
Expand All @@ -224,7 +255,7 @@ <h1>League Caster Cockpit</h1>
</button>
</div>
</div>
<div id="map-zoom" class="btn-group">
<div id="map-zoom-out" class="btn-group">
<button
type="button"
class="btn btn-secondary"
Expand Down Expand Up @@ -268,5 +299,6 @@ <h1>League Caster Cockpit</h1>
</div>

<script src="cockpit.js"></script>
<script src="functions.js"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
"main": "dist/plugin.js"
},
"needsBuild": true,
"toolkitVersion": "v1.8.0",
"dependencies": [
"module-league-state",
"module-league-static",
"module-league-in-game",
"module-teams"
]
},
Expand Down

0 comments on commit 00779ef

Please sign in to comment.