Merge pull request #7 from shadow8t4/alex
Final update to Master for submission
This commit is contained in:
commit
c183473d99
86 changed files with 2483 additions and 479 deletions
Binary file not shown.
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 2ff4eb0700f8b12488930f0e38c76712
|
|
||||||
timeCreated: 1523557265
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: e51ca5c9f429b994b809de4f27b07ef8
|
|
||||||
timeCreated: 1523381771
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 5e931df1f395ce34593d0c8d743fb7bc
|
|
||||||
timeCreated: 1523381756
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: b43a02c13753e5d4085147253e07502c
|
|
||||||
timeCreated: 1523382230
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: fbf6aa2e9f888374b950a720d0d4a1c7
|
|
||||||
timeCreated: 1523381760
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 37f0b1e2cab100b45b13105c713988a1
|
|
||||||
timeCreated: 1523381758
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 6f1ad5af631524940bf3e10e7792b9b8
|
|
||||||
timeCreated: 1524663319
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7d0f216d6d3858a479598e82060a4c1e
|
|
||||||
timeCreated: 1523557265
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: f4270938654392741b69c20500b1c26a
|
|
||||||
timeCreated: 1523381771
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: a9f18dad3047a8143a388663f4df1d7d
|
|
||||||
timeCreated: 1523381756
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: d89e27eba9f3ae145819263a78f1432d
|
|
||||||
timeCreated: 1523382230
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 441f50f7e865a4e9c937038cedf667ee
|
|
||||||
timeCreated: 1524703581
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
BIN
MoCha/Assets/Prefabs/Progress Bars & Text.prefab
Normal file
BIN
MoCha/Assets/Prefabs/Progress Bars & Text.prefab
Normal file
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 47cdeeb9927ccbc428e5e853529cabdd
|
guid: 5b086532012024c1d89b53fd7a7a004c
|
||||||
timeCreated: 1524162403
|
timeCreated: 1525034977
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
NativeFormatImporter:
|
NativeFormatImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7961087b887dd2c4b94eedd27077ebec
|
|
||||||
timeCreated: 1523381760
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
|
@ -1,10 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: ec93336fd97bdc84c8786bb7af6bff7a
|
|
||||||
timeCreated: 1523381758
|
|
||||||
licenseType: Free
|
|
||||||
NativeFormatImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
mainObjectFileID: 100100000
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Binary file not shown.
Binary file not shown.
BIN
MoCha/Assets/Scenes/FitbitLogin.unity
Normal file
BIN
MoCha/Assets/Scenes/FitbitLogin.unity
Normal file
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8d5718db90a3f2f46ab023b0588466b5
|
guid: e4e05e44213ffe141906009c29238b2e
|
||||||
timeCreated: 1523381729
|
timeCreated: 1525379963
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,15 +1,8 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: e5fcab55ab6a24d8eb5dd6198b597019
|
guid: e5fcab55ab6a24d8eb5dd6198b597019
|
||||||
<<<<<<< HEAD
|
|
||||||
timeCreated: 1497532216
|
timeCreated: 1497532216
|
||||||
licenseType: Pro
|
licenseType: Pro
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
=======
|
|
||||||
timeCreated: 1523382829
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
>>>>>>> alex
|
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
||||||
assetBundleVariant:
|
assetBundleVariant:
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
<<<<<<< Updated upstream
|
|
||||||
guid: 80685d60eb42cd340a5c76d410187801
|
guid: 80685d60eb42cd340a5c76d410187801
|
||||||
timeCreated: 1524716619
|
timeCreated: 1524716619
|
||||||
=======
|
|
||||||
guid: 1d9a971c325c98e4a81ea4ec2e52aed6
|
|
||||||
timeCreated: 1524756178
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|
|
@ -11,14 +11,14 @@ using UnityEngine;
|
||||||
|
|
||||||
namespace Assets.Scripts.Fitbit
|
namespace Assets.Scripts.Fitbit
|
||||||
{
|
{
|
||||||
|
|
||||||
public class FitBitAPI : MonoBehaviour
|
public class FitBitAPI : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
private const string _consumerSecret = "69307b9f332caf9946ef4e23cabde2e4";
|
private const string _consumerSecret = "69307b9f332caf9946ef4e23cabde2e4";
|
||||||
private const string _clientId = "22CX4L";
|
private const string _clientId = "22CX4L";
|
||||||
private const string _callbackURL = "http://localhost/callback";
|
private const string _callbackURL = "http://localhost/callback";
|
||||||
private const string CustomAndroidScheme = "mocha://";
|
private const string CustomAndroidScheme = "http://localhost/callback";
|
||||||
|
|
||||||
private const string _tokenUrl = "https://api.fitbit.com/oauth2/token";
|
private const string _tokenUrl = "https://api.fitbit.com/oauth2/token";
|
||||||
private const string _baseGetUrl = "https://api.fitbit.com/1/user/-/";
|
private const string _baseGetUrl = "https://api.fitbit.com/1/user/-/";
|
||||||
|
@ -42,7 +42,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
|
|
||||||
private OAuth2AccessToken _oAuth2 = new OAuth2AccessToken();
|
private OAuth2AccessToken _oAuth2 = new OAuth2AccessToken();
|
||||||
public FitbitData _fitbitData = new FitbitData();
|
public FitbitData _fitbitData = new FitbitData();
|
||||||
|
|
||||||
private string _statusMessage;
|
private string _statusMessage;
|
||||||
|
|
||||||
private string CallBackUrl
|
private string CallBackUrl
|
||||||
|
@ -73,6 +73,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
{
|
{
|
||||||
_bFirstFire = false;
|
_bFirstFire = false;
|
||||||
}
|
}
|
||||||
|
//GUI.Label(new Rect(10, 10, 100, 20), "Calories: " + _fitbitData.CurrentCalories);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoginToFitbit()
|
public void LoginToFitbit()
|
||||||
|
@ -123,7 +124,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
|
|
||||||
_wwwRequest = new WWW(_tokenUrl, form.data, headers);
|
_wwwRequest = new WWW(_tokenUrl, form.data, headers);
|
||||||
StartCoroutine(WaitForAccess(_wwwRequest));
|
StartCoroutine(WaitForAccess(_wwwRequest));
|
||||||
|
|
||||||
while (!_wwwRequest.isDone)
|
while (!_wwwRequest.isDone)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -192,7 +193,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
_returnCode = code;
|
_returnCode = code;
|
||||||
UseReturnCode();
|
UseReturnCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetAllData()
|
public void GetAllData()
|
||||||
{
|
{
|
||||||
GetProfileData();
|
GetProfileData();
|
||||||
|
@ -221,7 +222,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
_wwwRequest = new WWW(_profileUrl, null, headers);
|
_wwwRequest = new WWW(_profileUrl, null, headers);
|
||||||
Debug.Log("Doing GET Request");
|
Debug.Log("Doing GET Request");
|
||||||
StartCoroutine(WaitForAccess(_wwwRequest));
|
StartCoroutine(WaitForAccess(_wwwRequest));
|
||||||
|
|
||||||
while (!_wwwRequest.isDone)
|
while (!_wwwRequest.isDone)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -239,7 +240,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
_wwwRequest = new WWW(_caloriesUrl, null, headers);
|
_wwwRequest = new WWW(_caloriesUrl, null, headers);
|
||||||
Debug.Log("Doing Calories GET Request");
|
Debug.Log("Doing Calories GET Request");
|
||||||
StartCoroutine(WaitForAccess(_wwwRequest));
|
StartCoroutine(WaitForAccess(_wwwRequest));
|
||||||
|
|
||||||
while (!_wwwRequest.isDone)
|
while (!_wwwRequest.isDone)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -255,7 +256,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
_wwwRequest = new WWW(_distanceUrl, null, headers);
|
_wwwRequest = new WWW(_distanceUrl, null, headers);
|
||||||
Debug.Log("Doing Distance GET Request");
|
Debug.Log("Doing Distance GET Request");
|
||||||
StartCoroutine(WaitForAccess(_wwwRequest));
|
StartCoroutine(WaitForAccess(_wwwRequest));
|
||||||
|
|
||||||
while (!_wwwRequest.isDone)
|
while (!_wwwRequest.isDone)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -272,7 +273,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
_wwwRequest = new WWW(_stepsUrl, null, headers);
|
_wwwRequest = new WWW(_stepsUrl, null, headers);
|
||||||
Debug.Log("Doing Steps GET Request");
|
Debug.Log("Doing Steps GET Request");
|
||||||
StartCoroutine(WaitForAccess(_wwwRequest));
|
StartCoroutine(WaitForAccess(_wwwRequest));
|
||||||
|
|
||||||
while (!_wwwRequest.isDone)
|
while (!_wwwRequest.isDone)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -315,7 +316,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
{
|
{
|
||||||
if (kvp.Key == "avatar")
|
if (kvp.Key == "avatar")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//put a space between the camelCase
|
//put a space between the camelCase
|
||||||
var tempKey = Regex.Replace(kvp.Key, "(\\B[A-Z])", " $1");
|
var tempKey = Regex.Replace(kvp.Key, "(\\B[A-Z])", " $1");
|
||||||
//then capitalize the first letter
|
//then capitalize the first letter
|
||||||
|
@ -397,6 +398,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
var root = doc.Descendants("value").FirstOrDefault();
|
var root = doc.Descendants("value").FirstOrDefault();
|
||||||
_fitbitData.CurrentSteps = ToInt(root.Value);
|
_fitbitData.CurrentSteps = ToInt(root.Value);
|
||||||
Debug.Log("Steps from Fitbit: " + _fitbitData.CurrentSteps);
|
Debug.Log("Steps from Fitbit: " + _fitbitData.CurrentSteps);
|
||||||
|
PlayerPrefs.SetInt("fitbitSteps", _fitbitData.CurrentSteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseDistanceData(string data)
|
private void ParseDistanceData(string data)
|
||||||
|
@ -412,6 +414,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
_fitbitData.CurrentDistance = ToDouble(root);
|
_fitbitData.CurrentDistance = ToDouble(root);
|
||||||
|
|
||||||
Debug.Log("Distance from Fitbit is:" + _fitbitData.CurrentDistance);
|
Debug.Log("Distance from Fitbit is:" + _fitbitData.CurrentDistance);
|
||||||
|
PlayerPrefs.SetFloat("fitbitDistance", (float)_fitbitData.CurrentDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseCaloriesData(string data)
|
private void ParseCaloriesData(string data)
|
||||||
|
@ -422,6 +425,7 @@ namespace Assets.Scripts.Fitbit
|
||||||
var calories = doc.Descendants("value").FirstOrDefault().Value;
|
var calories = doc.Descendants("value").FirstOrDefault().Value;
|
||||||
|
|
||||||
_fitbitData.CurrentCalories = ToInt(calories);
|
_fitbitData.CurrentCalories = ToInt(calories);
|
||||||
|
PlayerPrefs.SetInt("fitbitCalories", ToInt(calories));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseSleepData(string data)
|
private void ParseSleepData(string data)
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
<<<<<<< Updated upstream
|
|
||||||
guid: aa5e856e9b878764db7c192f3aa20277
|
guid: aa5e856e9b878764db7c192f3aa20277
|
||||||
timeCreated: 1524716713
|
timeCreated: 1524716713
|
||||||
=======
|
|
||||||
guid: 849590d4a954ae445aa5db73d734450c
|
|
||||||
timeCreated: 1524756213
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
<<<<<<< Updated upstream
|
|
||||||
guid: 36444c03eedb84147a326a329de30d0e
|
guid: 36444c03eedb84147a326a329de30d0e
|
||||||
timeCreated: 1524716713
|
timeCreated: 1524716713
|
||||||
=======
|
|
||||||
guid: 80ba6a52e9d55564fbe8130844b17f29
|
|
||||||
timeCreated: 1524756213
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
<<<<<<< Updated upstream
|
|
||||||
guid: 7a928c029cb14204588724261a513ec1
|
guid: 7a928c029cb14204588724261a513ec1
|
||||||
timeCreated: 1524716713
|
timeCreated: 1524716713
|
||||||
=======
|
|
||||||
guid: 1d8622418b8bead4cad17658d650c6c2
|
|
||||||
timeCreated: 1524756213
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|
|
@ -7,180 +7,296 @@ using UnityEngine.UI;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
//Pretty much a copy of GetData...
|
//Pretty much a copy of GetData...
|
||||||
namespace PedometerU.Tests {
|
namespace PedometerU.Tests
|
||||||
|
{
|
||||||
|
|
||||||
public class GetGoals : MonoBehaviour {
|
public class GetGoals : MonoBehaviour
|
||||||
|
|
||||||
public Image background;
|
|
||||||
private string[] items = { "circle_eye", "crazy_hair", "circle_head", "gap_mouth", "pig_nose", "crown" };
|
|
||||||
|
|
||||||
public Text goalText;
|
|
||||||
public string currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
|
||||||
public string goalDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
|
||||||
public string prefKey;
|
|
||||||
|
|
||||||
//Progress Bar...
|
|
||||||
public float barDisplay; //current progress
|
|
||||||
private Vector2 barPos;
|
|
||||||
private Vector2 barSize = new Vector2(725, 39);
|
|
||||||
|
|
||||||
//Pedometer
|
|
||||||
private Pedometer pedometer;
|
|
||||||
int userSteps;
|
|
||||||
int userPoints;
|
|
||||||
double userDistance;
|
|
||||||
int stepsGoal = 100;
|
|
||||||
public Text stepText;
|
|
||||||
public Text pointsText;
|
|
||||||
private int savedSteps;
|
|
||||||
private int savedPoints;
|
|
||||||
|
|
||||||
void OnStep (int steps, double distance) {
|
|
||||||
userDistance = (distance * 3.28084);
|
|
||||||
userSteps = steps + savedSteps;
|
|
||||||
PlayerPrefs.SetInt("currentSteps",userSteps);
|
|
||||||
stepText.text = userSteps.ToString () + "/" + stepsGoal.ToString();
|
|
||||||
|
|
||||||
userPoints = steps*5 + savedPoints;
|
|
||||||
PlayerPrefs.SetInt("totalPoints",userPoints);
|
|
||||||
pointsText.text = "Points: " + userPoints.ToString ();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDisable () {
|
|
||||||
// Release the pedometer
|
|
||||||
pedometer.Dispose();
|
|
||||||
pedometer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//saved value from last session loads in on START
|
|
||||||
//write usersteps + saved val to pref in ONSTEP
|
|
||||||
|
|
||||||
void Start () {
|
|
||||||
savedSteps = PlayerPrefs.GetInt("currentSteps");
|
|
||||||
savedPoints = PlayerPrefs.GetInt("totalPoints");
|
|
||||||
// Create a new pedometer
|
|
||||||
pedometer = new Pedometer(OnStep);
|
|
||||||
// Reset UI
|
|
||||||
stepText.text = savedSteps.ToString () + "/" + stepsGoal.ToString();
|
|
||||||
if(PlayerPrefs.HasKey("totalPoints"))
|
|
||||||
{
|
|
||||||
pointsText.text = "Points: " + PlayerPrefs.GetInt("totalPoints").ToString ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PlayerPrefs.SetInt("totalPoints", 0);
|
|
||||||
pointsText.text = "Points: " + PlayerPrefs.GetInt("totalPoints").ToString ();
|
|
||||||
}
|
|
||||||
userSteps = savedSteps;
|
|
||||||
userPoints = savedPoints;
|
|
||||||
|
|
||||||
//OnStep(savedSteps, 0);
|
|
||||||
Debug.Log(savedSteps);
|
|
||||||
|
|
||||||
|
|
||||||
//goalText.text = prefKey;
|
|
||||||
goalText.color = new Color(0f, 0f, 0f);
|
|
||||||
Debug.Log(background.rectTransform.anchoredPosition.x.ToString() + " " + background.rectTransform.anchoredPosition.y.ToString());
|
|
||||||
|
|
||||||
barPos = new Vector2(background.transform.position.x, 2135 - background.transform.position.y);
|
|
||||||
|
|
||||||
currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
|
||||||
goalDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
|
||||||
Debug.Log(goalDayStr);
|
|
||||||
|
|
||||||
if(prefKey == "daily")
|
|
||||||
savePersistantGoalDate("daily");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Texture the progress bar using these parameters
|
|
||||||
public Texture2D emptyTex;
|
|
||||||
public Texture2D fullTex;
|
|
||||||
|
|
||||||
//on a button press? begin a goal?
|
|
||||||
void startGoal()
|
|
||||||
{
|
{
|
||||||
}
|
// For HTTP requests to the server.
|
||||||
|
private MochaParser mp;
|
||||||
|
|
||||||
void savePersistantGoalDate(string key)
|
// Goals Progress Bar
|
||||||
{
|
public Image pbbg;
|
||||||
PlayerPrefs.SetString(key, goalDayStr);
|
public Image pbf;
|
||||||
}
|
|
||||||
|
|
||||||
bool checkNewDay(string key)
|
// My Goal Progress Bar
|
||||||
{
|
public Image mgpbbg;
|
||||||
string checkDay = PlayerPrefs.GetString(key);
|
public Image mgpbf;
|
||||||
if(checkDay == currentDayStr)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
void OnGUI() {
|
|
||||||
//draw the background:
|
|
||||||
GUI.BeginGroup(new Rect(barPos.x, barPos.y, barSize.x, barSize.y));
|
|
||||||
GUI.Box(new Rect(0,0, barSize.x, barSize.y), emptyTex);
|
|
||||||
|
|
||||||
//draw the filled-in part:
|
// Monster Progress Bar
|
||||||
GUI.BeginGroup(new Rect(0,0, barSize.x * barDisplay, barSize.y));
|
public Image mpbbg;
|
||||||
GUI.Box(new Rect(0,0, barSize.x, barSize.y), fullTex);
|
public Image mpbf;
|
||||||
GUI.EndGroup();
|
|
||||||
GUI.EndGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private string[] items = { "circle_eye", "crazy_hair", "circle_head", "gap_mouth", "pig_nose", "crown" };
|
||||||
|
|
||||||
void Update() {
|
// Display Text
|
||||||
//needs current points counting toward this goal (daily?)
|
public Text rivalText;
|
||||||
//needs the total required points for this goal
|
public Text goalText;
|
||||||
currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
public Text stepText;
|
||||||
//barDisplay = Time.time*0.05f; //put actual progress here (current/total)
|
public Text pointsText;
|
||||||
barDisplay = (float)userSteps/(float)stepsGoal;
|
public Text remainingText;
|
||||||
|
|
||||||
//failed to complete goal
|
// Goal information.
|
||||||
if(currentDayStr != goalDayStr)
|
private string currentDayStr;
|
||||||
{
|
private string goalDayStr;
|
||||||
Debug.Log(currentDayStr);
|
public string prefKey;
|
||||||
Debug.Log(goalDayStr);
|
|
||||||
|
|
||||||
Debug.Log("DAY HAS PASSED!!");
|
// Used for time calculation.
|
||||||
|
private int timeUsed;
|
||||||
|
private int timeRemaining;
|
||||||
|
private const int secondsperday = 86400;
|
||||||
|
|
||||||
//make it so user dismisses the goal instead!
|
//Progress Bar...
|
||||||
//Destroy(this);
|
private float barDisplay; //current progress
|
||||||
//destroy the goal and set a new one?
|
//private Vector2 barPos;
|
||||||
|
// This gets overwritten later by the background's size values.
|
||||||
|
private Vector2 barSize = new Vector2(5000, 10);
|
||||||
|
|
||||||
}
|
//Pedometer
|
||||||
//goal complete
|
private Pedometer pedometer;
|
||||||
if(barDisplay >= 1.0f)
|
int userSteps;
|
||||||
{
|
int userPoints;
|
||||||
Debug.Log("Goal complete! +100pts!");
|
public int stepsGoal;
|
||||||
userSteps = 0;
|
private int savedSteps;
|
||||||
PlayerPrefs.SetInt("currentSteps", userSteps);
|
private int savedPoints;
|
||||||
savedSteps = 0;
|
|
||||||
//OnStep(0,0);
|
|
||||||
stepText.text = userSteps.ToString () + "/" + stepsGoal.ToString();
|
|
||||||
|
|
||||||
//destroy the goal and set a new one?
|
public string currentStepsKey;
|
||||||
savedPoints += stepsGoal*10;
|
public string totalPointsKey;
|
||||||
PlayerPrefs.SetInt("totalPoints", savedPoints);
|
|
||||||
pointsText.text = "Points: " + PlayerPrefs.GetInt("totalPoints").ToString ();
|
|
||||||
|
|
||||||
//Random item
|
void OnStep (int steps, double distance) {
|
||||||
StringBuilder invList = new StringBuilder ();
|
//userDistance = (distance * 3.28084);
|
||||||
invList.Append(PlayerPrefs.GetString ("inventory"));
|
userSteps = steps + savedSteps;
|
||||||
invList.Append(items[(int)Math.Round(UnityEngine.Random.value*6.0f)]).Append(" ");
|
PlayerPrefs.SetInt(currentStepsKey,userSteps);
|
||||||
PlayerPrefs.SetString ("inventory", invList.ToString());
|
stepText.text = userSteps.ToString () + "/" + stepsGoal.ToString();
|
||||||
|
|
||||||
|
userPoints = steps*5 + savedPoints;
|
||||||
|
PlayerPrefs.SetInt(totalPointsKey,userPoints);
|
||||||
|
pointsText.text = "Points: " + userPoints.ToString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
//only applies if "daily" goal
|
private void OnDisable () {
|
||||||
if(prefKey == "daily")
|
// Release the pedometer
|
||||||
|
pedometer.Dispose();
|
||||||
|
pedometer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//saved value from last session loads in on START
|
||||||
|
//write usersteps + saved val to pref in ONSTEP
|
||||||
|
|
||||||
|
void Start ()
|
||||||
{
|
{
|
||||||
if(checkNewDay(prefKey))
|
//PlayerPrefs.SetInt("currentGoals", 0);
|
||||||
|
//PlayerPrefs.DeleteAll(); //danger!!
|
||||||
|
if(prefKey == "daily")
|
||||||
{
|
{
|
||||||
Debug.Log("You failed your goal"); //not true if progress is actually complete!
|
// This should later only get called per goal
|
||||||
goalDayStr = currentDayStr;
|
StartCoroutine(updateRival());
|
||||||
savePersistantGoalDate("daily");
|
currentStepsKey = "currentSteps";
|
||||||
|
totalPointsKey = "totalPoints";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
currentStepsKey = "currentSteps_p";
|
||||||
|
totalPointsKey = "totalPoints_p";
|
||||||
|
}
|
||||||
|
|
||||||
|
savedSteps = PlayerPrefs.GetInt(currentStepsKey);
|
||||||
|
savedPoints = PlayerPrefs.GetInt(totalPointsKey);
|
||||||
|
// Create a new pedometer
|
||||||
|
pedometer = new Pedometer(OnStep);
|
||||||
|
// Reset UI
|
||||||
|
stepText.text = savedSteps.ToString () + "/" + stepsGoal.ToString();
|
||||||
|
|
||||||
|
if(!PlayerPrefs.HasKey("goalComplete"))
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetInt("goalComplete", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(PlayerPrefs.HasKey(totalPointsKey))
|
||||||
|
{
|
||||||
|
pointsText.text = "Points: " + PlayerPrefs.GetInt(totalPointsKey).ToString ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetInt(totalPointsKey, 0);
|
||||||
|
pointsText.text = "Points: " + PlayerPrefs.GetInt(totalPointsKey).ToString ();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(prefKey == "daily")
|
||||||
|
{
|
||||||
|
if(PlayerPrefs.HasKey("goalDate"))
|
||||||
|
{
|
||||||
|
goalDayStr = PlayerPrefs.GetString("goalDate");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetString("goalDate",
|
||||||
|
System.DateTime.Now.AddDays(1).ToString("MM/dd/yyyy"));
|
||||||
|
goalDayStr = PlayerPrefs.GetString("goalDate");
|
||||||
|
}
|
||||||
|
goalText.color = new Color(0f, 0f, 0f);
|
||||||
|
}
|
||||||
|
userSteps = savedSteps;
|
||||||
|
userPoints = savedPoints;
|
||||||
|
|
||||||
|
//OnStep(savedSteps, 0); //necessary?
|
||||||
|
//Debug.Log(savedSteps);
|
||||||
|
|
||||||
|
//Debug.Log(pbbg.rectTransform.anchoredPosition.x.ToString() + " " + pbbg.rectTransform.anchoredPosition.y.ToString());
|
||||||
|
|
||||||
|
//barPos = new Vector2(pbbg.transform.position.x, 1895 - pbbg.transform.position.y);
|
||||||
|
|
||||||
|
currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Was used for testing.
|
||||||
|
private float tempcounter = 0.1f;
|
||||||
|
|
||||||
|
// Call this to update the goals progress bar.
|
||||||
|
public void updateProgressBar()
|
||||||
|
{
|
||||||
|
//Debug.Log (pbbg.rectTransform.rect.width + " " + pbbg.rectTransform.rect.height);
|
||||||
|
barSize.x = pbbg.rectTransform.rect.width;
|
||||||
|
|
||||||
|
//tempcounter += 0.0005f;
|
||||||
|
|
||||||
|
// resize the fill.
|
||||||
|
RectTransform temp = pbf.rectTransform;
|
||||||
|
//temp.sizeDelta = new Vector2 (-barSize.x + barSize.x * tempcounter, 0);
|
||||||
|
temp.sizeDelta = new Vector2 (-barSize.x + (barSize.x * barDisplay), 0);
|
||||||
|
temp.anchoredPosition = new Vector2 (temp.rect.width * 0.5f - (barSize.x * 0.5f),0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use this for the progress bar you're testing with.
|
||||||
|
public void updateMyGoalProgressBar()
|
||||||
|
{
|
||||||
|
//Debug.Log (pbbg.rectTransform.rect.width + " " + pbbg.rectTransform.rect.height);
|
||||||
|
barSize.x = mgpbbg.rectTransform.rect.width;
|
||||||
|
|
||||||
|
//tempcounter += 0.0005f;
|
||||||
|
|
||||||
|
// resize the fill.
|
||||||
|
RectTransform temp = mgpbf.rectTransform;
|
||||||
|
//temp.sizeDelta = new Vector2 (-barSize.x + barSize.x * tempcounter, 0);
|
||||||
|
temp.sizeDelta = new Vector2 (-barSize.x + (barSize.x * barDisplay), 0);
|
||||||
|
temp.anchoredPosition = new Vector2 (temp.rect.width * 0.5f - (barSize.x * 0.5f),0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call this to update the monster's progress bar.
|
||||||
|
public void updateMonsterProgressBar()
|
||||||
|
{
|
||||||
|
float fractionused = (float)(timeUsed) / (float)(secondsperday);
|
||||||
|
//Debug.Log (dayleft);
|
||||||
|
|
||||||
|
barSize.x = mpbbg.rectTransform.rect.width;
|
||||||
|
|
||||||
|
//tempcounter += 0.0005f;
|
||||||
|
|
||||||
|
// resize the fill.
|
||||||
|
RectTransform temp = mpbf.rectTransform;
|
||||||
|
//temp.sizeDelta = new Vector2 (-barSize.x + barSize.x * tempcounter, 0);
|
||||||
|
temp.sizeDelta = new Vector2 (-barSize.x + (barSize.x * fractionused), 0);
|
||||||
|
temp.anchoredPosition = new Vector2 (temp.rect.width * 0.5f - (barSize.x * 0.5f),0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculates the time remaining for the day.
|
||||||
|
// Will likely make a separate function for smaller timed goals if we have time.
|
||||||
|
public void updateTimeRemaining()
|
||||||
|
{
|
||||||
|
timeUsed = ((System.DateTime.Now.Hour * 60 * 60) + (System.DateTime.Now.Minute * 60) + System.DateTime.Now.Second);
|
||||||
|
|
||||||
|
timeRemaining = secondsperday - timeUsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format the time remaining variable to a proper string.
|
||||||
|
public string formatTimeRemaining()
|
||||||
|
{
|
||||||
|
string output = "Time remaining: ";
|
||||||
|
|
||||||
|
output += "" + (timeRemaining / 3600);
|
||||||
|
output += ":" + (timeRemaining % 3600 / 60);
|
||||||
|
output += ":" + (timeRemaining % 60);
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shell function for now to update rival text.
|
||||||
|
// You'll wanna call this with startcoroutine().
|
||||||
|
public IEnumerator updateRival()
|
||||||
|
{
|
||||||
|
mp = new MochaParser ();
|
||||||
|
yield return mp.MakeRequest ("http://corder.tech/mocha/random");
|
||||||
|
rivalText.text = "You are being chased by " + mp.players [0].username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshSteps()
|
||||||
|
{
|
||||||
|
int fitbitSteps = PlayerPrefs.GetInt("fitbitSteps");
|
||||||
|
PlayerPrefs.SetInt(currentStepsKey, fitbitSteps);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
updateTimeRemaining ();
|
||||||
|
updateProgressBar ();
|
||||||
|
//updateMyGoalProgressBar ();
|
||||||
|
|
||||||
|
if(prefKey == "daily")
|
||||||
|
{
|
||||||
|
updateMonsterProgressBar ();
|
||||||
|
remainingText.text = formatTimeRemaining ();
|
||||||
|
currentDayStr = System.DateTime.Now.ToString("MM/dd/yyyy");
|
||||||
|
}
|
||||||
|
|
||||||
|
userSteps = PlayerPrefs.GetInt(currentStepsKey);
|
||||||
|
barDisplay = (float)userSteps/(float)stepsGoal;
|
||||||
|
if(barDisplay > 1.0f)
|
||||||
|
barDisplay = 1.0f;
|
||||||
|
stepText.text = userSteps.ToString () + "/" + stepsGoal.ToString();
|
||||||
|
|
||||||
|
//check if the current date matches the goal date
|
||||||
|
if(prefKey == "daily" && currentDayStr == goalDayStr)
|
||||||
|
{
|
||||||
|
Debug.Log("current: " + currentDayStr);
|
||||||
|
Debug.Log("goal: " + goalDayStr);
|
||||||
|
Debug.Log(prefKey + "...DAY HAS PASSED!! SETTING GOAL TO NEXT DAY!!");
|
||||||
|
PlayerPrefs.SetString("goalDate",
|
||||||
|
System.DateTime.Now.AddDays(1).ToString("MM/dd/yyyy"));
|
||||||
|
PlayerPrefs.SetInt("goalComplete", 0);
|
||||||
|
goalDayStr = PlayerPrefs.GetString("goalDate");
|
||||||
|
Debug.Log("new goal: " + goalDayStr);
|
||||||
|
|
||||||
|
//reset steps...
|
||||||
|
userSteps = 0;
|
||||||
|
PlayerPrefs.SetInt(currentStepsKey, userSteps);
|
||||||
|
}
|
||||||
|
//goal complete
|
||||||
|
else if(barDisplay >= 1.0f)
|
||||||
|
{
|
||||||
|
if(PlayerPrefs.GetInt("goalComplete") == 0)
|
||||||
|
{
|
||||||
|
Debug.Log(prefKey + "... Goal complete! +100pts!");
|
||||||
|
userSteps = 0;
|
||||||
|
PlayerPrefs.SetInt(currentStepsKey, userSteps);
|
||||||
|
savedSteps = 0;
|
||||||
|
//OnStep(0,0);
|
||||||
|
|
||||||
|
//destroy the goal and set a new one?
|
||||||
|
savedPoints += stepsGoal*10;
|
||||||
|
PlayerPrefs.SetInt(totalPointsKey, savedPoints);
|
||||||
|
pointsText.text = "Points: " + PlayerPrefs.GetInt(totalPointsKey).ToString ();
|
||||||
|
|
||||||
|
//Random item
|
||||||
|
if(!PlayerPrefs.HasKey("inventory"))
|
||||||
|
PlayerPrefs.SetString("inventory", "");
|
||||||
|
StringBuilder invList = new StringBuilder ();
|
||||||
|
invList.Append(PlayerPrefs.GetString ("inventory"));
|
||||||
|
invList.Append(items[(int)Math.Round(UnityEngine.Random.value*6.0f)]).Append(" ");
|
||||||
|
PlayerPrefs.SetString ("inventory", invList.ToString());
|
||||||
|
PlayerPrefs.SetInt("goalComplete", 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,5 +5,5 @@ public class Item : ScriptableObject {
|
||||||
|
|
||||||
public Sprite sprite;
|
public Sprite sprite;
|
||||||
|
|
||||||
public string name;
|
public string nameString;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
<<<<<<< Updated upstream
|
|
||||||
guid: da64cad21a33a6444ac511376fcb771b
|
guid: da64cad21a33a6444ac511376fcb771b
|
||||||
timeCreated: 1524716713
|
timeCreated: 1524716713
|
||||||
=======
|
|
||||||
guid: 9101b04121334074fb6e70fc34eeb3f9
|
|
||||||
timeCreated: 1524756213
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|
|
@ -6,13 +6,13 @@ using UnityEngine.UI;
|
||||||
public class MonsterDraw : MonoBehaviour {
|
public class MonsterDraw : MonoBehaviour {
|
||||||
|
|
||||||
public GameObject anchorPoint;
|
public GameObject anchorPoint;
|
||||||
|
public float scale;
|
||||||
|
|
||||||
private Vector2 anchorPos;
|
private Vector2 anchorPos;
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
anchorPos = new Vector2 (anchorPoint.transform.position.x, anchorPoint.transform.position.y);
|
anchorPos = new Vector3 (anchorPoint.transform.position.x, anchorPoint.transform.position.y, anchorPoint.transform.position.z);
|
||||||
loadMonster();
|
loadMonster();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,10 +25,11 @@ public class MonsterDraw : MonoBehaviour {
|
||||||
string savedString = PlayerPrefs.GetString(equipped[i]);
|
string savedString = PlayerPrefs.GetString(equipped[i]);
|
||||||
string[] values = savedString.Split ();
|
string[] values = savedString.Split ();
|
||||||
GameObject instance = (GameObject)Instantiate(Resources.Load(equipped[i]));
|
GameObject instance = (GameObject)Instantiate(Resources.Load(equipped[i]));
|
||||||
//instance.rectTransform.anchoredPosition = new Vector2(float.Parse(values[0]), float.Parse(values[1]));
|
|
||||||
instance.name = equipped [i];
|
instance.name = equipped [i];
|
||||||
//instance.GetComponent<DragAndDrop> ().inventory = inv;
|
//instance.GetComponent<DragAndDrop> ().inventory = inv;
|
||||||
instance.transform.position = new Vector2(float.Parse(values[0]), float.Parse(values[1]));
|
instance.transform.position = new Vector3(float.Parse(values[0]), float.Parse(values[1]), float.Parse(values[2]));
|
||||||
|
instance.transform.localScale -= new Vector3(scale, scale, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,43 +39,6 @@ public class MonsterManager : MonoBehaviour {
|
||||||
PlayerPrefs.SetString(/*SceneManager.GetActiveScene().name + */monsterParts[i].name, savedString);
|
PlayerPrefs.SetString(/*SceneManager.GetActiveScene().name + */monsterParts[i].name, savedString);
|
||||||
}
|
}
|
||||||
PlayerPrefs.SetString ("Equipped", equippedString);
|
PlayerPrefs.SetString ("Equipped", equippedString);
|
||||||
/*
|
|
||||||
StringBuilder eyePos = new StringBuilder();
|
|
||||||
|
|
||||||
eyePos.Append(GameObject.Find("circle_eye").transform.position.x).Append(" ").Append(GameObject.Find("circle_eye").transform.position.y).Append(" ").Append(GameObject.Find("circle_eye").transform.position.z);
|
|
||||||
string savedString = eyePos.ToString();
|
|
||||||
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "eyePosition", savedString);
|
|
||||||
|
|
||||||
StringBuilder hairPos = new StringBuilder();
|
|
||||||
|
|
||||||
hairPos.Append(GameObject.Find("crazy_hair").transform.position.x).Append(" ").Append(GameObject.Find("crazy_hair").transform.position.y).Append(" ").Append(GameObject.Find("crazy_hair").transform.position.z);
|
|
||||||
savedString = hairPos.ToString();
|
|
||||||
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "hairPosition", savedString);
|
|
||||||
|
|
||||||
StringBuilder headPos = new StringBuilder();
|
|
||||||
|
|
||||||
headPos.Append(GameObject.Find("circle_head").transform.position.x).Append(" ").Append(GameObject.Find("circle_head").transform.position.y).Append(" ").Append(GameObject.Find("circle_head").transform.position.z);
|
|
||||||
savedString = headPos.ToString();
|
|
||||||
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "headPosition", savedString);
|
|
||||||
|
|
||||||
StringBuilder hatPos = new StringBuilder();
|
|
||||||
|
|
||||||
hatPos.Append(GameObject.Find("crown").transform.position.x).Append(" ").Append(GameObject.Find("crown").transform.position.y).Append(" ").Append(GameObject.Find("crown").transform.position.z);
|
|
||||||
savedString = hatPos.ToString();
|
|
||||||
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "hatPosition", savedString);
|
|
||||||
|
|
||||||
StringBuilder mouthPos = new StringBuilder();
|
|
||||||
|
|
||||||
mouthPos.Append(GameObject.Find("gap_mouth").transform.position.x).Append(" ").Append(GameObject.Find("gap_mouth").transform.position.y).Append(" ").Append(GameObject.Find("gap_mouth").transform.position.z);
|
|
||||||
savedString = mouthPos.ToString();
|
|
||||||
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "mouthPosition", savedString);
|
|
||||||
|
|
||||||
StringBuilder nosePos = new StringBuilder();
|
|
||||||
|
|
||||||
nosePos.Append(GameObject.Find("pig_nose").transform.position.x).Append(" ").Append(GameObject.Find("pig_nose").transform.position.y).Append(" ").Append(GameObject.Find("pig_nose").transform.position.z);
|
|
||||||
savedString = nosePos.ToString();
|
|
||||||
PlayerPrefs.SetString(SceneManager.GetActiveScene().name + "nosePosition", savedString);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadMonster ()
|
public void loadMonster ()
|
||||||
|
@ -92,37 +55,5 @@ public class MonsterManager : MonoBehaviour {
|
||||||
instance.GetComponent<DragAndDrop> ().inventory = inv;
|
instance.GetComponent<DragAndDrop> ().inventory = inv;
|
||||||
instance.transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
instance.transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
string savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "eyePosition");
|
|
||||||
string[] values = savedString.Split(' ');
|
|
||||||
|
|
||||||
GameObject.Find("circle_eye").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
||||||
|
|
||||||
savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "hairPosition");
|
|
||||||
values = savedString.Split(' ');
|
|
||||||
|
|
||||||
GameObject.Find("crazy_hair").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
||||||
|
|
||||||
savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "headPosition");
|
|
||||||
values = savedString.Split(' ');
|
|
||||||
|
|
||||||
GameObject.Find("circle_head").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
||||||
|
|
||||||
savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "hatPosition");
|
|
||||||
values = savedString.Split(' ');
|
|
||||||
|
|
||||||
GameObject.Find("crown").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
||||||
|
|
||||||
savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "mouthPosition");
|
|
||||||
values = savedString.Split(' ');
|
|
||||||
|
|
||||||
GameObject.Find("gap_mouth").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
||||||
|
|
||||||
savedString = PlayerPrefs.GetString(SceneManager.GetActiveScene().name + "nosePosition");
|
|
||||||
values = savedString.Split(' ');
|
|
||||||
|
|
||||||
GameObject.Find("pig_nose").transform.position = new Vector3(float.Parse(values[0]),float.Parse(values[1]),float.Parse(values[2]));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
public class NavigationManager : MonoBehaviour
|
public class NavigationManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
private float timelastactive;
|
||||||
private GameObject navMenu;
|
private GameObject navMenu;
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
|
@ -13,6 +15,26 @@ public class NavigationManager : MonoBehaviour
|
||||||
navMenu = gameObject.transform.Find("Navigation Menu").gameObject;
|
navMenu = gameObject.transform.Find("Navigation Menu").gameObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
if (Input.GetKeyDown (KeyCode.Escape))
|
||||||
|
{
|
||||||
|
if (navMenu.activeSelf) {
|
||||||
|
CloseNavMenu ();
|
||||||
|
timelastactive = Time.time;
|
||||||
|
}
|
||||||
|
else if (Time.time > (timelastactive + 1.0f))
|
||||||
|
{
|
||||||
|
PreviousPage ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool isActive()
|
||||||
|
{
|
||||||
|
return navMenu.activeSelf;
|
||||||
|
}
|
||||||
|
|
||||||
public void OpenNavMenu()
|
public void OpenNavMenu()
|
||||||
{
|
{
|
||||||
navMenu.SetActive (true);
|
navMenu.SetActive (true);
|
||||||
|
@ -22,4 +44,59 @@ public class NavigationManager : MonoBehaviour
|
||||||
{
|
{
|
||||||
navMenu.SetActive (false);
|
navMenu.SetActive (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadScene(string scene)
|
||||||
|
{
|
||||||
|
string scenetext = scene;
|
||||||
|
Debug.Log (" " + scenetext);
|
||||||
|
|
||||||
|
switch (scenetext) {
|
||||||
|
case "Start":
|
||||||
|
if (!(SceneManager.GetActiveScene ().name == "Home"))
|
||||||
|
SceneManager.LoadScene ("Home");
|
||||||
|
break;
|
||||||
|
case "Run":
|
||||||
|
if (!(SceneManager.GetActiveScene ().name == "Goals"))
|
||||||
|
SceneManager.LoadScene ("Goals");
|
||||||
|
break;
|
||||||
|
case "Profile":
|
||||||
|
if (!(SceneManager.GetActiveScene ().name == "Stats"))
|
||||||
|
SceneManager.LoadScene ("Stats");
|
||||||
|
break;
|
||||||
|
case "Monster Creator":
|
||||||
|
if (!(SceneManager.GetActiveScene ().name == "MonsterCreator"))
|
||||||
|
SceneManager.LoadScene ("MonsterCreator");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (!(SceneManager.GetActiveScene ().name == scenetext))
|
||||||
|
SceneManager.LoadScene (scenetext);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PreviousPage()
|
||||||
|
{
|
||||||
|
string currentscene = SceneManager.GetActiveScene ().name;
|
||||||
|
|
||||||
|
switch(currentscene)
|
||||||
|
{
|
||||||
|
case "Main":
|
||||||
|
Application.Quit();
|
||||||
|
break;
|
||||||
|
case "Home":
|
||||||
|
break;
|
||||||
|
case "MonsterCreator":
|
||||||
|
SceneManager.LoadScene ("Stats");
|
||||||
|
break;
|
||||||
|
case "Leaderboard":
|
||||||
|
SceneManager.LoadScene ("Stats");
|
||||||
|
break;
|
||||||
|
case "Goals":
|
||||||
|
case "Credits":
|
||||||
|
case "Stats":
|
||||||
|
default:
|
||||||
|
SceneManager.LoadScene ("Home");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
<<<<<<< Updated upstream
|
|
||||||
guid: 2e4069fa83cbbb041aa91e83f7ece28e
|
guid: 2e4069fa83cbbb041aa91e83f7ece28e
|
||||||
timeCreated: 1524716713
|
timeCreated: 1524716713
|
||||||
=======
|
|
||||||
guid: 1d4c10710438d404085599a6fe50d37b
|
|
||||||
timeCreated: 1524756213
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
|
|
Binary file not shown.
|
@ -1,45 +0,0 @@
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
using System.Collections;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
|
|
||||||
public class SceneLoader : MonoBehaviour {
|
|
||||||
|
|
||||||
Text buttontext;
|
|
||||||
|
|
||||||
public void Start()
|
|
||||||
{
|
|
||||||
buttontext = GetComponentInChildren<Text> ();
|
|
||||||
// grab a UI element, set its rectTransform.anchoredPosition = to a Vector2 of the new position coordinates.
|
|
||||||
//buttontext.rectTransform.anchoredPosition = new Vector2(buttontext.rectTransform.anchoredPosition.x, buttontext.rectTransform.anchoredPosition.y + 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadScene()
|
|
||||||
{
|
|
||||||
string scenetext = buttontext.text;
|
|
||||||
Debug.Log (" " + scenetext);
|
|
||||||
|
|
||||||
switch (scenetext) {
|
|
||||||
case "Start":
|
|
||||||
if (!(SceneManager.GetActiveScene ().name == "Home"))
|
|
||||||
SceneManager.LoadScene ("Home");
|
|
||||||
break;
|
|
||||||
case "Run":
|
|
||||||
if (!(SceneManager.GetActiveScene ().name == "Goals"))
|
|
||||||
SceneManager.LoadScene ("Goals");
|
|
||||||
break;
|
|
||||||
case "Profile":
|
|
||||||
if (!(SceneManager.GetActiveScene ().name == "Stats"))
|
|
||||||
SceneManager.LoadScene ("Stats");
|
|
||||||
break;
|
|
||||||
case "Monster Creator":
|
|
||||||
if (!(SceneManager.GetActiveScene ().name == "MonsterCreator"))
|
|
||||||
SceneManager.LoadScene ("MonsterCreator");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!(SceneManager.GetActiveScene ().name == scenetext))
|
|
||||||
SceneManager.LoadScene (scenetext);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -9,12 +9,25 @@ public class StatsUpdate : MonoBehaviour {
|
||||||
public Text score;
|
public Text score;
|
||||||
public Text steps;
|
public Text steps;
|
||||||
public Text distance;
|
public Text distance;
|
||||||
|
public Text calories;
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
steps.text = PlayerPrefs.GetInt("currentSteps").ToString();
|
//steps.text = PlayerPrefs.GetInt("currentSteps").ToString();
|
||||||
|
steps.text = PlayerPrefs.GetInt("fitbitSteps").ToString();
|
||||||
score.text = PlayerPrefs.GetInt("totalPoints").ToString();
|
score.text = PlayerPrefs.GetInt("totalPoints").ToString();
|
||||||
distance.text = ((float)PlayerPrefs.GetInt("currentSteps")/2000.0f).ToString() + " mi.";
|
//distance.text = ((float)PlayerPrefs.GetInt("currentSteps")/2000.0f).ToString() + " mi.";
|
||||||
|
distance.text = PlayerPrefs.GetFloat("fitbitDistance").ToString() + " mi.";
|
||||||
|
calories.text = PlayerPrefs.GetInt("fitbitCalories").ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshPrefs() {
|
||||||
|
//steps.text = PlayerPrefs.GetInt("currentSteps").ToString();
|
||||||
|
steps.text = PlayerPrefs.GetInt("fitbitSteps").ToString();
|
||||||
|
score.text = PlayerPrefs.GetInt("totalPoints").ToString();
|
||||||
|
//distance.text = ((float)PlayerPrefs.GetInt("currentSteps")/2000.0f).ToString() + " mi.";
|
||||||
|
distance.text = PlayerPrefs.GetFloat("fitbitDistance").ToString() + " mi.";
|
||||||
|
calories.text = PlayerPrefs.GetInt("fitbitCalories").ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: fa408530e9193f04a89413db536ecad6
|
guid: 2df7842d377a9a84abfb17bc840cbab4
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
timeCreated: 1523381747
|
timeCreated: 1525117456
|
||||||
licenseType: Free
|
licenseType: Free
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
1568
MoCha/Assets/SimpleAndroidNotifications/DemoScene.unity
Normal file
1568
MoCha/Assets/SimpleAndroidNotifications/DemoScene.unity
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 04bafa369dbac00478feecb96bf71f90
|
||||||
|
timeCreated: 1504018996
|
||||||
|
licenseType: Store
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
MoCha/Assets/SimpleAndroidNotifications/Manual.pdf
Normal file
BIN
MoCha/Assets/SimpleAndroidNotifications/Manual.pdf
Normal file
Binary file not shown.
8
MoCha/Assets/SimpleAndroidNotifications/Manual.pdf.meta
Normal file
8
MoCha/Assets/SimpleAndroidNotifications/Manual.pdf.meta
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 25883581d81d38b44b43224baa0c1bbe
|
||||||
|
timeCreated: 1473442595
|
||||||
|
licenseType: Store
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,53 @@
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Assets.SimpleAndroidNotifications
|
||||||
|
{
|
||||||
|
public class NotificationExample : MonoBehaviour
|
||||||
|
{
|
||||||
|
public void Rate()
|
||||||
|
{
|
||||||
|
Application.OpenURL("http://u3d.as/y6r");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OpenWiki()
|
||||||
|
{
|
||||||
|
Application.OpenURL("https://github.com/hippogamesunity/SimpleAndroidNotificationsPublic/wiki");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ScheduleSimple()
|
||||||
|
{
|
||||||
|
NotificationManager.Send(TimeSpan.FromSeconds(5), "Simple notification", "Customize icon and color", new Color(1, 0.3f, 0.15f));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ScheduleNormal()
|
||||||
|
{
|
||||||
|
NotificationManager.SendWithAppIcon(TimeSpan.FromSeconds(5), "Notification", "Notification with app icon", new Color(0, 0.6f, 1), NotificationIcon.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ScheduleCustom()
|
||||||
|
{
|
||||||
|
var notificationParams = new NotificationParams
|
||||||
|
{
|
||||||
|
Id = UnityEngine.Random.Range(0, int.MaxValue),
|
||||||
|
Delay = TimeSpan.FromSeconds(5),
|
||||||
|
Title = "Custom notification",
|
||||||
|
Message = "Message",
|
||||||
|
Ticker = "Ticker",
|
||||||
|
Sound = true,
|
||||||
|
Vibrate = true,
|
||||||
|
Light = true,
|
||||||
|
SmallIcon = NotificationIcon.Heart,
|
||||||
|
SmallIconColor = new Color(0, 0.5f, 0),
|
||||||
|
LargeIcon = "app_icon"
|
||||||
|
};
|
||||||
|
|
||||||
|
NotificationManager.SendCustom(notificationParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CancelAll()
|
||||||
|
{
|
||||||
|
NotificationManager.CancelAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,8 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 39ce724310132854a9cfdd3e31737ae7
|
guid: 3a71b5771fef6424bb435eb90ac4c555
|
||||||
timeCreated: 1523377353
|
timeCreated: 1470125386
|
||||||
licenseType: Free
|
licenseType: Store
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
defaultReferences: []
|
defaultReferences: []
|
||||||
executionOrder: 0
|
executionOrder: 0
|
12
MoCha/Assets/SimpleAndroidNotifications/NotificationIcon.cs
Normal file
12
MoCha/Assets/SimpleAndroidNotifications/NotificationIcon.cs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
namespace Assets.SimpleAndroidNotifications
|
||||||
|
{
|
||||||
|
public enum NotificationIcon
|
||||||
|
{
|
||||||
|
Bell,
|
||||||
|
Clock,
|
||||||
|
Event,
|
||||||
|
Heart,
|
||||||
|
Message,
|
||||||
|
Star
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 243b640bb54d927499ad71bfe4b8137e
|
||||||
|
timeCreated: 1473424878
|
||||||
|
licenseType: Store
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
123
MoCha/Assets/SimpleAndroidNotifications/NotificationManager.cs
Normal file
123
MoCha/Assets/SimpleAndroidNotifications/NotificationManager.cs
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace Assets.SimpleAndroidNotifications
|
||||||
|
{
|
||||||
|
public static class NotificationManager
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
|
||||||
|
private const string FullClassName = "com.hippogames.simpleandroidnotifications.Controller";
|
||||||
|
private const string MainActivityClassName = "com.unity3d.player.UnityPlayerActivity";
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Schedule simple notification without app icon.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="smallIcon">List of build-in small icons: notification_icon_bell (default), notification_icon_clock, notification_icon_heart, notification_icon_message, notification_icon_nut, notification_icon_star, notification_icon_warning.</param>
|
||||||
|
public static int Send(TimeSpan delay, string title, string message, Color smallIconColor, NotificationIcon smallIcon = 0)
|
||||||
|
{
|
||||||
|
return SendCustom(new NotificationParams
|
||||||
|
{
|
||||||
|
Id = UnityEngine.Random.Range(0, int.MaxValue),
|
||||||
|
Delay = delay,
|
||||||
|
Title = title,
|
||||||
|
Message = message,
|
||||||
|
Ticker = message,
|
||||||
|
Sound = true,
|
||||||
|
Vibrate = true,
|
||||||
|
Light = true,
|
||||||
|
SmallIcon = smallIcon,
|
||||||
|
SmallIconColor = smallIconColor,
|
||||||
|
LargeIcon = ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Schedule notification with app icon.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="smallIcon">List of build-in small icons: notification_icon_bell (default), notification_icon_clock, notification_icon_heart, notification_icon_message, notification_icon_nut, notification_icon_star, notification_icon_warning.</param>
|
||||||
|
public static int SendWithAppIcon(TimeSpan delay, string title, string message, Color smallIconColor, NotificationIcon smallIcon = 0)
|
||||||
|
{
|
||||||
|
return SendCustom(new NotificationParams
|
||||||
|
{
|
||||||
|
Id = UnityEngine.Random.Range(0, int.MaxValue),
|
||||||
|
Delay = delay,
|
||||||
|
Title = title,
|
||||||
|
Message = message,
|
||||||
|
Ticker = message,
|
||||||
|
Sound = true,
|
||||||
|
Vibrate = true,
|
||||||
|
Light = true,
|
||||||
|
SmallIcon = smallIcon,
|
||||||
|
SmallIconColor = smallIconColor,
|
||||||
|
LargeIcon = "app_icon"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Schedule customizable notification.
|
||||||
|
/// </summary>
|
||||||
|
public static int SendCustom(NotificationParams notificationParams)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
|
||||||
|
var p = notificationParams;
|
||||||
|
var delay = (long) p.Delay.TotalMilliseconds;
|
||||||
|
|
||||||
|
new AndroidJavaClass(FullClassName).CallStatic("SetNotification", p.Id, delay, p.Title, p.Message, p.Ticker,
|
||||||
|
p.Sound ? 1 : 0, p.Vibrate ? 1 : 0, p.Light ? 1 : 0, p.LargeIcon, GetSmallIconName(p.SmallIcon), ColotToInt(p.SmallIconColor), MainActivityClassName);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
Debug.LogWarning("Simple Android Notifications are not supported for current platform. Build and play this scene on android device!");
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return notificationParams.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel notification by id.
|
||||||
|
/// </summary>
|
||||||
|
public static void Cancel(int id)
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
|
||||||
|
new AndroidJavaClass(FullClassName).CallStatic("CancelScheduledNotification", id);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Cancel all notifications.
|
||||||
|
/// </summary>
|
||||||
|
public static void CancelAll()
|
||||||
|
{
|
||||||
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
|
|
||||||
|
new AndroidJavaClass(FullClassName).CallStatic("CancelAllScheduledNotifications");
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int ColotToInt(Color color)
|
||||||
|
{
|
||||||
|
var smallIconColor = (Color32) color;
|
||||||
|
|
||||||
|
return smallIconColor.r * 65536 + smallIconColor.g * 256 + smallIconColor.b;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetSmallIconName(NotificationIcon icon)
|
||||||
|
{
|
||||||
|
return "anp_" + icon.ToString().ToLower();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0126c966198c04149a015ab2e2993d7c
|
||||||
|
timeCreated: 1470125384
|
||||||
|
licenseType: Store
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,26 @@
|
||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Assets.SimpleAndroidNotifications
|
||||||
|
{
|
||||||
|
public class NotificationParams
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Use random id for each new notification.
|
||||||
|
/// </summary>
|
||||||
|
public int Id;
|
||||||
|
public TimeSpan Delay;
|
||||||
|
public string Title;
|
||||||
|
public string Message;
|
||||||
|
public string Ticker;
|
||||||
|
public bool Sound = true;
|
||||||
|
public bool Vibrate = true;
|
||||||
|
public bool Light = true;
|
||||||
|
public NotificationIcon SmallIcon;
|
||||||
|
public Color SmallIconColor;
|
||||||
|
/// <summary>
|
||||||
|
/// Use "" for simple notification. Use "app_icon" to use the app icon. Use custom value but first place image to "simple-android-notifications.aar/res/". To modify "aar" file just rename it to "zip" and back.
|
||||||
|
/// </summary>
|
||||||
|
public string LargeIcon;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 21f9537b0dde1ff499b93870d79d2169
|
||||||
|
timeCreated: 1470161197
|
||||||
|
licenseType: Store
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
9
MoCha/Assets/SimpleAndroidNotifications/Plugins.meta
Normal file
9
MoCha/Assets/SimpleAndroidNotifications/Plugins.meta
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1ae4658634a06794699458349d94b91a
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1470052745
|
||||||
|
licenseType: Store
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,9 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 05659514faf5c00438b20237116fb96d
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1470052745
|
||||||
|
licenseType: Store
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 452bdd37e0400c94491ff114e437eba0
|
||||||
|
timeCreated: 1470202238
|
||||||
|
licenseType: Store
|
||||||
|
PluginImporter:
|
||||||
|
serializedVersion: 1
|
||||||
|
iconMap: {}
|
||||||
|
executionOrder: {}
|
||||||
|
isPreloaded: 0
|
||||||
|
platformData:
|
||||||
|
Android:
|
||||||
|
enabled: 1
|
||||||
|
settings: {}
|
||||||
|
Any:
|
||||||
|
enabled: 0
|
||||||
|
settings: {}
|
||||||
|
Editor:
|
||||||
|
enabled: 0
|
||||||
|
settings:
|
||||||
|
DefaultValueInitialized: true
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
MoCha/Assets/Sprites/Asset 1.png
Normal file
BIN
MoCha/Assets/Sprites/Asset 1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
107
MoCha/Assets/Sprites/Asset 1.png.meta
Normal file
107
MoCha/Assets/Sprites/Asset 1.png.meta
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5e61f4351ff403445a1633bb46270048
|
||||||
|
timeCreated: 1525112241
|
||||||
|
licenseType: Free
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: WebGL
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
BIN
MoCha/Assets/Sprites/running_man.png
Normal file
BIN
MoCha/Assets/Sprites/running_man.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
107
MoCha/Assets/Sprites/running_man.png.meta
Normal file
107
MoCha/Assets/Sprites/running_man.png.meta
Normal file
|
@ -0,0 +1,107 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b868443409c4bd7488485b342bebc4d6
|
||||||
|
timeCreated: 1525111249
|
||||||
|
licenseType: Free
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 4
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: -1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
platformSettings:
|
||||||
|
- buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
- buildTarget: WebGL
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Binary file not shown.
Binary file not shown.
|
@ -1,5 +1 @@
|
||||||
<<<<<<< HEAD
|
|
||||||
m_EditorVersion: 2017.4.0f1
|
|
||||||
=======
|
|
||||||
m_EditorVersion: 2017.3.1f1
|
m_EditorVersion: 2017.3.1f1
|
||||||
>>>>>>> alex
|
|
||||||
|
|
Binary file not shown.
Reference in a new issue