Коммит 0e701b2f создал по автору magcourier's avatar magcourier
Просмотр файлов

Стартовая страница и переработка списка объектов

владелец 586b867a
......@@ -27,7 +27,3 @@ material/4 = null
[node name="base_spaceship" parent="CollisionShape" instance=ExtResource( 3 )]
transform = Transform( -0.0034731, 0, 0.999994, 0, 1, 0, -0.999994, 0, -0.0034731, -4.98877, -3.8979, 6.84284 )
[node name="timer" type="Timer" parent="."]
wait_time = 10.0
[connection signal="timeout" from="timer" to="." method="_on_timer_timeout"]
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=16 format=2]
[ext_resource path="res://blokoj/kosmo/scenoj/waypoint.tscn" type="PackedScene" id=1]
[ext_resource path="res://blokoj/kosmo/scenoj/ship.tscn" type="PackedScene" id=2]
[ext_resource path="res://blokoj/kosmo/scenoj/space_object.tscn" type="PackedScene" id=3]
[ext_resource path="res://blokoj/kosmo/scenoj/main_camera.tscn" type="PackedScene" id=4]
[ext_resource path="res://blokoj/kosmo/scenoj/star.tscn" type="PackedScene" id=5]
[ext_resource path="res://blokoj/kosmo/skriptoj/http_space_query.gd" type="Script" id=6]
[ext_resource path="res://blokoj/kosmo/skriptoj/http_mutate.gd" type="Script" id=7]
[ext_resource path="res://blokoj/kosmo/skriptoj/space.gd" type="Script" id=8]
[ext_resource path="res://blokoj/kosmo/scenoj/menuo.tscn" type="PackedScene" id=9]
......@@ -36,9 +35,6 @@ font_data = ExtResource( 10 )
[node name="space" type="Spatial"]
script = ExtResource( 8 )
[node name="http_space_query" type="HTTPRequest" parent="."]
script = ExtResource( 6 )
[node name="http_mutate" type="HTTPRequest" parent="."]
script = ExtResource( 7 )
......@@ -52,7 +48,7 @@ script = ExtResource( 7 )
[node name="http_finado" type="HTTPRequest" parent="."]
[node name="ship" parent="." instance=ExtResource( 2 )]
[node name="ship1" parent="." instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 129.985 )
visible = false
......@@ -100,7 +96,7 @@ material/0 = SubResource( 4 )
z_away = 4000
colision_radius = 1.0
[node name="space_object" parent="." instance=ExtResource( 3 )]
[node name="space_object1" parent="." instance=ExtResource( 3 )]
transform = Transform( 10, 0, 0, 0, 10, 0, 0, 0, 10, -163.333, 10.0102, 3.27841 )
visible = false
......@@ -126,8 +122,11 @@ __meta__ = {
}
[node name="itinero" parent="b_itinero" instance=ExtResource( 11 )]
[connection signal="ready" from="." to="." method="_on_space_ready"]
[connection signal="request_completed" from="http_space_query" to="http_space_query" method="_on_http_space_query_request_completed"]
[node name="timer" type="Timer" parent="."]
wait_time = 10.0
[connection signal="load_objektoj" from="." to="." method="_on_space_load_objektoj"]
[connection signal="tree_exiting" from="." to="." method="_on_space_tree_exiting"]
[connection signal="request_completed" from="http_mutate" to="http_mutate" method="_on_http_mutate_request_completed"]
[connection signal="request_completed" from="http_projekto" to="." method="_on_http_projekto_request_completed"]
[connection signal="request_completed" from="http_taskoj" to="." method="_on_http_taskoj_request_completed"]
......@@ -135,3 +134,4 @@ __meta__ = {
[connection signal="request_completed" from="http_posedanto" to="." method="_on_http_posedanto_request_completed"]
[connection signal="request_completed" from="http_finado" to="." method="_on_http_finado_request_completed"]
[connection signal="pressed" from="b_itinero" to="." method="_on_Button_pressed"]
[connection signal="timeout" from="timer" to="." method="_on_Timer_timeout"]
extends HTTPRequest
const ship = preload("res://blokoj/kosmo/scenoj/ships.tscn")
func _on_http_space_query_request_completed(result, response_code, headers, body):
var resp = body.get_string_from_utf8()
var parsed_resp = parse_json(resp)
var simpled_data = parsed_resp['data']['universoObjekto']['edges']
for item in simpled_data:
if item['node']['resurso']['tipo']['objId'] == 3:#объект станция, на сегодня одна только
$"../space_object".translation=Vector3(item['node']['koordinatoX'],
item['node']['koordinatoY'], item['node']['koordinatoZ'])
$"../space_object".visible=true
if item['node']['resurso']['tipo']['objId'] == 2:
#если корабль игрока
if item['node']['posedantoId'] == Global.id:
$"../ship".translation=Vector3(item['node']['koordinatoX'],
item['node']['koordinatoY'], item['node']['koordinatoZ'])
$"../ship".rotation=Vector3(item['node']['rotaciaX'],
item['node']['rotaciaY'], item['node']['rotaciaZ'])
$"../main_camera".translation=Vector3(item['node']['koordinatoX'],
item['node']['koordinatoY'], item['node']['koordinatoZ']+22)
$"../ship".visible=true
$"../ship".uuid=item['node']['uuid']
# и теперь по uuid нужно найти проект и задачу
var projektoj = item['node']['projekto']['edges']
if len(projektoj)>1:
pass #нужно обнулить все проекты!!!
if len(projektoj)>0:
if len(projektoj[0]['node']['tasko']['edges'])==0:
pass# нужно закрыть проект!!!
else:
$"../ship".projekto_uuid=projektoj[0]['node']['uuid']
#заполняем маршрут
$"../b_itinero/itinero".itineroj.clear()
for tasko in projektoj[0]['node']['tasko']['edges']:
if tasko['node']['statuso']['objId']==2:#задачу, которая "В работе" ставим первой
$"../b_itinero/itinero".itineroj.append({
'uuid_tasko':tasko['node']['uuid'],
'nomo':'координаты в космосе',
'koordinatoX':tasko['node']['finKoordinatoX'],
'koordinatoY':tasko['node']['finKoordinatoY'],
'koordinatoZ':tasko['node']['finKoordinatoZ']
})
break;
for tasko in projektoj[0]['node']['tasko']['edges']:
if tasko['node']['statuso']['objId']==1:# добавляем остальные задачи
$"../b_itinero/itinero".itineroj.append({
'uuid_tasko':tasko['node']['uuid'],
'nomo':'координаты в космосе',
'koordinatoX':tasko['node']['finKoordinatoX'],
'koordinatoY':tasko['node']['finKoordinatoY'],
'koordinatoZ':tasko['node']['finKoordinatoZ']
})
print('ship4')
if len($"../b_itinero/itinero".itineroj)==0:
$"../ship".projekto_uuid='' #задач на полёт нет, проект надо бы закрыть
else:
#отправляем корабль по координатам
var position = Vector3($"../b_itinero/itinero".itineroj[0]['koordinatoX'],
$"../b_itinero/itinero".itineroj[0]['koordinatoY'],
$"../b_itinero/itinero".itineroj[0]['koordinatoZ'])
$"../b_itinero/itinero".FillItemList()
$"../ship".set_way_point(position,null)
$"../way_point".set_way_point(position)
$"../ship/timer".start()
$"../b_itinero/itinero/canvas/MarginContainer/VBoxContainer/HBoxContainer/kom_itinero".disabled=true
$"../b_itinero/itinero/canvas/MarginContainer/VBoxContainer/HBoxContainer/itinero_next".disabled=false
$"../b_itinero/itinero/canvas/MarginContainer/VBoxContainer/HBoxContainer/itinero_fin".disabled=false
$"../b_itinero/itinero/canvas/MarginContainer/VBoxContainer/HBoxContainer/itinero_clear".disabled=false
else:
$"../ship".projekto_uuid=''
else:
var s = ship.instance()
s.translation=Vector3(item['node']['koordinatoX'],
item['node']['koordinatoY'], item['node']['koordinatoZ'])
# s.rotation=Vector3(item['node']['rotaciaX'],
# item['node']['rotaciaY'], item['node']['rotaciaZ'])
$"../".add_child(s)
Title.get_node("CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window").distance_to($"../ship".translation)
......@@ -9,6 +9,7 @@ var itineroj = []
# 'koordinatoX':
# 'koordinatoY':
# 'koordinatoZ':
# расстояние до цели полёта - distance
func _on_Close_button_pressed():
$"canvas/MarginContainer".set_visible(false)
......@@ -28,7 +29,17 @@ func FillItemList():
$"canvas/MarginContainer/VBoxContainer/ItemList".clear()
# Заполняет список найдеными продуктами
for Item in itineroj:
get_node("canvas/MarginContainer/VBoxContainer/ItemList").add_item(Item['nomo'], null, true)
get_node("canvas/MarginContainer/VBoxContainer/ItemList").add_item('('+String(int(Item['distance']))+') '+Item['nomo'], null, true)
#пересчет дистанции до объектов в списке
func distance_to(trans):
for obj in itineroj:
obj['distance'] = trans.distance_to(Vector3(obj['koordinatoX'],
obj['koordinatoY'],obj['koordinatoZ']))
$'canvas/MarginContainer/VBoxContainer/ItemList'.clear()
# $'canvas/MarginContainer/VBoxContainer/scroll/ItemList'.clear()
FillItemList()
#отправляем корабль в полёт
func go_ship():
......@@ -41,7 +52,7 @@ func go_ship():
func _on_kom_itinero_pressed():
#остановить текущие задачи
# останавливаем таймер передачи данных на сервер
$"../../ship/timer".stop()
$"../../timer".stop()
#отправка последних координат и закрытие зачачи с проектом
$"../../ship".finofara_flugo()
#создать проект
......@@ -51,17 +62,18 @@ func _on_kom_itinero_pressed():
# отправляем в полёт
go_ship()
#запускаем таймер
$"../../ship/timer".start()
$"../../timer".start()
$canvas/MarginContainer/VBoxContainer/HBoxContainer/kom_itinero.disabled=true
func add_itinero(uuid, nomo, koordX, koordY, koordZ):
func add_itinero(uuid, nomo, koordX, koordY, koordZ, distance):
itineroj.append({
'uuid':uuid,
'nomo':nomo,
'koordinatoX':koordX,
'koordinatoY':koordY,
'koordinatoZ':koordZ,
'distance':distance,
})
FillItemList()
......@@ -94,7 +106,7 @@ func _on_itinero_clear_pressed():
#закрываем текущую задачу и проект автоматически закрывается
$"../../ship".clear_way_point()
$"../../way_point".set_active(false)
$"../../ship/timer".stop()
$"../../timer".stop()
$"../../ship".finofara_flugo()
# itineroj.clear()
# $canvas/MarginContainer/VBoxContainer/ItemList.clear()
......@@ -107,5 +119,8 @@ func _on_itinero_clear_pressed():
# пропустить текущую цель и лететь к следующей
func _on_itinero_next_pressed():
$"../../ship".clear_way_point()
$"../../way_point".set_active(false)
$"../../timer".stop()
$"../../ship".finofara_flugo()
pass # Replace with function body.
......@@ -40,7 +40,7 @@ const ROTATION_MULTIPLIER = 500
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_CONFINED)
func _input(event):
func _unhandled_input(event):
if freelook:
if Input.get_action_strength("right_click"):
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
......@@ -48,6 +48,8 @@ func _input(event):
_mouse_offset = event.relative
else:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
func _input(event):
if privot:
if event.is_action_pressed("wheel_down"):
distance-=distance_step
......
......@@ -18,25 +18,27 @@ func _input(event: InputEvent) -> void:
const translacio = 20
func _on_PopupMenu_index_pressed(index):
var index_obj = $"/root/Title/CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window/canvas/MarginContainer/VBoxContainer/ItemList".get_selected_items()
var index_obj = $"/root/Title/CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window/canvas/MarginContainer/VBoxContainer/scroll/ItemList".get_selected_items()
if $"/root/Title/CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window".ItemListContent[index_obj[0]]['uuid']==$"../ship".uuid:#если свой корабль
return null
var koordX = $"/root/Title/CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window".ItemListContent[index_obj[0]]['koordinatoX'] + translacio
var koordY = $"/root/Title/CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window".ItemListContent[index_obj[0]]['koordinatoY'] + translacio
var koordZ = $"/root/Title/CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window".ItemListContent[index_obj[0]]['koordinatoZ'] + translacio
var distance_to = $"../ship".translation.distance_to(Vector3(koordX,koordY,koordZ))
$"../b_itinero/itinero".itineroj.append({
'uuid':$"/root/Title/CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window".ItemListContent[index_obj[0]]['uuid'],
'nomo':$"/root/Title/CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window".ItemListContent[index_obj[0]]['nomo'],
'koordinatoX':koordX,
'koordinatoY':koordY,
'koordinatoZ':koordZ,
'distance':distance_to,
})
$"../b_itinero/itinero".FillItemList()
if index==0:
$"../".set_way_point(Vector3(koordX,koordY,koordZ),null)
elif index==1:
var distance_to = $"../ship".translation.distance_to(Vector3(koordX,koordY,koordZ))
$"../b_itinero/itinero".itineroj.append({
'uuid':$"/root/Title/CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window".ItemListContent[index_obj[0]]['uuid'],
'nomo':$"/root/Title/CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window".ItemListContent[index_obj[0]]['nomo']+ ' (' + String(distance_to) + ')',
'koordinatoX':koordX,
'koordinatoY':koordY,
'koordinatoZ':koordZ,
})
$"../b_itinero/itinero".FillItemList()
# $"../".set_way_point(Vector3(koordX,koordY,koordZ),null)
$"../b_itinero/itinero"._on_kom_itinero_pressed()
# elif index==1:
func _on_PopupMenu_draw():
......
......@@ -13,11 +13,13 @@ func objecto_query(kuboId, statusoId, kategorioId, tipo_id):
"{ universoObjekto (realeco_Id:$realecoId, kubo_Id: $kuboId, koordinatoX_Gt:-5000000, "+
" koordinatoY_Gt:-5000000, koordinatoZ_Gt:-5000000) { edges { node { uuid posedantoId "+
" projekto (statuso_Id: $statusoId, tipo_Id: $tipoId){ "+
" edges { node { uuid "+
" tasko (kategorio_Id:$kategorioId){ edges {node { "+
" uuid finKoordinatoX finKoordinatoY finKoordinatoZ statuso {objId} } } } } } } "+
" inCosmo nomo { enhavo } priskribo { enhavo } resurso { nomo { enhavo } priskribo { enhavo } "+
" tipo { objId nomo { enhavo } } } koordinatoX koordinatoY koordinatoZ "+
" edges { node { uuid "+
" tasko (kategorio_Id:$kategorioId){ edges {node { "+
" uuid finKoordinatoX finKoordinatoY finKoordinatoZ statuso {objId} } } } } } } "+
" inCosmo nomo { enhavo } priskribo { enhavo } "+
" resurso { nomo { enhavo } priskribo { enhavo } "+
" tipo { objId nomo { enhavo } } } "+
" koordinatoX koordinatoY koordinatoZ "+
" rotaciaX rotaciaY rotaciaZ } } } }",
'variables': {"kuboId":kuboId, "statusoId":statusoId,
"kategorioId":kategorioId, "tipoId":tipo_id,
......
......@@ -38,7 +38,7 @@ func _physics_process(delta):
clear_way_point()
print("doexali")
# останавливаем таймер передачи данных на сервер
$timer.stop()
$"../timer".stop()
#отправка последних координат и закрытие задачи с проектом
finofara_flugo()
return
......@@ -47,6 +47,8 @@ func _physics_process(delta):
if docking_rotation != null:
transform.basis = Basis(Quat(transform.basis).slerp(docking_rotation,speed_rotation*1.5)) #поворачиваем в дефолтное состояние, чтобы сесть
move_and_slide(target_dir*delta*current_speed) #Двигаемся к цели
Title.get_node("CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window").distance_to(translation)
$"../b_itinero/itinero".distance_to(translation)
func set_way_point(position, dock):
......@@ -156,5 +158,5 @@ func finofara_flugo():
$"../ship".set_way_point(position,null)
$"../way_point".set_way_point(position)
#запускаем таймер
$"../ship/timer".start()
$"../timer".start()
pass
......@@ -2,6 +2,8 @@ extends Spatial
var choose = false
signal load_objektoj
func _ready():
for i in get_children():
if has_signal(i,"new_way_point"):
......@@ -16,15 +18,15 @@ func _input(event):
$main_camera.set_privot(null)
func set_way_point(position,dock):
$ship.add_itinero()
get_node("ship").add_itinero()
#останавливаем таймер
$"ship/timer".stop()
$timer.stop()
$ship.set_way_point(position,dock)
$way_point.set_way_point(position)
#передаём текущие координаты
$ship.vojkomenco()#начинаем движение
#запускаем таймер
$"ship/timer".start()
$timer.start()
func has_signal(node, sgnl):
if node == null:
......@@ -41,15 +43,6 @@ func has_signal(node, sgnl):
const QueryObject = preload("queries.gd")
func _on_space_ready():
#космос сформирован
var q = QueryObject.new()
# Делаем запрос к бэкэнду
$http_space_query.request(q.URL, Global.backend_headers, true, 2,
q.objecto_query(1, 2, 3, 2))
# записав проект в базу, получили его uuid
func _on_http_projekto_request_completed(result, response_code, headers, body):
var resp = body.get_string_from_utf8()
......@@ -106,3 +99,111 @@ func _on_http_taskoj_request_completed(result, response_code, headers, body):
$"b_itinero/itinero".itineroj[i]['uuid_tasko']=tasko['uuid']
i += 1
const ships = preload("res://blokoj/kosmo/scenoj/ships.tscn")
const space_object = preload("res://blokoj/kosmo/scenoj/space_object.tscn")
const ship_gem = preload("res://blokoj/kosmo/scenoj/ship.tscn")
func _on_space_load_objektoj():
for item in Global.objektoj:
if item['resurso']['tipo']['objId'] == 3:#объект станция, на сегодня одна только
var state = space_object.instance()
state.translation=Vector3(item['koordinatoX'],
item['koordinatoY'], item['koordinatoZ'])
add_child(state)
state.add_to_group('state')
state.add_to_group('create')
if (item['resurso']['tipo']['objId'] == 2)and(item['koordinatoX']):
#если корабль игрока
if item['posedantoId'] == Global.id:
var ship = ship_gem.instance()
ship.translation=Vector3(item['koordinatoX'],
item['koordinatoY'], item['koordinatoZ'])
ship.rotation=Vector3(item['rotaciaX'],
item['rotaciaY'], item['rotaciaZ'])
$main_camera.translation=Vector3(item['koordinatoX'],
item['koordinatoY'], item['koordinatoZ']+22)
ship.visible=true
ship.uuid=item['uuid']
add_child(ship,true)
ship.add_to_group('create')
Title.get_node("CanvasLayer/UI/Lbar/L_VBox/Objektoj/Window").distance_to(ship.translation)
# и теперь по uuid нужно найти проект и задачу
var projektoj = item['projekto']['edges']
if len(projektoj)>1:
pass #нужно обнулить все проекты!!!
if len(projektoj)>0:
if len(projektoj[0]['node']['tasko']['edges'])==0:
pass# нужно закрыть проект!!!
else:
ship.projekto_uuid=projektoj[0]['node']['uuid']
#заполняем маршрут
$"b_itinero/itinero".itineroj.clear()
for tasko in projektoj[0]['node']['tasko']['edges']:
if tasko['node']['statuso']['objId']==2:#задачу, которая "В работе" ставим первой
$"b_itinero/itinero".itineroj.append({
'uuid_tasko':tasko['node']['uuid'],
'nomo':'координаты в космосе',
'koordinatoX':tasko['node']['finKoordinatoX'],
'koordinatoY':tasko['node']['finKoordinatoY'],
'koordinatoZ':tasko['node']['finKoordinatoZ']
})
break;
for tasko in projektoj[0]['node']['tasko']['edges']:
if tasko['node']['statuso']['objId']==1:# добавляем остальные задачи
$"b_itinero/itinero".itineroj.append({
'uuid_tasko':tasko['node']['uuid'],
'nomo':'координаты в космосе',
'koordinatoX':tasko['node']['finKoordinatoX'],
'koordinatoY':tasko['node']['finKoordinatoY'],
'koordinatoZ':tasko['node']['finKoordinatoZ']
})
if len($"b_itinero/itinero".itineroj)==0:
ship.projekto_uuid='' #задач на полёт нет, проект надо бы закрыть
else:
#отправляем корабль по координатам
var position = Vector3($"b_itinero/itinero".itineroj[0]['koordinatoX'],
$"b_itinero/itinero".itineroj[0]['koordinatoY'],
$"b_itinero/itinero".itineroj[0]['koordinatoZ'])
$"b_itinero/itinero".FillItemList()
ship.set_way_point(position,null)
$"way_point".set_way_point(position)
$timer.start()
$"b_itinero/itinero/canvas/MarginContainer/VBoxContainer/HBoxContainer/kom_itinero".disabled=true
$"b_itinero/itinero/canvas/MarginContainer/VBoxContainer/HBoxContainer/itinero_next".disabled=false
$"b_itinero/itinero/canvas/MarginContainer/VBoxContainer/HBoxContainer/itinero_fin".disabled=false
$"b_itinero/itinero/canvas/MarginContainer/VBoxContainer/HBoxContainer/itinero_clear".disabled=false
else:
ship.projekto_uuid=''
else:
if (item['koordinatoX']):
var s = ships.instance()
s.translation=Vector3(item['koordinatoX'],
item['koordinatoY'], item['koordinatoZ'])
# s.rotation=Vector3(item['rotaciaX'],
# item['rotaciaY'], item['rotaciaZ'])
add_child(s)
s.add_to_group('create')
s.add_to_group('enemies')
pass # Replace with function body.
func _on_Timer_timeout():
var q = QueryObject.new()
# Делаем запрос к бэкэнду
$http_mutate.request(q.URL, Global.backend_headers, true, 2,
q.objecto_mutation($ship.uuid, $ship.translation.x,
$ship.translation.y, $ship.translation.z,
$ship.rotation.x,
$ship.rotation.y, $ship.rotation.z)
)
func _on_space_tree_exiting():
#разрушаем все созданные объекты в этом мире
for ch in get_children():
if ch.is_in_group('create'):
ch.free()
......@@ -68,7 +68,7 @@ __meta__ = {
}
[node name="Label" type="Label" parent="canvas/MarginContainer/VBoxContainer"]
margin_right = 317.0
margin_right = 316.0
margin_bottom = 21.0
custom_fonts/font = SubResource( 1 )
text = "Объекты"
......@@ -103,6 +103,7 @@ __meta__ = {
}
[node name="check" type="CheckBox" parent="canvas/MarginContainer/VBoxContainer/Label"]
visible = false
margin_right = 24.0
margin_bottom = 24.0
pressed = true
......@@ -112,15 +113,15 @@ __meta__ = {
[node name="scroll" type="ScrollContainer" parent="canvas/MarginContainer/VBoxContainer"]
margin_top = 25.0
margin_right = 317.0
margin_bottom = 214.0
margin_right = 316.0
margin_bottom = 215.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="ItemList" type="ItemList" parent="canvas/MarginContainer/VBoxContainer/scroll"]
self_modulate = Color( 1, 1, 1, 0.784314 )
margin_right = 317.0
margin_bottom = 189.0
margin_right = 316.0
margin_bottom = 190.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = SubResource( 2 )
......
......@@ -10,8 +10,9 @@ func _on_HTTPRequestFind_request_completed(result, response_code, headers, body)
$'../'.ItemListContent.clear()
$'../canvas/MarginContainer/VBoxContainer/scroll/ItemList'.clear()
# $'../MarginContainer/VBoxContainer/'.get_node("DetailLabel").set_text("")
Global.objektoj.clear()
for item in simpled_data:
Global.objektoj.append(item['node'])
var itemj ={
'nomo':item['node']['nomo']['enhavo'],
'priskribo':item['node']['priskribo']['enhavo'],
......@@ -19,10 +20,12 @@ func _on_HTTPRequestFind_request_completed(result, response_code, headers, body)
'koordinatoX':item['node']['koordinatoX'],
'koordinatoY':item['node']['koordinatoY'],
'koordinatoZ':item['node']['koordinatoZ'],
'posedantoId':item['node']['posedantoId'],
'posedantoObjekto':item['node']['posedantoObjekto'],
'inCosmo':item['node']['inCosmo'],
'distance':0,
}
$'../'.ItemListContent.append(itemj)
# print('=====',$'../'.ItemListContent)
$'../'.FillItemList()
if $"/root".get_node_or_null('space'):
$"/root".get_node('space').emit_signal("load_objektoj")
......@@ -12,21 +12,12 @@ var ItemListContent = []
# 'koordinatoY':
# 'koordinatoZ':
# distance
# posedantoId
#_to = $"../ship".translation.distance_to(Vector3(koordX,koordY,koordZ))
func _on_Close_button_pressed():
$"canvas/MarginContainer".set_visible(false)
#func _input(event):
# if Input.is_action_just_pressed("right_click"):
# if event is InputEventMouseButton and $"canvas/MarginContainer".visible:
# var x = $".".get_global_mouse_position().x
# var y = $".".get_global_mouse_position().y
# if($"canvas/MarginContainer/VBoxContainer/ItemList".margin_left<x) and (x<$"canvas/MarginContainer/VBoxContainer/ItemList".margin_right):
# $"canvas/MarginContainer/VBoxContainer/ItemList".select(1,true)
# print('margin_left=',$"canvas/MarginContainer/VBoxContainer/ItemList".margin_left,' x=',x,' margin_right=',$"canvas/MarginContainer/VBoxContainer/ItemList".margin_right)
func _resize(event: InputEvent) -> void:
......@@ -44,7 +35,9 @@ func FillItemList():
var ls = ItemListContent
ItemListContent=[]
for Item in ls:
if Item['inCosmo']:
# если в космосе и нет объекта-владельца, то добавляем в список
#если корабль игрока, то его не добавляем в список
if Item['inCosmo'] and (not Item['posedantoObjekto']) and Item['posedantoId']!=Global.id:
ItemListContent.append(Item)
PrintList()
......@@ -62,15 +55,14 @@ func distance_to(trans):
obj['koordinatoY'],obj['koordinatoZ']))
$'canvas/MarginContainer/VBoxContainer/scroll/ItemList'.clear()
PrintList()
pass
# Вызывается перед созданием окна
func _on_Objekto_draw():
var q = QueryObject.new()
# Делаем запрос к бэкэнду
$HTTPObjectoRequestFind.request(q.URL, Global.backend_headers, true, 2, q.objecto_query())
$HTTPObjectoRequestFind.request(q.URL, Global.backend_headers, true, 2, q.objecto_query( 2, 3, 2, 1))
func _on_reload_pressed():
......@@ -87,3 +79,5 @@ func _on_ItemList_item_selected(index):
func _on_check_pressed():
_on_Objekto_draw()
pass # Replace with function body.
......@@ -7,11 +7,33 @@ const URL = "https://t34.tehnokom.su/api/v1.1/"
# Запрос к API
func objecto_query(kuboId = 1):
return JSON.print({ 'query': 'query ($kuboId:Float, $realecoId:Float ) { '+
'universoObjekto (kubo_Id:$kuboId, realeco_Id:$realecoId) { edges { node { '+
' uuid nomo { enhavo } priskribo { enhavo } '+
' koordinatoX koordinatoY koordinatoZ posedantoObjekto '+
' { uuid } inCosmo } } } }',
"variables": {"kuboId":kuboId,
func objecto_query(statusoId, kategorioId, tipoId, kuboId = 1):
# return JSON.print({ 'query': 'query ($kuboId:Float, $realecoId:Float ) { '+
# 'universoObjekto (kubo_Id:$kuboId, realeco_Id:$realecoId) { edges { node { '+
# ' uuid nomo { enhavo } priskribo { enhavo } '+
# ' koordinatoX koordinatoY koordinatoZ ' +
# ' posedantoObjekto '+
# ' { uuid } '+
# ' inCosmo } } } }',
# "variables": {"kuboId":kuboId,
# "realecoId":Global.realeco} })
# func objecto_query(kuboId, statusoId, kategorioId, tipo_id):
return JSON.print({ "query": "query ($kuboId:Float, $statusoId:Float, "+
" $realecoId:Float, $kategorioId:Float, $tipoId:Float) " +
"{ universoObjekto (realeco_Id:$realecoId, kubo_Id: $kuboId, "+
" ) { edges { node { uuid posedantoId "+
" projekto (statuso_Id: $statusoId, tipo_Id: $tipoId){ "+
" edges { node { uuid "+
" tasko (kategorio_Id:$kategorioId){ edges {node { "+
" uuid finKoordinatoX finKoordinatoY finKoordinatoZ statuso {objId} } } } } } } "+
" inCosmo nomo { enhavo } priskribo { enhavo } "+
" resurso { nomo { enhavo } priskribo { enhavo } "+
" tipo { objId nomo { enhavo } } } "+
" koordinatoX koordinatoY koordinatoZ "+
' posedantoObjekto '+
' { uuid } '+
" rotaciaX rotaciaY rotaciaZ } } } }",
'variables': {"kuboId":kuboId, "statusoId":statusoId,
"kategorioId":kategorioId, "tipoId":tipoId,
"realecoId":Global.realeco} })
extends Node2D
extends Control
# Вызывается при открытии сцены
......
[gd_scene load_steps=18 format=2]
[ext_resource path="res://blokoj/rajtigo/rajtigo.gd" type="Script" id=1]
[ext_resource path="res://kerno/menuo/resursoj/fonts/Buttons_stylel.tres" type="StyleBox" id=2]
[ext_resource path="res://kerno/menuo/resursoj/fonts/new_dynamicfont.tres" type="DynamicFont" id=3]
[ext_resource path="res://kerno/menuo/resursoj/fonts/18957.otf" type="DynamicFontData" id=4]
[ext_resource path="res://blokoj/rajtigo/skriptoj/message.gd" type="Script" id=5]
[ext_resource path="res://kerno/menuo/resursoj/fonts/Buttons_hover.tres" type="StyleBox" id=6]
[ext_resource path="res://blokoj/rajtigo/skriptoj/login_button.gd" type="Script" id=7]
[ext_resource path="res://blokoj/rajtigo/skriptoj/ru.gd" type="Script" id=8]
[ext_resource path="res://blokoj/rajtigo/skriptoj/en.gd" type="Script" id=9]
[ext_resource path="res://blokoj/rajtigo/skriptoj/eo.gd" type="Script" id=10]
[ext_resource path="res://resursoj/stelamapo_8k.jpg" type="Texture" id=11]
[sub_resource type="DynamicFont" id=1]
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=2]
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=3]
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=4]
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=5]
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=6]
font_data = ExtResource( 4 )
[gd_scene load_steps=10 format=2]
[ext_resource path="res://kerno/menuo/resursoj/fonts/button_style.tres" type="StyleBox" id=3]
[ext_resource path="res://kerno/menuo/resursoj/fonts/Buttons_hover.tres" type="StyleBox" id=4]
[ext_resource path="res://blokoj/rajtigo/skriptoj/login_button.gd" type="Script" id=5]
[ext_resource path="res://resursoj/stelamapo_8k.jpg" type="Texture" id=6]
[ext_resource path="res://blokoj/rajtigo/rajtigo.gd" type="Script" id=7]
[ext_resource path="res://blokoj/rajtigo/skriptoj/message.gd" type="Script" id=9]
[ext_resource path="res://blokoj/rajtigo/skriptoj/ru.gd" type="Script" id=10]
[ext_resource path="res://blokoj/rajtigo/skriptoj/en.gd" type="Script" id=11]
[ext_resource path="res://blokoj/rajtigo/skriptoj/eo.gd" type="Script" id=12]
[node name="auth_menu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 0.773926
margin_right = 0.773926
size_flags_horizontal = 4
size_flags_vertical = 4
script = ExtResource( 7 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="auth_menu" type="Node2D"]
script = ExtResource( 1 )
[node name="Control" type="Control" parent="."]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -250.0
margin_top = -125.0
margin_right = 250.0
margin_bottom = 125.0
__meta__ = {
"_edit_group_": true
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="login" type="Label" parent="."]
margin_left = 280.0
margin_top = 230.0
margin_right = 366.0
margin_bottom = 260.0
custom_styles/normal = ExtResource( 2 )
custom_fonts/font = ExtResource( 3 )
text = "Login"
align = 1
valign = 1
[node name="LoginButton" type="Button" parent="Control"]
margin_left = 345.0
margin_top = 200.0
margin_right = 465.0
margin_bottom = 233.0
custom_styles/hover = ExtResource( 4 )
custom_styles/focus = ExtResource( 3 )
text = "LogIn"
flat = true
script = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="password" type="Label" parent="."]
margin_left = 280.0
margin_top = 274.63
margin_right = 367.0
margin_bottom = 304.63
custom_styles/normal = ExtResource( 2 )
custom_fonts/font = SubResource( 1 )
text = "Password"
[node name="message" type="Label" parent="Control"]
visible = false
margin_left = 15.0
margin_top = 25.0
margin_right = 485.0
margin_bottom = 60.0
custom_styles/normal = ExtResource( 3 )
custom_colors/font_color = Color( 0.968627, 0.0431373, 0.0431373, 1 )
align = 1
valign = 1
[node name="Control" type="Control" parent="."]
margin_right = 40.0
margin_bottom = 40.0
script = ExtResource( 9 )
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="your_login" type="LineEdit" parent="Control"]
margin_left = 380.0
margin_top = 230.0
margin_right = 630.0
margin_bottom = 260.0
margin_left = 235.0
margin_top = 80.0
margin_right = 485.0
margin_bottom = 110.0
custom_colors/font_color_selected = Color( 0, 0, 0, 1 )
max_length = 24
caret_blink = true
caret_blink_speed = 0.5
__meta__ = {
"_edit_use_anchors_": false
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="your_password" type="LineEdit" parent="Control"]
margin_left = 380.0
margin_top = 275.0
margin_right = 630.0
margin_bottom = 305.0
margin_left = 235.0
margin_top = 140.0
margin_right = 485.0
margin_bottom = 170.0
max_length = 24
secret = true
caret_blink = true
caret_blink_speed = 0.5
__meta__ = {
"_edit_use_anchors_": false
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="message" type="Label" parent="."]
margin_left = 385.0
margin_top = 185.0
margin_right = 625.0
margin_bottom = 218.0
custom_styles/normal = ExtResource( 2 )
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.968627, 0.0431373, 0.0431373, 1 )
[node name="login" type="Label" parent="Control"]
margin_left = 15.0
margin_top = 82.0
margin_right = 235.0
margin_bottom = 108.0
custom_styles/normal = ExtResource( 3 )
text = "LogIn"
align = 1
valign = 1
script = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="LoginButton" type="Button" parent="."]
margin_left = 450.0
margin_top = 330.0
margin_right = 570.0
margin_bottom = 363.0
custom_styles/hover = ExtResource( 6 )
custom_styles/focus = ExtResource( 2 )
custom_fonts/font = SubResource( 3 )
text = "LogIn"
flat = true
script = ExtResource( 7 )
[node name="password" type="Label" parent="Control"]
margin_left = 15.0
margin_top = 142.0
margin_right = 235.0
margin_bottom = 168.0
custom_styles/normal = ExtResource( 3 )
text = "Password"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="ru" type="Button" parent="."]
margin_left = 950.0
margin_top = 3.0
margin_right = 985.0
margin_bottom = 26.0
custom_styles/hover = ExtResource( 6 )
custom_styles/focus = ExtResource( 2 )
custom_fonts/font = SubResource( 4 )
anchor_left = 0.971
anchor_right = 1.0
anchor_bottom = 0.023
margin_left = -44.3201
margin_top = 25.0
margin_right = -55.9998
margin_bottom = 24.16
custom_styles/hover = ExtResource( 4 )
custom_styles/focus = ExtResource( 3 )
text = "ru"
flat = true
script = ExtResource( 8 )
script = ExtResource( 10 )
__meta__ = {
"_edit_use_anchors_": false
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="en" type="Button" parent="."]
margin_left = 850.0
margin_top = 3.0
margin_right = 885.0
margin_bottom = 26.0
custom_styles/hover = ExtResource( 6 )
custom_styles/focus = ExtResource( 2 )
custom_fonts/font = SubResource( 5 )
text = "en"
flat = true
script = ExtResource( 9 )
[node name="eo" type="Button" parent="."]
margin_left = 900.0
margin_top = 3.0
margin_right = 935.0
margin_bottom = 26.0
custom_styles/hover = ExtResource( 6 )
custom_styles/focus = ExtResource( 2 )
custom_fonts/font = SubResource( 6 )
anchor_left = 0.971
anchor_right = 1.0
anchor_bottom = 0.023
margin_left = -94.3201
margin_top = 25.0
margin_right = -106.0
margin_bottom = 24.16
custom_styles/hover = ExtResource( 4 )
custom_styles/focus = ExtResource( 3 )
text = "eo"
flat = true
script = ExtResource( 10 )
script = ExtResource( 12 )
__meta__ = {
"_edit_use_anchors_": false
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="en" type="Button" parent="."]
anchor_left = 0.971
anchor_right = 1.0
anchor_bottom = 0.023
margin_left = -144.32
margin_top = 25.0
margin_right = -156.0
margin_bottom = 24.16
custom_styles/hover = ExtResource( 4 )
custom_styles/focus = ExtResource( 3 )
text = "en"
flat = true
script = ExtResource( 11 )
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": true
}
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
......@@ -162,8 +184,12 @@ __meta__ = {
[node name="TextureRect" type="TextureRect" parent="ParallaxBackground/ParallaxBackground"]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 11 )
margin_top = -100.0
margin_right = 0.00012207
margin_bottom = 120.0
texture = ExtResource( 6 )
expand = true
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
}
......@@ -24,7 +24,8 @@ func login_request_complete(result, response_code, headers, body):
# Если не авторизован, выводим сообщение, которое вернул бэкэнд
if !Global.status:
message = tr("Wrong login or password")
$'../message'.set_mytext(message)
$"/root/auth_menu/Control/message".set_visible(true)
$"/root/auth_menu/Control/message".set_mytext(message)
# Если авторизован
else:
# Сюда сложим куки, которые прислал сервер в заголовках ответа
......@@ -95,8 +96,8 @@ func get_nickname_request_complete(result, response_code, headers, body):
# Вызывается при нажатии кнопки login
func _pressed():
var password = $'../Control/your_password'.text
var login = $'../Control/your_login'.text
var password = $"/root/auth_menu/Control/your_password".text
var login = $"/root/auth_menu/Control/your_login".text
# Создаём объект HTTP запроса
request = HTTPRequest.new()
......
......@@ -44,6 +44,8 @@ func _on_cap_pressed():
# при переключении миров закрываем окна ресурсов, объектов, т.к. они расчитаны на конкретный мир
CloseWindow()
get_tree().change_scene('res://blokoj/kosmo/scenoj/space.tscn')
# for sc in $"/root".get_children():
# print(' - scena = = ',sc.name)
if reload:
reloadWindow()
# get_tree().change_scene('res://blokoj/kosmostacio/CapKosmostacio.tscn')
......@@ -74,6 +76,4 @@ func _on_real_pressed():
reloadWindow()
func _on_Objecto_pressed():
# $CanvasLayer/UI/Lbar/L_VBox/itinero/itinero/canvas/MarginContainer.set_visible(true)
pass
[gd_resource type="StyleBoxFlat" format=2]
[resource]
bg_color = Color( 1, 1, 1, 1 )
draw_center = false
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color( 0.972549, 0.0235294, 0.027451, 1 )
border_blend = true
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
shadow_size = 5
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://kerno/menuo/resursoj/fonts/18957.otf" type="DynamicFontData" id=1]
[gd_resource type="DynamicFont" load_steps=3 format=2]
[ext_resource path="res://kerno/menuo/resursoj/fonts/mob200.otf" type="DynamicFontData" id=1]
[ext_resource path="res://kerno/menuo/resursoj/fonts/tenotune.ttf" type="DynamicFontData" id=2]
[resource]
font_data = ExtResource( 1 )
size = 14
use_filter = true
extra_spacing_char = 2
font_data = ExtResource( 2 )
fallback/0 = ExtResource( 1 )
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать