Non0w před 3 roky
revize
12e53c9ec5
23 změnil soubory, kde provedl 47710 přidání a 0 odebrání
  1. +3
    -0
      .import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5
  2. binární
      .import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex
  3. binární
      .mono/assemblies/Debug/GodotSharp.dll
  4. binární
      .mono/assemblies/Debug/GodotSharp.pdb
  5. +45618
    -0
      .mono/assemblies/Debug/GodotSharp.xml
  6. binární
      .mono/assemblies/Debug/GodotSharpEditor.dll
  7. binární
      .mono/assemblies/Debug/GodotSharpEditor.pdb
  8. +1466
    -0
      .mono/assemblies/Debug/GodotSharpEditor.xml
  9. +13
    -0
      .mono/assemblies/Debug/api_hash_cache.cfg
  10. +2
    -0
      .mono/metadata/ide_messaging_meta.txt
  11. +7
    -0
      default_env.tres
  12. binární
      icon.png
  13. +34
    -0
      icon.png.import
  14. +33
    -0
      main/dialogues/test.yarn
  15. +27
    -0
      main/scenes/DialogueTest.tscn
  16. +9
    -0
      main/scripts/dialogue_test.gd
  17. +43
    -0
      project.godot
  18. +1
    -0
      yarn/onivim2-crash.log
  19. +56
    -0
      yarn/scenes/YarnSpinner.tscn
  20. +24
    -0
      yarn/scripts/ChoicesBox.gd
  21. +13
    -0
      yarn/scripts/LogPanel.gd
  22. +25
    -0
      yarn/scripts/YarnSpinner.gd
  23. +336
    -0
      yarn/scripts/yarn-importer.gd

+ 3
- 0
.import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 Zobrazit soubor

@@ -0,0 +1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"


binární
.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex Zobrazit soubor


binární
.mono/assemblies/Debug/GodotSharp.dll Zobrazit soubor


binární
.mono/assemblies/Debug/GodotSharp.pdb Zobrazit soubor


+ 45618
- 0
.mono/assemblies/Debug/GodotSharp.xml
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


binární
.mono/assemblies/Debug/GodotSharpEditor.dll Zobrazit soubor


binární
.mono/assemblies/Debug/GodotSharpEditor.pdb Zobrazit soubor


+ 1466
- 0
.mono/assemblies/Debug/GodotSharpEditor.xml
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 13
- 0
.mono/assemblies/Debug/api_hash_cache.cfg Zobrazit soubor

@@ -0,0 +1,13 @@
[core]

modified_time=1598304030
bindings_version=11
cs_glue_version=1593152274
api_hash=1162643074443927165

[editor]

modified_time=1598304030
bindings_version=11
cs_glue_version=1593152274
api_hash=353294936865702102

+ 2
- 0
.mono/metadata/ide_messaging_meta.txt Zobrazit soubor

@@ -0,0 +1,2 @@
58136
C:\Users\Arnaud\Desktop\Godot_v3.2.2-stable_mono_win64\Godot_v3.2.2-stable_mono_win64.exe

+ 7
- 0
default_env.tres Zobrazit soubor

@@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]

[sub_resource type="ProceduralSky" id=1]

[resource]
background_mode = 2
background_sky = SubResource( 1 )

binární
icon.png Zobrazit soubor

Před Za
Šířka: 64  |  Výška: 64  |  Velikost: 3.2 KiB

+ 34
- 0
icon.png.import Zobrazit soubor

@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

+ 33
- 0
main/dialogues/test.yarn Zobrazit soubor

@@ -0,0 +1,33 @@
title: Start
tags:
position: 701,320
---
Empty Text
Haha
[[lul]]
je devrais pas apparaître
===
title: lul
tags:
position: 1032.2125854492188,730.3896484375
---
Huhuhu
<<if $truc is True>>
OK !
<<else>>
Pas ok.
<<endif>>
[[zboub|zboub]]
[[start|Start]]
Moi non plus
===

title: zboub
tags:
position: 693.5343566489377,684.1047771502635
---
Prout poruoruoruo
===




+ 27
- 0
main/scenes/DialogueTest.tscn Zobrazit soubor

@@ -0,0 +1,27 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://main/scripts/dialogue_test.gd" type="Script" id=1]
[ext_resource path="res://yarn/scenes/YarnSpinner.tscn" type="PackedScene" id=2]

[node name="DialogueTest" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="YarnSpinner" parent="." instance=ExtResource( 2 )]
yarn_file = "main/dialogues/test.yarn"

