forked from ericaxu/gemmy
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Patch(Scaffolding): Different quotes for different animation sources (#…
…10) Co-authored-by: Moritz Jung <m.projects.code@gmail.com>
- Loading branch information
1 parent
c0d92a3
commit 5f95980
Showing
10 changed files
with
291 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import GranitePlugin from './main'; | ||
import { AnimationSourceType } from './Setting'; | ||
import { GraniteMode, GraniteState } from './Granite'; | ||
import { DRAKE_EXCLUSIVE_QUOTES, GEMMY_EXCLUSIVE_QUOTES, GRANITE_BASE_QUOTES, Quotes } from './quotes/Quotes'; | ||
|
||
export class QuoteManager { | ||
public readonly plugin: GranitePlugin; | ||
|
||
public readonly quoteMap: Record<AnimationSourceType, Record<GraniteMode, string[]>>; | ||
|
||
constructor(plugin: GranitePlugin) { | ||
this.plugin = plugin; | ||
|
||
this.quoteMap = { | ||
[AnimationSourceType.GEMMY]: { | ||
[GraniteMode.IDLE]: this.getIdleQuotes(GEMMY_EXCLUSIVE_QUOTES), | ||
[GraniteMode.WRITING]: this.getWritingQuotes(GEMMY_EXCLUSIVE_QUOTES), | ||
}, | ||
[AnimationSourceType.DRAKE]: { | ||
[GraniteMode.IDLE]: this.getIdleQuotes(DRAKE_EXCLUSIVE_QUOTES), | ||
[GraniteMode.WRITING]: this.getWritingQuotes(DRAKE_EXCLUSIVE_QUOTES), | ||
}, | ||
}; | ||
|
||
console.log('granite | build quote map', this.quoteMap); | ||
} | ||
|
||
private getIdleQuotes(exclusiveQuotes: Quotes): string[] { | ||
return [...GRANITE_BASE_QUOTES.general, ...GRANITE_BASE_QUOTES.idle, ...exclusiveQuotes.general, ...exclusiveQuotes.idle]; | ||
} | ||
|
||
private getWritingQuotes(exclusiveQuotes: Quotes): string[] { | ||
return [...GRANITE_BASE_QUOTES.general, ...GRANITE_BASE_QUOTES.writingMode, ...exclusiveQuotes.general, ...exclusiveQuotes.writingMode]; | ||
} | ||
|
||
public getQuote(): string { | ||
const quotes: string[] = this.quoteMap[this.plugin.settings.animationSource][this.plugin.granite.mode]; | ||
|
||
return quotes[Math.floor(Math.random() * quotes.length)]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.