| … | … | @@ -0,0 +1,3 @@ |
| 1 | [folding] | |
| 2 | ||
| 3 | sections_unfolded=PackedStringArray( ) |
| … | … | @@ -0,0 +1,173 @@ |
| 1 | [editor_states] | |
| 2 | ||
| 3 | Anim={ | |
| 4 | "visible": false | |
| 5 | } | |
| 6 | 2D={ | |
| 7 | "grid_offset": Vector2( 0, 0 ), | |
| 8 | "grid_snap_active": false, | |
| 9 | "grid_step": Vector2( 8, 8 ), | |
| 10 | "ofs": Vector2( -374.47, -437.365 ), | |
| 11 | "primary_grid_steps": 8, | |
| 12 | "show_edit_locks": true, | |
| 13 | "show_grid": false, | |
| 14 | "show_guides": true, | |
| 15 | "show_helpers": false, | |
| 16 | "show_origin": true, | |
| 17 | "show_rulers": true, | |
| 18 | "show_transformation_gizmos": true, | |
| 19 | "show_viewport": true, | |
| 20 | "show_zoom_control": true, | |
| 21 | "skeleton_show_bones": true, | |
| 22 | "smart_snap_active": false, | |
| 23 | "snap_guides": true, | |
| 24 | "snap_node_anchors": true, | |
| 25 | "snap_node_center": true, | |
| 26 | "snap_node_parent": true, | |
| 27 | "snap_node_sides": true, | |
| 28 | "snap_other_nodes": true, | |
| 29 | "snap_pixel": false, | |
| 30 | "snap_relative": false, | |
| 31 | "snap_rotation": false, | |
| 32 | "snap_rotation_offset": 0.0, | |
| 33 | "snap_rotation_step": 0.261799, | |
| 34 | "snap_scale": false, | |
| 35 | "snap_scale_step": 0.1, | |
| 36 | "zoom": 0.594604 | |
| 37 | } | |
| 38 | 3D={ | |
| 39 | "fov": 70.0, | |
| 40 | "gizmos_status": { | |
| 41 | "AudioStreamPlayer3D": 0, | |
| 42 | "BakedLightmap": 0, | |
| 43 | "CPUParticles3D": 0, | |
| 44 | "CSGShape3D": 0, | |
| 45 | "Camera3D": 0, | |
| 46 | "CollisionObject3D": 0, | |
| 47 | "CollisionPolygon3D": 0, | |
| 48 | "CollisionShape3D": 0, | |
| 49 | "Decal": 0, | |
| 50 | "GIProbe": 0, | |
| 51 | "GPUParticles3D": 0, | |
| 52 | "GPUParticlesCollision3D": 0, | |
| 53 | "Joint3D": 0, | |
| 54 | "Light3D": 0, | |
| 55 | "LightmapProbe": 0, | |
| 56 | "NavigationRegion3D": 0, | |
| 57 | "OccluderInstance3D": 0, | |
| 58 | "Path3D": 0, | |
| 59 | "PhysicalBone3D": 0, | |
| 60 | "Position3D": 0, | |
| 61 | "RayCast3D": 0, | |
| 62 | "ReflectionProbe": 0, | |
| 63 | "Skeleton3D": 0, | |
| 64 | "SoftBody3D": 0, | |
| 65 | "SpringArm3D": 0, | |
| 66 | "VehicleWheel3D": 0, | |
| 67 | "VisibilityNotifier3D": 0 | |
| 68 | }, | |
| 69 | "local_coords": false, | |
| 70 | "preview_sun_env": { | |
| 71 | "environ_ao_enabled": false, | |
| 72 | "environ_disabled": false, | |
| 73 | "environ_energy": 1.0, | |
| 74 | "environ_gi_enabled": false, | |
| 75 | "environ_glow_enabled": true, | |
| 76 | "environ_ground_color": Color( 0.121569, 0.121569, 0.129412, 1 ), | |
| 77 | "environ_sky_color": Color( 0.568627, 0.698039, 0.807843, 1 ), | |
| 78 | "environ_tonemap_enabled": true, | |
| 79 | "sun_color": Color( 1, 1, 1, 1 ), | |
| 80 | "sun_disabled": false, | |
| 81 | "sun_energy": 1.0, | |
| 82 | "sun_max_distance": 250.0, | |
| 83 | "sun_rotation": Basis( -0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, 0.5, -0.5 ) | |
| 84 | }, | |
| 85 | "rotate_snap": 15.0, | |
| 86 | "scale_snap": 10.0, | |
| 87 | "show_grid": true, | |
| 88 | "show_origin": true, | |
| 89 | "snap_enabled": false, | |
| 90 | "translate_snap": 1.0, | |
| 91 | "viewport_mode": 1, | |
| 92 | "viewports": [ { | |
| 93 | "auto_orthogonal": false, | |
| 94 | "auto_orthogonal_enabled": true, | |
| 95 | "cinematic_preview": false, | |
| 96 | "display_mode": 19, | |
| 97 | "distance": 4.0, | |
| 98 | "doppler": false, | |
| 99 | "frame_time": false, | |
| 100 | "gizmos": true, | |
| 101 | "half_res": false, | |
| 102 | "information": false, | |
| 103 | "listener": true, | |
| 104 | "position": Vector3( 0, 0, 0 ), | |
| 105 | "use_environment": false, | |
| 106 | "use_orthogonal": false, | |
| 107 | "view_name": "", | |
| 108 | "x_rotation": 0.5, | |
| 109 | "y_rotation": -0.5 | |
| 110 | }, { | |
| 111 | "auto_orthogonal": false, | |
| 112 | "auto_orthogonal_enabled": true, | |
| 113 | "cinematic_preview": false, | |
| 114 | "display_mode": 19, | |
| 115 | "distance": 4.0, | |
| 116 | "doppler": false, | |
| 117 | "frame_time": false, | |
| 118 | "gizmos": true, | |
| 119 | "half_res": false, | |
| 120 | "information": false, | |
| 121 | "listener": false, | |
| 122 | "position": Vector3( 0, 0, 0 ), | |
| 123 | "use_environment": false, | |
| 124 | "use_orthogonal": false, | |
| 125 | "view_name": "", | |
| 126 | "x_rotation": 0.5, | |
| 127 | "y_rotation": -0.5 | |
| 128 | }, { | |
| 129 | "auto_orthogonal": false, | |
| 130 | "auto_orthogonal_enabled": true, | |
| 131 | "cinematic_preview": false, | |
| 132 | "display_mode": 19, | |
| 133 | "distance": 4.0, | |
| 134 | "doppler": false, | |
| 135 | "frame_time": false, | |
| 136 | "gizmos": true, | |
| 137 | "half_res": false, | |
| 138 | "information": false, | |
| 139 | "listener": false, | |
| 140 | "position": Vector3( 0, 0, 0 ), | |
| 141 | "use_environment": false, | |
| 142 | "use_orthogonal": false, | |
| 143 | "view_name": "", | |
| 144 | "x_rotation": 0.5, | |
| 145 | "y_rotation": -0.5 | |
| 146 | }, { | |
| 147 | "auto_orthogonal": false, | |
| 148 | "auto_orthogonal_enabled": true, | |
| 149 | "cinematic_preview": false, | |
| 150 | "display_mode": 19, | |
| 151 | "distance": 4.0, | |
| 152 | "doppler": false, | |
| 153 | "frame_time": false, | |
| 154 | "gizmos": true, | |
| 155 | "half_res": false, | |
| 156 | "information": false, | |
| 157 | "listener": false, | |
| 158 | "position": Vector3( 0, 0, 0 ), | |
| 159 | "use_environment": false, | |
| 160 | "use_orthogonal": false, | |
| 161 | "view_name": "", | |
| 162 | "x_rotation": 0.5, | |
| 163 | "y_rotation": -0.5 | |
| 164 | } ], | |
| 165 | "zfar": 4000.0, | |
| 166 | "znear": 0.05 | |
| 167 | } | |
| 168 | TextureRegion={ | |
| 169 | "snap_mode": 0, | |
| 170 | "snap_offset": Vector2( 0, 0 ), | |
| 171 | "snap_separation": Vector2( 0, 0 ), | |
| 172 | "snap_step": Vector2( 10, 10 ) | |
| 173 | } |
| … | … | @@ -0,0 +1,5 @@ |
| 1 | [folding] | |
| 2 | ||
| 3 | node_unfolds=[ NodePath("."), PackedStringArray( "Rect" ), NodePath("Title"), PackedStringArray( "Rect", "Size Flags", "Structured Text" ), NodePath("HBoxContainer"), PackedStringArray( "Rect" ), NodePath("HBoxContainer/URLBar"), PackedStringArray( "Caret", "Rect", "Size Flags", "Structured Text" ), NodePath("HBoxContainer/LoadButton"), PackedStringArray( "Rect" ), NodePath("ScrollContainer"), PackedStringArray( "Rect", "Scroll", "Size Flags" ), NodePath("ScrollContainer/Output"), PackedStringArray( "Size Flags", "Structured Text" ), NodePath("StatusLabel"), PackedStringArray( "Rect", "Structured Text" ) ] | |
| 4 | resource_unfolds=[ ] | |
| 5 | nodes_folded=[ ] |
| … | … | @@ -0,0 +1,51 @@ |
| 1 | [docks] | |
| 2 | ||
| 3 | dock_3="Scene,Import" | |
| 4 | dock_4="FileSystem" | |
| 5 | dock_5="Inspector,Node" | |
| 6 | dock_filesystem_split=0 | |
| 7 | dock_filesystem_display_mode=0 | |
| 8 | dock_filesystem_file_sort=0 | |
| 9 | dock_filesystem_file_list_display_mode=1 | |
| 10 | dock_split_2=0 | |
| 11 | dock_split_3=0 | |
| 12 | dock_hsplit_1=0 | |
| 13 | dock_hsplit_2=70 | |
| 14 | dock_hsplit_3=-70 | |
| 15 | dock_hsplit_4=0 | |
| 16 | ||
| 17 | [EditorNode] | |
| 18 | ||
| 19 | open_scenes=[ "res://src/HyperLoad.tscn" ] | |
| 20 | ||
| 21 | [ScriptEditor] | |
| 22 | ||
| 23 | open_scripts=[ { | |
| 24 | "path": "res://src/GatewayRequest.gd", | |
| 25 | "state": { | |
| 26 | "bookmarks": [ ], | |
| 27 | "breakpoints": [ ], | |
| 28 | "column": 39, | |
| 29 | "folded_lines": PackedInt32Array( ), | |
| 30 | "h_scroll_position": 0, | |
| 31 | "row": 43, | |
| 32 | "scroll_position": 32.0, | |
| 33 | "selection": false, | |
| 34 | "syntax_highlighter": "GDScript" | |
| 35 | } | |
| 36 | }, { | |
| 37 | "path": "res://src/ResizeRoot.gd", | |
| 38 | "state": { | |
| 39 | "bookmarks": [ ], | |
| 40 | "breakpoints": [ ], | |
| 41 | "column": 0, | |
| 42 | "folded_lines": PackedInt32Array( ), | |
| 43 | "h_scroll_position": 0, | |
| 44 | "row": 0, | |
| 45 | "scroll_position": 0.0, | |
| 46 | "selection": false, | |
| 47 | "syntax_highlighter": "GDScript" | |
| 48 | } | |
| 49 | } ] | |
| 50 | open_help=[ ] | |
| 51 | split_offset=70 |
| … | … | @@ -0,0 +1,12 @@ |
| 1 | 3844edc3d1660e6e25a999aafc25a878 | |
| 2 | ::res://::1622251215 | |
| 3 | default_env.tres::Environment::1622100229::0::1::::<><>:: | |
| 4 | icon.png::StreamTexture2D::1621449955::1622251219::1::::<><>:: | |
| 5 | ::res://hyper-gateway/::1622100176 | |
| 6 | ::res://src/::1622245301 | |
| 7 | GatewayRequest.gd::GDScript::1622094645::0::1::::<>HTTPRequest<>:: | |
| 8 | HyperLoad.tscn::PackedScene::1622100229::0::1::::<><>::res://src/URLBar.gd<>res://src/GatewayRequest.gd<>res://src/StatusLabel.gd<>res://src/Output.gd<>res://src/ResizeRoot.gd | |
| 9 | Output.gd::GDScript::1622094345::0::1::::<>RichTextLabel<>:: | |
| 10 | ResizeRoot.gd::GDScript::1622084757::0::1::::<>VBoxContainer<>:: | |
| 11 | StatusLabel.gd::GDScript::1622094484::0::1::::<>Label<>:: | |
| 12 | URLBar.gd::GDScript::1621968967::0::1::::<>LineEdit<>:: |
| … | … | @@ -0,0 +1,2 @@ |
| 1 | res://src/GatewayRequest.gd | |
| 2 | res://src/HyperLoad.tscn |
| … | … | @@ -0,0 +1,13 @@ |
| 1 | [editor_metadata] | |
| 2 | ||
| 3 | executable_path="/home/mauve/programming/godot/source/bin/godot.linuxbsd.tools.64" | |
| 4 | ||
| 5 | [debug_options] | |
| 6 | ||
| 7 | run_live_debug=true | |
| 8 | run_reload_scripts=true | |
| 9 | ||
| 10 | [recent_files] | |
| 11 | ||
| 12 | scenes=[ "res://src/HyperLoad.tscn" ] | |
| 13 | scripts=[ "res://src/GatewayRequest.gd", "res://src/ResizeRoot.gd" ] |
| … | … | @@ -0,0 +1,3 @@ |
| 1 | source_md5="47313fa4c47a9963fddd764e1ec6e4a8" | |
| 2 | dest_md5="99b07af0f62c2854ca2010c2a394dc11" | |
| 3 |
| … | … | @@ -1,91 +0,0 @@ |
| 1 | extends HTTPRequest | |
| 2 | ||
| 3 | signal loaded_data(data) | |
| 4 | signal loading_data(url) | |
| 5 | signal failed_load(url, error) | |
| 6 | signal starting_gateway() | |
| 7 | signal started_gateway(pid) | |
| 8 | ||
| 9 | var processPID = 0 | |
| 10 | var storageDirectory = defaultDirectory() | |
| 11 | ||
| 12 | # Called when the node enters the scene tree for the first time. | |
| 13 | func _ready(): | |
| 14 | pass # Replace with function body. | |
| 15 | ||
| 16 | func _notification(what): | |
| 17 | if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: | |
| 18 | cleanupGateway() | |
| 19 | pass | |
| 20 | ||
| 21 | func cleanupGateway(): | |
| 22 | if processPID == 0: | |
| 23 | print('Gateway already closed ' + str(processPID)) | |
| 24 | return | |
| 25 | print('Cleaning up gateway ' + str(processPID)) | |
| 26 | OS.kill(processPID) | |
| 27 | pass | |
| 28 | ||
| 29 | func setupGateway(): | |
| 30 | emit_signal("starting_gateway") | |
| 31 | var executiblePath = getExecutiblePath() | |
| 32 | var executibleFile = File.new() | |
| 33 | ||
| 34 | executibleFile.open(executiblePath, File.READ) | |
| 35 | ||
| 36 | var path = executibleFile.get_path_absolute() | |
| 37 | executibleFile.close() | |
| 38 | ||
| 39 | var args = ["run", "--no-persist"] | |
| 40 | ||
| 41 | print("Starting gateway from " + path) | |
| 42 | ||
| 43 | # Start the hyper-gateway in a process | |
| 44 | processPID = OS.execute(path, args, false) | |
| 45 | ||
| 46 | # Sleep for a bit while the gateway loads | |
| 47 | # TODO: Find a better indicator like polling the HTTP server socket | |
| 48 | OS.delay_msec(2000) | |
| 49 | ||
| 50 | print("Started gateway at " + str(processPID)) | |
| 51 | emit_signal("started_gateway", processPID) | |
| 52 | pass | |
| 53 | ||
| 54 | func ensureSetup(): | |
| 55 | if processPID != 0: return | |
| 56 | setupGateway() | |
| 57 | pass | |
| 58 | ||
| 59 | func getExecutiblePath(): | |
| 60 | var name = OS.get_name() | |
| 61 | if name == 'X11': return "res://hyper-gateway/hyper-gateway-linux" | |
| 62 | if name == 'OSX': return "res://hyper-gateway/hyper-gateway-macos" | |
| 63 | if name == 'Windows': return "res://hyper-gateway/hyper-gateway-windows.exe" | |
| 64 | push_error("Can not start gateway, invalid operating system " + name) | |
| 65 | pass | |
| 66 | ||
| 67 | func defaultDirectory(): | |
| 68 | var dir = Directory.new() | |
| 69 | dir.open('user://gateway-data/') | |
| 70 | return dir.get_current_dir() | |
| 71 | pass | |
| 72 | ||
| 73 | # Called every frame. 'delta' is the elapsed time since the previous frame. | |
| 74 | #func _process(delta): | |
| 75 | # pass | |
| 76 | ||
| 77 | func requestHyper(url): | |
| 78 | ensureSetup() | |
| 79 | var toload = url.replace("hyper://", "http://127.0.0.1:4973/hyper/") | |
| 80 | print("Loading " + toload) | |
| 81 | request(toload) | |
| 82 | pass | |
| 83 | ||
| 84 | func _on_request_completed(result, response_code, headers, body): | |
| 85 | print("Response Code ", response_code) | |
| 86 | if response_code != 200: | |
| 87 | var message = body.get_string_from_utf8() | |
| 88 | print("Error message:", message) | |
| 89 | emit_signal("failed_load", result, message) | |
| 90 | else: emit_signal("loaded_data", body.get_string_from_utf8()) | |
| 91 | pass # Replace with function body. |
| … | … | @@ -1,7 +1,7 @@ |
| 1 | 1 | [gd_scene load_steps=6 format=2] |
| 2 | 2 | |
| 3 | 3 | [ext_resource path="res://src/URLBar.gd" type="Script" id=1] |
| 4 | [ext_resource path="res://src/GatewayRequest.gd" type="Script" id=2] | |
| 4 | [ext_resource path="res://src/HyperRequest.gd" type="Script" id=2] | |
| 5 | 5 | [ext_resource path="res://src/StatusLabel.gd" type="Script" id=3] |
| 6 | 6 | [ext_resource path="res://src/Output.gd" type="Script" id=4] |
| 7 | 7 | [ext_resource path="res://src/ResizeRoot.gd" type="Script" id=5] |
| … | … | @@ -52,20 +52,21 @@ __meta__ = { |
| 52 | 52 | [node name="ScrollContainer" type="ScrollContainer" parent="."] |
| 53 | 53 | margin_top = 46.0 |
| 54 | 54 | margin_right = 280.0 |
| 55 | margin_bottom = 46.0 | |
| 55 | margin_bottom = 58.0 | |
| 56 | 56 | size_flags_vertical = 3 |
| 57 | 57 | scroll_horizontal_enabled = false |
| 58 | 58 | |
| 59 | 59 | [node name="Output" type="RichTextLabel" parent="ScrollContainer"] |
| 60 | 60 | margin_right = 280.0 |
| 61 | margin_bottom = 12.0 | |
| 61 | 62 | size_flags_horizontal = 3 |
| 62 | 63 | size_flags_vertical = 3 |
| 63 | 64 | script = ExtResource( 4 ) |
| 64 | 65 | |
| 65 | 66 | [node name="StatusLabel" type="Label" parent="."] |
| 66 | margin_top = 50.0 | |
| 67 | margin_top = 62.0 | |
| 67 | 68 | margin_right = 280.0 |
| 68 | margin_bottom = 64.0 | |
| 69 | margin_bottom = 76.0 | |
| 69 | 70 | text = "Status: Waiting" |
| 70 | 71 | script = ExtResource( 3 ) |
| 71 | 72 | __meta__ = { |
| … | … | @@ -76,12 +77,7 @@ __meta__ = { |
| 76 | 77 | script = ExtResource( 2 ) |
| 77 | 78 | |
| 78 | 79 | [connection signal="text_entered" from="HBoxContainer/URLBar" to="HBoxContainer/URLBar" method="_on_URLBar_text_entered"] |
| 79 | [connection signal="url" from="HBoxContainer/URLBar" to="HyperLoad" method="requestHyper"] | |
| 80 | [connection signal="url" from="HBoxContainer/URLBar" to="HyperLoad" method="request"] | |
| 80 | 81 | [connection signal="pressed" from="HBoxContainer/LoadButton" to="HBoxContainer/URLBar" method="navigate"] |
| 81 | [connection signal="failed_load" from="HyperLoad" to="StatusLabel" method="setError"] | |
| 82 | [connection signal="loaded_data" from="HyperLoad" to="StatusLabel" method="setLoaded"] | |
| 83 | [connection signal="loaded_data" from="HyperLoad" to="ScrollContainer/Output" method="setContent"] | |
| 84 | [connection signal="loading_data" from="HyperLoad" to="StatusLabel" method="setLoadingData"] | |
| 85 | [connection signal="request_completed" from="HyperLoad" to="HyperLoad" method="_on_request_completed"] | |
| 86 | [connection signal="started_gateway" from="HyperLoad" to="StatusLabel" method="setGatewayLoaded"] | |
| 87 | [connection signal="starting_gateway" from="HyperLoad" to="StatusLabel" method="setGatewayLoading"] | |
| 82 | [connection signal="request_completed" from="HyperLoad" to="StatusLabel" method="_on_HyperLoad_request_completed"] | |
| 83 | [connection signal="request_completed" from="HyperLoad" to="ScrollContainer/Output" method="_on_HyperLoad_request_completed"] |
| … | … | @@ -0,0 +1,83 @@ |
| 1 | extends HTTPRequest | |
| 2 | ||
| 3 | signal loaded_data(data) | |
| 4 | signal loading_data(url) | |
| 5 | signal failed_load(url, error) | |
| 6 | signal starting_gateway() | |
| 7 | signal started_gateway(pid) | |
| 8 | ||
| 9 | var processPID = 0 | |
| 10 | var storageDirectory = defaultDirectory() | |
| 11 | var serverPrefix = "http://127.0.0.1:4973/hyper/" | |
| 12 | ||
| 13 | # Called when the node enters the scene tree for the first time. | |
| 14 | func _ready(): | |
| 15 | pass # Replace with function body. | |
| 16 | ||
| 17 | func _notification(what): | |
| 18 | if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: | |
| 19 | cleanupGateway() | |
| 20 | pass | |
| 21 | ||
| 22 | func cleanupGateway(): | |
| 23 | if processPID == 0: | |
| 24 | print('Gateway already closed ' + str(processPID)) | |
| 25 | return | |
| 26 | print('Cleaning up gateway ' + str(processPID)) | |
| 27 | OS.kill(processPID) | |
| 28 | pass | |
| 29 | ||
| 30 | func setupGateway(): | |
| 31 | emit_signal("starting_gateway") | |
| 32 | var executiblePath = getExecutiblePath() | |
| 33 | var executibleFile = File.new() | |
| 34 | ||
| 35 | executibleFile.open(executiblePath, File.READ) | |
| 36 | ||
| 37 | var path = executibleFile.get_path_absolute() | |
| 38 | executibleFile.close() | |
| 39 | ||
| 40 | var args = ["run", "--no-persist"] | |
| 41 | ||
| 42 | print("Starting gateway from " + path) | |
| 43 | ||
| 44 | # Start the hyper-gateway in a process | |
| 45 | processPID = OS.execute(path, args, false) | |
| 46 | ||
| 47 | # Sleep for a bit while the gateway loads | |
| 48 | # TODO: Find a better indicator like polling the HTTP server socket | |
| 49 | OS.delay_msec(2000) | |
| 50 | ||
| 51 | print("Started gateway at " + str(processPID)) | |
| 52 | emit_signal("started_gateway", processPID) | |
| 53 | pass | |
| 54 | ||
| 55 | func ensureSetup(): | |
| 56 | if processPID != 0: return | |
| 57 | setupGateway() | |
| 58 | pass | |
| 59 | ||
| 60 | func getExecutiblePath(): | |
| 61 | var name = OS.get_name() | |
| 62 | if name == 'X11': return "res://hyper-gateway/hyper-gateway-linux" | |
| 63 | if name == 'OSX': return "res://hyper-gateway/hyper-gateway-macos" | |
| 64 | if name == 'Windows': return "res://hyper-gateway/hyper-gateway-windows.exe" | |
| 65 | push_error("Can not start gateway, invalid operating system " + name) | |
| 66 | pass | |
| 67 | ||
| 68 | func defaultDirectory(): | |
| 69 | var dir = Directory.new() | |
| 70 | dir.open('user://gateway-data/') | |
| 71 | return dir.get_current_dir() | |
| 72 | pass | |
| 73 | ||
| 74 | # Called every frame. 'delta' is the elapsed time since the previous frame. | |
| 75 | #func _process(delta): | |
| 76 | # pass | |
| 77 | ||
| 78 | func request(url, custom_headers=PoolStringArray( ), ssl_validate_domain=false, method=0, request_data=""): | |
| 79 | assert(url.begins_with("hyper://")) | |
| 80 | ensureSetup() | |
| 81 | var toLoad = url.replace("hyper://", serverPrefix) | |
| 82 | .request(toLoad, custom_headers, ssl_validate_domain, method, request_data) | |
| 83 | pass |
| … | … | @@ -1,5 +1,5 @@ |
| 1 | 1 | extends RichTextLabel |
| 2 | 2 | |
| 3 | func setContent(data): | |
| 4 | text = data | |
| 3 | func _on_HyperLoad_request_completed(result, response_code, headers, body): | |
| 4 | text = body.get_string_from_utf8() | |
| 5 | 5 | pass # Replace with function body. |
| … | … | @@ -14,7 +14,7 @@ func _ready(): |
| 14 | 14 | #func _process(delta): |
| 15 | 15 | # pass |
| 16 | 16 | |
| 17 | func setLoaded(data): | |
| 17 | func setLoaded(): | |
| 18 | 18 | text = "Status: Loaded" |
| 19 | 19 | pass # Replace with function body. |
| 20 | 20 | |
| … | … | @@ -23,7 +23,7 @@ func setLoading(url): |
| 23 | 23 | pass # Replace with function body. |
| 24 | 24 | |
| 25 | 25 | |
| 26 | func setError(url, error): | |
| 26 | func setError(error): | |
| 27 | 27 | text = "Status: Failed Load" + error |
| 28 | 28 | pass # Replace with function body. |
| 29 | 29 | |
| … | … | @@ -36,3 +36,13 @@ func setGatewayLoading(): |
| 36 | 36 | func setGatewayLoaded(pid): |
| 37 | 37 | text = "Status: Gateway Loaded" |
| 38 | 38 | pass # Replace with function body. |
| 39 | ||
| 40 | ||
| 41 | func _on_HyperLoad_request_completed(result, response_code, headers, body): | |
| 42 | print("Response Code ", response_code) | |
| 43 | if response_code != 200: | |
| 44 | var message = body.get_string_from_utf8() | |
| 45 | print("Error message:", message) | |
| 46 | setError(message) | |
| 47 | else: setLoaded() | |
| 48 | pass # Replace with function body. |