diff --git a/src/Game/Game.fsproj b/src/Game/Game.fsproj index 589a770..67b6245 100644 --- a/src/Game/Game.fsproj +++ b/src/Game/Game.fsproj @@ -5,7 +5,7 @@ - + diff --git a/src/Server/Program.fs b/src/Server/Program.fs index 66e2362..1ede707 100644 --- a/src/Server/Program.fs +++ b/src/Server/Program.fs @@ -22,6 +22,7 @@ open Game.Game let moveHandler (next: HttpFunc) (ctx: HttpContext) = task { let! cmd = ctx.BindJsonAsync() + printfn "%O" cmd |> ignore Current.cmd cmd |> ignore return! (json Current.JSON) next ctx } @@ -32,6 +33,7 @@ let webApp = choose [ route "/" >=> htmlFile "WebRoot/index.html" route "/map" >=> json Current.JSON + route "/test" >=> json (Move South) ] POST >=> choose [ diff --git a/src/Server/Server.fsproj b/src/Server/Server.fsproj index 1840246..448b5f2 100644 --- a/src/Server/Server.fsproj +++ b/src/Server/Server.fsproj @@ -10,7 +10,7 @@ - + diff --git a/src/Server/WebRoot/index.html b/src/Server/WebRoot/index.html index d71ff1c..ba839e6 100644 --- a/src/Server/WebRoot/index.html +++ b/src/Server/WebRoot/index.html @@ -9,7 +9,12 @@

Dis my dumb game

- +
+ + + + +
\ No newline at end of file diff --git a/src/Server/WebRoot/main.js b/src/Server/WebRoot/main.js index 9f6c97b..7c8540b 100644 --- a/src/Server/WebRoot/main.js +++ b/src/Server/WebRoot/main.js @@ -33,13 +33,11 @@ let app = new Vue({ // sendCommand will be wired to the various keybinds // each binding should send the game command expected sendCommand: function (direction) { - if (direction == 'south') { - direction = {Case: 'South'} - } - axios.post("/cmd", direction) + let move = {"case": "Move", "fields": [{"case": direction}]} + axios.post("/cmd", move) .then(resp => { console.log("Got data from cmd:\n", resp) - this.board = resp.data; + this.state = resp.data; this.draw() }) .catch(err => this.err = err);