Skip to content

Commit

Permalink
Merge pull request #61 from gabber235/develop
Browse files Browse the repository at this point in the history
Cinematic Update Last tweaks
  • Loading branch information
gabber235 authored Jul 18, 2023
2 parents c927e35 + d6fda6f commit 8ea0760
Show file tree
Hide file tree
Showing 39 changed files with 601 additions and 258 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@
[![License](https://img.shields.io/github/license/gabber235/Typewriter?logo=github)](LICENSE)

Typewriter is a plugin for **Paper** Minecraft servers that allows for custom player interactions such as Quests,
NPC chat, Create branching story with ease, and more. It is easily configurable using the web panel specifically
NPC chat, Create branching story with ease, Creating Cinematic with camera paths, and more. It is easily configurable using the web panel specifically
designed for this plugin.

The plugin can also be extended using adapters, which are [pre-made](https://gabber235.github.io/TypeWriter/docs/pre-made-adapters) or can be custom-made by developers.

To get started with Typewriter, see the [Getting Started](#getting-started) section.

### Examples

![cinematic](readme/cinematic.gif)

A cinematic fully in vanilla minecraft using Typewriter. View a demo [here](https://youtu.be/1pGBtJleEuQ).

![dialogue sequence](readme/chat-messages.gif)

A dialogue sequence with Typewriter where the player is asked to choose between multiple options.
Expand All @@ -25,9 +31,10 @@ The web panel for Typewriter, where you can create quests, NPCs, and more.
### Features

- Create custom player interactions, including quests and NPC chat, branching story, and more...
- Create cinematic sequences with camera movements, dialogue, animated NPCs, and more...
- Configure interactions using a custom written visual interface
- Extend the plugin using adapters
- [Pre-made adapters](https://gabber235.github.io/TypeWriter/docs/pre-made-adapters) available for Citizens, and more coming soon
- [Pre-made adapters](https://gabber235.github.io/TypeWriter/docs/pre-made-adapters) available for popular plugins
- Custom adapters can be made by developers

## Getting started
Expand Down Expand Up @@ -63,4 +70,4 @@ See [LICENSE](LICENSE) to see the full text.

# Credits

- [Aarthificial](https://www.youtube.com/@aarthificial) For the inspiration on the base logic.
- [Aarthificial](https://www.youtube.com/@aarthificial) For the inspiration on the base logic.
Binary file not shown.
Binary file not shown.
93 changes: 93 additions & 0 deletions app/assets/fonts/JetBrains_Mono/OFL.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL


-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
79 changes: 79 additions & 0 deletions app/assets/fonts/JetBrains_Mono/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
JetBrains Mono Variable Font
============================

This download contains JetBrains Mono as both variable fonts and static fonts.

JetBrains Mono is a variable font with this axis:
wght

This means all the styles are contained in these files:
JetBrainsMono-VariableFont_wght.ttf
JetBrainsMono-Italic-VariableFont_wght.ttf

If your app fully supports variable fonts, you can now pick intermediate styles
that aren’t available as static fonts. Not all apps support variable fonts, and
in those cases you can use the static font files for JetBrains Mono:
static/JetBrainsMono-Thin.ttf
static/JetBrainsMono-ExtraLight.ttf
static/JetBrainsMono-Light.ttf
static/JetBrainsMono-Regular.ttf
static/JetBrainsMono-Medium.ttf
static/JetBrainsMono-SemiBold.ttf
static/JetBrainsMono-Bold.ttf
static/JetBrainsMono-ExtraBold.ttf
static/JetBrainsMono-ThinItalic.ttf
static/JetBrainsMono-ExtraLightItalic.ttf
static/JetBrainsMono-LightItalic.ttf
static/JetBrainsMono-Italic.ttf
static/JetBrainsMono-MediumItalic.ttf
static/JetBrainsMono-SemiBoldItalic.ttf
static/JetBrainsMono-BoldItalic.ttf
static/JetBrainsMono-ExtraBoldItalic.ttf

Get started
-----------

1. Install the font files you want to use

2. Use your app's font picker to view the font family and all the
available styles

Learn more about variable fonts
-------------------------------

https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
https://variablefonts.typenetwork.com
https://medium.com/variable-fonts

In desktop apps

https://theblog.adobe.com/can-variable-fonts-illustrator-cc
https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts

Online

https://developers.google.com/fonts/docs/getting_started
https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts

Installing fonts

MacOS: https://support.apple.com/en-us/HT201749
Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows

Android Apps

https://developers.google.com/fonts/docs/android
https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts

License
-------
Please read the full license text (OFL.txt) to understand the permissions,
restrictions and requirements for usage, redistribution, and modification.

You can use them in your products & projects – print or digital,
commercial or otherwise.

This isn't legal advice, please consider consulting a lawyer and see the full
license for all details.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
21 changes: 18 additions & 3 deletions app/lib/hooks/text_size.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
import "package:flutter/material.dart";
import "package:flutter_hooks/flutter_hooks.dart";

/// For some reason the differences between the Text widget and the TextPainter
/// are not the same. This is a correction factor to make them the same.
const flutterPainterErrorCorrection = 1.035;

/// Returns the size of the text with the given [style] in the given [context].
Size useTextSize(BuildContext context, String text, [TextStyle? style]) {
return useMemoized(
() {
final defaultTextStyle = DefaultTextStyle.of(context).style;
final defaultFontFamily = defaultTextStyle.fontFamily;

final textPainter = TextPainter(
text: TextSpan(
text: text,
style: style ?? DefaultTextStyle.of(context).style,
style:
style?.apply(fontFamily: style.fontFamily ?? defaultFontFamily) ??
DefaultTextStyle.of(context).style,
),
maxLines: 1,
textScaleFactor: MediaQuery.of(context).textScaleFactor,
textScaler: MediaQuery.of(context).textScaler,
textDirection: TextDirection.ltr,
)..layout(minWidth: 0, maxWidth: double.infinity);
return textPainter.size;

// TODO: Remove this once the bug is fixed
final size = textPainter.size;
return Size(
(size.width * flutterPainterErrorCorrection).roundToDouble(),
size.height,
);
},
[text, style],
);
Expand Down
9 changes: 5 additions & 4 deletions app/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "package:flutter/material.dart";
import "package:google_fonts/google_fonts.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:stack_trace/stack_trace.dart" as stack_trace;
import "package:typewriter/app_router.dart";
import "package:typewriter/utils/fonts.dart";
import "package:typewriter/widgets/components/general/toasts.dart";
import "package:typewriter/widgets/inspector/editors.dart";
import "package:uuid/uuid.dart";
Expand Down Expand Up @@ -46,7 +46,7 @@ class TypeWriterApp extends HookConsumerWidget {
final baseTheme = ThemeData(brightness: brightness);

return baseTheme.copyWith(
textTheme: GoogleFonts.jetBrainsMonoTextTheme(baseTheme.textTheme),
textTheme: baseTheme.textTheme.apply(fontFamily: "JetBrainsMono"),
inputDecorationTheme: InputDecorationTheme(
contentPadding: const EdgeInsets.symmetric(horizontal: 12),
border: OutlineInputBorder(
Expand All @@ -62,12 +62,12 @@ class TypeWriterApp extends HookConsumerWidget {
color: Colors.redAccent,
fontSize: 12,
),
hintStyle: GoogleFonts.jetBrainsMono(
hintStyle: TextStyle(
color: brightness == Brightness.light
? const Color(0x99000000)
: const Color(0x99FFFFFF),
fontSize: 16,
fontWeight: FontWeight.w400,
fontVariations: const [normalWeight],
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
Expand All @@ -80,6 +80,7 @@ class TypeWriterApp extends HookConsumerWidget {
),
hoverColor: Colors.black.withOpacity(0.1),
colorScheme: baseTheme.colorScheme.copyWith(
primary: Colors.blueAccent,
brightness: brightness,
error: Colors.redAccent,
),
Expand Down
21 changes: 11 additions & 10 deletions app/lib/pages/connect_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import "package:auto_route/auto_route.dart";
import "package:flutter/material.dart" hide Page;
import "package:flutter_animate/flutter_animate.dart";
import "package:flutter_hooks/flutter_hooks.dart";
import "package:google_fonts/google_fonts.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:rive/rive.dart";
import "package:typewriter/app_router.dart";
Expand Down Expand Up @@ -40,35 +39,37 @@ class ConnectPage extends HookConsumerWidget {
useEffect(
() {
final timer = Timer(1.seconds, () {
ref.read(socketProvider.notifier).init(hostname, port, token.isEmpty ? null : token);
ref
.read(socketProvider.notifier)
.init(hostname, port, token.isEmpty ? null : token);
});
return timer.cancel;
},
[],
);

return Scaffold(
return const Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Spacer(),
const Expanded(
Spacer(),
Expanded(
flex: 8,
child: RiveAnimation.asset(
"assets/tour.riv",
stateMachines: ["state_machine"],
),
),
const SizedBox(height: 24),
const Text(
SizedBox(height: 24),
Text(
"Waiting for connection",
style: TextStyle(fontSize: 40, fontWeight: FontWeight.bold),
),
ConnectionScroller(
style: GoogleFonts.jetBrainsMono(fontSize: 20, color: Colors.grey),
style: TextStyle(fontSize: 20, color: Colors.grey),
),
const SizedBox(height: 24),
const Spacer(),
SizedBox(height: 24),
Spacer(),
],
),
);
Expand Down
Loading

0 comments on commit 8ea0760

Please sign in to comment.