2 次代码提交

作者 SHA1 备注 提交日期
  acojez b019b1bcd0 Restore npc dialogue 4 年前
  acojez 5e56e9ec83 Add *.import to .gitignore 4 年前
共有 11 个文件被更改,包括 74 次插入49 次删除
  1. +2
    -1
      .gitignore
  2. +3
    -1
      jrpg/characters/basic_enemy.tres
  3. +4
    -39
      jrpg/scenes/TestLVL.tscn
  4. +9
    -1
      jrpg/scenes/TestMain.tscn
  5. +30
    -0
      jrpg/scenes/ui/SpeechPanel.tscn
  6. +6
    -7
      jrpg/scripts/entities/components/interactions/talk_interaction.gd
  7. +1
    -0
      jrpg/scripts/entities/data/character_data.gd
  8. +5
    -0
      jrpg/scripts/levels/spawner.gd
  9. +2
    -0
      jrpg/scripts/misc/controller.gd
  10. +1
    -0
      jrpg/scripts/ui/speech_panel.gd
  11. +11
    -0
      project.godot

+ 2
- 1
.gitignore 查看文件

@@ -5,7 +5,8 @@ export_presets.cfg

# Imported translations (automatically generated from CSV files)
*.translation
*.import

# Mono-specific ignores
.mono/
data_*/
data_*/

+ 3
- 1
jrpg/characters/basic_enemy.tres 查看文件

@@ -1,9 +1,11 @@
[gd_resource type="Resource" load_steps=3 format=2]
[gd_resource type="Resource" load_steps=4 format=2]

[ext_resource path="res://jrpg/scripts/entities/data/character_data.gd" type="Script" id=1]
[ext_resource path="res://jrpg/scenes/entities/Enemy.tscn" type="PackedScene" id=2]
[ext_resource path="res://jrpg/yarn_scripts/npc_debug.yarn" type="Resource" id=3]

[resource]
script = ExtResource( 1 )
name = "Basic Enemy"
scene = ExtResource( 2 )
yarn = ExtResource( 3 )

+ 4
- 39
jrpg/scenes/TestLVL.tscn 查看文件

@@ -1,16 +1,12 @@
[gd_scene load_steps=28 format=2]
[gd_scene load_steps=24 format=2]

[ext_resource path="res://jrpg/scripts/levels/spawner.gd" type="Script" id=1]
[ext_resource path="res://jrpg/scenes/ui/HUD.tscn" type="PackedScene" id=2]
[ext_resource path="res://jrpg/scenes/entities/Pickup.tscn" type="PackedScene" id=3]
[ext_resource path="res://jrpg/scenes/ui/SpeechText.tscn" type="PackedScene" id=4]
[ext_resource path="res://jrpg/scenes/ui/ChoicesBox.tscn" type="PackedScene" id=5]
[ext_resource path="res://jrpg/characters/player.tres" type="Resource" id=6]
[ext_resource path="res://jrpg/misc/jrpg_env.tres" type="Environment" id=7]
[ext_resource path="res://jrpg/models/nature/dirt.material" type="Material" id=8]
[ext_resource path="res://jrpg/models/nature/grass.material" type="Material" id=9]
[ext_resource path="res://jrpg/models/nature/_defaultMat.material" type="Material" id=10]
[ext_resource path="res://jrpg/scripts/ui/speech_panel.gd" type="Script" id=11]
[ext_resource path="res://jrpg/characters/basic_enemy.tres" type="Resource" id=12]
[ext_resource path="res://jrpg/scripts/misc/test_level.gd" type="Script" id=15]

@@ -239,6 +235,9 @@ data = PoolVector3Array( -0.2022, 0.1046, -0.5078, -0.1617, 0, -0.4063, 0.286, 0
[node name="TestLVL" type="Spatial"]
script = ExtResource( 15 )

[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource( 7 )

[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 0.422618, -0.742404, 0.519837, 0, 0.573576, 0.819152, -0.906308, -0.346189, 0.242404, 0, 0, 0 )
shadow_enabled = true
@@ -387,9 +386,6 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -4.84158, 3.80559, 11.3488 )
[node name="Pickup6" parent="Coins" instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 15.6138, 3.8056, 3.13732 )

[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource( 7 )

[node name="Enemy Spawner" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 3.42834, 0, 8.41565 )
script = ExtResource( 1 )
@@ -399,34 +395,3 @@ character_data = ExtResource( 12 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.218717, 0, -1.84536 )
script = ExtResource( 1 )
character_data = ExtResource( 6 )

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="UI" parent="CanvasLayer" instance=ExtResource( 2 )]
healthBar_path = NodePath("../../Enemy/CanvasLayer/UI/HealthBar")
goldText_path = NodePath("../../Enemy/CanvasLayer/UI/GoldText")

[node name="SpeechPanel" type="Panel" parent="CanvasLayer"]
anchor_right = 1.0
margin_bottom = 193.0
script = ExtResource( 11 )
__meta__ = {
"_edit_use_anchors_": false
}
text_path = NodePath("../../../TestLVL/CanvasLayer/SpeechPanel/SpeechText")
choices_path = NodePath("../../../TestLVL/CanvasLayer/SpeechPanel/ChoicesBox")

[node name="SpeechText" parent="CanvasLayer/SpeechPanel" instance=ExtResource( 4 )]
anchor_right = 0.658
anchor_bottom = 1.0
margin_right = 0.207947
margin_bottom = 0.0

[node name="ChoicesBox" parent="CanvasLayer/SpeechPanel" instance=ExtResource( 5 )]
anchor_left = 0.707
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 0.0319824
margin_right = -50.0
alignment = 1

+ 9
- 1
jrpg/scenes/TestMain.tscn 查看文件

@@ -1,10 +1,12 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=8 format=2]

