.
This commit is contained in:
parent
e5d3a862e1
commit
22ec89d3af
23 changed files with 191 additions and 12 deletions
5
allegiance/allegiance.gd
Normal file
5
allegiance/allegiance.gd
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
extends Resource
|
||||||
|
class_name Allegiance
|
||||||
|
|
||||||
|
@export var kingdom_name: String
|
||||||
|
@export var color: Color
|
||||||
1
allegiance/allegiance.gd.uid
Normal file
1
allegiance/allegiance.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dvu6aynwi8a0f
|
||||||
9
allegiance/bad.tres
Normal file
9
allegiance/bad.tres
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
[gd_resource type="Resource" script_class="Allegiance" format=3 uid="uid://dfbgxc6nlcjct"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dvu6aynwi8a0f" path="res://allegiance/allegiance.gd" id="1_7dttr"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_7dttr")
|
||||||
|
kingdom_name = "Baddica"
|
||||||
|
color = Color(1, 0, 0, 1)
|
||||||
|
metadata/_custom_type_script = "uid://dvu6aynwi8a0f"
|
||||||
9
allegiance/good.tres
Normal file
9
allegiance/good.tres
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
[gd_resource type="Resource" script_class="Allegiance" format=3 uid="uid://b7lxfjhx4qhts"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dvu6aynwi8a0f" path="res://allegiance/allegiance.gd" id="1_crqh1"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_crqh1")
|
||||||
|
kingdom_name = "Goodom"
|
||||||
|
color = Color(0, 0, 1, 1)
|
||||||
|
metadata/_custom_type_script = "uid://dvu6aynwi8a0f"
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
Give {for_timeline_calls.requested_amount} {for_timeline_calls.requested_currency} to {for_timeline_calls.requestee_class}? (You have {for_timeline_calls.economy_amount})
|
||||||
- Accept Terms
|
- Accept Terms
|
||||||
set {COUNTEROFFER_REPONSE} = 0
|
set {COUNTEROFFER_REPONSE} = 0
|
||||||
- Reject Terms
|
- Reject Terms
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,4 @@ class_name Currency
|
||||||
@export var production: Array[Production]
|
@export var production: Array[Production]
|
||||||
@export_multiline var description = "no description of currency"
|
@export_multiline var description = "no description of currency"
|
||||||
@export var thumbnail: Texture2D
|
@export var thumbnail: Texture2D
|
||||||
|
@export var color: Color = Color.PINK
|
||||||
|
|
|
||||||
13
currency/members/MemberSprite.gdshader
Normal file
13
currency/members/MemberSprite.gdshader
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
instance uniform vec3 fill_color : source_color;
|
||||||
|
instance uniform vec3 border_color : source_color;
|
||||||
|
instance uniform float border_width = 0.16;
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
if (min(UV.x, UV.y) < border_width || max(UV.x, UV.y) > 1.0 - border_width) {
|
||||||
|
COLOR.rgb = border_color;
|
||||||
|
} else {
|
||||||
|
COLOR.rgb = fill_color;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
currency/members/MemberSprite.gdshader.uid
Normal file
1
currency/members/MemberSprite.gdshader.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://d4lvn6yn7uk2i
|
||||||
26
currency/members/MemberSprite.tscn
Normal file
26
currency/members/MemberSprite.tscn
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
[gd_scene format=3 uid="uid://coebykrbnhlif"]
|
||||||
|
|
||||||
|
[ext_resource type="Shader" uid="uid://d4lvn6yn7uk2i" path="res://currency/members/MemberSprite.gdshader" id="1_tm326"]
|
||||||
|
[ext_resource type="Script" uid="uid://dfqairkyaac1r" path="res://currency/members/member_sprite.gd" id="2_5ifiv"]
|
||||||
|
|
||||||
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_tm326"]
|
||||||
|
shader = ExtResource("1_tm326")
|
||||||
|
|
||||||
|
[sub_resource type="CanvasTexture" id="CanvasTexture_wgite"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4sc8i"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
|
||||||
|
[node name="MemberSprite" type="TextureRect" unique_id=283117283]
|
||||||
|
material = SubResource("ShaderMaterial_tm326")
|
||||||
|
texture = SubResource("CanvasTexture_wgite")
|
||||||
|
script = ExtResource("2_5ifiv")
|
||||||
|
|
||||||
|
[node name="Area2D" type="Area2D" parent="." unique_id=1371993311]
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=894062478]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
shape = SubResource("RectangleShape2D_4sc8i")
|
||||||
|
|
||||||
|
[connection signal="mouse_entered" from="Area2D" to="." method="_on_area_2d_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Area2D" to="." method="_on_area_2d_mouse_exited"]
|
||||||
26
currency/members/member_sprite.gd
Normal file
26
currency/members/member_sprite.gd
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
extends TextureRect
|
||||||
|
class_name CurrencyMemberSprite
|
||||||
|
|
||||||
|
@export var currency: Currency
|
||||||
|
@export var allegiance: Allegiance
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
sync()
|
||||||
|
|
||||||
|
func sync():
|
||||||
|
set_instance_shader_parameter("border_color", allegiance.color)
|
||||||
|
set_instance_shader_parameter("fill_color", currency.color)
|
||||||
|
%CollisionShape2D.shape.size = custom_minimum_size
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area_2d_mouse_entered() -> void:
|
||||||
|
UserContext.focus_member(self)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area_2d_mouse_exited() -> void:
|
||||||
|
UserContext.unfocus_member(self)
|
||||||
|
|
||||||
|
func _unhandled_input(event: InputEvent) -> void:
|
||||||
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
|
pass
|
||||||
|
|
||||||
1
currency/members/member_sprite.gd.uid
Normal file
1
currency/members/member_sprite.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dfqairkyaac1r
|
||||||
|
|
@ -56,7 +56,7 @@ func get_all_currencies_in(dir: StringName):
|
||||||
var resources := []
|
var resources := []
|
||||||
for res in reses:
|
for res in reses:
|
||||||
if res.ends_with(".tres"):
|
if res.ends_with(".tres"):
|
||||||
resources.append(load(res))
|
resources.append(load(dir + "/" + res))
|
||||||
return resources
|
return resources
|
||||||
|
|
||||||
func get_all_sentient_currencies() -> Array:
|
func get_all_sentient_currencies() -> Array:
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,7 @@ func on_remove_letter(_l: Letter):
|
||||||
|
|
||||||
func _on_pressed() -> void:
|
func _on_pressed() -> void:
|
||||||
letter.start()
|
letter.start()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_reply_button_pressed() -> void:
|
||||||
|
letter.reply()
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
[ext_resource type="Script" uid="uid://nb536nqdwd8g" path="res://gui/inbox_message_subject.gd" id="1_npjct"]
|
[ext_resource type="Script" uid="uid://nb536nqdwd8g" path="res://gui/inbox_message_subject.gd" id="1_npjct"]
|
||||||
|
|
||||||
[node name="InboxMessageSubject" type="Button" unique_id=1590519653]
|
[node name="InboxMessageSubject" type="Button" unique_id=1590519653]
|
||||||
custom_minimum_size = Vector2(0, 40)
|
custom_minimum_size = Vector2(700, 40)
|
||||||
|
custom_maximum_size = Vector2(700, -1)
|
||||||
script = ExtResource("1_npjct")
|
script = ExtResource("1_npjct")
|
||||||
|
|
||||||
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1923870606]
|
[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1923870606]
|
||||||
|
|
@ -21,12 +22,27 @@ theme_override_constants/margin_bottom = 20
|
||||||
[node name="Source" type="Label" parent="MarginContainer" unique_id=1252337854]
|
[node name="Source" type="Label" parent="MarginContainer" unique_id=1252337854]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 0
|
||||||
text = "<Source>"
|
text = "<Source>"
|
||||||
|
|
||||||
[node name="Subject" type="Label" parent="MarginContainer" unique_id=707399847]
|
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer" unique_id=1418860833]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 8
|
||||||
|
|
||||||
|
[node name="Subject" type="Label" parent="MarginContainer/HBoxContainer" unique_id=707399847]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 8
|
size_flags_horizontal = 8
|
||||||
text = "<Subject>"
|
text = "<Subject>"
|
||||||
|
|
||||||
|
[node name="ReadButton" type="Button" parent="MarginContainer/HBoxContainer" unique_id=309821311]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Read"
|
||||||
|
|
||||||
|
[node name="ReplyButton" type="Button" parent="MarginContainer/HBoxContainer" unique_id=803741826]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Reply"
|
||||||
|
|
||||||
[connection signal="pressed" from="." to="." method="_on_pressed"]
|
[connection signal="pressed" from="." to="." method="_on_pressed"]
|
||||||
|
[connection signal="pressed" from="MarginContainer/HBoxContainer/ReadButton" to="." method="_on_pressed"]
|
||||||
|
[connection signal="pressed" from="MarginContainer/HBoxContainer/ReplyButton" to="." method="_on_reply_button_pressed"]
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,10 @@ func _ready() -> void:
|
||||||
|
|
||||||
func append(producer: Currency, production: Production):
|
func append(producer: Currency, production: Production):
|
||||||
var display := preload("res://gui/production_log.tscn").instantiate()
|
var display := preload("res://gui/production_log.tscn").instantiate()
|
||||||
|
display.set_color(Color.YELLOW)
|
||||||
|
for child in get_children():
|
||||||
|
if child is ProductionLog and child.is_old:
|
||||||
|
child.set_color(Color.WHITE)
|
||||||
display.producer = producer
|
display.producer = producer
|
||||||
display.production = production
|
display.production = production
|
||||||
add_child(display)
|
add_child(display)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
class_name ProductionLog
|
||||||
|
|
||||||
@export var producer: Currency = null
|
@export var producer: Currency = null
|
||||||
@export var production: Production
|
@export var production: Production
|
||||||
|
var is_old: bool = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
if producer != null:
|
if producer != null:
|
||||||
|
|
@ -22,4 +24,15 @@ func _ready() -> void:
|
||||||
|
|
||||||
%production.text = production.currency.name
|
%production.text = production.currency.name
|
||||||
%production2.text = production.currency.name
|
%production2.text = production.currency.name
|
||||||
|
make_old.call_deferred()
|
||||||
|
|
||||||
|
func make_old():
|
||||||
|
is_old = true
|
||||||
|
|
||||||
|
func set_color(color: Color):
|
||||||
|
var children = get_children()
|
||||||
|
while children.size():
|
||||||
|
var child = children.pop_back()
|
||||||
|
if child is Label:
|
||||||
|
child.add_theme_color_override("font_color", color)
|
||||||
|
children.append_array(child.get_children())
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ extends Node
|
||||||
|
|
||||||
var OFFERS = [preload("res://letters/ask_solo.tres"), preload("res://letters/counteroffer.tres"), preload("res://letters/life_expense.tres"), preload("res://letters/union_rep_ask.tres")]
|
var OFFERS = [preload("res://letters/ask_solo.tres"), preload("res://letters/counteroffer.tres"), preload("res://letters/life_expense.tres"), preload("res://letters/union_rep_ask.tres")]
|
||||||
|
|
||||||
func generate_offer():
|
func try_generate_offer() -> bool:
|
||||||
var offer: Counteroffer = OFFERS.pick_random()
|
var offer: Counteroffer = OFFERS.pick_random()
|
||||||
var currency: Production = Economy.currencies.pick_random()
|
var currency: Production = Economy.currencies.pick_random()
|
||||||
var amount = max(randi_range(1, 10), currency.amount)
|
var amount = min(randi_range(1, 10), currency.amount)
|
||||||
var request = Production.new()
|
var request = Production.new()
|
||||||
request.currency = currency.currency
|
request.currency = currency.currency
|
||||||
request.amount = amount
|
request.amount = amount
|
||||||
|
|
@ -15,9 +15,11 @@ func generate_offer():
|
||||||
offer.subject_field = "Need " + currency.currency.name
|
offer.subject_field = "Need " + currency.currency.name
|
||||||
|
|
||||||
var source: Currency = Economy.get_all_sentient_currencies().pick_random()
|
var source: Currency = Economy.get_all_sentient_currencies().pick_random()
|
||||||
#if source == null:
|
|
||||||
|
|
||||||
|
if source == preload("res://currency/sentient/royalty.tres") or currency.currency == preload("res://currency/sentient/royalty.tres") :
|
||||||
|
return false
|
||||||
|
|
||||||
offer.source = source
|
offer.source = source
|
||||||
|
|
||||||
GameState.add_letter.emit(offer)
|
GameState.add_letter.emit(offer)
|
||||||
|
return true
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,24 @@ class_name Counteroffer
|
||||||
|
|
||||||
@export var request: Production
|
@export var request: Production
|
||||||
|
|
||||||
func start():
|
|
||||||
|
func sync():
|
||||||
Dialogic.VAR.for_timeline_calls.requested_currency = request.currency.name
|
Dialogic.VAR.for_timeline_calls.requested_currency = request.currency.name
|
||||||
Dialogic.VAR.for_timeline_calls.requested_amount = request.amount
|
Dialogic.VAR.for_timeline_calls.requested_amount = request.amount
|
||||||
Dialogic.VAR.for_timeline_calls.requestee_class = source.name
|
Dialogic.VAR.for_timeline_calls.requestee_class = source.name
|
||||||
Dialogic.VAR.for_timeline_calls.requestee_name = "a " + source.name
|
Dialogic.VAR.for_timeline_calls.requestee_name = "a " + source.name
|
||||||
|
var supply := Economy.get_currency_amount(request.currency)
|
||||||
|
Dialogic.VAR.for_timeline_calls.economy_amount = supply
|
||||||
|
|
||||||
|
|
||||||
|
func start():
|
||||||
|
sync()
|
||||||
Dialogic.start(timeline)
|
Dialogic.start(timeline)
|
||||||
await Dialogic.timeline_ended
|
await Dialogic.timeline_ended
|
||||||
|
reply()
|
||||||
|
|
||||||
|
func reply():
|
||||||
|
sync()
|
||||||
var response: int
|
var response: int
|
||||||
while true:
|
while true:
|
||||||
Dialogic.start(preload("res://counteroffer_response.dtl"))
|
Dialogic.start(preload("res://counteroffer_response.dtl"))
|
||||||
|
|
@ -19,8 +29,6 @@ func start():
|
||||||
if response == 0:
|
if response == 0:
|
||||||
# Accept
|
# Accept
|
||||||
if not Economy.can_consume(request):
|
if not Economy.can_consume(request):
|
||||||
var supply := Economy.get_currency_amount(request.currency)
|
|
||||||
Dialogic.VAR.for_timeline_calls.economy_amount = supply
|
|
||||||
Dialogic.start(preload("res://cannot_consume.dtl"))
|
Dialogic.start(preload("res://cannot_consume.dtl"))
|
||||||
await Dialogic.timeline_ended
|
await Dialogic.timeline_ended
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,6 @@ class_name Letter
|
||||||
|
|
||||||
func start():
|
func start():
|
||||||
Dialogic.start(timeline)
|
Dialogic.start(timeline)
|
||||||
|
|
||||||
|
func reply():
|
||||||
|
push_error("reply Not implemented!")
|
||||||
|
|
|
||||||
|
|
@ -125,3 +125,4 @@ dialogic_default_action={
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
rendering_device/driver.windows="d3d12"
|
rendering_device/driver.windows="d3d12"
|
||||||
|
renderer/rendering_method="gl_compatibility"
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,4 @@ func _on_run_simulate_pressed() -> void:
|
||||||
|
|
||||||
func _on_open_inbox_pressed() -> void:
|
func _on_open_inbox_pressed() -> void:
|
||||||
UserContext.open_inbox.emit()
|
UserContext.open_inbox.emit()
|
||||||
LetterGeneration.generate_offer()
|
LetterGeneration.try_generate_offer()
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://dx3y20p75chkj" path="res://gui/production_ledger_scroll.tscn" id="3_n4oyp"]
|
[ext_resource type="PackedScene" uid="uid://dx3y20p75chkj" path="res://gui/production_ledger_scroll.tscn" id="3_n4oyp"]
|
||||||
[ext_resource type="PackedScene" uid="uid://75htlmk51oo" path="res://gui/currency_inspector_panel.tscn" id="4_7ya5o"]
|
[ext_resource type="PackedScene" uid="uid://75htlmk51oo" path="res://gui/currency_inspector_panel.tscn" id="4_7ya5o"]
|
||||||
[ext_resource type="PackedScene" uid="uid://vanflt5jr7tx" path="res://gui/inbox_panel.tscn" id="5_n4oyp"]
|
[ext_resource type="PackedScene" uid="uid://vanflt5jr7tx" path="res://gui/inbox_panel.tscn" id="5_n4oyp"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://coebykrbnhlif" path="res://currency/members/MemberSprite.tscn" id="6_vua3v"]
|
||||||
|
[ext_resource type="Resource" uid="uid://ihsvxienxbeu" path="res://currency/sentient/knight.tres" id="7_s0mui"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dfbgxc6nlcjct" path="res://allegiance/bad.tres" id="8_i7808"]
|
||||||
|
|
||||||
[node name="TestEconomy" type="Control" unique_id=629898212]
|
[node name="TestEconomy" type="Control" unique_id=629898212]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
|
|
@ -69,6 +72,19 @@ layout_mode = 1
|
||||||
[node name="InboxPanel" parent="." unique_id=534578339 instance=ExtResource("5_n4oyp")]
|
[node name="InboxPanel" parent="." unique_id=534578339 instance=ExtResource("5_n4oyp")]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
||||||
|
[node name="MemberSprite" parent="." unique_id=283117283 instance=ExtResource("6_vua3v")]
|
||||||
|
instance_shader_parameters/border_color = Color(1, 0, 0, 1)
|
||||||
|
instance_shader_parameters/border_width = 0.16
|
||||||
|
instance_shader_parameters/fill_color = Color(0, 1, 0, 1)
|
||||||
|
custom_minimum_size = Vector2(100, 100)
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 426.0
|
||||||
|
offset_top = 306.0
|
||||||
|
offset_right = 426.0
|
||||||
|
offset_bottom = 406.0
|
||||||
|
currency = ExtResource("7_s0mui")
|
||||||
|
allegiance = ExtResource("8_i7808")
|
||||||
|
|
||||||
[connection signal="pressed" from="Control/VBoxContainer/GetCow" to="." method="_on_get_cow_pressed"]
|
[connection signal="pressed" from="Control/VBoxContainer/GetCow" to="." method="_on_get_cow_pressed"]
|
||||||
[connection signal="pressed" from="Control/VBoxContainer/RunSimulate" to="." method="_on_run_simulate_pressed"]
|
[connection signal="pressed" from="Control/VBoxContainer/RunSimulate" to="." method="_on_run_simulate_pressed"]
|
||||||
[connection signal="pressed" from="Control/VBoxContainer/OpenInbox" to="." method="_on_open_inbox_pressed"]
|
[connection signal="pressed" from="Control/VBoxContainer/OpenInbox" to="." method="_on_open_inbox_pressed"]
|
||||||
|
|
|
||||||
|
|
@ -5,3 +5,22 @@ signal currency_inspect(c: Currency)
|
||||||
|
|
||||||
@warning_ignore("unused_signal")
|
@warning_ignore("unused_signal")
|
||||||
signal open_inbox
|
signal open_inbox
|
||||||
|
|
||||||
|
var focused_members: Array[CurrencyMemberSprite] = []
|
||||||
|
signal focused_member_change(current: CurrencyMemberSprite)
|
||||||
|
|
||||||
|
#func focused_member() -> Cur
|
||||||
|
|
||||||
|
func focus_member(member: CurrencyMemberSprite):
|
||||||
|
focused_members.append(member)
|
||||||
|
focused_member_change.emit(member)
|
||||||
|
|
||||||
|
func unfocus_member(member: CurrencyMemberSprite):
|
||||||
|
var i := focused_members.find(member)
|
||||||
|
if i == -1:
|
||||||
|
return
|
||||||
|
focused_members.remove_at(i)
|
||||||
|
if focused_members.size():
|
||||||
|
focused_member_change.emit(focused_members[focused_members.size()-1])
|
||||||
|
else:
|
||||||
|
focused_member_change.emit(null)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue