private void CreateGUI() { AssetUpdater updater = AssetUpdater.Instance; _gui = new GUIVertical(); GUIScrollView scrollView = _gui.Add(new GUIScrollView()) as GUIScrollView; scrollView.Add(new GUILabel(new GUIContent("Installed Assets"))); GUIStyle style = CreateBackgroundStyle(55, 70); _assetUpdateLabels = new List <GUILabel>(); _assetUpdateButtonContainers = new List <GUIHorizontal>(); GUIStyle statusStyle = new GUIStyle(); statusStyle.margin = new RectOffset(2, 4, 2, 2); statusStyle.normal.textColor = new Color(0.7f, 0.7f, 0.7f); statusStyle.alignment = TextAnchor.MiddleRight; int count = updater.AssetCount; for (int i = 0; i < count; i++) { AssetVersion localVersion = updater.GetLocalVersion(i); AssetVersion remoteVersion = updater.GetRemoteVersion(i); GUIHorizontal bar = scrollView.Add(new GUIHorizontal(style)) as GUIHorizontal; GUIVertical infoContainer = bar.Add(new GUIVertical()) as GUIVertical; infoContainer.Add(new GUILabel(new GUIContent(localVersion.Name + " (" + localVersion.Version + ")"))); infoContainer.Add(new GUILabel(new GUIContent(localVersion.Author))); string labelText = UpdateTextForVersion(localVersion, remoteVersion); GUIVertical updateContainer = bar.Add(new GUIVertical()) as GUIVertical; GUILabel label = updateContainer.Add(new GUILabel(new GUIContent(labelText))) as GUILabel; label.style = statusStyle; GUIHorizontal buttonsContainer = updateContainer.Add(new GUIHorizontal()) as GUIHorizontal; GUIButton button = buttonsContainer.Add(new GUIButton(new GUIContent("Release Notes"), ReleaseNotesButtonPressed)) as GUIButton; button.tag = i; button = buttonsContainer.Add(new GUIButton(new GUIContent("Download"), DownloadButtonPressed)) as GUIButton; button.tag = i; buttonsContainer.isHidden = remoteVersion == null || (localVersion.Version < remoteVersion.Version) == false; _assetUpdateLabels.Add(label); _assetUpdateButtonContainers.Add(buttonsContainer); } GUIHorizontal refreshContainer = scrollView.Add(new GUIHorizontal()) as GUIHorizontal; refreshContainer.Add(new GUISpace(true)); refreshContainer.Add(new GUIButton(new GUIContent("Refresh"), RefreshButtonPressed)); }
private void RemoteVersionDownloadFinished(AssetUpdater updater, int assetIndex) { AssetVersion local = AssetUpdater.Instance.GetLocalVersion(assetIndex); AssetVersion remote = AssetUpdater.Instance.GetRemoteVersion(assetIndex); _assetUpdateLabels[assetIndex].content.text = UpdateTextForVersion(local, remote); _downloadButtons[assetIndex].isHidden = (local.Version < remote.Version) == false; Repaint(); }
private void RemoteVersionDownloadFinished( AssetUpdater updater, int assetIndex) { AssetVersion local = AssetUpdater.Instance.GetLocalVersion( assetIndex); AssetVersion remote = AssetUpdater.Instance.GetRemoteVersion( assetIndex); _assetUpdateLabels[ assetIndex].content.text = UpdateTextForVersion( local, remote); _downloadButtons[ assetIndex].isHidden = (local.Version < remote.Version) == false; Repaint(); }
private void RemoteVersionDownloadFailed(AssetUpdater updater, int assetIndex) { _assetUpdateLabels[assetIndex].content.text = "Error: couldn't download update info"; Repaint(); }
private void RemoteVersionDownloadFailed( AssetUpdater updater, int assetIndex) { _assetUpdateLabels[ assetIndex].content.text = "Error: couldn't download update info"; Repaint(); }