Radio Done

This commit is contained in:
bigJIU 2022-10-24 22:17:55 +08:00
parent f5563685b2
commit 0004823617
4 changed files with 168 additions and 32 deletions

7
.idea/workspace.xml generated
View File

@ -2,12 +2,9 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c32bfd4e-6189-47f3-9d6c-c1825d3d7e5f" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Mario-AI-Interface.jar.js" beforeDir="false" afterPath="$PROJECT_DIR$/Mario-AI-Interface.jar.js" 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$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/play.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/play.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/eval.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/eval.html" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -108,6 +105,6 @@
</option>
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/MarioWeb$Flask__main_py_.coverage" NAME="Flask (main.py) Coverage Results" MODIFIED="1666606996030" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
<SUITE FILE_PATH="coverage/MarioWeb$Flask__main_py_.coverage" NAME="Flask (main.py) Coverage Results" MODIFIED="1666620093891" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="" />
</component>
</project>

Binary file not shown.

10
main.py
View File

@ -21,7 +21,15 @@ def eval():
@app.route('/', methods=['POST'])
def getData():
def getJSONData():
if request.method == 'POST':
print("POST")
print(request.json)
return redirect(url_for('datapage'))
@app.route('/', methods=['POST'])
def getRadioData():
if request.method == 'POST':
print("POST")
print(request.json)

View File

@ -3,40 +3,171 @@
<head>
<meta charset="utf-8">
<script src="https://cjrtnc.leaningtech.com/2.3/loader.js"></script>
<style>
*{
margin: 0;
padding: 0;
}
.popwindow {
width:500px;
height:550px;
border:3px solid #ff928e;
visibility: hidden;
position: absolute;
z-index: 999;
opacity: 1;
overflow: hidden;
background-color: white;
text-align: center;
margin-top: 10%;
margin-left: 35%;
border-radius: 10px;
}
.leftInfoBlock{
margin-top: 20px;
height: 180px;
background: #f1a087;
}
.leftInfo {
width: 90%;
top: 20px;
position:absolute;
background: #f7a2a2;
}
.rightQuery{
width: 10%;
left: 90%;
height: 400px;
top: 20px;
position:absolute;
background: #a19cee;
}
.circleButton{
align-items: center;
border-radius:50%;
border: none
}
.pararadio{
height: 20%;
}
</style>
</head>
<div id="replayWindow">
<div id="replayWindow" class="popwindow">
<div id="replayWindowGame">
</div>
<div align="center"><button onClick="closeReplayWindow()">Close Window</button></div>
</div>
<body>
<div align="center"><button onClick="Replay('test1')">Replay Game1</button></div>
<div align="center"><button onClick="Replay('test2')">Replay Game2</button></div>
<script>
//The Funtions
function closeReplayWindow(){
var replayWindow=document.getElementById("replayWindow");
replayWindow.style.visibility = 'hidden';
}
function Replay(id){
var replayWindow=document.getElementById("replayWindow");
replayWindow.style.visibility = 'visible';
cjCall("Play", "replayGameMain", id, id);
}
window.onload=function(){
<body>
<div class = "leftInfo">
<div class = "leftInfoBlock">
<h3 align = "center"> Game 1</h3>
<img src="../levels/test1.png" width="100%" >
<div align="center"><button onClick="Replay('test1')">Replay Game1</button></div>
</div>
<div class = "leftInfoBlock">
<h3 align = "center"> Game 2</h3>
<img src="../levels/test2.png" width="100%" >
<div align="center"><button onClick="Replay('test2')">Replay Game2</button></div>
</div>
<script>
//The Funtions
function closeReplayWindow(){
var replayWindow=document.getElementById("replayWindow");
replayWindow.style.visibility = 'hidden';
}
function Replay(id){
var replayWindow=document.getElementById("replayWindow");
replayWindow.style.visibility = 'visible';
cjCall("Play", "replayGameMain", id, id);
}
function getValue(){
var radio = document.getElementsByName("gameRadio");
for (i=0; i<radio.length; i++) {
if (radio[i].checked) {
alert(radio[i].value)
}
}
}
window.onload=function(){
closeReplayWindow();
}
</script>
<script>
cheerpjInit();
var divElement = document.getElementById("replayWindowGame");
cheerpjCreateDisplay(500,500,divElement);
cheerpjRunMain("Play", "/app/Mario-AI-Interface.jar", "0", "f_l");
closeReplayWindow();
}
</script>
<script>
cheerpjInit();
var divElement = document.getElementById("replayWindowGame");
cheerpjCreateDisplay(500,500,divElement);
cheerpjRunMain("Play", "/app/Mario-AI-Interface.jar", "0", "f_l");
closeReplayWindow();
</script>
</script>
</div>
<div class = "rightQuery">
<!-- <button class = "circleButton" style = "width: 100px; height: 100px;"></button>
<button class = "circleButton" style = "width: 60px; height: 60px;"></button>
<button class = "circleButton" style = "width: 40px; height: 40px;"></button>
<button class = "circleButton" style = "width: 60px; height: 60px;"></button>
<button class = "circleButton" style = "width: 100px; height: 100px;"></button> -->
<fieldset style="height: 100%;" >
<legend align="center" height = 30px >Fun</legend>
<div class = "pararadio">
<input type="radio" value="1-2" name="fun">
<label for="gameRadio">Game1 Better</label>
</div>
<div class = "pararadio">
<input type="radio" value="1-1" name="fun">
<label for="gameRadio">Game1 Good</label>
</div>
<div class = "pararadio">
<input type="radio" value="0-0" name="fun">
<label for="gameRadio">Equal</label>
</div>
<div class = "pararadio">
<input type="radio" value="2-1" name="fun">
<label for="gameRadio">Game2 Good</label>
</div>
<div class = "pararadio">
<input type="radio" value="2-2" name="fun">
<label for="gameRadio">Game2 Better</label>
</div>
</fieldset>
<script>
function getRadioValue(){
var obj = document.getElementsByName("fun");
for(var i=0; i<obj.length; i ++){
if(obj[i].checked){
alert(obj[i].value);
}
}
// var radio = document.getElementsByName("gameRadio");
// var addressID = $("input[name='sex']:checked").val();
// alert(addressID)
}
</script>
<button onclick="getRadioValue()"> Submit </button>
</div>
</body>