From c0e13115683d6514a76a83c77c4bc1a6ab0eceaa Mon Sep 17 00:00:00 2001 From: Kwaroran Date: Mon, 6 Jan 2025 00:24:03 +0900 Subject: [PATCH] Add branches --- src/lib/Others/AlertComp.svelte | 84 +++++++++++++++++++++- src/lib/SideBars/SideChatList.svelte | 15 +++- src/ts/alert.ts | 2 +- src/ts/gui/branches.ts | 104 +++++++++++++++++++++++++++ src/ts/process/memory/hypav2.ts | 1 + 5 files changed, 201 insertions(+), 5 deletions(-) create mode 100644 src/ts/gui/branches.ts diff --git a/src/lib/Others/AlertComp.svelte b/src/lib/Others/AlertComp.svelte index 8d418612..f6f35c13 100644 --- a/src/lib/Others/AlertComp.svelte +++ b/src/lib/Others/AlertComp.svelte @@ -21,12 +21,20 @@ import ModuleChatMenu from "../Setting/Pages/Module/ModuleChatMenu.svelte"; import { ColorSchemeTypeStore } from "src/ts/gui/colorscheme"; import Help from "./Help.svelte"; + import { getChatBranches } from "src/ts/gui/branches"; + import { getCurrentCharacter } from "src/ts/storage/database.svelte"; + import { message } from "@tauri-apps/plugin-dialog"; let btn let input = $state('') let cardExportType = $state('realm') let cardExportType2 = $state('') let cardLicense = $state('') let generationInfoMenuIndex = $state(0) + let branchHover:null|{ + x:number, + y:number, + content:string, + } = $state(null) $effect.pre(() => { if(btn){ btn.focus() @@ -34,6 +42,9 @@ if($alertStore.type !== 'input'){ input = '' } + if($alertStore.type !== 'branches'){ + branchHover = null + } if($alertStore.type !== 'cardexport'){ cardExportType = 'realm' cardExportType2 = '' @@ -69,7 +80,7 @@ } }}> -{#if $alertStore.type !== 'none' && $alertStore.type !== 'toast' && $alertStore.type !== 'cardexport' && $alertStore.type !== 'selectModule' && $alertStore.type !== 'pukmakkurit'} +{#if $alertStore.type !== 'none' && $alertStore.type !== 'toast' && $alertStore.type !== 'cardexport' && $alertStore.type !== 'branches' && $alertStore.type !== 'selectModule' && $alertStore.type !== 'pukmakkurit'}
{#if $alertStore.type === 'error'} @@ -551,7 +562,78 @@
+{:else if $alertStore.type === 'branches'} +
+ {#if branchHover !== null} +
+ {branchHover.content} +
+ {/if} +
+ +
+ + {#each getChatBranches() as obj} + + +
{ + if(branchHover === null){ + const char = getCurrentCharacter() + branchHover = { + x: obj.x, + y: obj.y, + content: char.chats[obj.chatId].message[obj.y - 1].data + } + } + }} + onclick={() => { + if(branchHover === null){ + const char = getCurrentCharacter() + branchHover = { + x: obj.x, + y: obj.y, + content: char.chats[obj.chatId].message[obj.y - 1].data + } + } + }} + onmouseleave={() => { + branchHover = null + }} + > + +
+ {#if obj.connectX === obj.x} + {#if obj.multiChild} +
+ +
+ {:else} +
+ +
+ {/if} + {:else if obj.connectX !== -1} +
+ +
+ + {/if} + {/each} +
{/if}