private void HandleSetIsEntitledToLevel(string userId, string levelId, EntitlementsStatus status) { if (userId == lastPlayer?.userId && levelId == lastLevelId) { SetLevelEntitlement(lastPlayer, status); } }
private void SetLevelEntitlement(IConnectedPlayer player, EntitlementsStatus status) { Color backgroundColor = status switch { EntitlementsStatus.Ok => green, EntitlementsStatus.NotOwned => red, _ => normal, }; backgroundColor.a = player.isMe ? 0.4f : 0.1f; _localPlayerBackgroundImage.color = backgroundColor; }
private void SetLevelEntitlement(IConnectedPlayer player, EntitlementsStatus status) { //Plugin.Log?.Debug($"{player.userId} has entitlement {status.ToString()}"); Color backgroundColor = status switch { EntitlementsStatus.Ok => green, EntitlementsStatus.NotOwned => red, _ => normal, }; backgroundColor.a = player.isMe ? 0.4f : 0.2f; _localPlayerBackgroundImage.color = backgroundColor; }
private async void GetLevelEntitlement(IConnectedPlayer player) { if (entitlementCts != null) { entitlementCts.Cancel(); } entitlementCts = new CancellationTokenSource(); string?levelId = _playersDataModel.GetPlayerBeatmapLevel(_playersDataModel.hostUserId)?.levelID; if (levelId == null) { return; } lastLevelId = levelId; EntitlementsStatus entitlement = player.isMe ? await _entitlementChecker.GetEntitlementStatus(levelId) : await _entitlementChecker.GetTcsTaskCanPlayerPlayLevel(player, levelId, entitlementCts.Token, out _); SetLevelEntitlement(player, entitlement); }