feat: 세력장수에 개인 전략 예약 상태 표기

This commit is contained in:
2023-12-30 04:01:53 +00:00
parent f0feb9a91c
commit 8ea85dd155
3 changed files with 97 additions and 46 deletions
+31 -1
View File
@@ -121,6 +121,7 @@ class GeneralList extends \sammo\BaseAPI
'autorun_limit' => 1, 'autorun_limit' => 1,
'impossibleUserAction' => 1, 'impossibleUserAction' => 1,
'reservedUserAction' => 1,
]; ];
public function validateArgs(): ?string public function validateArgs(): ?string
@@ -288,7 +289,36 @@ class GeneralList extends \sammo\BaseAPI
} }
} }
return $impossibleUserAction; return $impossibleUserAction;
} },
'reservedUserAction' => function ($rawGeneral) use ($env) {
$rawUserAction = ($rawGeneral['aux'] ?? [])[UserActionCommand::USER_ACTION_KEY] ?? [];
$userAction = UserAction::fromArray($rawUserAction);
$reservedUserAction = [];
$emptyTurnObj = [
'brief' => '휴식',
'action' => '휴식',
'arg' => [],
];
for($i = 0; $i < 5; $i++){
$reservedUserAction[] = $emptyTurnObj;
}
if ($userAction->reserved) {
foreach ($userAction->reserved as $turnIdx => $reserved) {
if($turnIdx >= 5){
continue;
}
$reservedUserAction[$turnIdx] = [
'brief' => $reserved->brief,
'action' => $reserved->command,
'arg' => [],
];
}
}
return $reservedUserAction;
},
]; ];
foreach ($rankColumns as $rankKey) { foreach ($rankColumns as $rankKey) {
+65 -45
View File
@@ -7,71 +7,50 @@
<BDropdownDivider /> <BDropdownDivider />
<BDropdownItem @click="storeDisplaySetting"><i class="bi bi-bookmark-plus-fill" />&nbsp;보관하기</BDropdownItem> <BDropdownItem @click="storeDisplaySetting"><i class="bi bi-bookmark-plus-fill" />&nbsp;보관하기</BDropdownItem>
<BDropdownDivider /> <BDropdownDivider />
<BDropdownItem <BDropdownItem v-for="[key, setting] of displaySettings.entries()" :key="key"
v-for="[key, setting] of displaySettings.entries()" @click="setDisplaySetting([false, key], setting)">
:key="key" <div class="row gx-0">
@click="setDisplaySetting([false, key], setting)"
><div class="row gx-0">
<div class="col-9 text-wrap"> <div class="col-9 text-wrap">
<span class="align-middle">{{ key }}</span> <span class="align-middle">{{ key }}</span>
</div> </div>
<div class="col-3"> <div class="col-3">
<div class="d-grid"><BButton size="sm" @click="deleteDisplaySetting(key)">삭제</BButton></div> <div class="d-grid">
<BButton size="sm" @click="deleteDisplaySetting(key)">삭제</BButton>
</div>
</div> </div>
</div></BDropdownItem </div>
> </BDropdownItem>
</BDropdown> </BDropdown>
<!-- eslint-disable-next-line vue/max-attributes-per-line --> <!-- eslint-disable-next-line vue/max-attributes-per-line -->
<BDropdown class="w-50" variant="info" text="열 선택" menuClass="column-menu" right> <BDropdown class="w-50" variant="info" text="열 선택" menuClass="column-menu" right>
<template v-for="[colID, col, depth] of getColumnList()" :key="[colID, depth]"> <template v-for="[colID, col, depth] of getColumnList()" :key="[colID, depth]">
<BDropdownItem v-if="col instanceof ProvidedColumnGroup" disabled> <BDropdownItem v-if="col instanceof ProvidedColumnGroup" disabled>
<span :style="{ marginLeft: depth ? `${12 * depth}px` : undefined }"> <span :style="{ marginLeft: depth ? `${12 * depth}px` : undefined }">
{{ col.getColGroupDef()?.headerName }}</span {{ col.getColGroupDef()?.headerName }}</span>
></BDropdownItem </BDropdownItem>
>
<BDropdownItem v-else> <BDropdownItem v-else>
<div :style="{ marginLeft: depth ? `${12 * depth}px` : undefined }" class="form-check" @click.stop="1"> <div :style="{ marginLeft: depth ? `${12 * depth}px` : undefined }" class="form-check" @click.stop="1">
<input <input :id="`column-type-${colID}`" class="form-check-input" type="checkbox" :checked="col.isVisible()"
:id="`column-type-${colID}`" @change.stop="toggleColumn(colID, col)" />
class="form-check-input" <label class="form-check-label" :for="`column-type-${colID}`" :style="{
type="checkbox" textDecoration: validColumns.has(colID) ? undefined : 'line-through'
:checked="col.isVisible()" }">
@change.stop="toggleColumn(colID, col)"
/>
<label
class="form-check-label"
:for="`column-type-${colID}`"
:style="{
textDecoration: validColumns.has(colID) ? undefined : 'line-through'
}"
>
{{ col.getColDef().headerName }} {{ col.getColDef().headerName }}
</label> </label>
</div></BDropdownItem </div>
> </BDropdownItem>
</template> </template>
<BDropdownDivider /> <BDropdownDivider />
</BDropdown> </BDropdown>
</BButtonGroup> </BButtonGroup>
</Teleport> </Teleport>
<div <div class="component-general-list" :style="{
class="component-general-list" height: props.height === 'fill' ? '100%' : props.height === 'static' ? undefined : `${props.height}px`
:style="{ }">
height: props.height === 'fill' ? '100%' : props.height === 'static' ? undefined : `${props.height}px` <AgGridVue style="width: 100%; height: 100%" class="ag-theme-balham-dark" :getRowId="getRowId"
}" :getRowHeight="getRowHeight" :columnDefs="columnDefs" :rowData="list" :defaultColDef="defaultColDef"
> :suppressColumnMoveAnimation="suppressColumnMoveAnimation" @grid-ready="onGridReady"
<AgGridVue @cell-clicked="onCellClicked" />
style="width: 100%; height: 100%"
class="ag-theme-balham-dark"
:getRowId="getRowId"
:getRowHeight="getRowHeight"
:columnDefs="columnDefs"
:rowData="list"
:defaultColDef="defaultColDef"
:suppressColumnMoveAnimation="suppressColumnMoveAnimation"
@grid-ready="onGridReady"
@cell-clicked="onCellClicked"
/>
</div> </div>
</template> </template>
<script lang="ts"></script> <script lang="ts"></script>
@@ -1048,6 +1027,34 @@ const columnRawDefs = ref<Partial<Record<headerType, GenColDef | GenColGroupDef>
} }
] ]
}, },
reservedUserAction: {
colId: "reservedUserAction",
headerName: "개인전략",
field: "reservedUserAction",
width: 120,
cellRenderer: ({ data }: GenValueParams) => {
if (data === undefined) {
return "?";
}
if (data.npc >= 2) {
return "NPC 장수";
}
if(!data.st1){
return '-';
}
const commandList = data.reservedUserAction;
if (!commandList) {
return "???";
}
return commandList
.map(({ brief }) => brief)
.join("<br>");
},
cellStyle: {
lineHeight: "1em",
fontSize: "0.85em"
},
},
turntime: { turntime: {
colId: "turntime", colId: "turntime",
headerName: "턴", headerName: "턴",
@@ -1231,6 +1238,7 @@ watch(columnRawDefs, (val) => {
.g-tr { .g-tr {
border-bottom: solid gray 1px; border-bottom: solid gray 1px;
} }
.g-thead-tr { .g-thead-tr {
position: sticky; position: sticky;
top: 0px; top: 0px;
@@ -1247,51 +1255,63 @@ watch(columnRawDefs, (val) => {
text-decoration: underline; text-decoration: underline;
cursor: pointer; cursor: pointer;
} }
.ag-root-wrapper .cell-middle { .ag-root-wrapper .cell-middle {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.ag-root-wrapper { .ag-root-wrapper {
font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic"; font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic";
font-size: 14px; font-size: 14px;
overflow: auto; overflow: auto;
} }
.ag-root { .ag-root {
overflow: auto; overflow: auto;
} }
.ag-header { .ag-header {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 10; z-index: 10;
} }
.cell-center { .cell-center {
justify-content: space-around; justify-content: space-around;
text-align: center; text-align: center;
} }
.cell-right { .cell-right {
justify-content: flex-end; justify-content: flex-end;
text-align: right; text-align: right;
} }
.cell-sp .col { .cell-sp .col {
min-width: 30px; min-width: 30px;
} }
.ag-header-cell, .ag-header-cell,
.ag-header-group-cell, .ag-header-group-cell,
.ag-cell { .ag-cell {
padding-left: 4px; padding-left: 4px;
padding-right: 4px; padding-right: 4px;
} }
.ag-header-cell-label, .ag-header-cell-label,
.ag-header-group-cell-label { .ag-header-group-cell-label {
justify-content: center; justify-content: center;
} }
.ag-ltr .ag-floating-filter-button { .ag-ltr .ag-floating-filter-button {
margin-left: 2px; margin-left: 2px;
} }
.ag-rtl .ag-floating-filter-button { .ag-rtl .ag-floating-filter-button {
margin-right: 2px; margin-right: 2px;
} }
} }
.general-list-toolbar { .general-list-toolbar {
.column-menu { .column-menu {
column-count: 3; column-count: 3;
+1
View File
@@ -83,6 +83,7 @@ export type GeneralListItemP1 = {
firenum: number; firenum: number;
impossibleUserAction: [string, number][]; impossibleUserAction: [string, number][];
reservedUserAction: TurnObj[] | null;
} & GeneralListItemP0; } & GeneralListItemP0;
export type GeneralListItemP2 = GeneralListItemP1; export type GeneralListItemP2 = GeneralListItemP1;