Skip to content

Commit

Permalink
refactor: 重构项目结构,合并api目录到game下
Browse files Browse the repository at this point in the history
  • Loading branch information
lovezhangchuangxin committed Nov 23, 2024
1 parent 4df57fa commit 0e1505b
Show file tree
Hide file tree
Showing 22 changed files with 95 additions and 46 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"author": "",
"license": "ISC",
"dependencies": {
"@star-angry/api": "workspace:^",
"@star-angry/core": "workspace:^",
"@star-angry/db": "workspace:^",
"@star-angry/shared": "workspace:^",
Expand Down
3 changes: 0 additions & 3 deletions packages/api/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions packages/api/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions packages/backend/src/service/structure/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ export default class StructureService {
console.log('终止运行')
return
}
const startTime = performance.now()

const data = await GameDB.getDB().getData()
data.user.forEach(({ id }) => {
const userData = data.userData[id]
Expand Down Expand Up @@ -84,13 +82,6 @@ export default class StructureService {
userData.updateTime = Date.now()
}
})

console.log(
'Tick:',
performance.now() - startTime,
'ms, user: ',
Object.keys(data.user).length,
)
}, 1000)
StructureService.intentTimer = timer
}
Expand Down
4 changes: 1 addition & 3 deletions packages/game/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ declare module 'vue' {
ElTag: typeof import('element-plus/es')['ElTag']
ElText: typeof import('element-plus/es')['ElText']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
GameMap: typeof import('./src/components/gameMap/index.vue')['default']
GameMap: typeof import('./src/components/game-map/index.vue')['default']
MdViewer: typeof import('./src/components/md-viewer/MdViewer.vue')['default']
NavHeader: typeof import('./src/components/navbar/NavHeader.vue')['default']
NavSide: typeof import('./src/components/navbar/NavSide.vue')['default']
NumberFormat: typeof import('./src/components/number/NumberFormat.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Expand Down
1 change: 0 additions & 1 deletion packages/game/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@bytemd/plugin-highlight": "^1.21.0",
"@bytemd/vue-next": "^1.21.0",
"@element-plus/icons-vue": "^2.3.1",
"@star-angry/api": "workspace:^",
"@star-angry/db": "workspace:^",
"@star-angry/shared": "workspace:^",
"bytemd": "^1.21.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/game/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<script setup lang="ts">
import { onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { UserApi } from '@star-angry/api'
import { UserApi } from '@/api'
import { useUserStore } from '@/store'
// import NavHeader from '@/layouts/components/NavHeader.vue'
Expand Down
1 change: 1 addition & 0 deletions packages/game/src/api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# API接口
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const render = throttle(
stage.width(),
stage.height(),
]
console.log(x, y, width, height)
const galaxies = universe.getGalaxies(x, y, x + width, y + height)
galaxies.forEach((galaxy) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/game/src/hooks/useVerification.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ref } from 'vue'
import { UserApi } from '@star-angry/api'
import { UserApi } from '@/api'
import { Validator } from '@star-angry/shared'
import { message } from '@/utils/message'

Expand Down
3 changes: 2 additions & 1 deletion packages/game/src/layouts/components/NavHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
<span
style="margin-left: 100px; cursor: pointer"
@click="router.push('/planet')"
>我的星球</span
>
我的星球
</span>
</div>

<div class="right">
Expand Down
2 changes: 1 addition & 1 deletion packages/game/src/layouts/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ defineOptions({
components: { Default },
})
let layoutMode = ref('default')
const layoutMode = ref('default')
</script>
2 changes: 1 addition & 1 deletion packages/game/src/views/chat/ChatPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { io, Socket } from 'socket.io-client'
import PersonList from './PersonList.vue'
import ChatWindow from './ChatWindow.vue'
import { message as toast } from '@/utils/message'
import { ResponseData } from '@star-angry/api'
import { ResponseData } from '@/api'
import { MessageInfo } from '@star-angry/db/src/model/message'
import { useUserStore } from '@/store'
Expand Down
2 changes: 1 addition & 1 deletion packages/game/src/views/home/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<script setup lang="ts">
import { useUserStore } from '@/store'
import GameMap from '@/components/gameMap/index.vue'
import GameMap from '@/components/game-map/index.vue'
const userStore = useUserStore()
console.log(userStore.username)
Expand Down
2 changes: 1 addition & 1 deletion packages/game/src/views/login/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ import { reactive, ref } from 'vue'
import { message } from '@/utils/message'
import { useState } from '@/hooks/useState'
import { useVerification } from '@/hooks/useVerification'
import { UserApi } from '@star-angry/api'
import { UserApi } from '@/api'
import {
Validator,
ValidatorCallBack,
Expand Down
2 changes: 1 addition & 1 deletion packages/game/src/views/user/RankPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
import NumberFormat from '@/components/number/NumberFormat.vue'
import { message } from '@/utils/message'
import { numberWithCommas, timeFromNow } from '@/utils/number'
import { UserApi } from '@star-angry/api'
import { UserApi } from '@/api'
import { onMounted, ref } from 'vue'
const rankRef = ref()
Expand Down
94 changes: 84 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0e1505b

Please sign in to comment.