[feat] vn
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getCustomBackground, getEmotion } from "../../ts/util";
|
import { getCustomBackground, getEmotion } from "../../ts/util";
|
||||||
import { DataBase } from "../../ts/storage/database";
|
import { DataBase } from "../../ts/storage/database";
|
||||||
import { CharEmotion, CurrentCharacter, selectedCharID } from "../../ts/stores";
|
import { CharEmotion, CurrentCharacter, ShowVN, selectedCharID } from "../../ts/stores";
|
||||||
import ResizeBox from './ResizeBox.svelte'
|
import ResizeBox from './ResizeBox.svelte'
|
||||||
import DefaultChatScreen from "./DefaultChatScreen.svelte";
|
import DefaultChatScreen from "./DefaultChatScreen.svelte";
|
||||||
import defaultWallpaper from '../../etc/bg.jpg'
|
import defaultWallpaper from '../../etc/bg.jpg'
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
import TransitionImage from "./TransitionImage.svelte";
|
import TransitionImage from "./TransitionImage.svelte";
|
||||||
import BackgroundDom from "./BackgroundDom.svelte";
|
import BackgroundDom from "./BackgroundDom.svelte";
|
||||||
import SideBarArrow from "../UI/GUI/SideBarArrow.svelte";
|
import SideBarArrow from "../UI/GUI/SideBarArrow.svelte";
|
||||||
|
import VisualNovelMain from "../VisualNovel/VisualNovelMain.svelte";
|
||||||
let openChatList = false
|
let openChatList = false
|
||||||
|
|
||||||
const wallPaper = `background: url(${defaultWallpaper})`
|
const wallPaper = `background: url(${defaultWallpaper})`
|
||||||
@@ -19,7 +20,6 @@
|
|||||||
+ ($DataBase.textScreenBorder ? `border: 0.3rem solid ${$DataBase.textScreenBorder};` : '')
|
+ ($DataBase.textScreenBorder ? `border: 0.3rem solid ${$DataBase.textScreenBorder};` : '')
|
||||||
let bgImg= ''
|
let bgImg= ''
|
||||||
let lastBg = ''
|
let lastBg = ''
|
||||||
|
|
||||||
$: (async () =>{
|
$: (async () =>{
|
||||||
if($DataBase.customBackground !== lastBg){
|
if($DataBase.customBackground !== lastBg){
|
||||||
lastBg = $DataBase.customBackground
|
lastBg = $DataBase.customBackground
|
||||||
@@ -27,7 +27,10 @@
|
|||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
</script>
|
</script>
|
||||||
{#if $DataBase.theme === ''}
|
|
||||||
|
{#if $ShowVN}
|
||||||
|
<VisualNovelMain />
|
||||||
|
{:else if $DataBase.theme === ''}
|
||||||
<div class="flex-grow h-full min-w-0 relative justify-center flex">
|
<div class="flex-grow h-full min-w-0 relative justify-center flex">
|
||||||
<SideBarArrow />
|
<SideBarArrow />
|
||||||
<BackgroundDom />
|
<BackgroundDom />
|
||||||
|
|||||||
@@ -314,6 +314,9 @@
|
|||||||
<OptionInput value="none">{language.none}</OptionInput>
|
<OptionInput value="none">{language.none}</OptionInput>
|
||||||
<OptionInput value="emotion">{language.emotionImage}</OptionInput>
|
<OptionInput value="emotion">{language.emotionImage}</OptionInput>
|
||||||
<OptionInput value="imggen">{language.imageGeneration}</OptionInput>
|
<OptionInput value="imggen">{language.imageGeneration}</OptionInput>
|
||||||
|
{#if $DataBase.tpo}
|
||||||
|
<OptionInput value="vn">VN test</OptionInput>
|
||||||
|
{/if}
|
||||||
</SelectInput>
|
</SelectInput>
|
||||||
{:else}
|
{:else}
|
||||||
<SelectInput className="mb-2" bind:value={currentChar.data.viewScreen}>
|
<SelectInput className="mb-2" bind:value={currentChar.data.viewScreen}>
|
||||||
|
|||||||
17
src/lib/VisualNovel/VisualNovelChat.svelte
Normal file
17
src/lib/VisualNovel/VisualNovelChat.svelte
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { CurrentCharacter } from "src/ts/stores";
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="w-full flex justify-center absolute bottom-5">
|
||||||
|
<div class="w-3xl max-w-full flex flex-col">
|
||||||
|
|
||||||
|
<div class="bg-slate-700 h-12 rounded-lg border-slate-500 border-1 w-40 mb-2 bg-opacity-90 text-center flex items-center justify-center">
|
||||||
|
<span class="font-bold p-2">{$CurrentCharacter.name}</span>
|
||||||
|
</div>
|
||||||
|
<div class="bg-slate-700 h-40 rounded-lg border-slate-500 border-1 w-full bg-opacity-90 text-justify p-4">
|
||||||
|
Test
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
26
src/lib/VisualNovel/VisualNovelMain.svelte
Normal file
26
src/lib/VisualNovel/VisualNovelMain.svelte
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { getCustomBackground, getEmotion } from "../../ts/util";
|
||||||
|
import { DataBase } from "../../ts/storage/database";
|
||||||
|
import BackgroundDom from "../ChatScreens/BackgroundDom.svelte";
|
||||||
|
import SideBarArrow from "../UI/GUI/SideBarArrow.svelte";
|
||||||
|
import defaultWallpaper from '../../etc/bg.jpg'
|
||||||
|
import VisualNovelChat from "./VisualNovelChat.svelte";
|
||||||
|
|
||||||
|
const wallPaper = `background: url(${defaultWallpaper})`
|
||||||
|
|
||||||
|
let bgImg= ''
|
||||||
|
let lastBg = ''
|
||||||
|
$: (async () =>{
|
||||||
|
if($DataBase.customBackground !== lastBg){
|
||||||
|
lastBg = $DataBase.customBackground
|
||||||
|
bgImg = await getCustomBackground($DataBase.customBackground)
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
</script>
|
||||||
|
<div class="flex-grow h-full min-w-0 relative justify-center flex">
|
||||||
|
<SideBarArrow />
|
||||||
|
<BackgroundDom />
|
||||||
|
<div style={wallPaper} class="h-full w-full">
|
||||||
|
<VisualNovelChat />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -549,7 +549,7 @@ export interface character{
|
|||||||
notes:string
|
notes:string
|
||||||
chats:Chat[]
|
chats:Chat[]
|
||||||
chatPage: number
|
chatPage: number
|
||||||
viewScreen: 'emotion'|'none'|'imggen',
|
viewScreen: 'emotion'|'none'|'imggen'|'vn',
|
||||||
bias: [string, number][]
|
bias: [string, number][]
|
||||||
emotionImages: [string, string][]
|
emotionImages: [string, string][]
|
||||||
globalLore: loreBook[]
|
globalLore: loreBook[]
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export const CurrentChat = writable(cloneDeep(currentChat))
|
|||||||
export const CurrentUsername = writable(db.username)
|
export const CurrentUsername = writable(db.username)
|
||||||
export const CurrentUserIcon = writable(db.userIcon)
|
export const CurrentUserIcon = writable(db.userIcon)
|
||||||
export const CurrentShowMemoryLimit = writable(db.showMemoryLimit)
|
export const CurrentShowMemoryLimit = writable(db.showMemoryLimit)
|
||||||
|
export const ShowVN = writable(false)
|
||||||
|
|
||||||
function createSimpleCharacter(char:character|groupChat){
|
function createSimpleCharacter(char:character|groupChat){
|
||||||
if((!char) || char.type === 'group'){
|
if((!char) || char.type === 'group'){
|
||||||
@@ -56,6 +57,7 @@ function createSimpleCharacter(char:character|groupChat){
|
|||||||
|
|
||||||
|
|
||||||
function updateCurrentCharacter(){
|
function updateCurrentCharacter(){
|
||||||
|
|
||||||
const db = get(DataBase)
|
const db = get(DataBase)
|
||||||
if(!db.characters){
|
if(!db.characters){
|
||||||
CurrentCharacter.set(null)
|
CurrentCharacter.set(null)
|
||||||
@@ -69,6 +71,8 @@ function updateCurrentCharacter(){
|
|||||||
if(isEqual(gotCharacter, currentChar)){
|
if(isEqual(gotCharacter, currentChar)){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
ShowVN.set(currentChar?.viewScreen === 'vn')
|
||||||
|
|
||||||
console.log("Character updated")
|
console.log("Character updated")
|
||||||
CurrentCharacter.set(cloneDeep(currentChar))
|
CurrentCharacter.set(cloneDeep(currentChar))
|
||||||
const simp = createSimpleCharacter(currentChar)
|
const simp = createSimpleCharacter(currentChar)
|
||||||
@@ -108,6 +112,7 @@ DataBase.subscribe((data) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
selectedCharID.subscribe((id) => {
|
selectedCharID.subscribe((id) => {
|
||||||
|
|
||||||
updateCurrentCharacter()
|
updateCurrentCharacter()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user