Ver código fonte

first wave of static assets

Stephen McQuay 4 anos atrás
pai
commit
6797c134d1
3 arquivos alterados com 162 adições e 0 exclusões
  1. 74
    0
      ui/css/hackerbots.css
  2. 28
    0
      ui/index.html
  3. 60
    0
      ui/js/botui.js

+ 74
- 0
ui/css/hackerbots.css Ver arquivo

@@ -0,0 +1,74 @@
1
+body {
2
+    background: #333;
3
+    color: #888;
4
+    font-family: Helvetica, Sans-Serif;
5
+}
6
+
7
+.error {
8
+    background-color: #993333;
9
+    color: #cccccc;
10
+}
11
+
12
+.under-button {
13
+    font-variant: small-caps;
14
+    font-size: 8pt;
15
+    text-align: center;
16
+}
17
+
18
+.health {
19
+ height: 5px;
20
+ background-color: #55FF55;
21
+ width: 100%;
22
+}
23
+
24
+canvas {
25
+    border: 3px solid black;
26
+    width: 100%;
27
+    height: 100%;
28
+    background-color: #888;
29
+}
30
+
31
+.ace_editor {
32
+    position: relative !important;
33
+    /*border: 1px solid lightgray;*/
34
+    /*height: 600px;*/
35
+    /*width: 85%;*/
36
+    font-family: "Monaco", "Menlo", "Ubuntu Mono", "Droid Sans Mono", "Consolas", monospace !important;
37
+    font-size: 12px !important;
38
+    font-weight: 400 !important;
39
+    letter-spacing: 0 !important;
40
+}
41
+
42
+.debug {
43
+    background-color: #888;
44
+    margin-top: 30px;
45
+    width: 80%;
46
+}
47
+
48
+.center {
49
+    margin: auto;
50
+}
51
+
52
+.label {
53
+    position: absolute;
54
+    border: 2px solid;
55
+    padding-top: 1px;
56
+    padding-bottom: 1px;
57
+    padding-left: 4px;
58
+    padding-right: 4px;
59
+    border-color: #666666;
60
+    border-radius: 7px;
61
+    font-variant: small-caps;
62
+    font-size: 9pt;
63
+}
64
+
65
+.step {
66
+    position: relative;
67
+    width: 900px;
68
+    padding: 40px;
69
+    margin: 20px auto;
70
+
71
+    /*font-family: 'PT Serif', georgia, serif;*/
72
+    font-size: 48px;
73
+    line-height: 1.5;
74
+}

+ 28
- 0
ui/index.html Ver arquivo

@@ -0,0 +1,28 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+    <head>
4
+        <title>Game Center</title>
5
+        <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
6
+        <link href="/ui/bs/css/bootstrap.min.css" rel="stylesheet" media="screen">
7
+        <link href="/ui/bs/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
8
+        <link href="/ui/css/hackerbots.css" rel="stylesheet" media="screen">
9
+    </head>
10
+    <body>
11
+        <div class="page-header">
12
+            <div class="container">
13
+                <h1>Game Center</h1>
14
+            </div>
15
+        </div>
16
+        <div class="container">
17
+            <div  id="error" class="alert alert-danger">
18
+                <div class="container"></div>
19
+            </div>
20
+        </div>
21
+
22
+        <div class="container" id="game-list"></div>
23
+
24
+        <script src="/ui/jquery.js"></script>
25
+        <script src="/ui/bs/js/bootstrap.min.js"></script>
26
+        <script src="/ui/js/botui.js"></script>
27
+    </body>
28
+</html>

+ 60
- 0
ui/js/botui.js Ver arquivo

@@ -0,0 +1,60 @@
1
+$(function(){
2
+    $("#error").hide();
3
+    if($("#error > div").text() != "") {
4
+        $("#error").show();
5
+    }
6
+    loadServers();
7
+    loadGames();
8
+});
9
+
10
+function loadServers() {
11
+    $.get("/ui/servers", function(data) {
12
+        $("#server-list").append(data);
13
+        $(".start").click(function(e) {
14
+            $("#error").hide();
15
+            data = {
16
+                'server': $(this).attr("value"),
17
+            }
18
+            $.post(
19
+                "/api/v1/game/add/",
20
+                JSON.stringify(data),
21
+                function(data) {
22
+                    if (data.ok) {
23
+                        loadGames();
24
+                    } else {
25
+                        $("#error").text(data.error);
26
+                        $("#error").show();
27
+                    }
28
+                }
29
+                );
30
+
31
+        });
32
+    });
33
+}
34
+
35
+function loadGames() {
36
+    $.get("/ui/games", function(data) {
37
+        $("#game-list").empty();
38
+        $("#game-list").append(data);
39
+        $(".stop").click(function(e) {
40
+            $("#error").hide();
41
+            data = {
42
+                'name': $(this).attr("server"),
43
+                'game_id': $(this).attr("value"),
44
+            }
45
+            $.post(
46
+                "/api/v1/game/stop/",
47
+                JSON.stringify(data),
48
+                function(data) {
49
+                    if (data.ok) {
50
+                        loadGames();
51
+                    } else {
52
+                        $("#error").text(data.error);
53
+                        $("#error").show();
54
+                    }
55
+                }
56
+                );
57
+
58
+        });
59
+    });
60
+}

Carregando…
Cancelar
Salvar