[node name="StartButton" type="Button" parent="."]
anchor_left = 0.45
anchor_top = 0.45
anchor_right = 0.55
anchor_bottom = 0.55
margin_left = -6.0
margin_top = -10.0
margin_right = 6.0
margin_bottom = 10.0
text = "Start !"
[connection signal="pressed" from="StartButton" to="." method="_on_start_pressed"]

+ 9
- 0
main/scripts/dialogue_test.gd Zobrazit soubor

@@ -0,0 +1,9 @@
extends Control

func start():
$StartButton.hide()
yield($YarnSpinner.spin_yarn($YarnSpinner.yarn_file), "completed")
$StartButton.show()

func _on_start_pressed():
start()

+ 43
- 0
project.godot Zobrazit soubor

@@ -0,0 +1,43 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters

config_version=4

_global_script_classes=[ {
"base": "VBoxContainer",
"class": "ChoicesBox",
"language": "GDScript",
"path": "res://yarn/scripts/ChoicesBox.gd"
}, {
"base": "Control",
"class": "LogPanel",
"language": "GDScript",
"path": "res://yarn/scripts/LogPanel.gd"
}, {
"base": "Node",
"class": "YarnImporter",
"language": "GDScript",
"path": "res://yarn/scripts/yarn-importer.gd"
} ]
_global_script_class_icons={
"ChoicesBox": "",
"LogPanel": "",
"YarnImporter": ""
}

[application]

config/name="Chepa"
config/icon="res://icon.png"

[rendering]

quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_environment="res://default_env.tres"

+ 1
- 0
yarn/onivim2-crash.log Zobrazit soubor

@@ -0,0 +1 @@
Yojson.Json_error("Line 100, bytes 20-53:\nInvalid escape sequence 'Users\\Arnaud\\scoop\\apps\\godot\\cur'"):

+ 56
- 0
yarn/scenes/YarnSpinner.tscn Zobrazit soubor

@@ -0,0 +1,56 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://yarn/scripts/LogPanel.gd" type="Script" id=1]
[ext_resource path="res://yarn/scripts/ChoicesBox.gd" type="Script" id=2]
[ext_resource path="res://yarn/scripts/YarnSpinner.gd" type="Script" id=3]

[node name="YarnSpinner" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="ChoicesBox" type="VBoxContainer" parent="."]
anchor_left = 0.3
anchor_top = 0.1
anchor_right = 0.7
anchor_bottom = 0.45
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="LogPanel" type="Control" parent="."]
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Panel" type="Panel" parent="LogPanel"]
anchor_right = 1.0
anchor_bottom = 1.0

[node name="RichTextLabel" type="RichTextLabel" parent="LogPanel"]
anchor_left = 0.02
anchor_top = 0.05
anchor_right = 0.98
anchor_bottom = 0.95
text = "Coucou je suis un text de test, ou bien l'inverse"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="TextButton" type="Button" parent="LogPanel"]
modulate = Color( 1, 1, 1, 0.235294 )
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = -20.0
flat = true
__meta__ = {
"_edit_use_anchors_": false
}

+ 24
- 0
yarn/scripts/ChoicesBox.gd Zobrazit soubor

@@ -0,0 +1,24 @@
extends VBoxContainer
class_name ChoicesBox

signal choice_made

func on_choice_made(marker):
emit_signal("choice_made", marker)

func on_choices(choices_list):
show()
for choice in choices_list:
var choiceButton := Button.new()
choiceButton.text = choice["text"]
choiceButton.connect("pressed", self, "on_choice_made", [choice["marker"]])
add_child(choiceButton)
var res = yield(self, "choice_made")
hide()
clear()
return res

func clear():
for child in get_children():
child.queue_free()

+ 13
- 0
yarn/scripts/LogPanel.gd Zobrazit soubor

@@ -0,0 +1,13 @@
extends Control
class_name LogPanel

func _ready():
$RichTextLabel.text = ""

func on_new_line(text):
show()
$RichTextLabel.text += text + '\n'
yield($TextButton, "pressed")

func clear():
$RichTextLabel.text = ''

+ 25
- 0
yarn/scripts/YarnSpinner.gd Zobrazit soubor

@@ -0,0 +1,25 @@
extends YarnImporter

export var yarn_file = ""

func _ready():
$ChoicesBox.hide()
$LogPanel.hide()

func on_dialogue_start():
yield(.on_dialogue_start(), "completed")
$LogPanel.show()
$ChoicesBox.show()
$LogPanel.clear()
$ChoicesBox.clear()

func on_new_line(line):
yield($LogPanel.on_new_line(line), "completed")
func on_choices(choices_list):
return yield($ChoicesBox.on_choices(choices_list), "completed")

func on_dialogue_end():
yield(.on_dialogue_end(), "completed")
$ChoicesBox.hide()
$LogPanel.hide()

