mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-31 15:09:26 +08:00
包装提示信息
This commit is contained in:
parent
5afd1c399f
commit
db5ff1b183
@ -1,5 +1,5 @@
|
|||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { message } from 'ant-design-vue';
|
import { tip } from './utils';
|
||||||
|
|
||||||
const markedEnemy = reactive<EnemyIds[]>([]);
|
const markedEnemy = reactive<EnemyIds[]>([]);
|
||||||
|
|
||||||
@ -61,10 +61,7 @@ export function getMarkInfo(id: EnemyIds, noMessage: boolean = false) {
|
|||||||
const info = markInfo[id]!;
|
const info = markInfo[id]!;
|
||||||
if (core.status.hero.atk >= info.nextCritical) {
|
if (core.status.hero.atk >= info.nextCritical) {
|
||||||
if (!reached[info.nextCritical] && !noMessage) {
|
if (!reached[info.nextCritical] && !noMessage) {
|
||||||
message.success({
|
tip('success', `踩到了${core.material.enemys[id].name}的临界!`);
|
||||||
content: `踩到了${core.material.enemys[id].name}的临界!`,
|
|
||||||
class: 'antdv-message'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
reached[info.nextCritical] = true;
|
reached[info.nextCritical] = true;
|
||||||
const n = core.nextCriticals(id, 1)[0]?.[0];
|
const n = core.nextCriticals(id, 1)[0]?.[0];
|
||||||
@ -85,39 +82,25 @@ export function checkMarkedEnemy(noMessage: boolean = false) {
|
|||||||
if (damage === -1) return;
|
if (damage === -1) return;
|
||||||
const info = enemyDamageInfo[v]!;
|
const info = enemyDamageInfo[v]!;
|
||||||
const name = core.material.enemys[v].name;
|
const name = core.material.enemys[v].name;
|
||||||
if (damage < 0) {
|
if (damage <= 0) {
|
||||||
if (!noMessage) {
|
if (!noMessage) tip('success', `${name}已经零伤了!`);
|
||||||
message.success({
|
|
||||||
content: `${name}已经负伤了!`,
|
|
||||||
class: 'antdv-message'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (damage < hp / 3) {
|
} else if (damage < hp / 3) {
|
||||||
if (!info[3] && !noMessage) {
|
if (!info[3] && !noMessage) {
|
||||||
message.success({
|
tip('success', `${name}的伤害已降至勇士生命值的1/3!`);
|
||||||
content: `${name}的伤害已降至勇士生命值的1/3!`,
|
|
||||||
class: 'antdv-message'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
info[1] = true;
|
info[1] = true;
|
||||||
info[2] = true;
|
info[2] = true;
|
||||||
info[3] = true;
|
info[3] = true;
|
||||||
} else if (damage < (hp / 3) * 2) {
|
} else if (damage < (hp / 3) * 2) {
|
||||||
if (!info[2] && !noMessage) {
|
if (!info[2] && !noMessage) {
|
||||||
message.success({
|
tip('success', `${name}的伤害已降至勇士生命值的2/3!`);
|
||||||
content: `${name}的伤害已降至勇士生命值的2/3!`,
|
|
||||||
class: 'antdv-message'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
info[1] = true;
|
info[1] = true;
|
||||||
info[2] = true;
|
info[2] = true;
|
||||||
info[3] = false;
|
info[3] = false;
|
||||||
} else if (damage < hp) {
|
} else if (damage < hp) {
|
||||||
if (!info[1] && !noMessage) {
|
if (!info[1] && !noMessage) {
|
||||||
message.success({
|
tip('success', `你已经能打过${name}了!`);
|
||||||
content: `你已经能打过${name}了!`,
|
|
||||||
class: 'antdv-message'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
info[1] = true;
|
info[1] = true;
|
||||||
info[2] = false;
|
info[2] = false;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
import { MessageApi } from 'ant-design-vue/lib/message';
|
||||||
import { isNil } from 'lodash';
|
import { isNil } from 'lodash';
|
||||||
import { Animation, TimingFn } from 'mutate-animate';
|
import { Animation, TimingFn } from 'mutate-animate';
|
||||||
import { ComputedRef, ref } from 'vue';
|
import { ComputedRef, ref } from 'vue';
|
||||||
@ -121,3 +123,13 @@ export function type(
|
|||||||
|
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function tip(
|
||||||
|
type: Exclude<keyof MessageApi, 'open' | 'config' | 'destroy'>,
|
||||||
|
text: string
|
||||||
|
) {
|
||||||
|
message[type]({
|
||||||
|
content: text,
|
||||||
|
class: 'antdv-message'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -183,10 +183,9 @@ import { computed, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
|||||||
import Scroll from '../components/scroll.vue';
|
import Scroll from '../components/scroll.vue';
|
||||||
import { getAddStatus, getEquips, getNowStatus } from '../plugin/ui/equipbox';
|
import { getAddStatus, getEquips, getNowStatus } from '../plugin/ui/equipbox';
|
||||||
import BoxAnimate from '../components/boxAnimate.vue';
|
import BoxAnimate from '../components/boxAnimate.vue';
|
||||||
import { has, type } from '../plugin/utils';
|
import { has, tip, type } from '../plugin/utils';
|
||||||
import { cancelGlobalDrag, isMobile, useDrag } from '../plugin/use';
|
import { cancelGlobalDrag, isMobile, useDrag } from '../plugin/use';
|
||||||
import { hyper, sleep } from 'mutate-animate';
|
import { hyper, sleep } from 'mutate-animate';
|
||||||
import { message } from 'ant-design-vue';
|
|
||||||
|
|
||||||
const equips = ref(getEquips());
|
const equips = ref(getEquips());
|
||||||
const col = ref('all');
|
const col = ref('all');
|
||||||
@ -310,10 +309,7 @@ function clickList(i: number) {
|
|||||||
if (i === selected.value && listClicked.value) {
|
if (i === selected.value && listClicked.value) {
|
||||||
const id = toShow.value[selected.value]?.[0];
|
const id = toShow.value[selected.value]?.[0];
|
||||||
if (!core.canEquip(id)) {
|
if (!core.canEquip(id)) {
|
||||||
message.warn({
|
tip('warn', '无法装备!');
|
||||||
content: '无法装备!',
|
|
||||||
class: 'antdv-message'
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.loadEquip(id);
|
core.loadEquip(id);
|
||||||
@ -359,10 +355,7 @@ function loadEquip() {
|
|||||||
const num = toEquipType.value;
|
const num = toEquipType.value;
|
||||||
if (num < 0) return;
|
if (num < 0) return;
|
||||||
if (!canDragin(num)) {
|
if (!canDragin(num)) {
|
||||||
message.warn({
|
tip('warn', '无法装备!');
|
||||||
content: '无法装备!',
|
|
||||||
class: 'antdv-message'
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const now = equiped.value[num];
|
const now = equiped.value[num];
|
||||||
|
Loading…
Reference in New Issue
Block a user