Permalink
Browse files

added multiplayer

  • Loading branch information...
1 parent e2c830c commit 3597d84f9096742f0128a731872ea5fb7745d896 @sharadmv committed Dec 29, 2011
View
@@ -8,7 +8,7 @@
<property name="metainf.dir" location="war/META-INF" />
<property name="dist.dir" location="dist" />
<property name="gwt.entrypoint.class" value="com.sharad.quizbowl.ui.client.QuizbowlUI" />
- <property name="gwt.sdk.location" location="/usr/lib/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.r37v201109211906/gwt-2.4.0/" />
+ <property name="gwt.sdk.location" location="/home/sharadv/.eclipse/org.eclipse.platform_3.7.0_1473617060/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201112160242-rel-r37/gwt-2.4.0/" />
<!-- Include property values -->
<property file="build.properties" />
@@ -41,6 +41,7 @@
import com.sharad.quizbowl.ui.client.widget.Chatroom;
import com.sharad.quizbowl.ui.client.widget.FilterBar;
import com.sharad.quizbowl.ui.client.widget.FilterBox;
+import com.sharad.quizbowl.ui.client.widget.MultiReader;
import com.sharad.quizbowl.ui.client.widget.Reader;
import com.sharad.quizbowl.ui.client.widget.SimpleSearch;
import com.sharad.quizbowl.ui.client.widget.SimpleSearch.Configuration;
@@ -82,7 +83,7 @@
public FlowPanel horizontalPanel;
public LayoutPanel centerPanel;
@UiField
- DockLayoutPanel searchPanel;
+ DockLayoutPanel searchPanel, multiReaderPanel;
public SimpleSearch search;
private TossupPanel tossupPanel;
@UiField(provided = true)
@@ -106,11 +107,13 @@
@UiField
UserBox userBox;
@UiField
- Button startButton;
+ static Button startButton;
+ static MultiReader multiReader;
public HomeWidget(JsArrayInteger years, JsArrayString tournaments,
JsArrayString difficulties, JsArrayString categories) {
loginDialog = new DialogBox();
+ multiReader = new MultiReader();
readerBox = new FilterBox(years, tournaments, difficulties, categories,
false, "", "Generate");
readerBox.addFilterEventHandler(new FilterEventHandler() {
@@ -184,6 +187,7 @@ public void onAnswerReceived(AnswerEvent event) {
});
initWidget(main);
+ multiReaderPanel.add(multiReader);
loginBox.addLoginEventHandler(new LoginEventHandler() {
@Override
@@ -271,8 +275,10 @@ public void onClick(ClickEvent event) {
public void onClick(ClickEvent event) {
loginDialog.hide();
LOGGED_IN = false;
+ startButton.setEnabled(LOGGED_IN);
USERNAME = null;
login.setText("Log In");
+ logout();
}
@@ -285,17 +291,30 @@ public void onClick(ClickEvent event) {
}
});
+ startButton.setEnabled(LOGGED_IN);
startButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- Window.alert("Under construction!");
+ if (LOGGED_IN) {
+ startGame();
+ } else {
+ Window.alert("Please log in");
+ }
}
});
}
+ protected static native void logout()/*-{
+ $wnd.now.logout();
+ }-*/;
+
+ protected static native void startGame()/*-{
+ $wnd.now.startGame();
+ }-*/;
+
public void readTossups(HashMap<String, List<String>> params) {
String parameters = "";
String delimiter = "";
@@ -463,6 +482,7 @@ public static void changeTab(String tab) {
public static void loggedIn(boolean loggedIn, String username) {
LOGGED_IN = loggedIn;
+ startButton.setEnabled(LOGGED_IN);
if (LOGGED_IN) {
USERNAME = username;
login.setText(USERNAME);
@@ -56,9 +56,6 @@
<g:north size="60">
<g:Button ui:field="startButton">Start</g:Button>
</g:north>
- <g:center>
- <my:MultiReader ui:field="multiReader" />
- </g:center>
<g:east size="250">
<my:Chatroom ui:field="chatroom">
</my:Chatroom>
@@ -139,6 +139,7 @@ public void run() {
sb.append(delimiter).append(split[i]);
delimiter = " ";
}
+ // speak(split[wordCount]);
readArea.setText(sb.toString());
wordCount++;
if (reading)
@@ -156,6 +157,10 @@ public void run() {
fireEvent(event);
}
+ protected native void speak(String string)/*-{
+ $wnd.speak(string);
+ }-*/;
+
private int convertSliderToSleed(float value) {
return (int) (2019.19 - 19.1919 * value);
}
View
@@ -28,13 +28,48 @@
<script type="text/javascript" src="sha1.js"></script>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
-<script
+<script type="text/javascript"
src="http://ec2-50-17-57-153.compute-1.amazonaws.com:8080/nowjs/now.js"></script>
+<!-- <script type="text/javascript" -->
+<!-- src="http://www.speechapi.com/static/lib/speechapi-1.3.js"></script> -->
+<!-- <script type="text/javascript" -->
+<!-- src="http://www.speechapi.com/static/lib/swfobject.js"></script> -->
+
<script>
now.receiveMessage = function(name, message) {
displayText(name + ": " + message);
}
</script>
+<!-- <script type="text/javascript">
+// function onLoaded() {
+// document.getElementById('flashContent').style.display = 'none'
+
+// }
+
+// //var flashvars = {speechServer : "rtmp://www.speechapi.com:1935/firstapp"};
+// var flashvars = {
+// speechServer : "http://www.speechapi.com:8000/speechcloud"
+// };
+// var params = {
+// allowscriptaccess : "always"
+// };
+// var attributes = {};
+// attributes.id = "flashContent";
+// swfobject.embedSWF("http://www.speechapi.com/static/lib/speechapi-1.5.swf",
+// "myAlternativeContent", "215", "138", "9.0.28", false, flashvars,
+// params, attributes);
+// speechapi.setup("say-demo", "password", onResult, onFinishTTS, onLoaded,
+// "flashContent");
+
+// function onResult(result) {
+// }
+// function onFinishTTS() {
+// }
+
+// function speak(val) {
+// speechapi.speak(val, "male");
+// }
+</script> -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push([ '_setAccount', 'UA-27408653-1' ]);
@@ -63,6 +98,8 @@
<!-- OPTIONAL: include this if you want history support -->
<iframe id="__gwt_historyFrame" style="width: 0; height: 0; border: 0"></iframe>
+<!-- <div id="myAlternativeContent"></div> -->
+<!-- <div id="flashContent"></div> -->
</body>
</html>

0 comments on commit 3597d84

Please sign in to comment.