future 1 năm trước cách đây
mục cha
commit
8a0c8ac280
2 tập tin đã thay đổi với 31 bổ sung1 xóa
  1. 30 0
      assets/script/GameManager.ts
  2. 1 1
      assets/script/data.ts

+ 30 - 0
assets/script/GameManager.ts

@@ -71,6 +71,36 @@ export class GameManager extends Component {
         })
     }
 
+    // 获取游戏结束提示索引
+    public static getGameEndPrompt(score:number):number {
+        let cur_index = -1
+        let list = tools.sys_config.game_end_prompt
+        for (let index = 0; index < list.length; index++) {
+            const element = list[index];
+            if(typeof element === "string") {
+                let arr = element.split('_')
+                if(arr.length == 2) {
+                    let start_num = Number(arr[0])
+                    let end_num = Number(arr[1])
+                    // console.log('start_num=',start_num,'end_num=',end_num)
+                    if(list.length-1==index) { //最后一个只判断开始值
+                        if(score>=start_num) {
+                            cur_index = index
+                            break
+                        }
+                    } else {
+                        if(score>=start_num&&score<=end_num) {
+                            cur_index = index
+                            break
+                        }
+                    }
+                }
+            }
+        }
+        // console.log('cur_index=',cur_index)
+        return cur_index
+    }
+
     // 设置
     public static getSettingData():settingData {
         if(GameManager.settingData!=null) {

+ 1 - 1
assets/script/data.ts

@@ -111,7 +111,7 @@ export class sysConfig{
     public free_game_number:number = 0 //今日免费玩游戏次数
     public share_number:number = 0     //今日分享次数
     public share_des:string = ''       //分享描述
-    public game_end_prompt:[] = []     //游戏结束提示
+    public game_end_prompt:string[] = []     //游戏结束提示
 }
 
 export class user_free_ads_data{