mirror of
				https://github.com/unanmed/HumanBreak.git
				synced 2025-10-31 12:12:58 +08:00 
			
		
		
		
	定点查看
This commit is contained in:
		
							parent
							
								
									ac55517d57
								
							
						
					
					
						commit
						36cf6150e4
					
				| @ -1247,6 +1247,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { | |||||||
|                 case 72: // H:打开帮助页面
 |                 case 72: // H:打开帮助页面
 | ||||||
|                     core.useItem('I560', true); |                     core.useItem('I560', true); | ||||||
|                     break; |                     break; | ||||||
|  |                 case 75: // J:定点查看
 | ||||||
|  |                     if ( | ||||||
|  |                         core.getBlockCls(...flags.mouseLoc)?.startsWith('enemy') | ||||||
|  |                     ) { | ||||||
|  |                         core.plugin.showFixed.value = false; | ||||||
|  |                         core.plugin.fixedDetailOpened.value = true; | ||||||
|  |                     } | ||||||
|  |                     break; | ||||||
|                 case 77: // M:快速标记
 |                 case 77: // M:快速标记
 | ||||||
|                     const [x, y] = flags.mouseLoc; |                     const [x, y] = flags.mouseLoc; | ||||||
|                     const mx = Math.round(x + core.bigmap.offsetX / 32); |                     const mx = Math.round(x + core.bigmap.offsetX / 32); | ||||||
|  | |||||||
| @ -92,6 +92,10 @@ import { has, setCanvasSize } from '../plugin/utils'; | |||||||
| import { debounce } from 'lodash'; | import { debounce } from 'lodash'; | ||||||
| import { isMobile } from '../plugin/use'; | import { isMobile } from '../plugin/use'; | ||||||
| 
 | 
 | ||||||
|  | const props = defineProps<{ | ||||||
|  |     fromBook?: boolean; | ||||||
|  | }>(); | ||||||
|  | 
 | ||||||
| const critical = ref<HTMLCanvasElement>(); | const critical = ref<HTMLCanvasElement>(); | ||||||
| const def = ref<HTMLCanvasElement>(); | const def = ref<HTMLCanvasElement>(); | ||||||
| 
 | 
 | ||||||
| @ -173,15 +177,20 @@ function generateData(data: [number, number][]): ChartConfiguration['data'] { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const update = debounce((atk: Chart, def: Chart) => { | const update = debounce((atk: Chart, def: Chart) => { | ||||||
|  |     const [x, y] = props.fromBook ? [void 0, void 0] : flags.mouseLoc; | ||||||
|     allCri.value = getCriticalDamage( |     allCri.value = getCriticalDamage( | ||||||
|         enemy, |         enemy, | ||||||
|         addAtk.value * ratio, |         addAtk.value * ratio, | ||||||
|         addDef.value * ratio |         addDef.value * ratio, | ||||||
|  |         x, | ||||||
|  |         y | ||||||
|     ); |     ); | ||||||
|     allDef.value = getDefDamage( |     allDef.value = getDefDamage( | ||||||
|         enemy, |         enemy, | ||||||
|         addDef.value * ratio, |         addDef.value * ratio, | ||||||
|         addAtk.value * ratio |         addAtk.value * ratio, | ||||||
|  |         x, | ||||||
|  |         y | ||||||
|     ); |     ); | ||||||
|     if (allCri.value.length > originCri.length) originCri = allCri.value; |     if (allCri.value.length > originCri.length) originCri = allCri.value; | ||||||
|     if (allDef.value.length > originDef.length) originDef = allDef.value; |     if (allDef.value.length > originDef.length) originDef = allDef.value; | ||||||
|  | |||||||
| @ -48,7 +48,10 @@ export function getSpecialHint(enemy: Enemy & DetailedEnemy) { | |||||||
| export function getDefDamage( | export function getDefDamage( | ||||||
|     enemy: DetailedEnemy, |     enemy: DetailedEnemy, | ||||||
|     addDef: number = 0, |     addDef: number = 0, | ||||||
|     addAtk: number = 0 |     addAtk: number = 0, | ||||||
|  |     x?: number, | ||||||
|  |     y?: number, | ||||||
|  |     floorId?: FloorIds | ||||||
| ) { | ) { | ||||||
|     const ratio = core.status.thisMap.ratio; |     const ratio = core.status.thisMap.ratio; | ||||||
|     const res: [number, number][] = []; |     const res: [number, number][] = []; | ||||||
| @ -59,10 +62,16 @@ export function getDefDamage( | |||||||
|     const max = 100 - Math.floor(addDef / ratio); |     const max = 100 - Math.floor(addDef / ratio); | ||||||
| 
 | 
 | ||||||
|     for (let i = 0; i <= max; i++) { |     for (let i = 0; i <= max; i++) { | ||||||
|         const dam = core.getDamageInfo(enemy.id, { |         const dam = core.getDamageInfo( | ||||||
|             def: core.getStatus('def') + ratio * i + addDef, |             enemy.id, | ||||||
|             atk: core.getStatus('atk') + addAtk |             { | ||||||
|         }); |                 def: core.getStatus('def') + ratio * i + addDef, | ||||||
|  |                 atk: core.getStatus('atk') + addAtk | ||||||
|  |             }, | ||||||
|  |             x, | ||||||
|  |             y, | ||||||
|  |             floorId | ||||||
|  |         ); | ||||||
| 
 | 
 | ||||||
|         if (res.length === 0) { |         if (res.length === 0) { | ||||||
|             origin = dam?.damage; |             origin = dam?.damage; | ||||||
| @ -88,7 +97,10 @@ export function getDefDamage( | |||||||
| export function getCriticalDamage( | export function getCriticalDamage( | ||||||
|     enemy: DetailedEnemy, |     enemy: DetailedEnemy, | ||||||
|     addAtk: number = 0, |     addAtk: number = 0, | ||||||
|     addDef: number = 0 |     addDef: number = 0, | ||||||
|  |     x?: number, | ||||||
|  |     y?: number, | ||||||
|  |     floorId?: FloorIds | ||||||
| ): [number, number][] { | ): [number, number][] { | ||||||
|     const ratio = core.status.thisMap.ratio; |     const ratio = core.status.thisMap.ratio; | ||||||
|     const res: [number, number][] = []; |     const res: [number, number][] = []; | ||||||
| @ -99,10 +111,16 @@ export function getCriticalDamage( | |||||||
|     const max = 100 - Math.floor(addAtk / ratio); |     const max = 100 - Math.floor(addAtk / ratio); | ||||||
| 
 | 
 | ||||||
|     for (let i = 0; i <= max; i++) { |     for (let i = 0; i <= max; i++) { | ||||||
|         const dam = core.getDamageInfo(enemy.id, { |         const dam = core.getDamageInfo( | ||||||
|             atk: core.getStatus('atk') + ratio * i + addAtk, |             enemy.id, | ||||||
|             def: core.getStatus('def') + addDef |             { | ||||||
|         }); |                 atk: core.getStatus('atk') + ratio * i + addAtk, | ||||||
|  |                 def: core.getStatus('def') + addDef | ||||||
|  |             }, | ||||||
|  |             x, | ||||||
|  |             y, | ||||||
|  |             floorId | ||||||
|  |         ); | ||||||
| 
 | 
 | ||||||
|         if (res.length === 0) { |         if (res.length === 0) { | ||||||
|             origin = dam?.damage; |             origin = dam?.damage; | ||||||
|  | |||||||
| @ -23,6 +23,10 @@ export default function init() { | |||||||
|         showFixed.value = false; |         showFixed.value = false; | ||||||
|         show(ev); |         show(ev); | ||||||
|     }); |     }); | ||||||
|  | 
 | ||||||
|  |     return { | ||||||
|  |         showFixed | ||||||
|  |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function getDetailedEnemy<I extends EnemyIds>( | export function getDetailedEnemy<I extends EnemyIds>( | ||||||
|  | |||||||
| @ -8,6 +8,7 @@ import Desc from '../ui/desc.vue'; | |||||||
| import Skill from '../ui/skill.vue'; | import Skill from '../ui/skill.vue'; | ||||||
| import SkillTree from '../ui/skillTree.vue'; | import SkillTree from '../ui/skillTree.vue'; | ||||||
| import Fly from '../ui/fly.vue'; | import Fly from '../ui/fly.vue'; | ||||||
|  | import FixedDetail from '../ui/fixedDetail.vue'; | ||||||
| 
 | 
 | ||||||
| export const bookOpened = ref(false); | export const bookOpened = ref(false); | ||||||
| export const toolOpened = ref(false); | export const toolOpened = ref(false); | ||||||
| @ -19,6 +20,7 @@ export const skillOpened = ref(false); | |||||||
| export const skillTreeOpened = ref(false); | export const skillTreeOpened = ref(false); | ||||||
| export const flyOpened = ref(false); | export const flyOpened = ref(false); | ||||||
| export const showStudiedSkill = ref(false); | export const showStudiedSkill = ref(false); | ||||||
|  | export const fixedDetailOpened = ref(false); | ||||||
| 
 | 
 | ||||||
| export const transition = ref(true); | export const transition = ref(true); | ||||||
| export const noClosePanel = ref(false); | export const noClosePanel = ref(false); | ||||||
| @ -34,7 +36,8 @@ const UI_LIST: [Ref<boolean>, Component][] = [ | |||||||
|     [descOpened, Desc], |     [descOpened, Desc], | ||||||
|     [skillOpened, Skill], |     [skillOpened, Skill], | ||||||
|     [skillTreeOpened, SkillTree], |     [skillTreeOpened, SkillTree], | ||||||
|     [flyOpened, Fly] |     [flyOpened, Fly], | ||||||
|  |     [fixedDetailOpened, FixedDetail] | ||||||
| ]; | ]; | ||||||
| 
 | 
 | ||||||
| /** ui栈 */ | /** ui栈 */ | ||||||
| @ -69,7 +72,8 @@ export default function init() { | |||||||
|         skillOpened, |         skillOpened, | ||||||
|         skillTreeOpened, |         skillTreeOpened, | ||||||
|         flyOpened, |         flyOpened, | ||||||
|         showStudiedSkill |         showStudiedSkill, | ||||||
|  |         fixedDetailOpened | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										6
									
								
								src/types/plugin.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								src/types/plugin.d.ts
									
									
									
									
										vendored
									
									
								
							| @ -178,6 +178,12 @@ interface PluginUis { | |||||||
|     /** 是否展示已学习的技能 */ |     /** 是否展示已学习的技能 */ | ||||||
|     readonly showStudiedSkill: Ref<boolean>; |     readonly showStudiedSkill: Ref<boolean>; | ||||||
| 
 | 
 | ||||||
|  |     /** 定点查看是否打开 */ | ||||||
|  |     readonly fixedDetailOpened: Ref<boolean>; | ||||||
|  | 
 | ||||||
|  |     /** 是否展示移动鼠标显示怪物信息的盒子 */ | ||||||
|  |     readonly showFixed: Ref<boolean>; | ||||||
|  | 
 | ||||||
|     /** ui栈 */ |     /** ui栈 */ | ||||||
|     readonly uiStack: Ref<Component[]>; |     readonly uiStack: Ref<Component[]>; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -30,7 +30,11 @@ | |||||||
|             </div> |             </div> | ||||||
|         </Scroll> |         </Scroll> | ||||||
|     </div> |     </div> | ||||||
|     <BookDetail v-if="detail" @close="closeDetail()"></BookDetail> |     <BookDetail | ||||||
|  |         v-if="detail" | ||||||
|  |         :from-book="true" | ||||||
|  |         @close="closeDetail()" | ||||||
|  |     ></BookDetail> | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script setup lang="tsx"> | <script setup lang="tsx"> | ||||||
|  | |||||||
| @ -10,7 +10,10 @@ | |||||||
|         </div> |         </div> | ||||||
|         <Transition name="detail"> |         <Transition name="detail"> | ||||||
|             <EnemySpecial v-if="panel === 'special'"></EnemySpecial> |             <EnemySpecial v-if="panel === 'special'"></EnemySpecial> | ||||||
|             <EnemyCritical v-else-if="panel === 'critical'"></EnemyCritical> |             <EnemyCritical | ||||||
|  |                 :from-book="fromBook" | ||||||
|  |                 v-else-if="panel === 'critical'" | ||||||
|  |             ></EnemyCritical> | ||||||
|             <EnemyTarget v-else-if="panel === 'target'"></EnemyTarget> |             <EnemyTarget v-else-if="panel === 'target'"></EnemyTarget> | ||||||
|         </Transition> |         </Transition> | ||||||
|         <div id="detail-more"> |         <div id="detail-more"> | ||||||
| @ -81,6 +84,10 @@ const panel = ref('special'); | |||||||
| 
 | 
 | ||||||
| let detail: HTMLDivElement; | let detail: HTMLDivElement; | ||||||
| 
 | 
 | ||||||
|  | const props = defineProps<{ | ||||||
|  |     fromBook?: boolean; | ||||||
|  | }>(); | ||||||
|  | 
 | ||||||
| const emits = defineEmits<{ | const emits = defineEmits<{ | ||||||
|     (e: 'close'): void; |     (e: 'close'): void; | ||||||
| }>(); | }>(); | ||||||
| @ -97,9 +104,15 @@ function close() { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function key(e: KeyboardEvent) { | function key(e: KeyboardEvent) { | ||||||
|     if (keycode(e.keyCode) === KeyCode.Enter) { |     const c = keycode(e.keyCode); | ||||||
|  |     if (c === KeyCode.Enter || c === KeyCode.Space || c === KeyCode.KeyC) { | ||||||
|         close(); |         close(); | ||||||
|     } |     } | ||||||
|  |     if (!props.fromBook) { | ||||||
|  |         if (c === KeyCode.KeyX || c === KeyCode.Escape) { | ||||||
|  |             close(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| onMounted(async () => { | onMounted(async () => { | ||||||
|  | |||||||
| @ -80,6 +80,7 @@ async function calHeight() { | |||||||
|     vw = window.innerWidth; |     vw = window.innerWidth; | ||||||
|     width.value = vh * 0.28; |     width.value = vh * 0.28; | ||||||
|     await new Promise(res => requestAnimationFrame(res)); |     await new Promise(res => requestAnimationFrame(res)); | ||||||
|  |     if (!main) return; | ||||||
|     main = document.getElementById('enemy-fixed') as HTMLDivElement; |     main = document.getElementById('enemy-fixed') as HTMLDivElement; | ||||||
|     const style = getComputedStyle(main); |     const style = getComputedStyle(main); | ||||||
|     const h = parseFloat(style.height); |     const h = parseFloat(style.height); | ||||||
|  | |||||||
							
								
								
									
										34
									
								
								src/ui/fixedDetail.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/ui/fixedDetail.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | |||||||
|  | <template> | ||||||
|  |     <div id="fixed-detail"> | ||||||
|  |         <BookDetail :from-book="false" @close="close"></BookDetail> | ||||||
|  |     </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script lang="ts" setup> | ||||||
|  | import { onMounted, ref } from 'vue'; | ||||||
|  | import { getDetailedEnemy } from '../plugin/ui/fixed'; | ||||||
|  | import BookDetail from './bookDetail.vue'; | ||||||
|  | 
 | ||||||
|  | core.plugin.bookDetailPos = 0; | ||||||
|  | 
 | ||||||
|  | function close() { | ||||||
|  |     core.plugin.fixedDetailOpened.value = false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | onMounted(() => { | ||||||
|  |     const [x, y] = flags.mouseLoc; | ||||||
|  |     const e = core.getBlockId(x, y); | ||||||
|  |     if (!e || !core.getClsFromId(e)?.startsWith('enemy')) return; | ||||||
|  |     const enemy = core.material.enemys[e as EnemyIds]; | ||||||
|  |     const detail = getDetailedEnemy(enemy, x, y); | ||||||
|  |     core.plugin.bookDetailEnemy = detail; | ||||||
|  |     core.plugin.bookDetailEnemy = getDetailedEnemy(enemy, x, y); | ||||||
|  | }); | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <style lang="less" scoped> | ||||||
|  | #fixed-detail { | ||||||
|  |     width: 80%; | ||||||
|  |     height: 100%; | ||||||
|  | } | ||||||
|  | </style> | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user