+ 336
- 0
yarn/scripts/yarn-importer.gd Zobrazit soubor

@@ -0,0 +1,336 @@
extends Node
class_name YarnImporter

#
# A YARN Importer for Godot
#
# Credits:
# - Dave Kerr (http://www.naturallyintelligent.com)
#
# Latest: https://github.com/naturally-intelligent/godot-yarn-importer
#
# Yarn: https://github.com/InfiniteAmmoInc/Yarn
# Twine: http://twinery.org
#
# Yarn: a ball of threads (Yarn file)
# Thread: a series of fibres (Yarn node)
# Fibre: a text or choice or logic (Yarn line)

var yarn = {}

# OVERRIDE METHODS
#
# called to request new dialog
func on_new_line(text):
pass
# called to request new choice button
func on_choices(choices_list):
pass

# called to request internal logic handling
func logic(instruction, command):
pass
# called for each line of text
func yarn_text_variables(text):
return text
# called when "settings" node parsed
func story_setting(setting, value):
pass
# called for each node name
func on_node_start(to):
pass
yield(get_tree(), "idle_frame")

# called for each node name (after)
func on_node_end(to):
pass
yield(get_tree(), "idle_frame")

# START SPINNING YOUR YARN
#
func spin_yarn(file, start_thread = false):
yarn = load_yarn(file)
# Find the starting thread...
if not start_thread:
start_thread = yarn['start']
# Load any scene-specific settings
# (Not part of official Yarn standard)
if 'settings' in yarn['threads']:
var settings = yarn['threads']['settings']
for fibre in settings['fibres']:
var line = fibre['text']
var split = line.split('=')
var setting = split[0].strip_edges(true, true)
var value = split[1].strip_edges(true, true)
story_setting(setting, value)
# First thread unravel...
yield(on_dialogue_start(), "completed")
yield(yarn_unravel(start_thread), "completed")

# Internally create a new thread (during loading)
func new_yarn_thread():
var thread = {}
thread['title'] = ''
thread['kind'] = 'branch' # 'branch' for standard dialog, 'code' for gdscript
thread['tags'] = [] # unused
thread['fibres'] = []
return thread

# Internally create a new fibre (during loading)
func new_yarn_fibre(line):
# choice fibre
if line.substr(0,2) == '[[':
if line.find('|') != -1:
var fibre = {}
fibre['kind'] = 'choice'
line = line.replace('[[', '')
line = line.replace(']]', '')
var split = line.split('|')
fibre['text'] = split[0]
fibre['marker'] = split[1]
return fibre
else:
var fibre = {}
fibre['kind'] = 'jump'
line = line.replace('[[', '')
line = line.replace(']]', '')
fibre['marker'] = line
return fibre
# logic instruction (not part of official Yarn standard)
elif line.substr(0,2) == '<<':
if line.find(':') != -1:
var fibre = {}
fibre['kind'] = 'logic'
line = line.replace('<<', '')
line = line.replace('>>', '')
var split = line.split(':')
fibre['instruction'] = split[0]
fibre['command'] = split[1]
#print(line, split[0], split[1])
return fibre
# text fibre
var fibre = {}
fibre['kind'] = 'text'
fibre['text'] = line
return fibre

# Create Yarn data structure from file (must be *.yarn.txt Yarn format)
func load_yarn(path):
var yarn = {}
yarn['threads'] = {}
yarn['start'] = false
yarn['file'] = path
var file = File.new()
file.open(path, file.READ)
if file.is_open():
# yarn reading flags
var start = false
var header = true
var thread = new_yarn_thread()
# loop
while !file.eof_reached():
# read a line
var line = file.get_line()
# header read mode
if header:
if line == '---':
header = false
else:
var split = line.split(': ')
if split[0] == 'title':
var title_split = split[1].split(':')
var thread_title = ''
var thread_kind = 'branch'
if len(title_split) == 1:
thread_title = split[1]
else:
thread_title = title_split[1]
thread_kind = title_split[0]
thread['title'] = thread_title
thread['kind'] = thread_kind
if not yarn['start']:
yarn['start'] = thread_title
# end of thread
elif line == '===':
header = true
yarn['threads'][thread['title']] = thread
thread = new_yarn_thread()
# fibre read mode
else:
var fibre = new_yarn_fibre(line)
if fibre:
thread['fibres'].append(fibre)
else:
print('ERROR: Yarn file missing: ', filename)
return yarn

