-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
108 lines (108 loc) · 4.73 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<meta http-equiv="content-type" content="text/html" charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<html>
<head>
<title>Arimaa</title>
<link rel=stylesheet type="text/css" href="style.css" />
<!-- <script src="[email protected]"></script> -->
<script src="vue.min.js"></script>
<script src="arimaa.js"></script>
<script src="gui.js"></script>
<script type="text/javascript">
let setup = function () {
c = new Client()
c.connect()
}
</script>
</head>
<body onload="setup()">
<div style="width:0px; height:0px; overflow:hidden">
<div class="death"></div>
<div class="E"></div>
<div class="ambiv"></div>
<div class="clear"></div>
<div class="skull"></div>
<div class="innerboard"></div>
</div>
<div id="main">
<div id="info_board" ><span v-html="status"></span><template v-if="your_turn"> [ Moves: {{moves_made}} ]</template></div>
<button v-if="disconnected" class="actionbutton fw" @click="reconnect">Reconnect</button>
<!-- Side picking utility -->
<template v-if="side_pick">
<div id="side_pick">
<a href="#" class="side_choice piece E black" :class="{chosen : side_choice == 0}" @click="side_choice = 0"></a>
<a href="#" class="side_choice ambiv beige" :class="{chosen : side_choice == 2}" @click="side_choice = 2"></a>
<a href="#" class="side_choice piece e_ white" :class="{chosen : side_choice == 1}" @click="side_choice = 1"></a>
</div>
<br />
<button v-if="side_choice != -1" class="actionbutton fw" style="height:4cm;" @click="confirm_choice">Confirm choice</button>
</template>
<!-- Board and related stuff -->
<div class="board" v-if="show_board">
<div style="position:relative;" class="innerboard">
<!--Board numbering/lettering-->
<template v-once v-for="i in 16">
<div class="marking lettering" :style="letter_pos(i > 8, (i-1)%8)"><span>{{board_letter((i-1)%8)}}<span></div>
<div class="marking numbering" :style="number_pos(i > 8, (i-1)%8)"><span>{{1+(i-1)%8}}</span></div>
</template>
<!--Pieces -->
<template v-for="gbp in pieces">
<div class="square piece" :class="gbp.css(marked)" :style="[pos(gbp.bp.pos)]" v-on="piece_cb(gbp.bp)">
</div>
</template>
<!-- Markers -->
<template v-if="markers != undefined" v-for="m in markers">
<template v-if="m.trapped.occupied">
<div :style="pos(m.trapped.pos)" class="square skull"></div>
</template>
<div class="square button" :class="m.class" :style="pos(m.to)" @click.stop="m.cb"></div>
</template>
</div>
</div>
<template v-if="!disconnected">
<!-- Current move set -->
<div v-if="your_turn" class="moves" style="font-size:1.4em">
<div class="entry" :class="['w_hist','b_hist'][player]">
<span v-for="m in ts.move_buffer" @click="undo(m)"> {{m.toString()}}</span>
</div>
</div>
<!-- Controls -->
<button class="actionbutton fw" v-if="piece_setup && !sent_setup" @click="send_setup">Confirm piece setup</button>
<div v-if="your_turn" style="display:flex; flex-direction: row; flex-wrap: wrap;">
<button :disabled="moves_made == 0" class="actionbutton" style="flex-grow:4"
@click="undo(undefined)">Undo</button>
<button class="actionbutton" style="flex-grow:1"
@click="end_turn(false)" :disabled="!valid_turn" >End</button>
<button :disabled="moves_made == 0" class="actionbutton" style="flex-grow:4"
@click="reset">Reset</button>
</div>
<!-- Setup and history -->
<div class="moves">
<div v-if="gs.white_setup" class="entry w_hist">{{gs.white_setup}}</div>
<div v-if="gs.black_setup" class="entry b_hist">{{gs.black_setup}}</div>
<div v-for="h, i in gs.move_history" class="entry" :class="['w_hist','b_hist'][i%2]">
<span v-for="m in h"> {{m.toString()}}</span>
</div>
</div>
<!-- Confirmation message -->
<div v-if="confirm != undefined" class="error_screen">
<div class="error_msg" style="display:flex; flex-wrap: wrap; background:#160707;">
<div class="fw" style="text-align:center">{{confirm}}</div>
<div style="height:1em; width:100%"></div>
<button class="actionbutton" style="flex-grow:1" @click="confirm = undefined">Cancel</button>
<button class="actionbutton" style="flex-grow:1" @click="end_turn(true)">Confirm</button>
</div>
</div>
<!-- Error message -->
<div v-if="error != undefined" class="error_screen">
<div class="error_msg">
{{error}}
<br/>
<br/>
<button class="actionbutton fw" @click="error=undefined">Ok</button>
</div>
</div>
</template>
</div>
</body>
</html>