private void SetStatus(AssetDeliveryStatus status, AssetDeliveryErrorCode error) { StatusText.text = status.ToString(); switch (status) { case AssetDeliveryStatus.Pending: case AssetDeliveryStatus.Retrieving: ShowButtons(CancelDownloadButton); ColorTint.color = NeutralColor; break; case AssetDeliveryStatus.WaitingForWifi: ShowButtons(ShowCellularDialogButton); ColorTint.color = NeutralColor; break; case AssetDeliveryStatus.Loading: HideButtons(); ColorTint.color = NeutralColor; break; case AssetDeliveryStatus.Loaded: ShowButtons(LoadSceneButton, RemoveButton); ColorTint.color = SuccessColor; break; case AssetDeliveryStatus.Failed: ShowButtons(RetrieveAssetBundleButton); ColorTint.color = ErrorColor; break; default: HideButtons(); ColorTint.color = NeutralColor; break; } if (error != AssetDeliveryErrorCode.NoError) { StatusText.text = string.Format("{0}: {1}", status.ToString(), error.ToString()); RetrieveAssetBundleButtonText.text = "Try Again"; } }
public void SetStatus(AssetDeliveryStatus status, AssetDeliveryErrorCode error) { StatusText.text = status.ToString(); if (_buttonsByStatus.ContainsKey(status)) { ShowButtons(_buttonsByStatus[status].ToArray()); } else { HideButtons(); ColorTint.color = NeutralColor; } if (_colorsByStatus.ContainsKey(status)) { ColorTint.color = _colorsByStatus[status]; } if (error != AssetDeliveryErrorCode.NoError) { StatusText.text = string.Format("{0}: {1}", status.ToString(), error.ToString()); RetrieveButtonText.text = "Try Again"; } }