Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SSBookMinigames
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
SSBookMinigames
Commits
7e7f8246
Commit
7e7f8246
authored
Apr 12, 2026
by
Mahmoud Aglan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update : Fixed If there is no questions Play buttons are disabled
parent
5f4e8e15
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
HomeController.cs
My project/Assets/App/UI/HomeController.cs
+45
-0
No files found.
My project/Assets/App/UI/HomeController.cs
View file @
7e7f8246
using
System.Linq
;
using
com.al_arcade.shared
;
using
Cysharp.Threading.Tasks
;
using
DG.Tweening
;
using
UnityEngine
;
...
...
@@ -8,6 +9,7 @@ public class HomeController : MonoBehaviour
{
[
SerializeField
]
private
UIDocument
mainMenuDocument
;
[
SerializeField
]
private
GameObject
challengePrefab
;
[
SerializeField
]
private
int
minQuestionsPerType
=
5
;
private
Label
username
;
private
Label
xp
;
...
...
@@ -16,6 +18,7 @@ public class HomeController : MonoBehaviour
private
CustomProgressBar
nextRankProgressBar
;
private
Button
challengeButton
;
private
Button
practiceButton
;
private
Label
nameMenuPanel
;
private
Label
xpMenuPanel
;
...
...
@@ -43,6 +46,9 @@ public class HomeController : MonoBehaviour
challengeButton
=
root
.
Q
<
Button
>(
"Challenge"
);
challengeButton
.
clicked
+=
OnChallengeButtonClicked
;
practiceButton
=
root
.
Q
<
Button
>(
"OpenPracticeButton"
);
SetPlayButtonsEnabled
(
false
);
OnUserChange
(
UserService
.
Instance
.
CurrentUser
);
}
...
...
@@ -58,6 +64,45 @@ public class HomeController : MonoBehaviour
nextRankProgressBar
.
Value
=
Rank
.
FromXP
(
user
.
Points
).
Progress
(
user
.
Points
);
nextRankProgressBar
.
LeftText
=
Rank
.
FromXP
(
user
.
Points
).
StartXP
.
ToString
()
+
" "
+
Rank
.
FromXP
(
user
.
Points
).
ArabicName
;
nextRankProgressBar
.
RightText
=
Rank
.
FromXP
(
user
.
Points
).
Next
?.
StartXP
.
ToString
()
+
" "
+
Rank
.
FromXP
(
user
.
Points
).
Next
?.
ArabicName
;
CheckQuestionAvailability
(
user
);
}
private
void
CheckQuestionAvailability
(
User
user
)
{
StartCoroutine
(
SSApiManager
.
EnsureInstance
().
GetChapters
(
chapters
=>
{
int
mcq
=
0
,
tf
=
0
,
cs
=
0
;
foreach
(
var
ch
in
chapters
)
{
mcq
+=
ch
.
mcq_count
;
tf
+=
ch
.
tf_count
;
cs
+=
ch
.
cs_count
;
}
bool
enough
=
mcq
>=
minQuestionsPerType
&&
tf
>=
minQuestionsPerType
&&
cs
>=
minQuestionsPerType
;
SetPlayButtonsEnabled
(
enough
);
},
_
=>
SetPlayButtonsEnabled
(
false
),
gradeId
:
user
.
Grade
,
termId
:
user
.
Term
));
}
private
void
SetPlayButtonsEnabled
(
bool
enabled
)
{
if
(
challengeButton
!=
null
)
{
challengeButton
.
SetEnabled
(
enabled
);
challengeButton
.
style
.
opacity
=
enabled
?
1f
:
0.35f
;
}
if
(
practiceButton
!=
null
)
{
practiceButton
.
SetEnabled
(
enabled
);
practiceButton
.
style
.
opacity
=
enabled
?
1f
:
0.35f
;
}
}
// private void OnNewActivityReceived(Activity activity)
...
...
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