page fix
This commit is contained in:
+7
-9
@@ -78,8 +78,8 @@ var owniverse_items: Dictionary[String, OwniverseItem] = {}
|
||||
|
||||
var item_list_to_update: Dictionary = {}
|
||||
|
||||
func set_datetime(value: String):
|
||||
date_time.text = value
|
||||
func set_datetime(value: float):
|
||||
date_time.text = str(snapped(value, 0.1))
|
||||
|
||||
#region Item manipulations: update and visibility
|
||||
|
||||
@@ -97,8 +97,8 @@ func set_owniverse_item_value() -> void:
|
||||
owniverse.items_to_update = {}
|
||||
|
||||
|
||||
func unlock_owniverse_item() -> void:
|
||||
pass
|
||||
#func unlock_owniverse_item() -> void:
|
||||
#pass
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -246,16 +246,14 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
owniverse.cycle(delta)
|
||||
|
||||
var sdt: String = str(snapped(owniverse.add_time_delta(delta), 0.1))
|
||||
set_datetime(sdt)
|
||||
var year_delta: float = owniverse.add_time_delta(delta)
|
||||
set_datetime(year_delta)
|
||||
owniverse.cycle(year_delta)
|
||||
|
||||
var actions = _check_counters(delta)
|
||||
_do_actions(actions)
|
||||
|
||||
##page_actions[1].set_visible(false)
|
||||
|
||||
_set_active_page_actions()
|
||||
|
||||
func _set_active_page_actions() -> void:
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
[node name="Actions" type="HBoxContainer" unique_id=503388208]
|
||||
custom_minimum_size = Vector2(0, 216)
|
||||
theme_override_constants/separation = 0
|
||||
script = ExtResource("1_cjivn")
|
||||
|
||||
[node name="ActionControl0" type="Control" parent="." unique_id=1275614326]
|
||||
|
||||
@@ -20,7 +20,8 @@ var item_type = ""
|
||||
|
||||
|
||||
func set_label(value: float) -> void:
|
||||
description.text = Global.format_number(value)
|
||||
#description.text = Global.format_number(value)
|
||||
description.text = str(value)
|
||||
|
||||
|
||||
func set_selection(flag: bool) -> void:
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@ custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="../../Documents/Owad/Owniverse.I/Builds/owniverse.0.6.12-128.exe"
|
||||
export_path="../../Documents/Owad/Owniverse.I/Builds/owniverse.0.6.123-129.exe"
|
||||
patches=PackedStringArray()
|
||||
patch_delta_encoding=false
|
||||
patch_delta_compression_level_zstd=19
|
||||
@@ -110,7 +110,7 @@ architectures/armeabi-v7a=false
|
||||
architectures/arm64-v8a=true
|
||||
architectures/x86=false
|
||||
architectures/x86_64=false
|
||||
version/code=126
|
||||
version/code=129
|
||||
version/name=""
|
||||
package/unique_name="com.KIDGameProduction.Owniverse"
|
||||
package/name="Owniverse"
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true
|
||||
[application]
|
||||
|
||||
config/name="Owniverse"
|
||||
config/version="0.6.12"
|
||||
config/version="0.6.13"
|
||||
run/main_scene="uid://bv384dpmvjv8o"
|
||||
config/features=PackedStringArray("4.6", "Mobile")
|
||||
boot_splash/show_image=false
|
||||
|
||||
+45
-19
@@ -17,12 +17,39 @@ var current_amount: Dictionary[String, float] = {}
|
||||
var auto_production: Array = []
|
||||
var locked_entities: Array = []
|
||||
|
||||
#region Production
|
||||
var some_flag := true
|
||||
|
||||
func cycle(delta: float) -> void:
|
||||
|
||||
func cycle(year_delta: float) -> void:
|
||||
# all owniverse activity should be called here
|
||||
_auto_production(year_delta)
|
||||
_entity_evolution(year_delta)
|
||||
|
||||
_check_locked_items()
|
||||
|
||||
|
||||
#region object evolution
|
||||
|
||||
func _auto_production(year_delta: float) -> void:
|
||||
var cycle_production = {"S": 0.0, "H": 0.0}
|
||||
for entity: OwniverseEntity in auto_production:
|
||||
if current_amount[entity.id] == 0:
|
||||
continue
|
||||
cycle_production[entity.product_per_year_type] += \
|
||||
current_amount[entity.id] * entity.product_per_year_amount * year_delta
|
||||
|
||||
for item in cycle_production:
|
||||
_count_amount(item, cycle_production[item])
|
||||
|
||||
|
||||
func _entity_evolution(year_delta: float) -> void:
|
||||
pass
|
||||
|
||||
#endregion
|
||||
|
||||
#region Production
|
||||
|
||||
|
||||
func produce(item_id: String, amount: float) -> void:
|
||||
var entity: OwniverseEntity = entities[item_id]
|
||||
|
||||
@@ -59,21 +86,23 @@ func get_available_to_produce(item_id: String) -> float:
|
||||
func _process_enitity(entity_id: String, amount: float) -> void:
|
||||
if amount == 0: return
|
||||
_count_amount(entity_id, amount)
|
||||
items_to_update[entity_id] = current_amount[entity_id]
|
||||
|
||||
|
||||
func _count_amount(entity_id: String, amount: float) -> void:
|
||||
if amount == 0: return
|
||||
|
||||
current_amount[entity_id] += amount
|
||||
var entity: OwniverseEntity = entities[entity_id]
|
||||
if entity.group_as != "":
|
||||
current_amount[entity.group_as] += amount
|
||||
|
||||
if amount <= 0: return
|
||||
if amount < 0: return
|
||||
|
||||
cumulative_amount[entity_id] += amount
|
||||
if entity.group_as != "":
|
||||
cumulative_amount[entity.group_as] += amount
|
||||
|
||||
items_to_update[entity_id] = current_amount[entity_id]
|
||||
|
||||
func _check_locked_items() -> void:
|
||||
for entity:OwniverseEntity in locked_entities:
|
||||
@@ -88,6 +117,18 @@ func _check_locked_items() -> void:
|
||||
#endregion
|
||||
|
||||
|
||||
func add_time_delta(delta) -> float:
|
||||
var year_delta: float = delta * g_speed_in_years
|
||||
g_datetime += year_delta
|
||||
return g_datetime
|
||||
|
||||
|
||||
func change_speed(delta: int) -> int:
|
||||
g_speed = clamp(g_speed + delta, 1, Global.SPEED_LIMIT)
|
||||
g_speed_in_years = pow(10, g_speed - 1)
|
||||
return g_speed
|
||||
|
||||
|
||||
func init_enitities() -> void:
|
||||
for entity_id in Global.OwniverseEntities:
|
||||
var entity = OwniverseEntity.new()
|
||||
@@ -105,18 +146,3 @@ func init_enitities() -> void:
|
||||
|
||||
if entity.product_per_year_type != "":
|
||||
auto_production.append(entity)
|
||||
|
||||
|
||||
func add_time_delta(delta) -> float:
|
||||
var year_delta: float = delta * g_speed_in_years
|
||||
|
||||
# all ownivewrse activity should be called here
|
||||
|
||||
g_datetime += year_delta
|
||||
return g_datetime
|
||||
|
||||
|
||||
func change_speed(delta: int) -> int:
|
||||
g_speed = clamp(g_speed + delta, 1, Global.SPEED_LIMIT)
|
||||
g_speed_in_years = pow(10, g_speed - 1)
|
||||
return g_speed
|
||||
|
||||
+6
-1
@@ -5,7 +5,7 @@
|
||||
[ext_resource type="Script" uid="uid://iiva6x8uo0f2" path="res://stage/stage.gd" id="3_k83x5"]
|
||||
[ext_resource type="Texture2D" uid="uid://5f80g4i46ycl" path="res://ui/topmenu/buttons/button.burger.normal.png" id="4_b8tmp"]
|
||||
[ext_resource type="Texture2D" uid="uid://caia36a08wlqs" path="res://ui/topmenu/buttons/button.burger.pressed.png" id="5_en1oy"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjcchycx7biyl" path="res://ui/topmenu/time&speed/time_x.png" id="6_pfbnl"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjcchycx7biyl" path="res://ui/topmenu/time&speed/timex.png" id="6_pfbnl"]
|
||||
[ext_resource type="FontFile" uid="uid://dtyi81a0phumr" path="res://fonts/Roboto_Condensed/RobotoCondensed-Bold.ttf" id="7_gwdna"]
|
||||
[ext_resource type="Texture2D" uid="uid://davmv5mwt3mo1" path="res://ui/topmenu/time&speed/speed.png" id="8_h4vgh"]
|
||||
[ext_resource type="Texture2D" uid="uid://cnjtnggw5ccq3" path="res://ui/topmenu/time&speed/time1.png" id="9_kvuv0"]
|
||||
@@ -202,6 +202,7 @@ theme_override_constants/separation = 0
|
||||
|
||||
[node name="ForcePage" type="VBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer" unique_id=71643627]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="PageHeader" type="HBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer/ForcePage" unique_id=2102307933]
|
||||
custom_minimum_size = Vector2(0, 128)
|
||||
@@ -260,6 +261,7 @@ theme_override_styles/panel = SubResource("StyleBoxEmpty_ifjjt")
|
||||
|
||||
[node name="ResourcePage" type="VBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer" unique_id=1417647206]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="ResourceHeader" type="HBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer/ResourcePage" unique_id=1468901953]
|
||||
custom_minimum_size = Vector2(0, 128)
|
||||
@@ -411,6 +413,7 @@ theme_override_styles/panel = SubResource("StyleBoxEmpty_ifjjt")
|
||||
|
||||
[node name="StarPage" type="VBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer" unique_id=270059674]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="StarHeader" type="HBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer/StarPage" unique_id=1459928]
|
||||
custom_minimum_size = Vector2(0, 128)
|
||||
@@ -527,6 +530,7 @@ layout_mode = 2
|
||||
|
||||
[node name="StructurePage" type="VBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer" unique_id=435979853]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="StructureHeader" type="HBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer/StructurePage" unique_id=1291109226]
|
||||
custom_minimum_size = Vector2(0, 128)
|
||||
@@ -667,6 +671,7 @@ layout_mode = 2
|
||||
|
||||
[node name="LifePage" type="VBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer" unique_id=1519563846]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="LifeHeader" type="HBoxContainer" parent="Stage/StageRows/PageScroller/HBoxContainer/LifePage" unique_id=1673431378]
|
||||
custom_minimum_size = Vector2(0, 128)
|
||||
|
||||
Reference in New Issue
Block a user