// Use this for initialization
    void Awake()
    {
        playerLives    = 3;
        Time.timeScale = 1;
        restartTimer   = Time.time + 5.5f;
        hud            = GameObject.FindObjectOfType <PlayerHUD>();
        player         = GameObject.FindObjectOfType <PlayerMan>();
        stopWatch      = GameObject.FindObjectOfType <StopWatchManager>();
        timeSubmit     = GameObject.FindObjectOfType <TimeSaveController>();
        if (playerName == null)
        {
            playerName = "tester";
        }
        //Debug.Log("Game Manager Loaded");

        //InputMap
        jump      = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("jumpKey", "Space"));
        attack    = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("attackKey", "F"));
        left      = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("leftKey", "A"));
        right     = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("rightKey", "D"));
        setIce    = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("iceKey", "Alpha3"));
        setFire   = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("fireKey", "Alpha2"));
        setArcane = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("arcaneKey", "Alpha1"));
        pause     = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("pauseKey", "Escape"));
    }
Ejemplo n.º 2
0
        public void BasicTest()
        {
            StopWatchManager sw = new StopWatchManager();

            Assert.IsNotNull(sw);
        }
Ejemplo n.º 3
0
 void Awake()
 {
     stopWatch = Object.FindObjectOfType <StopWatchManager>();
     stopWatch.ClearTime();
 }
Ejemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();
            primarySaveDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\" + appNameAppID;

            if (!System.IO.Directory.Exists(primarySaveDirectory))
            {
                System.IO.Directory.CreateDirectory(primarySaveDirectory);
            }

            xmlUserSettingsLocation = primarySaveDirectory + "\\UserSettings.xml";
            stopWatchUserSettings   = new UserSettings();
            xmlUserSettings         = new XmlUserSettings(
                xmlUserSettingsLocation,
                stopWatchUserSettings);

            LoadUserPreferences();

            SqliteDatabase.ReadySqliteDatabase(primarySaveDirectory, "TimeTracker.db");
            SqliteDataAccess.DefaultConnectionString = "Data Source=" + System.IO.Path.Combine(primarySaveDirectory, "TimeTracker.db");

            stopWatches = new List <StopWatchManager>();
            for (int i = 1; i <= stopWatchUserSettings.StopWatchInstances; i++)
            {
                stopWatches.Add(new StopWatchManager(
                                    "StopWatch" + i,
                                    primarySaveDirectory,
                                    StartingYLocation + ((i - 1) * YPadding),
                                    this,
                                    lblMainDisplay,
                                    stopWatchUserSettings.IncludeMicroseconds,
                                    stopWatchUserSettings.DatabaseCommitOption,
                                    BtnStartStop_Click,
                                    BtnReset_Click));
            }

            adminTimer = new StopWatchManager(
                "AdminStopWatch",
                primarySaveDirectory,
                lblAdminTimer,
                stopWatchUserSettings.IncludeMicroseconds);

            string adminStartTimeLocation = primarySaveDirectory + "\\AdminStartTime.dat";

            if (!System.IO.File.Exists(adminStartTimeLocation))
            {
                System.IO.FileStream fs = System.IO.File.Create(adminStartTimeLocation);
                fs.Close();
            }

            System.IO.TextReader textReader = new System.IO.StreamReader(adminStartTimeLocation);
            try
            {
                if (DateTime.Now.Date != Convert.ToDateTime(textReader.ReadLine()).Date)
                {
                    adminTimer.StopWatch.Reset();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                textReader.Close();
            }

            System.IO.TextWriter textWriter = new System.IO.StreamWriter(adminStartTimeLocation);
            try
            {
                textWriter.WriteLine(Convert.ToString(DateTime.Now));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                textWriter.Close();
            }

            adminTimer.StopWatch.StartStop();

            appUpdater                   = new ApplicationUpdater(this);
            bgWorker                     = new BackgroundWorker();
            bgWorker.DoWork             += BgWorker_DoWork;
            bgWorker.RunWorkerCompleted += BgWorker_RunWorkerCompleted;
            bgWorker.RunWorkerAsync();
            lblUpdate.Text = "Checking for updates....";

            LoadInitialDataFromDatabase();
            LoadStats();
        }