Exemple #1
0
        void Awake()
        {
            calories             = this;
            CalorieDisplayObject = new GameObject("YUR Calorie Canvas");

            DontDestroyOnLoad(CalorieDisplayObject);
            DontDestroyOnLoad(calories);
        }
Exemple #2
0
        /// <summary>
        /// Called upon creation of YUR object
        /// </summary>
        /// <param name="game_ID"></param>
        /// <param name="Fixed_Time_Step"></param>
        /// <param name="debug"></param>
        /// <param name="error_debug"></param>
        public void StartUp(string game_ID = "yurapp", float Fixed_Time_Step = 90, bool debug = false, bool error_debug = true, bool server_debug = false, bool log_to_file = false, bool auto_sign_in = false, bool editor_debugging = true)
        {
            main = this;

            DontDestroyOnLoad(main);
            DontDestroyOnLoad(this);

            this.game_ID      = game_ID;
            TimeStep          = Fixed_Time_Step;
            this.auto_sign_in = auto_sign_in;

            YUR_Log.Debugging        = debug;
            YUR_Log.Error_Logging    = error_debug;
            YUR_Log.Server_Logging   = server_debug;
            YUR_Log.Log_To_File      = log_to_file;
            YUR_Log.Editor_Debugging = editor_debugging;
            YUR_Log.Log("Starting YUR");

            workout  = gameObject.AddComponent <Workouts.Workout>();
            calories = new GameObject("YUR Calorie Display Object").AddComponent <Tracking.Calories>();
            DontDestroyOnLoad(workout); // TODO Check DontDestroyOnLoads are not over done. Placed everywhere as a quick fix
            DontDestroyOnLoad(calories);

            YUR_UserManager.Successful_Login += new YUR_UserManager.Login_Status_Changed(Active_User_Logged_In_Successfully);
            YUR_UserManager.Bad_Login        += new YUR_UserManager.Login_Status_Changed(Active_User_Unable_To_Login);
            YUR_Log.Log("Subscribed to events");
            try
            {
                YUR_Log.Log("Getting Last Logged In User ID");
                string path = Utilities.YUR_Conversions.PathCombine(Application.persistentDataPath, YUR_Constants.LAST_ACTIVE_USER_FILEPATH);
                Directory.CreateDirectory(path);
                path += "active.txt";
                YUR_Log.Log("Looking here: " + path);
                if (File.Exists(path))
                {
                    Last_Played_User = File.ReadAllText(path);
                    YUR_Log.Log("Last uid: " + Last_Played_User);
                }
                else
                {
                    YUR_Log.Log("Last user was not saved!");
                }

                StartCoroutine(LoadUsers());
            }
            catch (System.Exception e)
            {
                YUR_Log.Error(e.ToString());
            }
        }