private GUIStyle GetDownloadingMessageStyle(DownloadingStatus downloadingStatus) { var style = new GUIStyle(GUI.skin.GetStyle("Label")); switch (downloadingStatus) { case DownloadingStatus.ReadyToDownload: { style.normal.textColor = Color.white; } break; case DownloadingStatus.Downloading: { style.normal.textColor = Color.yellow; } break; case DownloadingStatus.DownloadingComplete: { style.normal.textColor = Color.green; } break; default: break; } return(style); }
private string GetDownloadingStatus(DownloadingStatus downloadingStatus) { switch (downloadingStatus) { case DownloadingStatus.ReadyToDownload: { return("Ready to download"); } case DownloadingStatus.Downloading: { return("Downloading..."); } case DownloadingStatus.DownloadingComplete: { return("Downloading complete"); } default: { return(""); } } }
private void ShowLoadingTab() { EditorGUILayout.LabelField("Development table", EditorStyles.boldLabel); EditorGUILayout.LabelField("Status:", GetDownloadingStatus(developmentTableDownloadStatus), GetDownloadingMessageStyle(developmentTableDownloadStatus)); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Download")) { developmentTableDownloadStatus = DownloadingStatus.Downloading; LocalizatorWebLoader.DownloadTranslationFileFromEditorWindow(BuildType.Development, () => OnDownloadingEnded(BuildType.Development)); } DrawSpace(2); EditorGUILayout.EndHorizontal(); DrawSpace(2); EditorGUILayout.LabelField("Release table", EditorStyles.boldLabel); EditorGUILayout.LabelField("Status:", GetDownloadingStatus(releaseTableDownloadStatus), GetDownloadingMessageStyle(releaseTableDownloadStatus)); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Download")) { releaseTableDownloadStatus = DownloadingStatus.Downloading; LocalizatorWebLoader.DownloadTranslationFileFromEditorWindow(BuildType.Release, () => OnDownloadingEnded(BuildType.Release)); } DrawSpace(2); EditorGUILayout.EndHorizontal(); DrawCloseButton(); }
private void OnDownloadingEnded(BuildType buildType) { switch (buildType) { case BuildType.Release: { releaseTableDownloadStatus = DownloadingStatus.DownloadingComplete; } break; case BuildType.Development: { developmentTableDownloadStatus = DownloadingStatus.DownloadingComplete; } break; default: break; } }