From 046174d13aeee8ed585ab2d4e28b8bce272e0217 Mon Sep 17 00:00:00 2001
From: lmw <125975490@qq.com>
Date: 星期三, 19 六月 2024 17:25:40 +0800
Subject: [PATCH] 文件管理权限移到里面

---
 app/src/main/java/com/dollearn/student/ui/home/ResultActivity.kt |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/app/src/main/java/com/dollearn/student/ui/home/ResultActivity.kt b/app/src/main/java/com/dollearn/student/ui/home/ResultActivity.kt
index ab565eb..283da05 100644
--- a/app/src/main/java/com/dollearn/student/ui/home/ResultActivity.kt
+++ b/app/src/main/java/com/dollearn/student/ui/home/ResultActivity.kt
@@ -1,6 +1,8 @@
 package com.dollearn.student.ui.home
 
 import android.content.Context
+import cn.sinata.xldutils.gone
+import cn.sinata.xldutils.visible
 import com.dollearn.student.MainActivity
 import com.dollearn.student.R
 import com.dollearn.student.network.HttpManager
@@ -27,8 +29,14 @@
     private val score by lazy { intent.getIntExtra("score",0) }
     private val time by lazy { intent.getIntExtra("time",0) }
 
+    private val difficulty by lazy { intent.getIntExtra("difficulty",0) } //游戏难度
+
     override fun initClick() {
         tv_last.setOnClickListener {
+            startActivity<MainActivity>()
+        }
+
+        tv_back.setOnClickListener {
             startActivity<MainActivity>()
         }
 
@@ -45,14 +53,41 @@
         tv_fault.text = "${total-right}次"
         val rate = (right * 100) / total
         tv_rate.text = "正确率:$rate%"
-
-        HttpManager.completeLearning(rate,time,day,week,season,type,id?:"").request(this){_,data->
+        when(type){
+            6->{
+                title = "超级听力"
+                tv_back.visible()
+                tv_last.gone()
+                tv_exit.gone()
+                HttpManager.gameAchievement(rate,difficulty,id?:"","超级听力",time).request(this){_,data->
+                }
+            }
+            7->{
+                title = "超级记忆"
+                tv_back.visible()
+                tv_last.gone()
+                tv_exit.gone()
+                HttpManager.gameAchievement(rate,difficulty,id?:"","超级记忆",time).request(this){_,data->
+                }
+            }
+            8->{
+                tv_back.visible()
+                tv_last.gone()
+                tv_exit.gone()
+                HttpManager.completeStory(rate,type,id?:"").request(this){_,data->
+                }
+            }
+            else->{
+                HttpManager.completeLearning(rate,time,day,week,season,type,id?:"").request(this){_,data->
+                }
+            }
         }
     }
 
     companion object{
-        fun startResult(context:Context,day:Int,week:Int,season:Int,type:Int,total:Int,right:Int,score:Int,time:Int,id:String){
-            context.startActivity<ResultActivity>("day" to day,"week" to week,"season" to season,"type" to type,"total" to total,"right" to right,"score" to score,"time" to time,"id" to id)
+        fun startResult(context:Context,day:Int,week:Int,season:Int,type:Int,total:Int,right:Int,score:Int,time:Int,id:String,difficulty:Int? = null){
+            context.startActivity<ResultActivity>("day" to day,"week" to week,"season" to season,"type" to type,"total" to total,"right" to right,"score" to score,
+                "time" to time,"id" to id,"difficulty" to difficulty)
         }
     }
 }

--
Gitblit v1.7.1