Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
igem-quantifly
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
igem-quantifly
Commits
e18da80d
Unverified
Commit
e18da80d
authored
Oct 28, 2016
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Back button: Implement reactions on Scenes
parent
929d90b5
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
1 deletion
+45
-1
GameOver.cs
Assets/Scripts/GameOver.cs
+2
-0
HighScores.cs
Assets/Scripts/HighScores.cs
+2
-0
Menu.cs
Assets/Scripts/Menu.cs
+2
-1
UIController.cs
Assets/Scripts/UIController.cs
+2
-0
BackButtonHelper.cs
Assets/Scripts/Utils/BackButtonHelper.cs
+25
-0
BackButtonHelper.cs.meta
Assets/Scripts/Utils/BackButtonHelper.cs.meta
+12
-0
No files found.
Assets/Scripts/GameOver.cs
View file @
e18da80d
...
...
@@ -4,6 +4,7 @@ using System.Collections;
using
UnityEngine.SceneManagement
;
using
Assets.Scripts
;
using
Assets.Scripts.API
;
using
Assets.Scripts.Utils
;
public
class
GameOver
:
MonoBehaviour
{
...
...
@@ -28,6 +29,7 @@ public class GameOver : MonoBehaviour
// SceneManager.LoadScene("Menu");
score
=
PlayerPrefs
.
GetInt
(
"lastscore"
);
Score
.
text
=
"You scored "
+
score
;
BackButtonHelper
.
playOnBack
();
}
public
void
OnButtonPlayClicked
()
...
...
Assets/Scripts/HighScores.cs
View file @
e18da80d
using
Assets.Scripts.API
;
using
Assets.Scripts.Utils
;
using
UnityEngine
;
using
UnityEngine.SceneManagement
;
using
UnityEngine.UI
;
...
...
@@ -21,6 +22,7 @@ public class HighScores : MonoBehaviour {
// Update is called once per frame
void
Update
()
{
BackButtonHelper
.
playOnBack
();
if
(!
updatedScores
)
{
if
(
Server
.
Scores
.
status
.
Equals
(
"ok"
))
{
Score
[]
highScores
=
Server
.
Scores
.
scores
;
...
...
Assets/Scripts/Menu.cs
View file @
e18da80d
using
UnityEngine
;
using
System.Collections
;
using
UnityEngine.SceneManagement
;
using
Assets.Scripts.Utils
;
public
class
Menu
:
MonoBehaviour
{
...
...
@@ -11,7 +12,7 @@ public class Menu : MonoBehaviour {
// Update is called once per frame
void
Update
()
{
BackButtonHelper
.
quitOnBack
();
}
public
void
OnButtonPlayClicked
()
...
...
Assets/Scripts/UIController.cs
View file @
e18da80d
...
...
@@ -3,6 +3,7 @@ using UnityEngine;
using
System.Collections
;
using
System.Collections.Generic
;
using
Assets.Scripts
;
using
Assets.Scripts.Utils
;
using
UnityEngine.UI
;
public
class
UIController
:
MonoBehaviour
...
...
@@ -37,6 +38,7 @@ public class UIController : MonoBehaviour
DisplayBattery
();
HandlePowerUps
();
HandleScore
();
BackButtonHelper
.
menuOnBack
();
}
private
void
HandleScore
()
...
...
Assets/Scripts/Utils/BackButtonHelper.cs
0 → 100644
View file @
e18da80d
using
System
;
using
UnityEngine
;
using
UnityEngine.SceneManagement
;
namespace
Assets.Scripts.Utils
{
public
static
class
BackButtonHelper
{
public
static
void
quitOnBack
()
{
if
(
Input
.
GetKeyDown
(
KeyCode
.
Escape
))
Application
.
Quit
();
}
public
static
void
menuOnBack
()
{
if
(
Input
.
GetKeyDown
(
KeyCode
.
Escape
))
SceneManager
.
LoadScene
(
"Menu"
);
}
public
static
void
playOnBack
()
{
if
(
Input
.
GetKeyDown
(
KeyCode
.
Escape
))
SceneManager
.
LoadScene
(
"Main"
);
}
}
}
Assets/Scripts/Utils/BackButtonHelper.cs.meta
0 → 100644
View file @
e18da80d
fileFormatVersion: 2
guid: 3be153ffde4554d9cbb676f03dc3005d
timeCreated: 1477660884
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
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