[ext_resource path="res://addons/yarn_spinner/yarn_runner_node.gd" type="Script" id=1]
[ext_resource path="res://jrpg/scripts/misc/test_main.gd" type="Script" id=2]
[ext_resource path="res://jrpg/yarn_scripts/main_debug.yarn" type="Resource" id=3]
[ext_resource path="res://jrpg/scenes/TestLVL.tscn" type="PackedScene" id=4]
[ext_resource path="res://jrpg/scenes/TestGameOver.tscn" type="PackedScene" id=5]
[ext_resource path="res://jrpg/scenes/ui/SpeechPanel.tscn" type="PackedScene" id=6]
[ext_resource path="res://jrpg/scenes/ui/HUD.tscn" type="PackedScene" id=7]

[node name="TestMain" type="Node"]
script = ExtResource( 2 )
@@ -18,3 +20,9 @@ script = ExtResource( 1 )
yarnScript = ExtResource( 3 )

[node name="SceneContainer" type="Node" parent="."]

[node name="CanvasLayer" type="CanvasLayer" parent="."]

[node name="HUD" parent="CanvasLayer" instance=ExtResource( 7 )]

[node name="SpeechPanel" parent="CanvasLayer" instance=ExtResource( 6 )]

+ 30
- 0
jrpg/scenes/ui/SpeechPanel.tscn 查看文件

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

[ext_resource path="res://jrpg/scenes/ui/SpeechText.tscn" type="PackedScene" id=1]
[ext_resource path="res://jrpg/scenes/ui/ChoicesBox.tscn" type="PackedScene" id=2]
[ext_resource path="res://jrpg/scripts/ui/speech_panel.gd" type="Script" id=7]

[node name="SpeechPanel" type="Panel"]
anchor_right = 1.0
margin_bottom = 193.0
script = ExtResource( 7 )
__meta__ = {
"_edit_use_anchors_": false
}
text_path = NodePath("SpeechText")
choices_path = NodePath("ChoicesBox")

[node name="SpeechText" parent="." instance=ExtResource( 1 )]
anchor_right = 0.65
anchor_bottom = 1.0
margin_right = -0.0400391
margin_bottom = 0.0

[node name="ChoicesBox" parent="." instance=ExtResource( 2 )]
anchor_left = 0.7
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 0.0319824
margin_right = -50.0
alignment = 1

+ 6
- 7
jrpg/scripts/entities/components/interactions/talk_interaction.gd 查看文件

@@ -1,26 +1,25 @@
extends BasisInteraction

class_name TalkInteraction

var is_talking = false

export var yarnScript : Resource

export var speechPanel_path : NodePath
onready var speechPanel := get_node(speechPanel_path)

var yarnRunner := YarnRunner.new()

func on_interact():
if not is_talking:
yarnRunner.say_func = funcref(speechPanel.text, "on_new_line")
yarnRunner.choices_func = funcref(speechPanel.choices, "on_choices")
yarnRunner.say_func = funcref(Controller.speech_panel.text, "on_new_line")
yarnRunner.choices_func = funcref(Controller.speech_panel.choices, "on_choices")
yarnRunner.yarnScript = self.yarnScript
is_talking = true
speechPanel.show()
Controller.speech_panel.show()
Controller.player_input_enabled = false
yield(yarnRunner.run_all(), "completed")
Controller.player_input_enabled = true
speechPanel.hide()
Controller.speech_panel.hide()
is_talking = false

+ 1
- 0
jrpg/scripts/entities/data/character_data.gd 查看文件

@@ -4,3 +4,4 @@ class_name CharacterData

export var name : String
export var scene : PackedScene
export var yarn : Resource

+ 5
- 0
jrpg/scripts/levels/spawner.gd 查看文件

@@ -5,4 +5,9 @@ export var character_data : Resource
func _ready():
var inst = character_data.scene.instance()
inst.name = character_data.name
if character_data.yarn != null:
var yarn_runner := TalkInteraction.new()
yarn_runner.name = character_data.yarn.resource_name
yarn_runner.yarnScript = character_data.yarn
inst.add_child(yarn_runner)
add_child(inst)

+ 2
- 0
jrpg/scripts/misc/controller.gd 查看文件

@@ -1,5 +1,7 @@
extends Node

var speech_panel

var player_infos := PlayerInfos.new()

var player_input_enabled := true setget player_input_enabled_set


+ 1
- 0
jrpg/scripts/ui/speech_panel.gd 查看文件

@@ -7,4 +7,5 @@ export var choices_path : NodePath
onready var choices := get_node(choices_path)

func _ready():
Controller.speech_panel = self
hide()

+ 11
- 0
project.godot 查看文件

@@ -44,6 +44,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://jrpg/scripts/ui/speech_text.gd"
}, {
"base": "BasisInteraction",
"class": "TalkInteraction",
"language": "GDScript",
"path": "res://jrpg/scripts/entities/components/interactions/talk_interaction.gd"
}, {
"base": "BaseLevel",
"class": "TestLevel",
"language": "GDScript",
@@ -77,6 +82,7 @@ _global_script_class_icons={
"Player": "",
"PlayerInfos": "",
"SpeechText": "",
"TalkInteraction": "",
"TestLevel": "",
"YarnImporter": "",
"YarnRunner": "",
@@ -87,6 +93,7 @@ _global_script_class_icons={
[application]

config/name="Chepa"
run/main_scene="res://jrpg/scenes/TestMain.tscn"
config/icon="res://icon.png"

[autoload]
@@ -97,6 +104,10 @@ Controller="*res://jrpg/scripts/misc/controller.gd"

enabled=PoolStringArray( "yarn_spinner" )

[gui]

theme/use_hidpi=true

[importer_defaults]

yarn.script={


正在加载...
取消
保存