This commit is contained in:
zyb
2025-05-06 19:57:50 +08:00
parent 56d8d7a345
commit 062550d126
22 changed files with 14472 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<template>
<div>
<label>
上传 Weapon.xml
<input type="file" @change="onWeaponFileChange" />
</label>
<br />
<label>
上传单位 XML AlliedAntiInfantryInfantry.xml
<input type="file" @change="onUnitFileChange" />
</label>
</div>
</template>
<script setup>
import { ref } from 'vue'
const emit = defineEmits(['updateWeaponTemplates', 'updateUnitDoc'])
const onWeaponFileChange = (e) => {
const file = e.target.files[0]
if (!file) return
const reader = new FileReader()
reader.onload = (event) => {
const parser = new DOMParser()
const xml = parser.parseFromString(event.target.result, 'text/xml')
const templates = xml.querySelectorAll('WeaponTemplate')
const ids = new Set()
templates.forEach((t) => {
const id = t.getAttribute('id')
if (id) ids.add(id)
})
emit('updateWeaponTemplates', ids)
}
reader.readAsText(file)
}
const onUnitFileChange = (e) => {
const file = e.target.files[0]
if (!file) return
const reader = new FileReader()
reader.onload = (event) => {
const parser = new DOMParser()
const xml = parser.parseFromString(event.target.result, 'text/xml')
emit('updateUnitDoc', xml)
}
reader.readAsText(file)
}
</script>

View File

@@ -0,0 +1,26 @@
<template>
<table>
<thead>
<tr>
<th>GameObject id</th>
<th>匹配到的 WeaponTemplate</th>
</tr>
</thead>
<tbody>
<tr v-for="(result, index) in matchResults" :key="index">
<td>{{ result.goId }}</td>
<td>{{ result.templates.length > 0 ? result.templates.join(', ') : 'None' }}</td>
</tr>
</tbody>
</table>
</template>
<script setup>
defineProps({
matchResults: {
type: Array,
required: true
}
})
</script>

11
src/components/index.vue Normal file
View File

@@ -0,0 +1,11 @@
<script setup lang="ts">
</script>
<template>
</template>
<style scoped>
</style>