private void TokensSlide()
        {
            TutorialGUI.Paragraph(
                "Copy the game token and editor key you will see after " +
                "game creation into these fields and click the button."
                );

            TutorialGUI.Form(() => {
                if (preferences == null)
                {
                    preferences = UnisavePreferences.LoadOrCreate();
                }

                preferences.GameToken = EditorGUILayout.TextField(
                    "Game token", preferences.GameToken
                    );
                preferences.EditorKey = EditorGUILayout.TextField(
                    "Editor key", preferences.EditorKey
                    );

                if (GUILayout.Button("Save preferences & upload the backend"))
                {
                    preferences.BackendFolder = BackendFolderPath;
                    preferences.Save();

                    Uploader
                    .GetDefaultInstance()
                    .UploadBackend(
                        verbose: true,
                        useAnotherThread: true
                        );
                }
            });
        }
Exemple #2
0
        private List <BackendFile> RecalculateBackendHashAndGetFileList(
            out string backendHash
            )
        {
            // list all backend folders
            var backendFolders = new string[] {
                "Assets/" + preferences.BackendFolder
            };

            // get list of files to be uploaded
            var files = new List <BackendFile>();

            files.AddRange(CSharpFile.FindFiles(backendFolders));
            files.AddRange(SOFile.FindFiles(backendFolders));

            // compute file hashes
            files.ForEach(f => f.ComputeHash());

            // get all file hashes
            List <string> hashes = files.Select(f => f.Hash).ToList();

            // add hashes of contextual data (e.g. framework version)
            hashes.Add(Hash.MD5(FrameworkMeta.Version));

            // compute backend hash
            backendHash = Hash.CompositeMD5(hashes);

            // store the backend hash
            preferences.BackendHash = backendHash;
            preferences.Save();

            return(files);
        }
Exemple #3
0
 // called by unity, when keyboard focus is lost
 // BUT ALSO by this window when mouse leaves the window
 void OnLostFocus()
 {
     if (preferences != null)
     {
         BeforePreferencesSave();
         preferences.Save();
     }
 }