From 4b8a8d722a18eed0269a4d325162ea6324159141 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Mon, 4 Apr 2022 03:19:28 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20ag-grid=EC=97=90=EC=84=9C=20iActionInfo?= =?UTF-8?q?=EB=A5=BC=20=ED=88=B4=ED=8C=81=EC=9C=BC=EB=A1=9C=20=EB=9D=84?= =?UTF-8?q?=EC=9B=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/sammo/API/Nation/GeneralList.php | 11 ----- hwe/ts/components/GeneralList.vue | 47 +++++++++++++----- hwe/ts/gridCellRenderer/GridTooltipCell.vue | 49 +++++++++++++++++++ hwe/ts/gridCellRenderer/SimpleTooltipCell.vue | 42 ++++++++++++++++ 4 files changed, 125 insertions(+), 24 deletions(-) create mode 100644 hwe/ts/gridCellRenderer/GridTooltipCell.vue create mode 100644 hwe/ts/gridCellRenderer/SimpleTooltipCell.vue diff --git a/hwe/sammo/API/Nation/GeneralList.php b/hwe/sammo/API/Nation/GeneralList.php index 62c9da17..0a0643a9 100644 --- a/hwe/sammo/API/Nation/GeneralList.php +++ b/hwe/sammo/API/Nation/GeneralList.php @@ -113,8 +113,6 @@ class GeneralList extends \sammo\BaseAPI $customViewColumns = [ 'officerLevel' => 0, 'officerLevelText' => 0, - 'specialDomesticTest' => 0, - 'specialWarText' => 0, 'lbonus' => 0, 'ownerName' => 0, 'honorText' => 0, @@ -131,15 +129,6 @@ class GeneralList extends \sammo\BaseAPI $level = $this->getOfficerLevel($rawGeneral); return getOfficerLevelText($level, $nationArr['level']); }, - 'specialDomesticTest' => function ($rawGeneral) { - return getGeneralSpecialDomesticName($rawGeneral['special']); - }, - 'specialWarText' => function ($rawGeneral) { - return getGeneralSpecialWarName($rawGeneral['special2']); - }, - 'personal' => function ($rawGeneral) { - return getGenChar($rawGeneral['personal']); - }, 'lbonus' => function ($rawGeneral) use ($nationArr) { return calcLeadershipBonus($rawGeneral['officer_level'], $nationArr['level']); }, diff --git a/hwe/ts/components/GeneralList.vue b/hwe/ts/components/GeneralList.vue index e455b3ba..d01e74e5 100644 --- a/hwe/ts/components/GeneralList.vue +++ b/hwe/ts/components/GeneralList.vue @@ -34,12 +34,12 @@ import type { GridReadyEvent, } from "ag-grid-community"; import { getNpcColor } from "@/common_legacy"; -import type { - BaseWithValueColDefParams, - ValueGetterParams, -} from "ag-grid-community/dist/lib/entities/colDef"; +import type { BaseWithValueColDefParams, ValueGetterParams } from "ag-grid-community/dist/lib/entities/colDef"; import type { GameConstStore } from "@/GameConstStore"; import { unwrap } from "@/util/unwrap"; +import SimpleTooltipCell from "@/gridCellRenderer/SimpleTooltipCell.vue"; +import GridTooltipCell from "@/gridCellRenderer/GridTooltipCell.vue"; +import type { GameIActionInfo } from "@/defs/GameObj"; const props = defineProps({ list: { @@ -54,7 +54,7 @@ const props = defineProps({ }, }); -const gameConstStore = unwrap(inject>('gameConstStore')); +const gameConstStore = unwrap(inject>("gameConstStore")); const iActionInfo = gameConstStore.value.iActionInfo; console.log(iActionInfo); //debug @@ -144,6 +144,12 @@ interface GenCellClassParams extends CellClassParams { data: GeneralListItem; } +type GridCellInfo = { + iActionMap?: Record; + info?: string; + target: keyof GeneralListItem; +}; + function naiveCheClassNameFilter(value: string): string { const text = value.split("_").pop() ?? "None"; if (text === "None") { @@ -310,11 +316,17 @@ const columnRawDefs = ref children: [ { headerName: "요약", - cellRenderer: ({ data }: GenValueParams) => { - const personal = naiveCheClassNameFilter(data.personal); - const specialDomestic = naiveCheClassNameFilter(data.specialDomestic); - const specialWar = naiveCheClassNameFilter(data.specialWar); - return `${personal}
${specialDomestic}
${specialWar}
`; + cellRenderer: GridTooltipCell, + cellRendererParams: { + cells: ((): GridCellInfo[][] => { + return [ + [{ target: "personal", iActionMap: gameConstStore.value.iActionInfo.personality }], + [ + { target: "specialDomestic", iActionMap: gameConstStore.value.iActionInfo.specialDomestic }, + { target: "specialWar", iActionMap: gameConstStore.value.iActionInfo.specialWar }, + ], + ]; + })(), }, width: 90, columnGroupShow: "closed", @@ -322,7 +334,10 @@ const columnRawDefs = ref { headerName: "성격", field: "personal", - valueFormatter: naiveCheClassNameFilterFromRow("personal"), + cellRenderer: SimpleTooltipCell, + cellRendererParams: { + iActionMap: gameConstStore.value.iActionInfo.personality, + }, width: 70, sortable: true, filter: true, @@ -331,7 +346,10 @@ const columnRawDefs = ref { headerName: "내특", field: "specialDomestic", - valueFormatter: naiveCheClassNameFilterFromRow("specialDomestic"), + cellRenderer: SimpleTooltipCell, + cellRendererParams: { + iActionMap: gameConstStore.value.iActionInfo.specialDomestic, + }, width: 70, sortable: true, filter: true, @@ -340,7 +358,10 @@ const columnRawDefs = ref { headerName: "전특", field: "specialWar", - valueFormatter: naiveCheClassNameFilterFromRow("specialWar"), + cellRenderer: SimpleTooltipCell, + cellRendererParams: { + iActionMap: gameConstStore.value.iActionInfo.specialWar, + }, width: 70, sortable: true, filter: true, diff --git a/hwe/ts/gridCellRenderer/GridTooltipCell.vue b/hwe/ts/gridCellRenderer/GridTooltipCell.vue new file mode 100644 index 00000000..3ca5ee49 --- /dev/null +++ b/hwe/ts/gridCellRenderer/GridTooltipCell.vue @@ -0,0 +1,49 @@ + + + diff --git a/hwe/ts/gridCellRenderer/SimpleTooltipCell.vue b/hwe/ts/gridCellRenderer/SimpleTooltipCell.vue new file mode 100644 index 00000000..732485cc --- /dev/null +++ b/hwe/ts/gridCellRenderer/SimpleTooltipCell.vue @@ -0,0 +1,42 @@ + + +