mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Minor graphic changes
This commit is contained in:
parent
b77f271183
commit
1be876fb83
File diff suppressed because one or more lines are too long
15
client/public/stylesheets/button.css
Normal file
15
client/public/stylesheets/button.css
Normal file
@ -0,0 +1,15 @@
|
||||
.olympus-button{
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background-color: transparent;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.olympus-button:hover{
|
||||
|
||||
}
|
||||
|
||||
.olympus-button:active{
|
||||
|
||||
}
|
||||
7
client/public/stylesheets/connectionstatuspanel.css
Normal file
7
client/public/stylesheets/connectionstatuspanel.css
Normal file
@ -0,0 +1,7 @@
|
||||
.olympus-status-disconnected{
|
||||
color: red;
|
||||
}
|
||||
|
||||
.olympus-status-connected{
|
||||
color: #00FF00;
|
||||
}
|
||||
@ -1,15 +1,19 @@
|
||||
.olympus-dropdown {
|
||||
width: 100%;
|
||||
min-width: 100px;
|
||||
height: 30px;
|
||||
background-color: #FFFD;
|
||||
position: relative;
|
||||
background-color: #DDDD;
|
||||
z-index: 1000;
|
||||
border-radius: 2px;
|
||||
border-radius: 15px;
|
||||
font-family: Verdana, Geneva, Tahoma, sans-serif;
|
||||
color: var(--background-color);
|
||||
color: var(--background-color-dark);
|
||||
padding-left: 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
font-size: 15px;
|
||||
font-size: 13px;
|
||||
display: flex;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.olympus-dropdown::before {
|
||||
@ -19,10 +23,10 @@
|
||||
width: 30px;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
background-color: var(--background-color);
|
||||
background-color: var(--background-color-dark);
|
||||
z-index: 1000;
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
border-top-right-radius: 15px;
|
||||
border-bottom-right-radius: 15px;
|
||||
}
|
||||
|
||||
.olympus-dropdown-open {
|
||||
@ -61,21 +65,21 @@
|
||||
|
||||
.olympus-dropdown-content {
|
||||
position: fixed;
|
||||
overflow: visible;
|
||||
overflow-y: scroll;
|
||||
background-color: #FFFD;
|
||||
/*overflow: visible;
|
||||
overflow-y: scroll;*/
|
||||
background-color: #DDDD;
|
||||
z-index: 2000;
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.olympus-dropdown-element {
|
||||
margin: 2px;
|
||||
font-family: Verdana, Geneva, Tahoma, sans-serif;
|
||||
color: var(--background-color);
|
||||
color: var(--background-color-dark);
|
||||
cursor: pointer;
|
||||
opacity: 1;
|
||||
font-size: 15px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.olympus-dropdown-element:hover {
|
||||
|
||||
@ -1,11 +1,10 @@
|
||||
/* Panels style */
|
||||
.olympus-panel {
|
||||
background-color: var(--background-color);
|
||||
border: solid white 1px;
|
||||
background-color: var(--background-color-dark);
|
||||
|
||||
font-size: 12px;
|
||||
position: fixed;
|
||||
transition: bottom 0.2s;
|
||||
border-radius: 2px;
|
||||
border-radius: 15px;
|
||||
text-shadow: 1px 1px #000, -1px -1px #000, 1px -1px #000, -1px 1px #000;
|
||||
font-family: "Lucida Console", "Courier New", monospace !important;
|
||||
}
|
||||
@ -17,7 +16,8 @@
|
||||
|
||||
.olympus-panel-title {
|
||||
font-size: 14px;
|
||||
color: #d3e9ff;
|
||||
color: white;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
.olympus-panel-label {
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
height: 220px;
|
||||
overflow: visible;
|
||||
overflow-y: scroll;
|
||||
background-color: var(--background-color);
|
||||
background-color: var(--background-color-dark);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
|
||||
@ -3,10 +3,13 @@
|
||||
@import url("selectionwheel.css");
|
||||
@import url("selectionscroll.css");
|
||||
@import url("unitmarker.css");
|
||||
@import url("connectionstatuspanel.css");
|
||||
@import url("button.css");
|
||||
|
||||
/* Variables definitions */
|
||||
:root {
|
||||
--background-color:#202831;
|
||||
--background-color-dark:#202831;
|
||||
--background-color-light:#aaaaaa;
|
||||
--title-color:#d3e9ff;
|
||||
--text-color:white;
|
||||
--blue-coalition-color: #2196F3;
|
||||
@ -20,20 +23,24 @@
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
|
||||
#map-container
|
||||
{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
min-width: 820px;
|
||||
}
|
||||
|
||||
#unit-info-panel {
|
||||
position: fixed;
|
||||
height: 100px;
|
||||
width: 800px;
|
||||
left: 10px;
|
||||
@ -42,16 +49,66 @@ html, body {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#scenario-dropdown {
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
#map-source-dropdown{
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
width: 250px;
|
||||
top: 10px;
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#map-source-dropdown {
|
||||
position: fixed;
|
||||
#scenario-dropdown{
|
||||
position: absolute;
|
||||
left: 170px;
|
||||
top: 10px;
|
||||
left: 280px;
|
||||
width: 250px;
|
||||
}
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
#unit-control-panel {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
margin-left: -55px;
|
||||
height: 30px;
|
||||
width: 110px;
|
||||
top: 10px;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
#visibility-control-panel {
|
||||
position: absolute;
|
||||
left: 340;
|
||||
height: 30px;
|
||||
width: 110;
|
||||
top: 10px;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
|
||||
#connection-status-panel {
|
||||
position: absolute;
|
||||
height: 30px;
|
||||
width: 150px;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1440px) {
|
||||
#unit-control-panel {
|
||||
top: 50px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import * as L from 'leaflet'
|
||||
import { getUnitsManager } from '..';
|
||||
import { getUnitsManager, setConnected } from '..';
|
||||
import { ConvertDDToDMS } from '../other/utils';
|
||||
|
||||
/* Edit here to change server address */
|
||||
@ -15,10 +15,12 @@ export function getDataFromDCS(callback: CallableFunction)
|
||||
{
|
||||
var data = JSON.parse(xmlHttp.responseText);
|
||||
callback(data);
|
||||
setConnected(true);
|
||||
};
|
||||
|
||||
xmlHttp.onerror = function () {
|
||||
console.error("An error occurred during the XMLHttpRequest");
|
||||
setConnected(false);
|
||||
};
|
||||
xmlHttp.send( null );
|
||||
}
|
||||
|
||||
@ -5,7 +5,9 @@ import { UnitsManager } from "./units/unitsmanager";
|
||||
import { UnitInfoPanel } from "./panels/unitinfopanel";
|
||||
import { SelectionScroll } from "./controls/selectionscroll";
|
||||
import { Dropdown } from "./controls/dropdown";
|
||||
import { ConnectionStatusPanel } from "./panels/connectionstatuspanel";
|
||||
|
||||
/* TODO: should this be a class? */
|
||||
var map: Map;
|
||||
var selectionWheel: SelectionWheel;
|
||||
var selectionScroll: SelectionScroll;
|
||||
@ -14,6 +16,8 @@ var unitInfoPanel: UnitInfoPanel;
|
||||
var activeCoalition: string;
|
||||
var scenarioDropdown: Dropdown;
|
||||
var mapSourceDropdown: Dropdown;
|
||||
var connected: boolean;
|
||||
var connectionStatusPanel: ConnectionStatusPanel;
|
||||
|
||||
function setup()
|
||||
{
|
||||
@ -25,14 +29,24 @@ function setup()
|
||||
unitInfoPanel = new UnitInfoPanel("unit-info-panel");
|
||||
scenarioDropdown = new Dropdown("scenario-dropdown", ["Caucasus", "Syria", "Nevada", "Marianas", "South Atlantic", "The channel"], () => {});
|
||||
mapSourceDropdown = new Dropdown("map-source-dropdown", map.getLayers(), (option: string) => map.setLayer(option));
|
||||
connectionStatusPanel = new ConnectionStatusPanel("connection-status-panel");
|
||||
|
||||
/* Default values */
|
||||
activeCoalition = "blue";
|
||||
connected = false;
|
||||
|
||||
/* Main update rate = 250ms is minimum time, equal to server update time. */
|
||||
setInterval(() => getDataFromDCS(update), 250);
|
||||
requestUpdate();
|
||||
}
|
||||
|
||||
function update(data: JSON)
|
||||
function requestUpdate()
|
||||
{
|
||||
getDataFromDCS(update);
|
||||
/* Main update rate = 250ms is minimum time, equal to server update time. */
|
||||
setTimeout(() => requestUpdate(), getConnected() ? 250: 1000);
|
||||
connectionStatusPanel.update(getConnected() );
|
||||
}
|
||||
|
||||
export function update(data: JSON)
|
||||
{
|
||||
unitsManager.update(data);
|
||||
}
|
||||
@ -62,9 +76,9 @@ export function getUnitInfoPanel()
|
||||
return unitInfoPanel;
|
||||
}
|
||||
|
||||
export function setActiveCoalition(coalition: string)
|
||||
export function setActiveCoalition(newActiveCoalition: string)
|
||||
{
|
||||
activeCoalition = coalition;
|
||||
activeCoalition = newActiveCoalition;
|
||||
}
|
||||
|
||||
export function getActiveCoalition()
|
||||
@ -72,4 +86,14 @@ export function getActiveCoalition()
|
||||
return activeCoalition;
|
||||
}
|
||||
|
||||
export function setConnected(newConnected: boolean)
|
||||
{
|
||||
connected = newConnected
|
||||
}
|
||||
|
||||
export function getConnected()
|
||||
{
|
||||
return connected;
|
||||
}
|
||||
|
||||
window.onload = setup;
|
||||
32
client/src/panels/connectionstatuspanel.ts
Normal file
32
client/src/panels/connectionstatuspanel.ts
Normal file
@ -0,0 +1,32 @@
|
||||
export class ConnectionStatusPanel
|
||||
{
|
||||
#element: HTMLElement
|
||||
|
||||
constructor(ID: string)
|
||||
{
|
||||
this.#element = <HTMLElement>document.getElementById(ID);
|
||||
}
|
||||
|
||||
update(connected: boolean)
|
||||
{
|
||||
if (this.#element != null)
|
||||
{
|
||||
var div = this.#element.querySelector("#status-string");
|
||||
if (div != null)
|
||||
{
|
||||
if (connected)
|
||||
{
|
||||
div.innerHTML = "Connected";
|
||||
div.classList.add("olympus-status-connected");
|
||||
div.classList.remove("olympus-status-disconnected");
|
||||
}
|
||||
else
|
||||
{
|
||||
div.innerHTML = "Disconnected";
|
||||
div.classList.add("olympus-status-disconnected");
|
||||
div.classList.remove("olympus-status-connected");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,7 +13,7 @@ export class UnitInfoPanel
|
||||
if (this.#element != null)
|
||||
{
|
||||
this.#display = this.#element.style.display;
|
||||
this.hide();
|
||||
this.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
3
client/views/connectionstatus.ejs
Normal file
3
client/views/connectionstatus.ejs
Normal file
@ -0,0 +1,3 @@
|
||||
<div class="olympus-panel" id="connection-status-panel">
|
||||
<div class="olympus-panel-title" id="status-string"> Connected </div>
|
||||
</div>
|
||||
@ -7,13 +7,15 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="map-container">
|
||||
<%- include('unitinfo.ejs') %>
|
||||
</div>
|
||||
<div id="map-container"></div>
|
||||
<%- include('unitinfo.ejs') %>
|
||||
<%- include('selectionwheel.ejs') %>
|
||||
<%- include('selectionscroll.ejs') %>
|
||||
<div class="olympus-dropdown" id="scenario-dropdown">Nevada</div>
|
||||
<div class="olympus-dropdown" id="map-source-dropdown">Satellite</div>
|
||||
<div class="olympus-dropdown" id="scenario-dropdown">Nevada</div>
|
||||
<%- include('unitcontrol.ejs') %>
|
||||
<%- include('visibilitycontrol.ejs') %>
|
||||
<!-- ENABLE ME BACK <%- include('connectionstatus.ejs') %> -->
|
||||
<script src="javascripts/bundle.js"></script>
|
||||
</body>
|
||||
|
||||
|
||||
6
client/views/unitcontrol.ejs
Normal file
6
client/views/unitcontrol.ejs
Normal file
@ -0,0 +1,6 @@
|
||||
<div class="olympus-panel" id="unit-control-panel">
|
||||
<div class="olympus-button" id="slow"></div>
|
||||
<div class="olympus-button" id="fast"></div>
|
||||
<div class="olympus-button" id="descent"></div>
|
||||
<div class="olympus-button" id="climb"></div>
|
||||
</div>
|
||||
@ -72,9 +72,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td style="height:100%"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
6
client/views/visibilitycontrol.ejs
Normal file
6
client/views/visibilitycontrol.ejs
Normal file
@ -0,0 +1,6 @@
|
||||
<div class="olympus-panel" id="visibility-control-panel">
|
||||
<div class="olympus-button" ></div>
|
||||
<div class="olympus-button" ></div>
|
||||
<div class="olympus-button" ></div>
|
||||
<div class="olympus-button" ></div>
|
||||
</div>
|
||||
Loading…
x
Reference in New Issue
Block a user