# Main logic for node handling
#
func yarn_unravel(to, from=false):
if not to in yarn['threads']:
print('WARNING: Missing Yarn thread: ', to, ' in file ',yarn['file'])
return
while to != null and to in yarn['threads']:
yield (on_node_start(to), "completed")
if to in yarn['threads']:
var thread = yarn['threads'][to]
to = null
match thread['kind']:
'branch':
var i = 0
while i < thread['fibres'].size():
match thread['fibres'][i]['kind']:
'text':
var fibre = thread['fibres'][i]
var text = yarn_text_variables(fibre['text'])
yield(on_new_line(text), "completed")
'choice':
var choices = []
while i < thread['fibres'].size() and thread['fibres'][i]['kind'] == 'choice' :
var fibre = thread['fibres'][i]
var text = yarn_text_variables(fibre['text'])
choices.push_back({"text": text, "marker": fibre['marker']})
i += 1
to = yield(on_choices(choices), "completed")
break
'logic':
var fibre = thread['fibres'][i]
var instruction = fibre['instruction']
var command = fibre['command']
yield(logic(instruction, command), "completed")
'jump':
var fibre = thread['fibres'][i]
to = fibre['marker']
break
i += 1
'code':
yarn_code(to)
yield(on_node_end(to), "completed")
yield (on_dialogue_end(), "completed")

func on_dialogue_start():
pass
yield(get_tree(), "idle_frame")

func on_dialogue_end():
pass
yield(get_tree(), "idle_frame")

#
# RUN GDSCRIPT CODE FROM YARN NODE - Special node = code:title
# - Not part of official Yarn standard
#
func yarn_code(title, run=true, parent='parent.', tabs="\t", next_func="yarn_unravel"):
if title in yarn['threads']:
var thread = yarn['threads'][title]
var code = ''
for fibre in thread['fibres']:
match fibre['kind']:
'text':
var line = yarn_text_variables(fibre['text'])
line = yarn_code_replace(line, parent, next_func)
code += tabs + line + "\n"
'choice':
var line = parent+next_func+"('"+fibre['marker']+"')"
print(line)
code += tabs + line + "\n"
if run:
run_yarn_code(code)
else:
return code
else:
print('WARNING: Title missing in yarn ball: ', title)

# override to replace convenience variables
func yarn_code_replace(code, parent='parent.', next_func="yarn_unravel"):
if code.find("[[") != -1:
code = code.replace("[[", parent+next_func+"('")
code = code.replace("]]", "')")
code = code.replace("say(", parent+"say(")
code = code.replace("choice(", parent+"choice(")
return code

func run_yarn_code(code):
var front = "extends Node\n"
front += "func dynamic_code():\n"
front += "\tvar parent = get_parent()\n\n"
code = front + code
#print("CODE BLOCK: \n", code)

var script = GDScript.new()
script.set_source_code(code)
script.reload()

#print("Executing code...")
var node = Node.new()
node.set_script(script)
add_child(node)
var result = node.dynamic_code()
remove_child(node)

return result

# EXPORTING TO GDSCRIPT
#
# This code may not be directly usable
# Use if you need an exit from Yarn

func export_to_gdscript():
var script = ''
script += "func start_story():\n\n"
if 'settings' in yarn['threads']:
var settings = yarn['threads']['settings']
for fibre in settings['fibres']:
var line = fibre['text']
var split = line.split('=')
var setting = split[0].strip_edges(true, true)
var value = split[1].strip_edges(true, true)
script += "\t" + 'story_setting("' + setting + '", "' + value + '")' + "\n"
script += "\tstory_logic('" + yarn['start'] + "')\n\n"
# story logic choice/press event
script += "func story_logic(marker):\n\n"
script += "\tmatch marker:\n"
for title in yarn['threads']:
var thread = yarn['threads'][title]
match thread['kind']:
'branch':
var code = "\n\t\t'" + thread['title'] + "':"
var tabs = "\n\t\t\t"
for fibre in thread['fibres']:
match fibre['kind']:
'text':
code += tabs + 'say("' + fibre['text'] + '")'
'choice':
code += tabs + 'choice("' + fibre['text'] + '", "' + fibre['marker'] + '")'
'logic':
code += tabs + 'logic("' + fibre['instruction'] + '", "' + fibre['command'] + '")'
script += code + "\n"
'code':
var code = "\n\t\t'" + thread['title'] + "':"
var tabs = "\n\t\t\t"
code += "\n"
code += yarn_code(thread['title'], false, '', "\t\t\t", "story_logic")
script += code + "\n"
# done
return script

func print_gdscript_to_console():
print(export_to_gdscript())

func save_to_gdscript(filename):
var script = export_to_gdscript()
# write to file
var file = File.new()
file.open(filename, file.WRITE)
if not file.is_open():
print('ERROR: Cant open file ', filename)
return false
file.store_string(script)
file.close()


Načítá se…
Zrušit
Uložit