Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
ingame
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
ingame
Commits
e9d90e00
Commit
e9d90e00
authored
Jun 25, 2024
by
Georgiy Yankovskiy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ILAct1mel-main'
parents
6fa45932
0f6e8282
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
11 deletions
+38
-11
App.py
ingame/models/App.py
+16
-4
GameAgent.py
ingame/models/GameAgent.py
+13
-5
qml.qml
qml/qml.qml
+4
-0
GameInfoScene.qml
qml/scenes/GameInfoScene.qml
+5
-2
No files found.
ingame/models/App.py
View file @
e9d90e00
...
@@ -27,6 +27,8 @@ class App(QtCore.QObject):
...
@@ -27,6 +27,8 @@ class App(QtCore.QObject):
game_started
=
Signal
(
bool
,
name
=
"gameStarted"
)
game_started
=
Signal
(
bool
,
name
=
"gameStarted"
)
game_ended
=
Signal
(
bool
,
name
=
"gameEnded"
)
game_ended
=
Signal
(
bool
,
name
=
"gameEnded"
)
data_found
=
Signal
(
dict
,
name
=
"gotGameData"
)
gamepad_clicked_LB
=
Signal
(
bool
,
name
=
"gamepadClickedLB"
)
gamepad_clicked_LB
=
Signal
(
bool
,
name
=
"gamepadClickedLB"
)
gamepad_clicked_RB
=
Signal
(
bool
,
name
=
"gamepadClickedRB"
)
gamepad_clicked_RB
=
Signal
(
bool
,
name
=
"gamepadClickedRB"
)
gamepad_clicked_apply
=
Signal
(
bool
,
name
=
"gamepadClickedApply"
)
gamepad_clicked_apply
=
Signal
(
bool
,
name
=
"gamepadClickedApply"
)
...
@@ -121,10 +123,20 @@ class App(QtCore.QObject):
...
@@ -121,10 +123,20 @@ class App(QtCore.QObject):
@Slot
(
str
,
result
=
dict
)
@Slot
(
str
,
result
=
dict
)
def
get_game_data
(
self
,
game_name
):
def
get_game_data
(
self
,
game_name
):
print
(
game_name
)
# self.agent.search_game("Risk of rain 2") # оригинальной osu в стиме нет =) Плейсхолдер
#print(game_name)
return
self
.
agent
.
search_game
(
game_name
)
def
search_thread
(
t
,
name
):
# self.agent.search_game("asdjfiawefhawijefh")
search_result
=
t
.
agent
.
search_game
(
name
)
t
.
data_found
.
emit
(
search_result
)
return
thread
=
threading
.
Thread
(
target
=
search_thread
,
args
=
(
self
,
game_name
))
thread
.
start
()
pass
@Slot
(
str
)
@Slot
(
str
)
def
start_game
(
self
,
exec
):
def
start_game
(
self
,
exec
):
...
...
ingame/models/GameAgent.py
View file @
e9d90e00
...
@@ -2,12 +2,11 @@ import os
...
@@ -2,12 +2,11 @@ import os
import
pickle
import
pickle
from
steam_web_api
import
Steam
from
steam_web_api
import
Steam
# TODO:
# TODO:
#
-
Определиться, используется ли Lutris. Если да, вместо этого будет обращение к нему. Если нет,
#
[?]
Определиться, используется ли Lutris. Если да, вместо этого будет обращение к нему. Если нет,
# продумать "рыбу" более логично.
# продумать "рыбу" более логично.
#
-
Починить отображение системных требований (точнее, разобраться, что именно возвращает API.
#
[?]
Починить отображение системных требований (точнее, разобраться, что именно возвращает API.
#
-
Додумать форматированные данные, что именно мы видим на странице игры?
#
[done 1/2]
Додумать форматированные данные, что именно мы видим на странице игры?
class
GameAgent
:
class
GameAgent
:
...
@@ -22,6 +21,8 @@ class GameAgent:
...
@@ -22,6 +21,8 @@ class GameAgent:
self
.
steam_process
=
Steam
(
agent_key
)
self
.
steam_process
=
Steam
(
agent_key
)
self
.
get_all_data
()
self
.
get_all_data
()
def
add_game_info
(
self
,
data
,
name
):
def
add_game_info
(
self
,
data
,
name
):
if
not
data
[
'apps'
]:
if
not
data
[
'apps'
]:
self
.
all_data
[
name
]
=
0
self
.
all_data
[
name
]
=
0
...
@@ -34,7 +35,9 @@ class GameAgent:
...
@@ -34,7 +35,9 @@ class GameAgent:
self
.
get_all_data
()
self
.
get_all_data
()
def
search_game
(
self
,
game_name
):
def
search_game
(
self
,
game_name
):
self
.
get_all_data
()
self
.
get_all_data
()
if
game_name
in
self
.
all_data
:
if
game_name
in
self
.
all_data
:
print
(
"ITS HERE!"
)
print
(
"ITS HERE!"
)
else
:
else
:
...
@@ -59,8 +62,13 @@ class GameAgent:
...
@@ -59,8 +62,13 @@ class GameAgent:
# for key, value in formatted_data.items():
# for key, value in formatted_data.items():
# print("{0}: {1}".format(key, value))
# print("{0}: {1}".format(key, value))
else
:
else
:
print
(
"Игра не распознана!"
)
#TODO исправить это недоразумение, временная затычка
formatted_data
[
'title'
]
=
"Информация не найдена!"
formatted_data
[
'desc'
]
=
"Информация не найдена!"
formatted_data
[
'languages'
]
=
"Информация не найдена!"
formatted_data
[
'reqs'
]
=
"Информация не найдена!"
# print(formatted_data)
return
formatted_data
return
formatted_data
def
clean_data
(
self
):
def
clean_data
(
self
):
...
...
qml/qml.qml
View file @
e9d90e00
...
@@ -28,6 +28,10 @@ Window {
...
@@ -28,6 +28,10 @@ Window {
// console.log("core_app: gameEnded");
// console.log("core_app: gameEnded");
window
.
scene
=
SceneConstants
.
gameInfoScene
;
window
.
scene
=
SceneConstants
.
gameInfoScene
;
}
}
function
onGotGameData
(
result
)
{
// console.log(JSON.stringify(result))
gameInfoScene
.
setGameData
(
result
)
}
function
onGamepadClickedLB
(
done
){
function
onGamepadClickedLB
(
done
){
window
.
_trigger
(
"onGamepadClickedLB"
,
done
);
window
.
_trigger
(
"onGamepadClickedLB"
,
done
);
}
}
...
...
qml/scenes/GameInfoScene.qml
View file @
e9d90e00
...
@@ -40,8 +40,8 @@ Rectangle {
...
@@ -40,8 +40,8 @@ Rectangle {
let
_l
=
v
[
'languages'
];
let
_l
=
v
[
'languages'
];
let
_r
=
v
[
'reqs'
];
let
_r
=
v
[
'reqs'
];
// console.log(_t, _d, _l, _r);
// console.log(_t, _d, _l, _r);
let
pretty_title
=
((
_t
===
undefined
)
?
"
Нет информации об игре
"
:
_t
);
let
pretty_title
=
((
_t
===
undefined
)
?
"
Поиск информации...
"
:
_t
);
let
pretty_description
=
((
_d
===
undefined
)
?
"
Нет информации об игре
"
:
_d
);
let
pretty_description
=
((
_d
===
undefined
)
?
"
Поиск информации...
"
:
_d
);
description
.
text
=
"Наименование игры:
\
n"
+
pretty_title
+
"
\
n
\
nОписание игры:
\
n"
+
pretty_description
;
description
.
text
=
"Наименование игры:
\
n"
+
pretty_title
+
"
\
n
\
nОписание игры:
\
n"
+
pretty_description
;
}
}
...
@@ -386,6 +386,9 @@ Rectangle {
...
@@ -386,6 +386,9 @@ Rectangle {
c
[
i
].
forceActiveFocus
();
c
[
i
].
forceActiveFocus
();
}
}
function
setGameData
(
result
){
description
.
text
=
"Наименование игры:
\
n"
+
result
[
'title'
]
+
"
\
n
\
nОписание игры:
\
n"
+
result
[
'desc'
]
}
function
onGamepadAxisLeft
(
done
){
function
onGamepadAxisLeft
(
done
){
if
(
window
.
scene
!==
S
.
gameInfoScene
)
return
;
if
(
window
.
scene
!==
S
.
gameInfoScene
)
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment