Update Tutorial Structure

This commit is contained in:
bigJIU 2023-03-03 12:44:34 +08:00
parent d4f0a160d1
commit 85fde930f8
7 changed files with 42 additions and 21 deletions

10
.idea/workspace.xml generated
View File

@ -3,10 +3,10 @@
<component name="ChangeListManager">
<list default="true" id="c32bfd4e-6189-47f3-9d6c-c1825d3d7e5f" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/reps/f_l_sav.rep" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/reps/f_l_sav.rep" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/core/MarioGame.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/core/MarioGame.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/core/MarioWorld.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/core/MarioWorld.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data/questionare.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data/questionare.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/src/Play.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/Play.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/helper/Replay.java" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface/src/engine/helper/Replay.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/GameTutorial.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/GameTutorial.html" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -213,7 +213,7 @@
<workItem from="1677563906178" duration="5318000" />
<workItem from="1677572224495" duration="2432000" />
<workItem from="1677595224096" duration="799000" />
<workItem from="1677674512203" duration="2230000" />
<workItem from="1677674512203" duration="3759000" />
</task>
<servers />
</component>

View File

@ -26,6 +26,7 @@ public class Play {
//FIXME: Debug Use
//playGameMain("lvl1");
playJavaGame();
System.out.println("Java: Play Java Main Function Done");
}

View File

@ -29,7 +29,6 @@ public class Replay {
byte[] content = new byte[events.size()];
for (int i = 0; i < events.size(); i++) {
boolean[] action = events.get(i).getActions();
// System.out.println(action);
content[i] = serializeAction(action);
}
return content;

Binary file not shown.

View File

@ -208,3 +208,4 @@ IP,Style,Frequency,Age,Gender
1,A,A,A,B,A,A,,
2,A,A,A,A,A,A,,
1,A,A,A,A,A,A,,
1,A,A,A,A,A,A,,

1 IP,Style,Frequency,Age,Gender
208 1,A,A,A,B,A,A,,
209 2,A,A,A,A,A,A,,
210 1,A,A,A,A,A,A,,
211 1,A,A,A,A,A,A,,

View File

@ -53,7 +53,7 @@ def gamepreplay():
@app.route('/gametutorial/<id>')
def gametutorial(id):
return render_template('GameTutorial.html', tutorial=idm.addTutorial(id), next=idm.hasNextTutorial(id),
return render_template('GameTutorial.html', tutorial=idm.addTutorial(id), next=idm.hasNextTutorial(id),maxT=idm.tutorialMax,
control=idm.getControl(id))

View File

@ -213,9 +213,36 @@
<div class="col-md-6" align="center" style="visibility: hidden;" id = "next">
<br>
<button onclick="
window.location.href = window.location.href;
" class="cirButton"><h3>Repeat Tutorial</h3></button>
<button onclick='
//Init Cheerpj Framework
document.getElementById("game").style.visibility = "hidden";
document.getElementById("next").style.visibility = "hidden";
//var divElement = document.getElementById("GameWindow");
tutorialId = tutorialId+1
var level = "t"+tutorialId;
var img=document.getElementById("windowshow");
GameLoad().then(function(){
console.log("Cheerpj Initialize Succeed!");
document.getElementById("loading").style.visibility = "hidden";
})
var control = ("{{control}}" == "1");
PlayLevel(level,control)
.then(function (){
//play next?
if (tutorialId<parseInt("{{maxT}}")){
document.getElementById("next").style.visibility = "visible";
}
document.getElementById("game").style.visibility = "visible";
});
' class="cirButton"><h3>Repeat Tutorial</h3></button>
</div>
<div class="col-md-6" align="center" style="visibility: hidden;" id = "game">
<br>
@ -226,19 +253,12 @@
<script>
//Init Cheerpj Framework
cheerpjInit();
var divElement = document.getElementById("GameWindow");
var tutorialId = parseInt("{{tutorial}}")
var level = "t"+"{{tutorial}}";
var img=document.getElementById("windowshow");
if ("{{next}}"=="1"){
img.style.visibility= "visible";
}else{
img.style.visibility= "hidden";
}
cheerpjCreateDisplay(500,500,divElement);
cheerpjRunMain("Play", "/app/Mario-AI-Interface.jar", "0", "f_l");
@ -253,10 +273,10 @@
PlayLevel(level,control)
.then(function (){
//play next?
if ("{{next}}"=="1"){
if (tutorialId<parseInt("{{maxT}}")){
document.getElementById("next").style.visibility = "visible";
}
document.getElementById("game").style.visibility = "visible";
document.getElementById("game").style.visibility = "visible";
});