Skip to content

Commit

Permalink
[erp-card] 临时
Browse files Browse the repository at this point in the history
  • Loading branch information
masquevil committed Oct 17, 2024
1 parent 3f7a721 commit b3d0791
Show file tree
Hide file tree
Showing 20 changed files with 547 additions and 329 deletions.
292 changes: 155 additions & 137 deletions src/apps/erp-card/components/SkillTable.vue

Large diffs are not rendered by default.

78 changes: 33 additions & 45 deletions src/apps/erp-card/components/SkillTdLabel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import vClickOutside from '@/directives/clickOutside';
import { usePC } from '../hooks/useProviders';
import type { ChildSkill } from '../types/skill';
import type { COCCardViewData } from '../types/viewData';
import type { COCPCSkill } from '../types/character';
// import type { COCPCSkill } from '../types/character';
import SoxCheckbox from '@/components/SoxCheckbox.vue';
interface Props {
skillName: string;
showCheckbox?: boolean;
comments?: string;
childSkillData?: {
name: string;
Expand All @@ -29,9 +30,7 @@ interface Emits {
const emit = defineEmits<Emits>();
const isOptionsShowing = ref(false);
const currentData = computed(() =>
viewData?.showingChildSkills.get(props.skillName),
);
const currentData = computed(() => viewData?.showingChildSkills.get(props.skillName));
const existedData = computed(() => {
if (['母语', '外语'].includes(props.skillName)) {
return [
Expand All @@ -52,71 +51,61 @@ const isProSkill = computed(() => {
}
// 二级技能
const [skillName, _, childSkillPlace] = skillInfo;
return (
skillName === props.skillName &&
childSkillPlace === props.childSkillData?.place
);
return skillName === props.skillName && childSkillPlace === props.childSkillData?.place;
});
});
function updateCurrentData(value: string) {
if (!props.childSkillData || !currentData.value) return;
// update pro data
if (isProSkill.value && pc) {
const skillInfo = pc.value.proSkills.find(
([skillName, _, childSkillPlace]) => {
return (
skillName === props.skillName &&
childSkillPlace === props.childSkillData?.place
);
},
);
const skillInfo = pc.value.proSkills.find(([skillName, _, childSkillPlace]) => {
return skillName === props.skillName && childSkillPlace === props.childSkillData?.place;
});
if (skillInfo && typeof skillInfo !== 'string') {
skillInfo[1] = value;
}
}
// update view data
currentData.value[props.childSkillData.place] = value;
viewData!.showingChildSkills.set(props.skillName, currentData.value);
}
function selectChildSkill(childSkill: ChildSkill) {
updateCurrentData(childSkill.name);
emit('selectChildSkill', childSkill);
isOptionsShowing.value = false;
}
function changeProSkill(value: boolean) {
if (!pc) return;
if (value) {
let skillInfo: COCPCSkill = props.skillName;
if (props.childSkillData)
skillInfo = [
props.skillName,
props.childSkillData.name,
props.childSkillData.place,
];
pc.value.proSkills.push(skillInfo);
} else {
pc.value.proSkills = pc.value.proSkills.filter((skillInfo) => {
if (!props.childSkillData) return skillInfo !== props.skillName;
const [skillName, _, childSkillPlace] = skillInfo;
return (
skillName !== props.skillName ||
childSkillPlace !== props.childSkillData.place
);
});
}
}
// function changeProSkill(value: boolean) {
// if (!pc) return;
// if (value) {
// let skillInfo: COCPCSkill = props.skillName;
// if (props.childSkillData)
// skillInfo = [props.skillName, props.childSkillData.name, props.childSkillData.place];
// pc.value.proSkills.push(skillInfo);
// } else {
// pc.value.proSkills = pc.value.proSkills.filter((skillInfo) => {
// if (!props.childSkillData) return skillInfo !== props.skillName;
// const [skillName, _, childSkillPlace] = skillInfo;
// return skillName !== props.skillName || childSkillPlace !== props.childSkillData.place;
// });
// }
// }
</script>

<template>
<div class="skill-td-label">
<label class="skill-td-checkbox-label">
<SoxCheckbox
<label
class="skill-td-checkbox-label"
v-if="showCheckbox"
>
<SoxCheckbox :checked="isProSkill" />
<!-- <SoxCheckbox
:checked="isProSkill"
@check="changeProSkill"
/>
/> -->
</label>
<div>{{ skillName }}</div>
<div v-if="skillName || !showCheckbox">{{ skillName || '&nbsp;' }}</div>
<div
v-if="!!childSkillData"
class="child-skill-display"
Expand All @@ -143,9 +132,7 @@ function changeProSkill(value: boolean) {
:key="childSkill.name"
class="child-skill-option"
:class="{
'child-skill-option-existed': existedData?.includes(
childSkill.name,
),
'child-skill-option-existed': existedData?.includes(childSkill.name),
}"
@click="selectChildSkill(childSkill)"
>
Expand All @@ -167,6 +154,7 @@ function changeProSkill(value: boolean) {
.skill-td-label {
display: flex;
align-items: center;
margin-left: 0.4em;
margin-right: 0.6em;
white-space: nowrap;
Expand Down
9 changes: 5 additions & 4 deletions src/apps/erp-card/components/WritableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ const inputStyle = reactive({
'printing-image': pageData?.printing,
}"
>
<div class="label">
<div
class="label"
v-if="label"
>
<div class="label-title">{{ label }}</div>
<div
v-if="hint"
Expand All @@ -54,9 +57,7 @@ const inputStyle = reactive({
:placeholder="pageData?.printing ? '' : placeholder"
:readonly="readonly"
:value="modelValue"
@input="
$emit('update:modelValue', ($event.target as HTMLInputElement).value)
"
@input="$emit('update:modelValue', ($event.target as HTMLInputElement).value)"
@focus="$emit('focus')"
@blur="$emit('blur')"
/>
Expand Down
18 changes: 18 additions & 0 deletions src/apps/erp-card/constants/resources/skillPacks/eb-01-invest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// ERP basic pack 01: invest 刑侦
import type { ResourceSkillPack } from '../../../types/resources/resourceSkill';

export const packInvest: ResourceSkillPack = {
name: '刑侦',
initPlus: 20,
skills: [
{ name: '侦查', init: 25 },
{ name: '聆听', init: 20 },
{ name: '查阅', init: 20 },
{ name: '躲藏', init: 20 },
{ name: '追踪', init: 10 },
{ name: '导航', init: 10 },
{ name: '估价', init: 5 },
],
};

export default packInvest;
16 changes: 16 additions & 0 deletions src/apps/erp-card/constants/resources/skillPacks/eb-02-social.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// ERP basic pack 02: social 社交
import type { ResourceSkillPack } from '../../../types/resources/resourceSkill';

export const packSocial: ResourceSkillPack = {
name: '社交',
initPlus: 20,
skills: [
{ name: '话术', init: 25 },
{ name: '说服', init: 10 },
{ name: '取悦', init: 15 },
{ name: '恐吓', init: 15 },
{ name: '心理学', init: 10 },
],
};

export default packSocial;
27 changes: 27 additions & 0 deletions src/apps/erp-card/constants/resources/skillPacks/eb-03-battle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ERP basic pack 03: battle 战斗
import type { ResourceSkillPack } from '../../../types/resources/resourceSkill';

export const packBattle: ResourceSkillPack = {
name: '战斗',
initPlus: 30,
skills: [
{ name: '闪避', init: 0 },
{
name: '格斗',
init: 0,
group: {
show: ['斗殴', '', ''],
skills: [
{ name: '斗殴', init: 25 },
{ name: '刀剑', init: 20 },
{ name: '矛', init: 20 },
{ name: '斧', init: 15 },
{ name: '绞索', init: 15 },
{ name: '链锯', init: 10 },
{ name: '链枷', init: 10 },
{ name: '鞭', init: 5 },
],
},
},
],
};
29 changes: 29 additions & 0 deletions src/apps/erp-card/constants/resources/skillPacks/eb-04-medical.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// ERP basic pack 04: medical 医疗
import type { ResourceSkillPack } from '../../../types/resources/resourceSkill';

export const packMedical: ResourceSkillPack = {
name: '医疗',
initPlus: 30,
skills: [
{ name: '急救', init: 30 },
{ name: '精神分析', init: 0 },
{
name: '医疗',
init: 0,
group: {
show: [''],
skills: [
{ name: '外科' },
{ name: '内科' },
{ name: '药学' },
{ name: '护理' },
{ name: '美容科' },
{ name: '传统医学' },
{ name: '兽医' },
],
},
},
],
};

export default packMedical;
24 changes: 24 additions & 0 deletions src/apps/erp-card/constants/resources/skillPacks/eb-04-shoot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// ERP basic pack 03: battle 战斗
import type { ResourceSkillPack } from '../../../types/resources/resourceSkill';

export const packBattle: ResourceSkillPack = {
name: '射击',
initPlus: 30,
skills: [
{
name: '射击',
init: 0,
group: {
show: ['手枪', '步/霰', ''],
skills: [
{ name: '手枪', init: 20 },
{ name: '步/霰', init: 25 },
{ name: '冲锋枪', init: 15 },
{ name: '弓弩', init: 15 },
{ name: '机枪', init: 10 },
{ name: '重武器', init: 10 },
],
},
},
],
};
Loading

0 comments on commit b3d0791

Please sign in to comment.