Permalink
Browse files

add room is running page with testy buttons

  • Loading branch information...
ilanpillemer committed Aug 2, 2017
1 parent 1b06546 commit f8b6992d9a21c24bff191058514464ba2e02728f
@@ -18,7 +18,7 @@ class HomeController @Inject()(cc: ControllerComponents)
Ok(views.html.index())
}
def ws: WebSocket = WebSocket.accept[String, String] { request =>
def room: WebSocket = WebSocket.accept[String, String] { request =>
ActorFlow.actorRef { out =>
RoomActor.props(out)
}
@@ -71,7 +71,7 @@ object RoomActor {
def isDirection (payload : String) = contentOf(payload) match {
case x if x.length >= 5 => {
contentOf(payload).substring(4,5) match {
contentOf(payload).substring(4,5).toUpperCase match {
case "N" | "S" | "W" | "E" => true
case _ => false
}
@@ -101,8 +101,6 @@ object RoomActor {
userid -> "you attempt an unimplemented command"
),
"bookmark" -> "!*?#"
)
def move(direction : String) : JsValue = direction.substring(0, 1).toUpperCase match {
View
@@ -1,5 +1,26 @@
@()
@main("Welcome to Play") {
<h1>Welcome to Play!</h1>
@main("sample scala room") {
<div class="jumbotron">
<h1>Welcome to your sample scala room running on play!</h1>
<p>This is a template for a starter scala/play based room in game-on. Use it as a starting point to create something more unique by building on or modifying it.</p>
</div>
<p>
<button type="button" onclick="roomHello()" class="btn btn-default">Hello</button>
<button type="button" onclick="argh()" class="btn btn-primary">Do Undefined</button>
<button type="button" onclick="roomGoodbye()" class="btn btn-success">Goodbye</button>
<button type="button" onclick="chat()" class="btn btn-info">chat</button>
<button type="button" onclick="play()" class="btn btn-warning">Play</button>
<button type="button" onclick="gowest()" class="btn btn-danger">Go west</button>
</p>
<p>
<button type="button" onclick="clearScreen()" class="btn btn-default">Clear Output</button>
</p>
<div class="panel panel-info">
<div class="panel-heading">
<h3 class="panel-title">Web Socket Latest Response</h3>
</div>
<div id="output" class="panel-body"></div>
</div>
}
View
@@ -1,25 +1,31 @@
@*
* This template is called from the `index` template. This template
* handles the rendering of the page header and body tags. It takes
* two arguments, a `String` for the title of the page and an `Html`
* object to insert into the body of the page.
*@
* This template is called from the `index` template. This template
* handles the rendering of the page header and body tags. It takes
* two arguments, a `String` for the title of the page and an `Html`
* object to insert into the body of the page.
*@
@(title: String)(content: Html)
<!DOCTYPE html>
<html lang="en">
<head>
@* Here's where we render the page title `String`. *@
<title>@title</title>
<link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/main.css")">
<link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
@* Here's where we render the page title `String`. *@
<title>@title</title>
<link rel="stylesheet" media="screen" href="@routes.Assets.versioned("stylesheets/bootstrap.css")">
<link rel="shortcut icon" type="image/png" href="@routes.Assets.versioned("images/favicon.png")">
</head>
<body>
@* And here's where we render the `Html` object containing
* the page content. *@
@content
</head>
<body>
@* And here's where we render the `Html` object containing
* the page content. *@
@content
<script src="@routes.Assets.versioned("javascripts/main.js")" type="text/javascript"></script>
</body>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="@routes.Assets.versioned("javascripts/jquery.min.js")" type="text/javascript"></script>
<script src="@routes.Assets.versioned("javascripts/bootstrap.js")" type="text/javascript"></script>
<script src="@routes.Assets.versioned("javascripts/main.js")" type="text/javascript"></script>
</body>
</html>
View
@@ -1 +1,2 @@
# https://www.playframework.com/documentation/latest/Configuration
play.filters.headers.contentSecurityPolicy = "default-src 'self' 'unsafe-inline' ws://localhost:9000/room"
View
@@ -5,7 +5,7 @@
# An example controller showing a sample home page
GET / controllers.HomeController.index
GET /ws controllers.HomeController.ws
GET /room controllers.HomeController.room
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
Oops, something went wrong.

0 comments on commit f8b6992

Please sign in to comment.