From 2687a0e50b3543af3daf542f12c272d1ea8dff99 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Wed, 22 Feb 2023 20:23:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E5=B0=B1=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components.d.ts | 2 + public/libs/control.js | 2 +- public/libs/loader.js | 15 -- src/data/achievement.json | 26 +-- src/plugin/ui/achievement.ts | 14 ++ src/plugin/uiController.ts | 5 +- src/types/plugin.d.ts | 3 + src/ui/achievement.vue | 325 ++++++++++++++++++++++++++++++++++- src/ui/start.vue | 16 +- 9 files changed, 378 insertions(+), 30 deletions(-) create mode 100644 src/plugin/ui/achievement.ts diff --git a/components.d.ts b/components.d.ts index 4e8ab88..6ebc023 100644 --- a/components.d.ts +++ b/components.d.ts @@ -8,6 +8,7 @@ export {} declare module '@vue/runtime-core' { export interface GlobalComponents { ADivider: typeof import('ant-design-vue/es')['Divider'] + AProgress: typeof import('ant-design-vue/es')['Progress'] ASelect: typeof import('ant-design-vue/es')['Select'] ASelectOption: typeof import('ant-design-vue/es')['SelectOption'] ASlider: typeof import('ant-design-vue/es')['Slider'] @@ -17,5 +18,6 @@ declare module '@vue/runtime-core' { Colomn: typeof import('./src/components/colomn.vue')['default'] EnemyOne: typeof import('./src/components/enemyOne.vue')['default'] Scroll: typeof import('./src/components/scroll.vue')['default'] + TextedProgress: typeof import('./src/components/textedProgress.vue')['default'] } } diff --git a/public/libs/control.js b/public/libs/control.js index 31b5783..47ce82f 100644 --- a/public/libs/control.js +++ b/public/libs/control.js @@ -502,7 +502,7 @@ control.prototype.showStartAnimate = function (noAnimate, callback) { }; control.prototype._showStartAnimate_resetDom = function () { - core.plugin.loaded.value = true; + if (main.mode === 'play') core.plugin.loaded.value = true; core.status.played = false; core.dom.gameGroup.style.display = 'none'; core.clearStatus(); diff --git a/public/libs/loader.js b/public/libs/loader.js index 5081c43..dbd8795 100644 --- a/public/libs/loader.js +++ b/public/libs/loader.js @@ -245,7 +245,6 @@ loader.prototype._loadTilesets_sync = function (callback) { core.tilesets, core.material.images.tilesets, function () { - core.loader._loadTilesets_afterLoad(); callback(); } ); @@ -259,25 +258,11 @@ loader.prototype._loadTilesets_async = function (onprogress, onfinished) { core.material.images.tilesets, onprogress, function () { - core.loader._loadTilesets_afterLoad(); onfinished(); } ); }; -loader.prototype._loadTilesets_afterLoad = function () { - // 检查宽高是32倍数,如果出错在控制台报错 - for (var imgName in core.material.images.tilesets) { - var img = core.material.images.tilesets[imgName]; - if (img.width % 32 != 0 || img.height % 32 != 0) { - console.warn('警告!' + imgName + '的宽或高不是32的倍数!'); - } - if (img.width * img.height > 32 * 32 * 3000) { - console.warn('警告!' + imgName + '上的图块素材个数大于3000!'); - } - } -}; - // ------ 实际加载一系列图片 ------ // loader.prototype.loadImages = function (dir, names, toSave, callback) { diff --git a/src/data/achievement.json b/src/data/achievement.json index 006c3bf..801a232 100644 --- a/src/data/achievement.json +++ b/src/data/achievement.json @@ -1,5 +1,5 @@ { - "challenge": [ + "normal": [ { "name": "虚惊一场", "text": [ @@ -7,6 +7,15 @@ ], "point": 30 }, + { + "name": "真能刷", + "text": [ + "勇气之路的刷血怪刷到 15w 以上的血" + ], + "point": 30 + } + ], + "challenge": [ { "name": "逃出生天", "text": [ @@ -14,13 +23,6 @@ ], "point": 20 }, - { - "name": "真能刷", - "text": [ - "勇气之路的刷血怪刷到 15w 以上的血" - ], - "point": 30 - }, { "name": "冰与火之舞", "text": [ @@ -35,7 +37,8 @@ "text": [ "第一章完成度达到100%" ], - "progress": "", + "progress": "100 / 100", + "percent": true, "point": 50 }, { @@ -43,6 +46,7 @@ "text": [ "与山路上的若干个神秘木牌对话" ], + "progress": "5 / 5", "hide": "该探索成就需要你自己探索如何达成", "point": 25 }, @@ -51,7 +55,8 @@ "text": [ "第二章完成度达到100%" ], - "progress": "", + "progress": "100 / 100", + "percent": true, "point": 50 }, { @@ -59,6 +64,7 @@ "text": [ "学习电摇嘲讽技能" ], + "hide": "该探索成就需要你自己探索如何达成", "point": 20 }, { diff --git a/src/plugin/ui/achievement.ts b/src/plugin/ui/achievement.ts new file mode 100644 index 0000000..9f06d2f --- /dev/null +++ b/src/plugin/ui/achievement.ts @@ -0,0 +1,14 @@ +import list from '../../data/achievement.json'; + +type AchievementList = typeof list; +type AchievementType = keyof AchievementList; + +export default function init() { + return {}; +} + +export function completeAchievement(type: AchievementType, index: number) {} + +export function hasCompletedAchievement(type: AchievementType, index: number) { + return true; +} diff --git a/src/plugin/uiController.ts b/src/plugin/uiController.ts index d5ea21a..c4ea368 100644 --- a/src/plugin/uiController.ts +++ b/src/plugin/uiController.ts @@ -10,6 +10,7 @@ import SkillTree from '../ui/skillTree.vue'; import Fly from '../ui/fly.vue'; import FixedDetail from '../ui/fixedDetail.vue'; import Shop from '../ui/shop.vue'; +import Achievement from '../ui/achievement.vue'; export const bookOpened = ref(false); export const toolOpened = ref(false); @@ -24,6 +25,7 @@ export const showStudiedSkill = ref(false); export const fixedDetailOpened = ref(false); export const shopOpened = ref(false); export const startOpened = ref(false); +export const achievementOpened = ref(false); export const transition = ref(true); export const noClosePanel = ref(false); @@ -51,7 +53,8 @@ const UI_LIST: [Ref, Component][] = [ [skillTreeOpened, SkillTree], [flyOpened, Fly], [fixedDetailOpened, FixedDetail], - [shopOpened, Shop] + [shopOpened, Shop], + [achievementOpened, Achievement] ]; /** ui栈 */ diff --git a/src/types/plugin.d.ts b/src/types/plugin.d.ts index b464537..cfea028 100644 --- a/src/types/plugin.d.ts +++ b/src/types/plugin.d.ts @@ -209,6 +209,9 @@ interface PluginUis { /** 开始界面是否打开 */ readonly startOpened: Ref; + /** 成就界面是否打开 */ + readonly achievementOpened: Ref; + /** ui栈 */ readonly uiStack: Ref; diff --git a/src/ui/achievement.vue b/src/ui/achievement.vue index 0a63ab9..8b320f6 100644 --- a/src/ui/achievement.vue +++ b/src/ui/achievement.vue @@ -1,14 +1,335 @@ - + + + 返回游戏 + + + + {{ columnName[c] }} + + + + + + + + + + + {{ a.name }} + + + + 完成情况: + {{ + a.complete + ? '已完成' + : '未完成' + }} + 成就点数: {{ a.point }} + + + + + + + + + + + + + + + + 成就点: {{ nowPoint }} / {{ totalPoint }} + + diff --git a/src/ui/start.vue b/src/ui/start.vue index f46fbe3..e3e56e4 100644 --- a/src/ui/start.vue +++ b/src/ui/start.vue @@ -52,6 +52,7 @@ import { sleep } from 'mutate-animate'; import { Matrix4 } from '../plugin/webgl/matrix'; import { doByInterval, keycode } from '../plugin/utils'; import { KeyCode } from '../plugin/keyCodes'; +import { achievementOpened } from '../plugin/uiController'; let startdiv: HTMLDivElement; let start: HTMLDivElement; @@ -119,6 +120,9 @@ async function clickStartButton(id: string) { core.load(); } if (id === 'replay') core.chooseReplayFile(); + if (id === 'achievement') { + achievementOpened.value = true; + } } function onmove(e: MouseEvent) { @@ -324,6 +328,7 @@ onUnmounted(() => { #000 100% ); animation: gradient 4s ease-out 0.5s 1 normal forwards; + pointer-events: none; } #listen { @@ -345,7 +350,6 @@ onUnmounted(() => { #title { margin-top: 7%; text-align: center; - color: transparent; font: 4em 'normal'; font-weight: 200; background-image: linear-gradient( @@ -363,6 +367,7 @@ onUnmounted(() => { 5px 5px 5px rgba(0, 0, 0, 0.4); filter: brightness(1.8); user-select: none; + animation: opacity 3s ease-out 0.5s 1 normal forwards; } #buttons { @@ -547,6 +552,15 @@ onUnmounted(() => { } } +@keyframes opacity { + from { + color: #bbb; + } + to { + color: transparent; + } +} + .start-enter-active { transition: all 1.2s ease-out; }