feat: processing 체계를 일괄 변경

This commit is contained in:
2021-12-23 01:34:45 +09:00
parent 41d5df60f4
commit 2969ed2edc
16 changed files with 122 additions and 66 deletions
+2 -1
View File
@@ -247,7 +247,8 @@ class che_출병 extends Command\GeneralCommand
'mapTheme' => \sammo\getMapTheme(), 'mapTheme' => \sammo\getMapTheme(),
'procRes' => [ 'procRes' => [
'cities' => \sammo\JSOptionsForCities(), 'cities' => \sammo\JSOptionsForCities(),
'distanceList' => new \StdClass(), 'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 1),
], ],
]; ];
} }
-1
View File
@@ -227,7 +227,6 @@ declare const commandList: {
values: commandItem[]; values: commandItem[];
}[]; }[];
declare const serverNow: string; declare const serverNow: string;
declare const serverID: string;
type TurnObj = { type TurnObj = {
action: string; action: string;
brief: string; brief: string;
+3 -2
View File
@@ -27,9 +27,9 @@
<div>{{ crewType.attack }}</div> <div>{{ crewType.attack }}</div>
<div>{{ crewType.defence }}</div> <div>{{ crewType.defence }}</div>
<div>{{ crewType.speed }}</div> <div>{{ crewType.speed }}</div>
<div>{{ crewType.avoid }}</div>
<div>{{ crewType.baseCost.toFixed(1) }}</div> <div>{{ crewType.baseCost.toFixed(1) }}</div>
<div>{{ crewType.baseRice.toFixed(1) }}</div> <div>{{ crewType.baseRice.toFixed(1) }}</div>
<div>{{ crewType.avoid }}</div>
<div class="crewTypePanel"> <div class="crewTypePanel">
<b-button-group <b-button-group
><b-button class="py-1" variant="dark" @click="beHalf">절반</b-button ><b-button class="py-1" variant="dark" @click="beHalf">절반</b-button
@@ -59,7 +59,7 @@
background-color: #ddd; background-color: #ddd;
" "
><div style="margin-left: auto"> ><div style="margin-left: auto">
{{ Math.ceil(amount * crewType.baseCost).toLocaleString() }} {{ Math.ceil(amount * crewType.baseCost * goldCoeff).toLocaleString() }}
</div></span </div></span
> >
</div> </div>
@@ -86,6 +86,7 @@ export default defineComponent({
commandName: VueTypes.string.isRequired, commandName: VueTypes.string.isRequired,
currentCrewType: VueTypes.number.def(-1), currentCrewType: VueTypes.number.def(-1),
crew: VueTypes.number.def(0), crew: VueTypes.number.def(0),
goldCoeff: VueTypes.number.isRequired,
}, },
emits: ["submitOutput", "update:amount"], emits: ["submitOutput", "update:amount"],
watch: { watch: {
+6 -5
View File
@@ -16,20 +16,21 @@
</li> </li>
</ul> </ul>
<div class="row"> <div class="row">
<div class="col-12 col-md-4"> <div class="col-4 col-md-2">
국명 : <b-form-input v-model="destNationName" /> 국명 : <b-form-input maxlength="18" v-model="destNationName" />
</div> </div>
<div class="col-6 col-md-2"> <div class="col-3 col-md-2">
색상 : <ColorSelect :colors="colors" v-model="selectedColorID" /> 색상 : <ColorSelect :colors="colors" v-model="selectedColorID" />
</div> </div>
<div class="col-6 col-md-2"> <div class="col-3 col-md-2">
<label>성향 :</label> <label>성향 :</label>
<b-form-select <b-form-select
:options="nationTypesOption" :options="nationTypesOption"
v-model="selectedNationType" v-model="selectedNationType"
/> />
</div> </div>
<div class="col-12 col-md-2 d-grid">
<div class="col-2 col-md-2 d-grid">
<b-button @click="submit">{{ commandName }}</b-button> <b-button @click="submit">{{ commandName }}</b-button>
</div> </div>
</div> </div>
@@ -12,7 +12,7 @@
<b-button :pressed="!buyRice" @click="buyRice=false"></b-button> <b-button :pressed="!buyRice" @click="buyRice=false"></b-button>
</b-button-group> </b-button-group>
</div> </div>
<div class="col-6 col-md-4"> <div class="col-7 col-md-4">
금액 : 금액 :
<SelectAmount <SelectAmount
:amountGuide="amountGuide" :amountGuide="amountGuide"
@@ -21,7 +21,7 @@
:minAmount="minAmount" :minAmount="minAmount"
/> />
</div> </div>
<div class="col-4 col-md-2 d-grid"> <div class="col-3 col-md-2 d-grid">
<b-button variant="primary" @click="submit">{{ commandName }}</b-button> <b-button variant="primary" @click="submit">{{ commandName }}</b-button>
</div> </div>
</div> </div>
+2 -2
View File
@@ -11,7 +11,7 @@
장수를 선택하세요.<br /> 장수를 선택하세요.<br />
</div> </div>
<div class="row"> <div class="row">
<div class="col-12 col-md-6"> <div class="col-9 col-md-4">
장수 : 장수 :
<SelectGeneral <SelectGeneral
:generals="generalList" :generals="generalList"
@@ -19,7 +19,7 @@
v-model="selectedGeneralID" v-model="selectedGeneralID"
/> />
</div> </div>
<div class="col-4 col-md-2 d-grid"> <div class="col-3 col-md-2 d-grid">
<b-button variant="primary" @click="submit">{{ commandName }}</b-button> <b-button variant="primary" @click="submit">{{ commandName }}</b-button>
</div> </div>
</div> </div>
@@ -8,7 +8,7 @@
임관할 국가를 목록에서 선택하세요.<br /> 임관할 국가를 목록에서 선택하세요.<br />
</div> </div>
<div class="row"> <div class="row">
<div class="col-12 col-md-6"> <div class="col-8 col-md-4">
장수 : 장수 :
<SelectGeneral <SelectGeneral
:generals="generalList" :generals="generalList"
@@ -25,11 +25,20 @@
<div class="nation-header nation-row bg1 center"> <div class="nation-header nation-row bg1 center">
<div>국가명</div> <div>국가명</div>
<div>임관권유문</div> <div>임관권유문</div>
<div class="zoom-toggle d-grid">
<b-button
:pressed="toggleZoom"
:variant="toggleZoom ? 'info' : 'secondary'"
v-model="toggleZoom"
@click="toggleZoom = !toggleZoom"
>{{ toggleZoom ? "작게 보기" : "크게 보기" }}</b-button
>
</div>
</div> </div>
<div <div
v-for="[, nation] in nationList" v-for="[, nation] in nationList"
:key="nation.id" :key="nation.id"
class="nation-row s-border-b" :class="['nation-row', 's-border-b', toggleZoom ? 'on-zoom' : 'on-fit']"
> >
<div <div
:style="{ :style="{
@@ -87,6 +96,7 @@ export default defineComponent({
procRes.generals procRes.generals
); );
const toggleZoom = ref(true);
const selectedGeneralID = ref(generalList[0].no); const selectedGeneralID = ref(generalList[0].no);
function textHelpGeneral(gen: procGeneralItem): string { function textHelpGeneral(gen: procGeneralItem): string {
@@ -116,6 +126,7 @@ export default defineComponent({
selectedGeneralID, selectedGeneralID,
generalList, generalList,
commandName, commandName,
toggleZoom,
isBrightColor, isBrightColor,
textHelpGeneral, textHelpGeneral,
submit, submit,
@@ -132,24 +143,57 @@ export default defineComponent({
display: grid; display: grid;
grid-template-columns: 130px 870px; grid-template-columns: 130px 870px;
} }
.zoom-toggle {
display: none;
}
.zoom-toggle > * {
display: none;
}
} }
@include media-500px { @include media-500px {
.nation-list .nation-row.nation-header {
display: grid;
grid-template-columns: 3fr 1fr;
grid-template-rows: 1fr 1fr;
.zoom-toggle {
grid-column: 2/3;
grid-row: 1/3;
}
}
.nation-list .nation-row { .nation-list .nation-row {
display: grid; display: grid;
grid-template-columns: 1fr; grid-template-columns: 1fr;
grid-template-rows: 1fr minmax(1fr, calc(200px * 500 / 870)); grid-template-rows: 1fr minmax(1fr, calc(200px * 500 / 870));
} }
.nation-scout-plate { .on-fit {
max-height: calc(200px * 500 / 870); .nation-scout-plate {
overflow: hidden; max-height: calc(200px * 500 / 870);
overflow: hidden;
}
.nation-scout-msg {
width: 870px;
transform-origin: 0px 0px;
transform: scale(calc(500 / 870));
}
} }
.nation-scout-msg { .on-zoom {
width: 870px; .nation-scout-plate {
transform-origin: 0px 0px; max-height: 200px;
transform: scale(calc(500 / 870)); overflow-y: hidden;
overflow-x: auto;
}
.nation-scout-msg {
max-width: 870px;
}
} }
} }
</style> </style>
+29 -27
View File
@@ -61,11 +61,12 @@
></div> ></div>
<div <div
:style="{ :style="{
backgroundColor: (destCrewType.notAvailable backgroundColor:
? 'red' (destCrewType.notAvailable
: destCrewType.reqTech == 0 ? 'red'
? 'green' : destCrewType.reqTech == 0
: 'limegreen')+' !important', ? 'green'
: 'limegreen') + ' !important',
height: '100%', height: '100%',
}" }"
class="d-grid" class="d-grid"
@@ -74,7 +75,7 @@
{{ destCrewType.name }} {{ destCrewType.name }}
</div> </div>
</div> </div>
<div>{{ destCrewType.baseCost.toFixed(1) }}</div> <div></div>
<div class="crewTypePanel"> <div class="crewTypePanel">
<b-button-group <b-button-group
><b-button class="py-1" variant="dark" @click="beHalf" ><b-button class="py-1" variant="dark" @click="beHalf"
@@ -107,7 +108,7 @@
><div style="margin-left: auto"> ><div style="margin-left: auto">
{{ {{
Math.ceil( Math.ceil(
amount * destCrewType.baseCost amount * destCrewType.baseCost * goldCoeff
).toLocaleString() ).toLocaleString()
}} }}
</div></span </div></span
@@ -116,6 +117,7 @@
</div> </div>
</div> </div>
</div> </div>
<div></div>
<b-button variant="primary" @click="submit">{{ <b-button variant="primary" @click="submit">{{
commandName commandName
}}</b-button> }}</b-button>
@@ -126,9 +128,9 @@
<div>공격</div> <div>공격</div>
<div>방어</div> <div>방어</div>
<div>기동</div> <div>기동</div>
<div>회피</div>
<div>가격</div> <div>가격</div>
<div>군량</div> <div>군량</div>
<div>회피</div>
<div class="crewTypePanel">병사 </div> <div class="crewTypePanel">병사 </div>
<div class="crewTypeBtn">행동</div> <div class="crewTypeBtn">행동</div>
<div class="crewTypeInfo">특징</div> <div class="crewTypeInfo">특징</div>
@@ -140,10 +142,17 @@
:key="armCrewType.armType" :key="armCrewType.armType"
> >
<div class="s-border-b row gx-0"> <div class="s-border-b row gx-0">
<div class="col-7 col-md-10 align-self-center px-3" style="font-size:1.3em;">{{ armCrewType.armName }} 계열</div> <div
class="col-7 col-md-10 align-self-center px-3"
style="font-size: 1.3em"
>
{{ armCrewType.armName }} 계열
</div>
<div class="col-5 col-md-2 d-grid"> <div class="col-5 col-md-2 d-grid">
<b-button <b-button
:variant="showNotAvailable.get(armCrewType.armType) ? 'warning' : 'dark'" :variant="
showNotAvailable.get(armCrewType.armType) ? 'warning' : 'dark'
"
:pressed="showNotAvailable.get(armCrewType.armType)" :pressed="showNotAvailable.get(armCrewType.armType)"
class="btn-sm" class="btn-sm"
@click="toggleShowNotAvailable(armCrewType.armType)" @click="toggleShowNotAvailable(armCrewType.armType)"
@@ -166,6 +175,7 @@
:commandName="commandName" :commandName="commandName"
:currentCrewType="currentCrewType" :currentCrewType="currentCrewType"
:crew="crew" :crew="crew"
:goldCoeff="goldCoeff"
@submitOutput="trySubmit" @submitOutput="trySubmit"
@click=" @click="
destCrewType = crewTypeMap.get(crewType.id); destCrewType = crewTypeMap.get(crewType.id);
@@ -262,26 +272,18 @@ export default defineComponent({
void submit(e); void submit(e);
} }
function toggleShowNotAvailable(armType: number){ function toggleShowNotAvailable(armType: number) {
showNotAvailable.value.set(armType, !(showNotAvailable.value.get(armType)??0)); showNotAvailable.value.set(
armType,
!(showNotAvailable.value.get(armType) ?? 0)
);
} }
return { return {
destCrewType, destCrewType,
amount, amount,
showNotAvailable, showNotAvailable,
relYear: procRes.relYear, ...procRes,
year: procRes.year,
tech: procRes.tech,
techLevel: procRes.techLevel,
startYear: procRes.startYear,
goldCoeff: procRes.goldCoeff,
leadership: procRes.leadership,
fullLeadership: procRes.fullLeadership,
armCrewTypes: procRes.armCrewTypes,
currentCrewType: procRes.currentCrewType,
crew: procRes.crew,
gold: procRes.gold,
crewTypeMap, crewTypeMap,
commandName, commandName,
beHalf, beHalf,
@@ -320,8 +322,8 @@ export default defineComponent({
display: none; display: none;
} }
.only500pxMode{ .only500pxMode {
display: none; display: none;
} }
} }
@@ -367,7 +369,7 @@ export default defineComponent({
.miniCrewPanel { .miniCrewPanel {
display: grid; display: grid;
grid-template-columns: 64px 1.5fr 1fr 270px 2fr; grid-template-columns: 64px 1.5fr 0.5fr 270px 0.5fr 2fr;
grid-template-rows: 64px; grid-template-rows: 64px;
align-items: center; align-items: center;
} }
+2 -2
View File
@@ -12,7 +12,7 @@
<b-button :pressed="!isGold" @click="isGold = false"></b-button> <b-button :pressed="!isGold" @click="isGold = false"></b-button>
</b-button-group> </b-button-group>
</div> </div>
<div class="col-6 col-md-4"> <div class="col-7 col-md-4">
금액 : 금액 :
<SelectAmount <SelectAmount
:amountGuide="amountGuide" :amountGuide="amountGuide"
@@ -21,7 +21,7 @@
:minAmount="minAmount" :minAmount="minAmount"
/> />
</div> </div>
<div class="col-4 col-md-2 d-grid"> <div class="col-3 col-md-2 d-grid">
<b-button variant="primary" @click="submit">{{ commandName }}</b-button> <b-button variant="primary" @click="submit">{{ commandName }}</b-button>
</div> </div>
</div> </div>
@@ -7,7 +7,7 @@
<div class="row"> <div class="row">
<div class="col-6 col-md-3"> <div class="col-6 col-md-3">
국명 : 국명 :
<b-form-input v-model="destNationName"/> <b-form-input maxlength="18" v-model="destNationName"/>
</div> </div>
<div class="col-4 col-md-2 d-grid"> <div class="col-4 col-md-2 d-grid">
<b-button @click="submit">{{ commandName }}</b-button> <b-button @click="submit">{{ commandName }}</b-button>
@@ -18,15 +18,14 @@
<span style="color: red">붉은색</span>으로 표시됩니다.<br /> <span style="color: red">붉은색</span>으로 표시됩니다.<br />
</div> </div>
<div class="row"> <div class="row">
<div class="col-6 col-md-3"> <div class="col-4 col-md-3">
국가 : 국가 :
<SelectNation :nations="nationList" v-model="selectedNationID" /> <SelectNation :nations="nationList" v-model="selectedNationID" />
</div> </div>
<div class="col-6 col-md-3"> <div class="col-5 col-md-3">
기간 : 기간 :
<div class="input-group"></div>
<div class="input-group"> <div class="input-group">
<b-form-select v-model="selectedYear" <b-form-select class="text-end selectedYear" v-model="selectedYear"
><b-form-select-option ><b-form-select-option
v-for="yearP in maxYear - minYear + 1" v-for="yearP in maxYear - minYear + 1"
:key="yearP" :key="yearP"
@@ -34,16 +33,16 @@
>{{ yearP + minYear - 1 }}</b-form-select-option >{{ yearP + minYear - 1 }}</b-form-select-option
> >
</b-form-select> </b-form-select>
<span class="input-group-text"></span> <span class="input-group-text px-2"></span>
<b-form-select v-model="selectedMonth" <b-form-select class="text-center" v-model="selectedMonth"
><b-form-select-option v-for="month in 12" :key="month" :value="month">{{ ><b-form-select-option v-for="month in 12" :key="month" :value="month">{{
month month
}}</b-form-select-option> }}</b-form-select-option>
</b-form-select> </b-form-select>
<span class="input-group-text"></span> <span class="input-group-text px-2"></span>
</div> </div>
</div> </div>
<div class="col-4 col-md-2 d-grid"> <div class="col-3 col-md-2 d-grid">
<b-button @click="submit">{{ commandName }}</b-button> <b-button @click="submit">{{ commandName }}</b-button>
</div> </div>
</div> </div>
@@ -130,3 +129,9 @@ export default defineComponent({
}, },
}); });
</script> </script>
<style lang="scss" scoped>
.selectedYear{
width:32%;
}
</style>
@@ -24,14 +24,14 @@
국가 : 국가 :
<SelectNation :nations="nationList" v-model="selectedNationID" /> <SelectNation :nations="nationList" v-model="selectedNationID" />
</div> </div>
<div class="col-4 col-md-2"> <div class="col-3 col-md-2">
<label>전략 :</label> <label>전략 :</label>
<b-form-select <b-form-select
:options="commandTypesOption" :options="commandTypesOption"
v-model="selectedCommandID" v-model="selectedCommandID"
/> />
</div> </div>
<div class="col-4 col-md-2 d-grid"> <div class="col-3 col-md-2 d-grid">
<b-button @click="submit">{{ commandName }}</b-button> <b-button @click="submit">{{ commandName }}</b-button>
</div> </div>
</div> </div>
+2 -2
View File
@@ -28,7 +28,7 @@
<b-button :pressed="!isGold" @click="isGold=false"></b-button> <b-button :pressed="!isGold" @click="isGold=false"></b-button>
</b-button-group> </b-button-group>
</div> </div>
<div class="col-6 col-md-4"> <div class="col-7 col-md-4">
금액 : 금액 :
<SelectAmount <SelectAmount
:amountGuide="amountGuide" :amountGuide="amountGuide"
@@ -37,7 +37,7 @@
:minAmount="minAmount" :minAmount="minAmount"
/> />
</div> </div>
<div class="col-4 col-md-2 d-grid"> <div class="col-3 col-md-2 d-grid">
<b-button variant="primary" @click="submit">{{ commandName }}</b-button> <b-button variant="primary" @click="submit">{{ commandName }}</b-button>
</div> </div>
</div> </div>
+1 -1
View File
@@ -20,7 +20,7 @@
> >
<input <input
type="number" type="number"
class="form-control" class="form-control text-end"
:max="maxAmount" :max="maxAmount"
:min="minAmount" :min="minAmount"
:step="step" :step="step"
+4
View File
@@ -1,3 +1,4 @@
import { mb_strwidth } from "@/util/mb_strwidth";
import { isArray, isBoolean, isInteger, isString } from "lodash"; import { isArray, isBoolean, isInteger, isString } from "lodash";
@@ -55,6 +56,9 @@ export function testSubmitArgs(args: Args): true | ['int' | 'string' | 'boolean'
if (!isString(testVal)) { if (!isString(testVal)) {
return ['string', stringKey, testVal]; return ['string', stringKey, testVal];
} }
if(stringKey == 'nationName' && mb_strwidth(testVal) > 18){
throw `길이가 반각 18자 분량을 넘었습니다.`;
}
} }
for (const booleanKey of booleanArgs) { for (const booleanKey of booleanArgs) {
const testVal = args[booleanKey]; const testVal = args[booleanKey];
-1
View File
@@ -1,4 +1,3 @@
//TODO: X-Requested-With 믿지 말자.
//https://gist.github.com/demouth/3217440 //https://gist.github.com/demouth/3217440
/** /**
* mb_strwidth * mb_strwidth