Browse Source

修改引导游戏类型

lan 3 years ago
parent
commit
2037a9c059
3 changed files with 21 additions and 2 deletions
  1. 4 2
      assets/script/rule/GuideRule.ts
  2. 1 0
      assets/script/ui/Editor.ts
  3. 16 0
      assets/script/ui/public/GuideUI.ts

+ 4 - 2
assets/script/rule/GuideRule.ts

@@ -2,7 +2,7 @@
 import {Data, Mgr} from '../GameControl'
 import {GuideUI} from '../ui/public/GuideUI'
 import {PathUtils} from '../utils/PathUtils'
-import {ACT_TYPE, PLAY_STATE} from '../enums/Enum'
+import {ACT_TYPE, GAME_TYPE, PLAY_STATE} from '../enums/Enum'
 
 const {ccclass, property} = cc._decorator
 
@@ -397,7 +397,9 @@ export default class GuideRule extends cc.Component {
     }
     editorPlayAudio(audioUrl) {
         if (!CC_EDITOR) return
-        let uuid = Editor.assetdb.remote.urlToUuid('db://assets/gameMathSeme/' + audioUrl + '.mp3')
+        let uuid = Editor.assetdb.remote.urlToUuid(
+            'db://assets/' + GAME_TYPE[this.guideUI.gameType] + 'Seme/' + audioUrl + '.mp3',
+        )
         cc.loader.load({uuid}, (err, clip) => {
             if (!err) {
                 cc.audioEngine.playEffect(clip, false)

+ 1 - 0
assets/script/ui/Editor.ts

@@ -363,6 +363,7 @@ export default class Editor extends cc.Component {
     importGuide(json) {
         this.initStageData(json)
         let guideUI = this.getGameNode().getComponent(GuideUI)
+        guideUI.initCurPart(this.gameType, this.semeID, this.gameID, this.partID)
         guideUI.initUI(json.gameJson, json.guidePage)
     }
     outGuideJson() {

+ 16 - 0
assets/script/ui/public/GuideUI.ts

@@ -2,9 +2,19 @@
 import {BaseUI} from '../BaseUI'
 import {ccUtils} from '../../utils/ccUtils'
 import GuideRule from '../../rule/GuideRule'
+import {GAME_TYPE} from '../../enums/Enum'
 const {ccclass, property} = cc._decorator
 @ccclass
 export class GuideUI extends BaseUI {
+    // 编辑器序列属性
+    @property({visible: false})
+    gameType: GAME_TYPE = GAME_TYPE.gameChild
+    @property({visible: false})
+    semeID: number = 0
+    @property({visible: false})
+    gameID: number = 0
+    @property({visible: false})
+    partID: number = 0
     pages: cc.Node[] = []
     allNodes: cc.Node[][] = []
     curPageRules: GuideRule[] = []
@@ -68,4 +78,10 @@ export class GuideUI extends BaseUI {
             guideRule.reset()
         }
     }
+    initCurPart(gameType, semeID, gameID, partID) {
+        this.gameType = gameType
+        this.semeID = semeID
+        this.gameID = gameID
+        this.partID = partID
+    }
 }