| 
					
				 | 
			
			
				@@ -1,6 +1,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.yingyang.livebroadcast.dialog 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.annotation.SuppressLint 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import android.content.Context 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.os.Bundle 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.text.TextUtils 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.view.LayoutInflater 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -15,12 +16,17 @@ import com.gyf.immersionbar.BarHide 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.gyf.immersionbar.ktx.immersionBar 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yingyang.livebroadcast.R 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yingyang.livebroadcast.entity.GameTasksBean 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yingyang.livebroadcast.net.LivebroadcastServiceFactory 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yingyangfly.baselib.bean.Record 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yingyangfly.baselib.ext.setOnSingleClickListener 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yingyangfly.baselib.net.BaseObserver 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.yingyangfly.baselib.net.MyRxScheduler 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yingyangfly.baselib.router.RouterUrlCommon 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yingyangfly.baselib.utils.GlideImgUtil 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yingyangfly.baselib.utils.GsonUtil 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.yingyangfly.baselib.utils.ViewTool 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import gorden.rxbus2.RxBus 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import io.reactivex.schedulers.Schedulers 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * 专属游戏任务弹窗 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -33,6 +39,9 @@ class GameTasksDialog : DialogFragment() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private var tvGameDifficulty: AppCompatTextView? = null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private var btnGame: AppCompatButton? = null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private var gameData: String = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private var content: Context? = null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private var gameTotalScore = "" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private var record: Record? = null 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     fun setData(data: String) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         gameData = data 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -66,11 +75,35 @@ class GameTasksDialog : DialogFragment() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         val rootView = ViewTool.inflateFragmentPixels( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             activity, R.layout.dialog_game_tasks, container, 1194, 834 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        content = activity 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         findId(rootView) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         init() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return rootView 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 获取游戏详情 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private fun getGameDetail(id: String) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (TextUtils.isEmpty(id).not()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            LivebroadcastServiceFactory.getService() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .getGameDetail(id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .subscribeOn(Schedulers.io()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .compose(MyRxScheduler.ioMain(content!!, true)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .subscribe(object : BaseObserver<Record>() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    override fun onSuccess(t: Record?) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        if (t != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            record = t 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            gameTotalScore = t.gameScore 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    override fun onFail(msg: String) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private fun findId(rootView: View) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         gameImage = rootView.findViewById(R.id.gameImage) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         tvGameType = rootView.findViewById(R.id.tvGameType) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -88,6 +121,7 @@ class GameTasksDialog : DialogFragment() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 tvGameType!!.text = "游戏类型:" + gameTasksBean.gameTypeName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 tvGameName!!.text = "游戏名称:" + gameTasksBean.gameName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 tvGameDifficulty!!.text = "游戏难度:" + gameDifficultyInfo(gameTasksBean.gameDifficulty) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                getGameDetail(gameTasksBean.id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             btnGame!!.setOnSingleClickListener { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (gameTasksBean != null) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -96,7 +130,7 @@ class GameTasksDialog : DialogFragment() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         .withString("playClass", "A") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         .withString("url", gameTasksBean.url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         .withString("gameType", gameTasksBean.gameType) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        .withString("gameTotalScore", gameTasksBean.gameTotalScore) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        .withString("gameTotalScore", gameTotalScore) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         .withString("gameInbetweenImage", gameTasksBean.gameInbetweenImage) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         .withString("gameBackgroundImage", gameTasksBean.gameBackgroundImage) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         .withString("gameShortDesn", gameTasksBean.gameShortDesn) 
			 |