|
|
@@ -5,6 +5,30 @@
|
|
|
:src="gameUrl"
|
|
|
frameborder="0"
|
|
|
/>
|
|
|
+ <!-- 左上角按钮 -->
|
|
|
+ <div class="btn-group">
|
|
|
+ <button
|
|
|
+ class="return-home"
|
|
|
+ :style="{
|
|
|
+ backgroundImage: `url(${returnHomeBtnBgImgUrl})`,
|
|
|
+ }"
|
|
|
+ @click="onClickReturnHome"
|
|
|
+ />
|
|
|
+ <button
|
|
|
+ v-if="store.state.gameRuleList[gameRuleConfig.idxInGameRule].rtf"
|
|
|
+ class="game-rule"
|
|
|
+ :style="{
|
|
|
+ backgroundImage: `url(${gameRuleBtnBgImgUrl})`,
|
|
|
+ }"
|
|
|
+ @click="isShowRule = true"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <GameRule
|
|
|
+ v-show="isShowRule"
|
|
|
+ :game-title="gameRuleConfig.title"
|
|
|
+ :rich-text="store.state.gameRuleList[gameRuleConfig.idxInGameRule].rtf"
|
|
|
+ @close="isShowRule=false"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -12,11 +36,17 @@
|
|
|
import { ref, computed, watch, onMounted } from "vue"
|
|
|
import { useRoute, useRouter } from "vue-router"
|
|
|
import { useStore } from "vuex"
|
|
|
+import GameRule from '@/components/GameRule.vue'
|
|
|
|
|
|
const route = useRoute()
|
|
|
const router = useRouter()
|
|
|
const store = useStore()
|
|
|
|
|
|
+const {
|
|
|
+ windowSizeInCssForRef,
|
|
|
+ windowSizeWhenDesignForRef,
|
|
|
+} = useSizeAdapt(390, 752)
|
|
|
+
|
|
|
let gameUrlQuery = ''
|
|
|
if (store.state.loginStatus) {
|
|
|
gameUrlQuery = `?userId=${store.state.userInfo.id}&token=${store.state.token}`
|
|
|
@@ -27,9 +57,45 @@ const gameUrlMap = {
|
|
|
EnviromentProtection: `unity/enviroment-protection/index.html${gameUrlQuery}#/`,
|
|
|
LostChildren: `unity/lost-children/index.html${gameUrlQuery}#/`,
|
|
|
}
|
|
|
-
|
|
|
const gameUrl = gameUrlMap[route.query.gameName]
|
|
|
|
|
|
+const floatingBtnFileNameAffixMap = {
|
|
|
+ AntibodyBattle: ``,
|
|
|
+ DisasterRelief: ``,
|
|
|
+ EnviromentProtection: ``,
|
|
|
+ LostChildren: `_dark`,
|
|
|
+}
|
|
|
+const floatingBtnFileNameAffix = floatingBtnFileNameAffixMap[route.query.gameName]
|
|
|
+const returnHomeBtnBgImgUrl = require(`@/assets/images/icon_home${floatingBtnFileNameAffix}.png`)
|
|
|
+const gameRuleBtnBgImgUrl = require(`@/assets/images/icon_rules${floatingBtnFileNameAffix}.png`)
|
|
|
+
|
|
|
+function onClickReturnHome() {
|
|
|
+ router.push({
|
|
|
+ name: 'HomeView',
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const gameRuleConfigMap = {
|
|
|
+ AntibodyBattle: {
|
|
|
+ title: '抗体大作战',
|
|
|
+ idxInGameRule: 3,
|
|
|
+ },
|
|
|
+ DisasterRelief: {
|
|
|
+ title: '应急救灾',
|
|
|
+ idxInGameRule: 4,
|
|
|
+ },
|
|
|
+ EnviromentProtection: {
|
|
|
+ title: '生态保护',
|
|
|
+ idxInGameRule: 5,
|
|
|
+ },
|
|
|
+ LostChildren: {
|
|
|
+ title: '找回走失儿童',
|
|
|
+ idxInGameRule: 6,
|
|
|
+ },
|
|
|
+}
|
|
|
+const gameRuleConfig = gameRuleConfigMap[route.query.gameName]
|
|
|
+const isShowRule = ref(false)
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
@@ -46,5 +112,27 @@ const gameUrl = gameUrlMap[route.query.gameName]
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
+ >.btn-group{
|
|
|
+ position: absolute;
|
|
|
+ top: calc(36 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ right: calc(12 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ gap: calc(16 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ >button.return-home{
|
|
|
+ background-size: contain;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-position: center center;
|
|
|
+ width: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ height: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ }
|
|
|
+ >button.game-rule{
|
|
|
+ background-size: contain;
|
|
|
+ background-repeat: no-repeat;
|
|
|
+ background-position: center center;
|
|
|
+ width: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ height: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|