From 3b31284c1bdc19e6b848ad584848f41a6d418257 Mon Sep 17 00:00:00 2001 From: JVAO <1030126308@qq.com> Date: Wed, 19 Jan 2022 20:39:51 +0800 Subject: [PATCH 1/3] update person detail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 人物详细界面: 1、添加六维显示(差一个势,以后完善)。 2、调整。 --- UIMain/PersonDetail/PersonDetail.tscn | 947 ++++++++++++++------------ UIMain/PersonDetail/Polygon.gd | 37 + Util.gd | 5 + 3 files changed, 570 insertions(+), 419 deletions(-) create mode 100644 UIMain/PersonDetail/Polygon.gd diff --git a/UIMain/PersonDetail/PersonDetail.tscn b/UIMain/PersonDetail/PersonDetail.tscn index 980b3857..8653a48f 100644 --- a/UIMain/PersonDetail/PersonDetail.tscn +++ b/UIMain/PersonDetail/PersonDetail.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://UIMain/MainTheme.tres" type="Theme" id=1] [ext_resource path="res://Images/PersonPortrait/default-male-martial.jpg" type="Texture" id=2] @@ -7,6 +7,8 @@ [ext_resource path="res://UIMain/Sounds/Close.wav" type="AudioStream" id=5] [ext_resource path="res://Fonts/font_subheader.tres" type="DynamicFont" id=6] [ext_resource path="res://UIMain/TabList/PersonList.tscn" type="PackedScene" id=7] +[ext_resource path="res://UIMain/PersonDetail/Polygon.gd" type="Script" id=8] +[ext_resource path="res://Fonts/font.tres" type="DynamicFont" id=9] [node name="PersonDetail" type="Panel"] anchor_right = 1.0 @@ -16,12 +18,16 @@ margin_bottom = -168.0 theme = ExtResource( 1 ) script = ExtResource( 4 ) __meta__ = { -"_edit_use_anchors_": false +"_edit_horizontal_guides_": [ 397.0, 473.0, 562.0 ], +"_edit_use_anchors_": false, +"_edit_vertical_guides_": [ 310.0, 996.0 ] } [node name="Portrait" type="TextureRect" parent="."] -margin_left = 16.0 -margin_top = 16.0 +margin_left = 35.0 +margin_top = 66.0 +margin_right = 547.0 +margin_bottom = 578.0 rect_scale = Vector2( 0.5, 0.5 ) texture = ExtResource( 2 ) __meta__ = { @@ -29,55 +35,72 @@ __meta__ = { } [node name="Name" type="Label" parent="."] -margin_left = 288.0 -margin_top = 16.0 +margin_left = 87.0 +margin_top = 20.0 +margin_right = 233.0 +margin_bottom = 56.0 custom_fonts/font = ExtResource( 3 ) text = "耒火(字字)" +__meta__ = { +"_edit_use_anchors_": false +} [node name="SurnameEdit" type="LineEdit" parent="."] visible = false -margin_left = 288.0 +margin_left = 49.0 margin_top = 16.0 +margin_right = 155.0 +margin_bottom = 62.0 custom_fonts/font = ExtResource( 3 ) [node name="GivenNameEdit" type="LineEdit" parent="."] visible = false -margin_left = 410.0 -margin_top = 16.0 +margin_left = 158.0 +margin_top = 18.0 +margin_right = 264.0 +margin_bottom = 64.0 custom_fonts/font = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} [node name="CourtesyNameEdit" type="LineEdit" parent="."] visible = false -margin_left = 532.0 -margin_top = 16.0 +margin_left = 269.0 +margin_top = 19.0 +margin_right = 375.0 +margin_bottom = 65.0 custom_fonts/font = ExtResource( 3 ) +__meta__ = { +"_edit_use_anchors_": false +} [node name="Description" type="RichTextLabel" parent="."] -anchor_bottom = 1.0 -margin_left = 17.0 -margin_top = 288.0 -margin_right = 448.0 -margin_bottom = -16.0 +anchor_left = 0.653359 +anchor_top = 0.0932018 +anchor_right = 0.970215 +anchor_bottom = 0.949561 bbcode_enabled = true meta_underlined = false __meta__ = { -"_edit_use_anchors_": false +"_edit_use_anchors_": true } [node name="Status" type="GridContainer" parent="."] anchor_right = 1.0 -margin_left = 288.0 -margin_top = 64.0 -margin_right = -16.0 +margin_left = 324.0 +margin_top = 62.0 +margin_right = -566.0 +margin_bottom = 206.0 custom_constants/vseparation = 8 custom_constants/hseparation = 8 -columns = 13 +columns = 6 __meta__ = { "_edit_use_anchors_": false } [node name="Label10" type="Label" parent="Status"] -margin_right = 89.0 +margin_right = 108.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) @@ -87,33 +110,27 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Label6" type="Label" parent="Status"] -margin_left = 97.0 -margin_right = 186.0 +[node name="Gender" type="Label" parent="Status"] +margin_left = 116.0 +margin_right = 224.0 margin_bottom = 18.0 size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "FACTION" +text = "男" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="Label7" type="Label" parent="Status"] -margin_left = 194.0 -margin_right = 283.0 -margin_bottom = 18.0 -size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "SECTION" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} +[node name="GenderButton" type="Button" parent="Status"] +visible = false +margin_left = 116.0 +margin_top = 26.0 +margin_right = 224.0 +margin_bottom = 44.0 [node name="Label8" type="Label" parent="Status"] -margin_left = 291.0 -margin_right = 380.0 +margin_left = 232.0 +margin_right = 340.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) @@ -123,158 +140,78 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Label9" type="Label" parent="Status"] -margin_left = 388.0 -margin_right = 477.0 -margin_bottom = 18.0 -size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "STATUS" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label14" type="Label" parent="Status"] -margin_left = 485.0 -margin_right = 574.0 -margin_bottom = 18.0 -size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "MERIT" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label11" type="Label" parent="Status"] -margin_left = 582.0 -margin_right = 671.0 -margin_bottom = 18.0 -size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "KARMA" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label12" type="Label" parent="Status"] -margin_left = 679.0 -margin_right = 780.0 -margin_bottom = 18.0 -size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "POPULARITY" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label13" type="Label" parent="Status"] -margin_left = 788.0 -margin_right = 877.0 -margin_bottom = 18.0 -size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "PRESTIGE" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label15" type="Label" parent="Status"] -margin_left = 885.0 -margin_right = 974.0 -margin_bottom = 18.0 -size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "AMBITION" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label16" type="Label" parent="Status"] -margin_left = 982.0 -margin_right = 1071.0 +[node name="Location" type="Label" parent="Status"] +margin_left = 348.0 +margin_right = 456.0 margin_bottom = 18.0 size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "MORALITY" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="Label17" type="Label" parent="Status"] -margin_left = 1079.0 -margin_right = 1177.0 +[node name="Label6" type="Label" parent="Status"] +margin_left = 464.0 +margin_right = 572.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "BRAVENESS" +text = "FACTION" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="Label18" type="Label" parent="Status"] -margin_left = 1185.0 -margin_right = 1274.0 +[node name="Faction" type="Label" parent="Status"] +margin_left = 580.0 +margin_right = 688.0 margin_bottom = 18.0 size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "CALMNESS" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="Gender" type="Label" parent="Status"] +[node name="Label7" type="Label" parent="Status"] margin_top = 26.0 -margin_right = 89.0 +margin_right = 108.0 margin_bottom = 44.0 size_flags_horizontal = 3 -text = "男" +custom_colors/font_color = Color( 0, 1, 1, 1 ) +text = "SECTION" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="GenderButton" type="Button" parent="Status"] -visible = false +[node name="Section" type="Label" parent="Status"] margin_left = 116.0 margin_top = 26.0 margin_right = 224.0 margin_bottom = 44.0 - -[node name="Faction" type="Label" parent="Status"] -margin_left = 97.0 -margin_top = 26.0 -margin_right = 186.0 -margin_bottom = 44.0 size_flags_horizontal = 3 align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="Section" type="Label" parent="Status"] -margin_left = 194.0 +[node name="Label9" type="Label" parent="Status"] +margin_left = 232.0 margin_top = 26.0 -margin_right = 283.0 +margin_right = 340.0 margin_bottom = 44.0 size_flags_horizontal = 3 +custom_colors/font_color = Color( 0, 1, 1, 1 ) +text = "STATUS" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="Location" type="Label" parent="Status"] -margin_left = 291.0 +[node name="Status" type="Label" parent="Status"] +margin_left = 348.0 margin_top = 26.0 -margin_right = 380.0 +margin_right = 456.0 margin_bottom = 44.0 size_flags_horizontal = 3 align = 1 @@ -282,21 +219,23 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Status" type="Label" parent="Status"] -margin_left = 388.0 +[node name="Label14" type="Label" parent="Status"] +margin_left = 464.0 margin_top = 26.0 -margin_right = 477.0 +margin_right = 572.0 margin_bottom = 44.0 size_flags_horizontal = 3 +custom_colors/font_color = Color( 0, 1, 1, 1 ) +text = "MERIT" align = 1 __meta__ = { "_edit_use_anchors_": false } [node name="Merit" type="Label" parent="Status"] -margin_left = 485.0 +margin_left = 580.0 margin_top = 26.0 -margin_right = 574.0 +margin_right = 688.0 margin_bottom = 44.0 size_flags_horizontal = 3 text = "10" @@ -315,139 +254,93 @@ size_flags_horizontal = 3 text = "10" align = 1 -[node name="Karma" type="Label" parent="Status"] -margin_left = 582.0 -margin_top = 26.0 -margin_right = 671.0 -margin_bottom = 44.0 +[node name="Label11" type="Label" parent="Status"] +margin_top = 52.0 +margin_right = 108.0 +margin_bottom = 70.0 size_flags_horizontal = 3 -text = "10" +custom_colors/font_color = Color( 0, 1, 1, 1 ) +text = "KARMA" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="KarmaEdit" type="LineEdit" parent="Status"] -visible = false -margin_left = 994.0 -margin_top = 26.0 -margin_right = 1128.0 -margin_bottom = 44.0 +[node name="Karma" type="Label" parent="Status"] +margin_left = 116.0 +margin_top = 52.0 +margin_right = 224.0 +margin_bottom = 70.0 size_flags_horizontal = 3 text = "10" align = 1 - -[node name="Popularity" type="Label" parent="Status"] -margin_left = 679.0 -margin_top = 26.0 -margin_right = 780.0 -margin_bottom = 44.0 -size_flags_horizontal = 3 -text = "100" -align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="PopularityEdit" type="LineEdit" parent="Status"] +[node name="KarmaEdit" type="LineEdit" parent="Status"] visible = false -margin_left = 1136.0 +margin_left = 994.0 margin_top = 26.0 -margin_right = 1270.0 -margin_bottom = 44.0 +margin_right = 1128.0 +margin_bottom = 54.0 size_flags_horizontal = 3 -text = "100" +text = "10" align = 1 -[node name="Prestige" type="Label" parent="Status"] -margin_left = 788.0 -margin_top = 26.0 -margin_right = 877.0 -margin_bottom = 44.0 +[node name="Label12" type="Label" parent="Status"] +margin_left = 232.0 +margin_top = 52.0 +margin_right = 340.0 +margin_bottom = 70.0 size_flags_horizontal = 3 -text = "100" +custom_colors/font_color = Color( 0, 1, 1, 1 ) +text = "POPULARITY" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="PrestigeEdit" type="LineEdit" parent="Status"] -visible = false +[node name="Popularity" type="Label" parent="Status"] +margin_left = 348.0 margin_top = 52.0 -margin_right = 134.0 +margin_right = 456.0 margin_bottom = 70.0 size_flags_horizontal = 3 text = "100" align = 1 - -[node name="Ambition" type="Label" parent="Status"] -margin_left = 885.0 -margin_top = 26.0 -margin_right = 974.0 -margin_bottom = 44.0 -size_flags_horizontal = 3 -text = "100" -align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="AmbitionEdit" type="LineEdit" parent="Status"] +[node name="PopularityEdit" type="LineEdit" parent="Status"] visible = false -margin_top = 52.0 -margin_right = 134.0 -margin_bottom = 80.0 -size_flags_horizontal = 3 -text = "100" -align = 1 - -[node name="Morality" type="Label" parent="Status"] -margin_left = 982.0 +margin_left = 1136.0 margin_top = 26.0 -margin_right = 1071.0 -margin_bottom = 44.0 +margin_right = 1270.0 +margin_bottom = 54.0 size_flags_horizontal = 3 text = "100" align = 1 -__meta__ = { -"_edit_use_anchors_": false -} -[node name="MoralityEdit" type="LineEdit" parent="Status"] -visible = false +[node name="Label13" type="Label" parent="Status"] +margin_left = 464.0 margin_top = 52.0 -margin_right = 134.0 -margin_bottom = 80.0 -size_flags_horizontal = 3 -text = "100" -align = 1 - -[node name="Braveness" type="Label" parent="Status"] -margin_left = 1079.0 -margin_top = 26.0 -margin_right = 1177.0 -margin_bottom = 44.0 +margin_right = 572.0 +margin_bottom = 70.0 size_flags_horizontal = 3 -text = "100" +custom_colors/font_color = Color( 0, 1, 1, 1 ) +text = "PRESTIGE" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="BravenessEdit" type="LineEdit" parent="Status"] -visible = false +[node name="Prestige" type="Label" parent="Status"] +margin_left = 580.0 margin_top = 52.0 -margin_right = 134.0 -margin_bottom = 80.0 -size_flags_horizontal = 3 -text = "100" -align = 1 - -[node name="Calmness" type="Label" parent="Status"] -margin_left = 1185.0 -margin_top = 26.0 -margin_right = 1274.0 -margin_bottom = 44.0 +margin_right = 688.0 +margin_bottom = 70.0 size_flags_horizontal = 3 text = "100" align = 1 @@ -455,7 +348,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="CalmnessEdit" type="LineEdit" parent="Status"] +[node name="PrestigeEdit" type="LineEdit" parent="Status"] visible = false margin_top = 52.0 margin_right = 134.0 @@ -464,194 +357,153 @@ size_flags_horizontal = 3 text = "100" align = 1 -[node name="Abilities" type="GridContainer" parent="."] -margin_left = 288.0 -margin_top = 128.0 -margin_right = 492.0 -margin_bottom = 276.0 -custom_constants/vseparation = 8 -custom_constants/hseparation = 8 -columns = 2 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Label" type="Label" parent="Abilities"] -margin_right = 118.0 -margin_bottom = 18.0 -size_flags_horizontal = 3 -custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "COMMAND" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="Command" type="Label" parent="Abilities"] -margin_left = 126.0 -margin_right = 204.0 -margin_bottom = 18.0 -size_flags_horizontal = 3 -text = "60" -align = 1 -__meta__ = { -"_edit_use_anchors_": false -} - -[node name="CommandEdit" type="LineEdit" parent="Abilities"] -visible = false -margin_top = 26.0 -margin_right = 78.0 -margin_bottom = 44.0 -size_flags_horizontal = 3 -text = "60" -align = 1 - -[node name="Label2" type="Label" parent="Abilities"] -margin_top = 26.0 -margin_right = 118.0 -margin_bottom = 44.0 +[node name="Label15" type="Label" parent="Status"] +margin_top = 78.0 +margin_right = 108.0 +margin_bottom = 96.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "STRENGTH" +text = "AMBITION" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="Strength" type="Label" parent="Abilities"] -margin_left = 126.0 -margin_top = 26.0 -margin_right = 204.0 -margin_bottom = 44.0 +[node name="Ambition" type="Label" parent="Status"] +margin_left = 116.0 +margin_top = 78.0 +margin_right = 224.0 +margin_bottom = 96.0 size_flags_horizontal = 3 -text = "60" +text = "100" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="StrengthEdit" type="LineEdit" parent="Abilities"] +[node name="AmbitionEdit" type="LineEdit" parent="Status"] visible = false margin_top = 52.0 -margin_right = 89.0 -margin_bottom = 70.0 +margin_right = 134.0 +margin_bottom = 80.0 size_flags_horizontal = 3 -text = "60" +text = "100" align = 1 -[node name="Label3" type="Label" parent="Abilities"] -margin_top = 52.0 -margin_right = 118.0 -margin_bottom = 70.0 +[node name="Label16" type="Label" parent="Status"] +margin_left = 232.0 +margin_top = 78.0 +margin_right = 340.0 +margin_bottom = 96.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "INTELLIGENCE" +text = "MORALITY" align = 1 __meta__ = { "_edit_use_anchors_": false -} - -[node name="Intelligence" type="Label" parent="Abilities"] -margin_left = 126.0 -margin_top = 52.0 -margin_right = 204.0 -margin_bottom = 70.0 +} + +[node name="Morality" type="Label" parent="Status"] +margin_left = 348.0 +margin_top = 78.0 +margin_right = 456.0 +margin_bottom = 96.0 size_flags_horizontal = 3 -text = "60" +text = "100" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="IntelligenceEdit" type="LineEdit" parent="Abilities"] +[node name="MoralityEdit" type="LineEdit" parent="Status"] visible = false -margin_top = 78.0 -margin_right = 118.0 -margin_bottom = 96.0 +margin_top = 52.0 +margin_right = 134.0 +margin_bottom = 80.0 size_flags_horizontal = 3 -text = "60" +text = "100" align = 1 -[node name="Label4" type="Label" parent="Abilities"] +[node name="Label17" type="Label" parent="Status"] +margin_left = 464.0 margin_top = 78.0 -margin_right = 118.0 +margin_right = 572.0 margin_bottom = 96.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "POLITICS" +text = "BRAVENESS" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="Politics" type="Label" parent="Abilities"] -margin_left = 126.0 +[node name="Braveness" type="Label" parent="Status"] +margin_left = 580.0 margin_top = 78.0 -margin_right = 204.0 +margin_right = 688.0 margin_bottom = 96.0 size_flags_horizontal = 3 -text = "60" +text = "100" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="PoliticsEdit" type="LineEdit" parent="Abilities"] +[node name="BravenessEdit" type="LineEdit" parent="Status"] visible = false -margin_top = 104.0 -margin_right = 118.0 -margin_bottom = 122.0 +margin_top = 52.0 +margin_right = 134.0 +margin_bottom = 80.0 size_flags_horizontal = 3 -text = "60" +text = "100" align = 1 -[node name="Label5" type="Label" parent="Abilities"] +[node name="Label18" type="Label" parent="Status"] margin_top = 104.0 -margin_right = 118.0 +margin_right = 108.0 margin_bottom = 122.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) -text = "GLAMOUR" +text = "CALMNESS" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="Glamour" type="Label" parent="Abilities"] -margin_left = 126.0 +[node name="Calmness" type="Label" parent="Status"] +margin_left = 116.0 margin_top = 104.0 -margin_right = 204.0 +margin_right = 224.0 margin_bottom = 122.0 size_flags_horizontal = 3 -text = "60" +text = "100" align = 1 __meta__ = { "_edit_use_anchors_": false } -[node name="GlamourEdit" type="LineEdit" parent="Abilities"] +[node name="CalmnessEdit" type="LineEdit" parent="Status"] visible = false -margin_top = 130.0 -margin_right = 118.0 -margin_bottom = 148.0 +margin_top = 52.0 +margin_right = 134.0 +margin_bottom = 80.0 size_flags_horizontal = 3 -text = "60" +text = "100" align = 1 [node name="Relations" type="GridContainer" parent="."] anchor_right = 1.0 -margin_left = 508.0 -margin_top = 128.0 -margin_right = -16.0 -margin_bottom = 172.0 +margin_left = 325.0 +margin_top = 203.0 +margin_right = -597.0 +margin_bottom = 248.0 columns = 7 __meta__ = { "_edit_use_anchors_": false } [node name="Label5" type="Label" parent="Relations"] -margin_right = 147.0 +margin_right = 89.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) @@ -659,8 +511,8 @@ text = "IDEAL" align = 1 [node name="Label6" type="Label" parent="Relations"] -margin_left = 151.0 -margin_right = 298.0 +margin_left = 93.0 +margin_right = 186.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) @@ -668,8 +520,8 @@ text = "BORN_YEAR" align = 1 [node name="AgeLabel" type="Label" parent="Relations"] -margin_left = 302.0 -margin_right = 449.0 +margin_left = 190.0 +margin_right = 279.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) @@ -678,8 +530,8 @@ align = 1 [node name="DeathYearLabel" type="Label" parent="Relations"] visible = false -margin_left = 453.0 -margin_right = 600.0 +margin_left = 277.0 +margin_right = 383.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) @@ -687,8 +539,8 @@ text = "DEATH_YEAR" align = 1 [node name="Label" type="Label" parent="Relations"] -margin_left = 453.0 -margin_right = 600.0 +margin_left = 283.0 +margin_right = 372.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) @@ -696,8 +548,8 @@ text = "FATHER" align = 1 [node name="Label2" type="Label" parent="Relations"] -margin_left = 604.0 -margin_right = 751.0 +margin_left = 376.0 +margin_right = 465.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) @@ -705,8 +557,8 @@ text = "MOTHER" align = 1 [node name="Label3" type="Label" parent="Relations"] -margin_left = 755.0 -margin_right = 902.0 +margin_left = 469.0 +margin_right = 558.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) @@ -714,8 +566,8 @@ text = "SPOUSE" align = 1 [node name="Label4" type="Label" parent="Relations"] -margin_left = 906.0 -margin_right = 1053.0 +margin_left = 562.0 +margin_right = 651.0 margin_bottom = 18.0 size_flags_horizontal = 3 custom_colors/font_color = Color( 0, 1, 1, 1 ) @@ -724,56 +576,58 @@ align = 1 [node name="Ideal" type="Label" parent="Relations"] margin_top = 22.0 -margin_right = 147.0 +margin_right = 89.0 margin_bottom = 40.0 align = 1 [node name="IdealEdit" type="LineEdit" parent="Relations"] visible = false -margin_top = 52.0 -margin_right = 134.0 -margin_bottom = 80.0 +margin_left = 187.0 +margin_top = 22.0 +margin_right = 273.0 +margin_bottom = 50.0 size_flags_horizontal = 3 text = "100" align = 1 [node name="BornYear" type="Label" parent="Relations"] -margin_left = 151.0 +margin_left = 93.0 margin_top = 22.0 -margin_right = 298.0 +margin_right = 186.0 margin_bottom = 40.0 align = 1 [node name="BornYearEdit" type="LineEdit" parent="Relations"] visible = false -margin_top = 52.0 -margin_right = 134.0 -margin_bottom = 80.0 +margin_left = 190.0 +margin_top = 22.0 +margin_right = 279.0 +margin_bottom = 50.0 size_flags_horizontal = 3 text = "100" align = 1 [node name="Age" type="Label" parent="Relations"] -margin_left = 302.0 +margin_left = 190.0 margin_top = 22.0 -margin_right = 449.0 +margin_right = 279.0 margin_bottom = 40.0 align = 1 [node name="DeathYearEdit" type="LineEdit" parent="Relations"] visible = false -margin_left = 453.0 +margin_left = 283.0 margin_top = 22.0 -margin_right = 600.0 +margin_right = 372.0 margin_bottom = 50.0 size_flags_horizontal = 3 text = "100" align = 1 [node name="Father" type="Label" parent="Relations"] -margin_left = 453.0 +margin_left = 283.0 margin_top = 22.0 -margin_right = 600.0 +margin_right = 372.0 margin_bottom = 40.0 align = 1 @@ -785,9 +639,9 @@ margin_right = 629.0 margin_bottom = 40.0 [node name="Mother" type="Label" parent="Relations"] -margin_left = 604.0 +margin_left = 376.0 margin_top = 22.0 -margin_right = 751.0 +margin_right = 465.0 margin_bottom = 40.0 align = 1 @@ -799,9 +653,9 @@ margin_right = 629.0 margin_bottom = 40.0 [node name="Spouses" type="Label" parent="Relations"] -margin_left = 755.0 +margin_left = 469.0 margin_top = 22.0 -margin_right = 902.0 +margin_right = 558.0 margin_bottom = 40.0 align = 1 @@ -813,9 +667,9 @@ margin_right = 629.0 margin_bottom = 40.0 [node name="Brothers" type="Label" parent="Relations"] -margin_left = 906.0 +margin_left = 562.0 margin_top = 22.0 -margin_right = 1053.0 +margin_right = 651.0 margin_bottom = 40.0 align = 1 @@ -826,20 +680,271 @@ margin_top = 22.0 margin_right = 629.0 margin_bottom = 40.0 +[node name="AbilitiePolygon" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 52.0 +margin_top = 352.0 +margin_right = -1247.0 +margin_bottom = -340.0 +rect_scale = Vector2( 0.8, 0.8 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Polygon" type="Node2D" parent="AbilitiePolygon"] +script = ExtResource( 8 ) + +[node name="Abilities" type="Control" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 26.0 +margin_top = 337.0 +margin_right = -1279.0 +margin_bottom = -361.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label" type="Label" parent="Abilities"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 34.0 +margin_right = -122.0 +margin_bottom = -193.0 +size_flags_horizontal = 3 +custom_colors/font_color = Color( 0, 1, 1, 1 ) +custom_fonts/font = ExtResource( 9 ) +text = "COMMAND" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Command" type="Label" parent="Abilities"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 24.0 +margin_top = 19.0 +margin_right = -188.0 +margin_bottom = -174.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 9 ) +text = "60" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="CommandEdit" type="LineEdit" parent="Abilities"] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 22.0 +margin_top = 21.0 +margin_right = -181.0 +margin_bottom = -162.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 9 ) +text = "60" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label2" type="Label" parent="Abilities"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 3.0 +margin_top = 83.0 +margin_right = -171.0 +margin_bottom = -109.0 +size_flags_horizontal = 3 +custom_colors/font_color = Color( 0, 1, 1, 1 ) +custom_fonts/font = ExtResource( 9 ) +text = "STRENGTH" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Strength" type="Label" parent="Abilities"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -4.0 +margin_top = 101.0 +margin_right = -204.0 +margin_bottom = -92.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 9 ) +text = "60" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="StrengthEdit" type="LineEdit" parent="Abilities"] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = -11.0 +margin_top = 105.0 +margin_right = -214.0 +margin_bottom = -78.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 9 ) +text = "60" +align = 1 + +[node name="Label3" type="Label" parent="Abilities"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 193.0 +margin_top = -1.0 +margin_right = 56.0 +margin_bottom = -194.0 +size_flags_horizontal = 3 +custom_colors/font_color = Color( 0, 1, 1, 1 ) +custom_fonts/font = ExtResource( 9 ) +text = "INTELLIGENCE" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Intelligence" type="Label" parent="Abilities"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 193.0 +margin_top = 18.0 +margin_bottom = -175.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 9 ) +text = "60" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="IntelligenceEdit" type="LineEdit" parent="Abilities"] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 182.0 +margin_top = 19.0 +margin_right = -21.0 +margin_bottom = -164.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 9 ) +text = "60" +align = 1 + +[node name="Label4" type="Label" parent="Abilities"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 229.0 +margin_top = 80.0 +margin_right = 45.0 +margin_bottom = -113.0 +size_flags_horizontal = 3 +custom_colors/font_color = Color( 0, 1, 1, 1 ) +custom_fonts/font = ExtResource( 9 ) +text = "POLITICS" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Politics" type="Label" parent="Abilities"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 224.0 +margin_top = 101.0 +margin_right = 6.0 +margin_bottom = -92.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 9 ) +text = "60" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="PoliticsEdit" type="LineEdit" parent="Abilities"] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 208.0 +margin_top = 101.0 +margin_right = 5.0 +margin_bottom = -82.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 9 ) +text = "60" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Label5" type="Label" parent="Abilities"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 195.0 +margin_top = 171.0 +margin_right = 23.0 +margin_bottom = -20.0 +size_flags_horizontal = 3 +custom_colors/font_color = Color( 0, 1, 1, 1 ) +custom_fonts/font = ExtResource( 9 ) +text = "GLAMOUR" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Glamour" type="Label" parent="Abilities"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 192.0 +margin_top = 191.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 9 ) +text = "60" +align = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="GlamourEdit" type="LineEdit" parent="Abilities"] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 182.0 +margin_top = 194.0 +margin_right = -21.0 +margin_bottom = 11.0 +size_flags_horizontal = 3 +custom_fonts/font = ExtResource( 9 ) +text = "60" +align = 1 + [node name="SkillsHeader" type="HBoxContainer" parent="."] -margin_left = 508.0 -margin_top = 180.0 -margin_right = 591.0 -margin_bottom = 207.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 329.0 +margin_top = 259.0 +margin_right = -877.0 +margin_bottom = -621.0 __meta__ = { "_edit_use_anchors_": false } [node name="Label" type="Label" parent="SkillsHeader"] +margin_top = 2.0 margin_right = 83.0 -margin_bottom = 27.0 -custom_fonts/font = ExtResource( 6 ) +margin_bottom = 29.0 custom_colors/font_color = Color( 1, 0.501961, 0, 1 ) +custom_fonts/font = ExtResource( 6 ) text = "SKILLS" __meta__ = { "_edit_use_anchors_": false @@ -849,43 +954,46 @@ __meta__ = { visible = false margin_left = 87.0 margin_right = 180.0 -margin_bottom = 27.0 +margin_bottom = 32.0 text = "EDIT" [node name="Label2" type="Label" parent="SkillsHeader"] visible = false margin_left = 184.0 -margin_top = 4.0 +margin_top = 7.0 margin_right = 375.0 -margin_bottom = 22.0 +margin_bottom = 25.0 text = "SKILL_EDIT_INSTRUCTION" [node name="Skills" type="GridContainer" parent="."] -margin_left = 508.0 -margin_top = 212.0 -margin_right = 508.0 -margin_bottom = 212.0 +margin_left = 329.0 +margin_top = 288.0 +margin_right = 329.0 +margin_bottom = 288.0 custom_constants/vseparation = 8 custom_constants/hseparation = 8 -columns = 10 +columns = 6 __meta__ = { "_edit_use_anchors_": false } [node name="StuntsHeader" type="HBoxContainer" parent="."] -margin_left = 508.0 -margin_top = 288.0 -margin_right = 601.0 -margin_bottom = 315.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 329.0 +margin_top = 424.0 +margin_right = -880.0 +margin_bottom = -457.0 __meta__ = { "_edit_use_anchors_": false } [node name="Label" type="Label" parent="StuntsHeader"] +margin_top = 2.0 margin_right = 93.0 -margin_bottom = 27.0 -custom_fonts/font = ExtResource( 6 ) +margin_bottom = 29.0 custom_colors/font_color = Color( 1, 0.501961, 0, 1 ) +custom_fonts/font = ExtResource( 6 ) text = "STUNTS" __meta__ = { "_edit_use_anchors_": false @@ -895,25 +1003,24 @@ __meta__ = { visible = false margin_left = 97.0 margin_right = 190.0 -margin_bottom = 27.0 +margin_bottom = 31.0 text = "EDIT" [node name="Label2" type="Label" parent="StuntsHeader"] visible = false -margin_left = 194.0 -margin_top = 4.0 -margin_right = 385.0 -margin_bottom = 22.0 +margin_top = 6.0 +margin_right = 191.0 +margin_bottom = 24.0 text = "SKILL_EDIT_INSTRUCTION" [node name="Stunts" type="GridContainer" parent="."] -margin_left = 508.0 -margin_top = 320.0 -margin_right = 508.0 -margin_bottom = 320.0 +margin_left = 330.0 +margin_top = 455.0 +margin_right = 330.0 +margin_bottom = 455.0 custom_constants/vseparation = 8 custom_constants/hseparation = 8 -columns = 6 +columns = 4 __meta__ = { "_edit_use_anchors_": false } @@ -929,12 +1036,13 @@ grow_horizontal = 0 text = "9999" [node name="Edit" type="Button" parent="."] +visible = false anchor_left = 1.0 anchor_right = 1.0 -margin_left = -120.0 -margin_top = 16.0 -margin_right = -16.0 -margin_bottom = 48.0 +margin_left = -124.0 +margin_top = 24.0 +margin_right = -31.0 +margin_bottom = 56.0 text = "EDIT" __meta__ = { "_edit_use_anchors_": false @@ -944,9 +1052,10 @@ __meta__ = { visible = false anchor_left = 1.0 anchor_right = 1.0 -margin_top = 16.0 -margin_right = -16.0 -margin_bottom = 48.0 +margin_left = -353.0 +margin_top = 24.0 +margin_right = -129.0 +margin_bottom = 57.0 grow_horizontal = 0 __meta__ = { "_edit_use_anchors_": false @@ -954,7 +1063,7 @@ __meta__ = { [node name="Cancel" type="Button" parent="EditingButtons"] margin_right = 121.0 -margin_bottom = 32.0 +margin_bottom = 33.0 text = "CANCEL" __meta__ = { "_edit_use_anchors_": false @@ -963,7 +1072,7 @@ __meta__ = { [node name="Save" type="Button" parent="EditingButtons"] margin_left = 125.0 margin_right = 224.0 -margin_bottom = 32.0 +margin_bottom = 33.0 text = "SAVE" __meta__ = { "_edit_use_anchors_": false @@ -1003,17 +1112,17 @@ anchor_bottom = 1.0 [connection signal="text_changed" from="Status/MoralityEdit" to="." method="_on_MoralityEdit_text_changed"] [connection signal="text_changed" from="Status/BravenessEdit" to="." method="_on_BravenessEdit_text_changed"] [connection signal="text_changed" from="Status/CalmnessEdit" to="." method="_on_CalmnessEdit_text_changed"] -[connection signal="text_changed" from="Abilities/CommandEdit" to="." method="_on_CommandEdit_text_changed"] -[connection signal="text_changed" from="Abilities/StrengthEdit" to="." method="_on_StrengthEdit_text_changed"] -[connection signal="text_changed" from="Abilities/IntelligenceEdit" to="." method="_on_IntelligenceEdit_text_changed"] -[connection signal="text_changed" from="Abilities/PoliticsEdit" to="." method="_on_PoliticsEdit_text_changed"] -[connection signal="text_changed" from="Abilities/GlamourEdit" to="." method="_on_GlamourEdit_text_changed"] [connection signal="text_changed" from="Relations/IdealEdit" to="." method="_on_IdealEdit_text_changed"] [connection signal="text_changed" from="Relations/BornYearEdit" to="." method="_on_BornYearEdit_text_changed"] [connection signal="pressed" from="Relations/FatherEdit" to="." method="_on_FatherEdit_pressed"] [connection signal="pressed" from="Relations/MotherEdit" to="." method="_on_MotherEdit_pressed"] [connection signal="pressed" from="Relations/SpousesEdit" to="." method="_on_SpousesEdit_pressed"] [connection signal="pressed" from="Relations/BrothersEdit" to="." method="_on_BrothersEdit_pressed"] +[connection signal="text_changed" from="Abilities/CommandEdit" to="." method="_on_CommandEdit_text_changed"] +[connection signal="text_changed" from="Abilities/StrengthEdit" to="." method="_on_StrengthEdit_text_changed"] +[connection signal="text_changed" from="Abilities/IntelligenceEdit" to="." method="_on_IntelligenceEdit_text_changed"] +[connection signal="text_changed" from="Abilities/PoliticsEdit" to="." method="_on_PoliticsEdit_text_changed"] +[connection signal="text_changed" from="Abilities/GlamourEdit" to="." method="_on_GlamourEdit_text_changed"] [connection signal="pressed" from="SkillsHeader/Edit" to="." method="_on_Skills_Edit_pressed"] [connection signal="pressed" from="StuntsHeader/Edit" to="." method="_on_Stunts_Edit_pressed"] [connection signal="pressed" from="Edit" to="." method="_on_Edit_pressed"] diff --git a/UIMain/PersonDetail/Polygon.gd b/UIMain/PersonDetail/Polygon.gd new file mode 100644 index 00000000..776ac808 --- /dev/null +++ b/UIMain/PersonDetail/Polygon.gd @@ -0,0 +1,37 @@ +extends Node2D + +const SCALE = 0.01 #五维最高100 +const WIDTH = 1.5 +const POSITION = Vector2(132.5,111.8) +const COLOR = Color(1,1,1,1) +const POINTS = PoolVector2Array([Vector2(80,19.2), Vector2(185,19.2), + Vector2(240,111.8), Vector2(185,205.5), Vector2(80,205.5), Vector2(25,111.8)]) +var current_points = PoolVector2Array([Vector2(80,19.2), Vector2(185,19.2), + Vector2(240,111.8), Vector2(185,205.5), Vector2(80,205.5), Vector2(25,111.8)]) + +func _process(_delta): + update() + +func _draw(): + draw_colored_polygon(POINTS,Color.gray) + draw_line(POSITION, Vector2(80,19.2), Color.darkgray, WIDTH) + draw_line(POSITION, Vector2(185,19.2), Color.darkgray, WIDTH) + draw_line(POSITION, Vector2(240,111.8), Color.darkgray, WIDTH) + draw_line(POSITION, Vector2(185,205.5), Color.darkgray, WIDTH) + draw_line(POSITION, Vector2(80,205.5), Color.darkgray, WIDTH) + draw_line(POSITION, Vector2(25,111.8), Color.darkgray, WIDTH) + + if get_node("../..").current_person != null: + draw_date() + draw_colored_polygon(current_points,Color.teal) + +func draw_date(): + var command: Vector2 = Util.line_scale(get_node("../..").current_person.get_command()*0.01,POSITION,Vector2(80,19.2)) + var intelligence: Vector2 = Util.line_scale(get_node("../..").current_person.get_intelligence()*0.01,POSITION,Vector2(185,19.2)) + var politics: Vector2 = Util.line_scale(get_node("../..").current_person.get_politics()*0.01,POSITION,Vector2(240,111.8)) + var glamour: Vector2 = Util.line_scale(get_node("../..").current_person.get_glamour()*0.01,POSITION,Vector2(185,205.5)) + var commands: Vector2 = Util.line_scale(get_node("../..").current_person.get_command()*0.01,POSITION,Vector2(80,205.5)) + var strength: Vector2 = Util.line_scale(get_node("../..").current_person.get_strength()*0.01,POSITION,Vector2(25,111.8)) + + + current_points = PoolVector2Array([command,intelligence,politics,glamour,commands,strength]) diff --git a/Util.gd b/Util.gd index f212b87f..e11c04e1 100644 --- a/Util.gd +++ b/Util.gd @@ -76,6 +76,11 @@ static func bstr(b: bool) -> String: ############################################## # Math # ############################################## +#根据百分比获取两点直接的距离的点 +static func line_scale(scale: float, a1: Vector2, a2: Vector2) -> Vector2: + var pos_x = (a2.x - a1.x) * scale + a1.x + var pos_y = (a2.y - a1.y) * scale + a1.y + return(Vector2(pos_x,pos_y)) # float to integer with randomized component by remaining frac static func f2ri(x: float) -> int: From d995b1119aa777f904bd9fea53046864918e02f1 Mon Sep 17 00:00:00 2001 From: JVAO <1030126308@qq.com> Date: Thu, 20 Jan 2022 12:04:19 +0800 Subject: [PATCH 2/3] fix person natural death at save load MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、存档名称不一致 2、读取存档,无法读取SharedData数据 --- ScenarioScene/Person/Person.gd | 4 ++-- ScenarioScene/Scenario.gd | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ScenarioScene/Person/Person.gd b/ScenarioScene/Person/Person.gd index ec0e8c17..379a88f8 100644 --- a/ScenarioScene/Person/Person.gd +++ b/ScenarioScene/Person/Person.gd @@ -350,8 +350,8 @@ func get_salary(): func get_age(): if scenario != null and scenario.scenario_config != null and scenario.scenario_config.person_natural_death: return scenario.get_year() - born_year + 1 - elif SharedData.selected_scenario_start_year > 0: - return SharedData.selected_scenario_start_year - born_year + 1 +# elif SharedData.selected_scenario_start_year > 0: +# return SharedData.selected_scenario_start_year - born_year + 1 else: return 30 diff --git a/ScenarioScene/Scenario.gd b/ScenarioScene/Scenario.gd index 2714fab0..a0206122 100644 --- a/ScenarioScene/Scenario.gd +++ b/ScenarioScene/Scenario.gd @@ -226,7 +226,7 @@ func _save_data(path): "AITroopTrainingRate": scenario_config.ai_troop_training_rate, "AITroopOffenceRate": scenario_config.ai_troop_offence_rate, "AITroopDefenceRate": scenario_config.ai_troop_defence_rate, - "OfficerDeath": scenario_config.person_natural_death + "PersonNaturalDeath": scenario_config.person_natural_death })) file.close() @@ -279,7 +279,7 @@ func _load_data(path, new_game, headless): scenario_config.ai_troop_training_rate = float(Util.dict_try_get(obj, 'AITroopTrainingRate', 1.0)) scenario_config.ai_troop_offence_rate = float(Util.dict_try_get(obj, 'AITroopOffenceRate', 1.0)) scenario_config.ai_troop_defence_rate = float(Util.dict_try_get(obj, 'AITroopDefenceRate', 1.0)) - scenario_config.person_natural_death = Util.dict_try_get(obj, "PersonNaturalDeath", true) + scenario_config.person_natural_death = Util.dict_try_get(obj, "PersonNaturalDeath", false) file.close() if file.open(path + "/Skills.json", File.READ) == OK: From 7485d453e9325008a7245d8ebcb1c3e783961650 Mon Sep 17 00:00:00 2001 From: JVAO <1030126308@qq.com> Date: Thu, 20 Jan 2022 12:15:21 +0800 Subject: [PATCH 3/3] update ai architecture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、提升训练优先级。 2、生成装备根据士兵数量。 3、遇到有上限任务,如募兵,人员按预期价分配。 4、任务分配更分散。 --- ScenarioScene/AI/AIArchitecture.gd | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/ScenarioScene/AI/AIArchitecture.gd b/ScenarioScene/AI/AIArchitecture.gd index 1855f750..d891247d 100644 --- a/ScenarioScene/AI/AIArchitecture.gd +++ b/ScenarioScene/AI/AIArchitecture.gd @@ -81,8 +81,8 @@ func _assign_task(arch: Architecture, scenario): var m = -9e9 if arch.kind.morale <= 0 or fund < 20 or has_enemy_troop_in_city else arch.kind.morale / float(arch.morale + 1) var e = -9e9 if arch.kind.endurance <= 0 or fund < 20 or has_enemy_troop_next_to_city else arch.kind.endurance / float(arch.endurance + 1) var r = -9e9 if arch.population <= 0 or fund < 50 or arch.morale <= 100 or arch.military_population <= 0 or not enough_food else _target_troop_quantity(arch) / (arch.troop + 1) - var t = -9e9 if arch.troop <= 0 or fund < 20 or arch.troop_morale >= target_troop_morale else (target_troop_morale * 2 / (arch.troop_morale + 10.0) - 1) - var q = -9e9 if arch.troop <= 0 or fund < 100 or not enough_fund or not enough_food else _target_equipment_quantity(arch) / (arch.equipments[min_equipment.id] + 1) / min_equipment.amount_to_troop_ratio + var t = -9e9 if arch.troop <= 0 or fund < 20 or arch.troop_morale >= target_troop_morale else target_troop_morale * 2 / (arch.troop_morale + 10.0) + var q = -9e9 if arch.troop <= 0 or fund < 100 or not enough_fund or not enough_food or arch.troop < arch.equipments[min_equipment.id] else arch.troop / (arch.equipments[min_equipment.id] + 1) / min_equipment.amount_to_troop_ratio if not enough_fund: c *= 99 @@ -94,6 +94,7 @@ func _assign_task(arch: Architecture, scenario): e *= 99 var task_priority = [a, c, m, e, r, t, q] + var military_population = arch.military_population while list.size() > 0: var task = Util.max_pos(task_priority) match task[0]: @@ -101,38 +102,42 @@ func _assign_task(arch: Architecture, scenario): var person = Util.max_by(list, "get_agriculture_ability") person[1].set_working_task(Person.Task.AGRICULTURE) list.remove(person[0]) - task_priority[0] -= 0.2 + task_priority[0] -= 0.5 1: var person = Util.max_by(list, "get_commerce_ability") person[1].set_working_task(Person.Task.COMMERCE) list.remove(person[0]) - task_priority[1] -= 0.2 + task_priority[1] -= 0.5 2: var person = Util.max_by(list, "get_morale_ability") person[1].set_working_task(Person.Task.MORALE) list.remove(person[0]) - task_priority[2] -= 0.2 + task_priority[2] -= 0.5 3: var person = Util.max_by(list, "get_endurance_ability") person[1].set_working_task(Person.Task.ENDURANCE) list.remove(person[0]) - task_priority[3] -= 0.2 + task_priority[3] -= 0.5 4: var person = Util.max_by(list, "get_recruit_troop_ability") + var quantity = min(min(Util.f2ri(person[1].get_recruit_troop_ability() * sqrt(sqrt(arch.military_population)) * arch.morale * 0.001), arch.population), arch.military_population) person[1].set_working_task(Person.Task.RECRUIT_TROOP) list.remove(person[0]) - task_priority[4] -= 0.2 + task_priority[4] -= 0.5 + military_population -= quantity + if military_population < 0: #减去该人预期完成量,剩余为负数就不做了 + task_priority[4] = -9e9 5: var person = Util.max_by(list, "get_train_troop_ability") person[1].set_working_task(Person.Task.TRAIN_TROOP) list.remove(person[0]) - task_priority[5] -= 0.2 + task_priority[5] -= 0.5 6: var person = Util.max_by(list, "get_produce_equipment_ability") person[1].set_working_task(Person.Task.PRODUCE_EQUIPMENT) person[1].set_produce_equipment(min_equipment.id) list.remove(person[0]) - task_priority[6] -= 0.2 + task_priority[6] -= 0.5 func _manage_attached_army(arch: Architecture, scenario): if arch.troop > 5000: