Открыть боковую панель
Левадный Владимир Юрьевич
universo-godot
Коммиты
acd601b6
Коммит
acd601b6
создал
Янв 21, 2020
по автору
dron5
Просмотр файлов
Добавление магазина
владелец
f57ee2b5
Изменения
10
Скрыть пробелы
Построчно
Рядом
blokoj/rajtigo/Button.gd
Просмотр файла @
acd601b6
...
...
@@ -3,7 +3,7 @@ extends Button
func
_pressed
():
var
URL
=
"https://tehnokom.su/api/v1.1/registrado/"
#var URL = "https://t34.tehnokom.su/api/v1.1/registrado/"
var
headers
=
[
"Content-Type: application/json"
]
var
password
=
$
'
../your_password'
.
text
...
...
blokoj/rajtigo/HTTPRequest.gd
Просмотр файла @
acd601b6
...
...
@@ -3,11 +3,7 @@ extends HTTPRequest
func
_on_HTTPRequest_request_completed
(
result
,
response_code
,
headers
,
body
):
var
resp
=
body
.
get_string_from_utf8
()
var
parsed_resp
=
parse_json
(
resp
)
#Обращаться к глоб.переменным
#напрямую или создать методы для доступа к ним?
#Global.set_token(parsed_resp['data']['ensaluti']['token'])
#Global.set_csrftoken(parsed_resp['data']['ensaluti']['csrfToken'])
#Global.set_status(parsed_resp['data']['ensaluti']['status'])
Global
.
token
=
parsed_resp
[
'
data'
][
'
ensaluti'
][
'
token'
]
Global
.
csrfToken
=
parsed_resp
[
'
data'
][
'
ensaluti'
][
'
csrfToken'
]
Global
.
status
=
parsed_resp
[
'
data'
][
'
ensaluti'
][
'
status'
]
...
...
blokoj/rajtigo/HTTPRequestFind.gd
0 → 100644
Просмотр файла @
acd601b6
extends
HTTPRequest
func
_on_HTTPRequestFind_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'
][
'
resursoj'
][
'
edges'
]
$
"../../WindowDialog"
.
ItemListContent
.
clear
()
$
"../../WindowDialog"
.
get_node
(
"ItemList"
)
.
clear
()
$
"../../WindowDialog"
.
get_node
(
"Label-output"
)
.
set_text
(
""
)
for
item
in
simpled_data
:
$
"../../WindowDialog"
.
ItemListContent
.
append
(
item
[
'
node'
][
'
nomo'
][
'
enhavo'
])
$
"../../WindowDialog"
.
FillItemList
()
\ Нет новой строки в конце файла
blokoj/rajtigo/ItemList.gd
0 → 100644
Просмотр файла @
acd601b6
extends
ItemList
func
_ready
():
pass
func
_on_ItemList_item_selected
(
index
):
# Обработка клика мыши на элемент списка
# Назначаем текст виджету Label-output
var
SelectedText
=
$
"../../WindowDialog"
.
ItemListContent
[
index
]
$
"../../WindowDialog"
.
get_node
(
"Label-output"
)
.
set_text
(
SelectedText
)
blokoj/rajtigo/auth_menu.tscn
Просмотр файла @
acd601b6
...
...
@@ -33,7 +33,6 @@ margin_right = 302.0
margin_bottom = 258.0
theme = ExtResource( 1 )
text = "login"
align = 1
valign = 1
[node name="password" type="Label" parent="."]
...
...
@@ -43,7 +42,6 @@ margin_right = 337.0
margin_bottom = 304.63
theme = ExtResource( 1 )
text = "password"
align = 1
valign = 1
[node name="your_login" type="LineEdit" parent="."]
...
...
@@ -64,6 +62,7 @@ margin_top = 185.0
margin_right = 625.0
margin_bottom = 218.0
theme = ExtResource( 1 )
custom_colors/font_color = Color( 0.968627, 0.0431373, 0.0431373, 1 )
align = 1
valign = 1
script = ExtResource( 2 )
...
...
blokoj/rajtigo/locale/en_US.po
Просмотр файла @
acd601b6
...
...
@@ -19,7 +19,9 @@ msgstr "Login"
msgid "password"
msgstr "Password"
msgid "
w
rong login or password"
msgstr "
w
rong login or password"
msgid "
W
rong login or password"
msgstr "
W
rong login or password"
msgid "store"
msgstr "Store"
blokoj/rajtigo/locale/eo_XX.po
Просмотр файла @
acd601b6
...
...
@@ -19,5 +19,9 @@ msgstr "Login-eo"
msgid "password"
msgstr "Password-eo"
msgid "wrong login or password"
msgstr "wrong logino or passwordo)"
msgid "Wrong login or password"
msgstr "Wrong logino or passwordo)"
msgid "store"
msgstr "Store"
blokoj/rajtigo/locale/ru_RU.po
Просмотр файла @
acd601b6
...
...
@@ -21,4 +21,10 @@ msgid "password"
msgstr "Пароль"
msgid "wrong login or password"
msgstr "неверный логин или пароль"
msgstr "Неверный логин или пароль"
msgid "Stuff"
msgstr "Товары"
msgid "store"
msgstr "Магазин"
blokoj/rajtigo/project.godot
Просмотр файла @
acd601b6
...
...
@@ -23,6 +23,14 @@ config/icon="res://icon.png"
Global="*res://global.gd"
[input]
ui_mouse_right={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":2,"pressed":false,"doubleclick":false,"script":null)
]
}
[locale]
translations=PoolStringArray( "res://locale/ru_RU.po", "res://locale/eo_XX.po", "res://locale/en_US.po" )
...
...
blokoj/rajtigo/root.tscn
Просмотр файла @
acd601b6
[gd_scene load_steps=
4
format=2]
[gd_scene load_steps=
8
format=2]
[ext_resource path="res://Spatial.gd" type="Script" id=1]
[ext_resource path="res://HTTPRequestFind.gd" type="Script" id=2]
[ext_resource path="res://cyrTheme.tres" type="Theme" id=3]
[ext_resource path="res://ItemList.gd" type="Script" id=4]
[sub_resource type="SpatialMaterial" id=1]
albedo_color = Color( 0.12549, 0.443137, 0.00784314, 1 )
[sub_resource type="PlaneMesh" id=2]
[sub_resource type="GDScript" id=3]
script/source = "extends WindowDialog
func _on_ToolButton_pressed():
var URL = \"https://t34.tehnokom.su/api/v1.1/\"
var headers = [\"Content-Type: application/json\"]
var json_query = {\"query\":\"{resursoj { edges { node { uuid nomo { enhavo }}}}}\"}
var post_request = JSON.print(json_query)
$HTTPRequestFind.request(URL, headers, false, 2, post_request)
popup_centered()
var ItemListContent = []
func _ready():
#get_node(\"ItemList\").select(0,true) # Не понятно, надо или нет, работает без этой строки
# нужна, что бы убрать ошибки при не выделеной строке, при нажатии Show_detail_btn
pass
func FillItemList():
# # Заполняет список найдеными продуктами
if ItemListContent.size() > 0:
for ItemID in range(ItemListContent.size()):
get_node(\"ItemList\").add_item(ItemListContent[ItemID],null,true)
"
[node name="Node" type="Node"]
[node name="Spatial" type="Spatial" parent="."]
...
...
@@ -20,3 +52,44 @@ material/0 = null
[node name="Camera" type="Camera" parent="Spatial"]
transform = Transform( 1, 0, 0, 0, 0.980939, 0.194315, 0, -0.194315, 0.980939, 0, 1.07392, 8.01514 )
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="WindowDialog" type="WindowDialog" parent="CanvasLayer"]
visible = true
margin_left = 138.0
margin_top = 98.0
margin_right = 944.0
margin_bottom = 462.0
window_title = "Stuff"
script = SubResource( 3 )
[node name="HTTPRequestFind" type="HTTPRequest" parent="CanvasLayer/WindowDialog"]
script = ExtResource( 2 )
[node name="ItemList" type="ItemList" parent="CanvasLayer/WindowDialog"]
margin_left = 12.0
margin_top = 12.0
margin_right = 394.0
margin_bottom = 352.0
theme = ExtResource( 3 )
script = ExtResource( 4 )
[node name="Label-output" type="Label" parent="CanvasLayer/WindowDialog"]
margin_left = 406.0
margin_top = 63.0
margin_right = 797.0
margin_bottom = 87.0
theme = ExtResource( 3 )
[node name="ToolButton" type="ToolButton" parent="CanvasLayer"]
margin_right = 12.0
margin_bottom = 22.0
theme = ExtResource( 3 )
custom_colors/font_color = Color( 0.0156863, 0.0235294, 0.647059, 1 )
custom_colors/font_color_hover = Color( 0.94902, 0.913725, 0.0156863, 1 )
custom_colors/font_color_pressed = Color( 0.0196078, 0, 0, 1 )
text = "store"
[connection signal="request_completed" from="CanvasLayer/WindowDialog/HTTPRequestFind" to="CanvasLayer/WindowDialog/HTTPRequestFind" method="_on_HTTPRequestFind_request_completed"]
[connection signal="item_selected" from="CanvasLayer/WindowDialog/ItemList" to="CanvasLayer/WindowDialog/ItemList" method="_on_ItemList_item_selected"]
[connection signal="pressed" from="CanvasLayer/ToolButton" to="CanvasLayer/WindowDialog" method="_on_ToolButton_pressed"]
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать