Esempio n. 1
0
    /**
     * Starts the timer if it's not already running AND if the timer isn't already complete
     * @returns true if the timer was started, false otherwise
     **/
    public bool start()
    {
        if (complete)
        {
            return(false);
        }

        startedAt = new DaggerfallDateTime();
        startedAt.FromSeconds(worldTime.Now.ToSeconds());

        running = true;
        return(true);
    }
        void UpdateSelectedSaveInfo()
        {
            // Clear info if no save selected
            if (saveNameTextBox.Text.Length == 0 || savesList.SelectedIndex < 0)
            {
                screenshotPanel.BackgroundTexture = null;
                saveVersionLabel.Text             = string.Empty;
                saveFolderLabel.Text             = string.Empty;
                saveTimeLabel.Text               = string.Empty;
                gameTimeLabel.Text               = string.Empty;
                renameSaveButton.BackgroundColor = namePanelBackgroundColor;
                deleteSaveButton.BackgroundColor = namePanelBackgroundColor;
                return;
            }

            // Get save key
            int key = GameManager.Instance.SaveLoadManager.FindSaveFolderByNames(currentPlayerName, saveNameTextBox.Text);

            if (key == -1)
            {
                return;
            }

            // Destroy old background texture
            if (screenshotPanel.BackgroundTexture)
            {
                UnityEngine.Object.Destroy(screenshotPanel.BackgroundTexture);
                screenshotPanel.BackgroundTexture = null;
            }

            // Get save info and texture
            string      path        = GameManager.Instance.SaveLoadManager.GetSaveFolder(key);
            SaveInfo_v1 saveInfo    = GameManager.Instance.SaveLoadManager.GetSaveInfo(key);
            Texture2D   saveTexture = GameManager.Instance.SaveLoadManager.GetSaveScreenshot(key);

            if (saveTexture != null)
            {
                screenshotPanel.BackgroundTexture = saveTexture;
            }

            // Show save info
            DaggerfallDateTime dfDateTime = new DaggerfallDateTime();

            dfDateTime.FromSeconds(saveInfo.dateAndTime.gameTime);
            saveVersionLabel.Text            = string.Format("V{0}", saveInfo.saveVersion);
            saveFolderLabel.Text             = Path.GetFileName(path);
            saveTimeLabel.Text               = DateTime.FromBinary(saveInfo.dateAndTime.realTime).ToLongDateString();
            gameTimeLabel.Text               = dfDateTime.MidDateTimeString();
            renameSaveButton.BackgroundColor = saveButtonBackgroundColor;
            deleteSaveButton.BackgroundColor = cancelButtonBackgroundColor;
        }