public static string GetUnableToEditResourceReason(ClaimKeeper keeper, string resourceId, string resourceName, GetInvalidResourceReason reason)
    {
        string ownerNickname = keeper.GetEffectiveOwnerNickname(resourceId);

        if (ownerNickname != null && !keeper.IsMine(resourceId))
        {
            return($"{ownerNickname} is editing '{resourceName}'.");
        }
        if (reason != null)
        {
            return(reason());
        }
        return(null);
    }
 private void TryClaim()
 {
     claimToken = claimKeeper.Claim(resourceClaimId);
     if (claimToken != null)
     {
         claimStatusChangedCallback?.Invoke(true);
         gameObject.SetActive(false);
     }
     else
     {
         timeSinceLastClaim        = Time.realtimeSinceStartup;
         waitingToEditMessage.text = $"Waiting to edit after {claimKeeper.GetEffectiveOwnerNickname(resourceClaimId)}";
         gameObject.SetActive(true);
     }
 }
Exemple #3
0
    private void RemoveSelectedParticleEffect()
    {
        string claimId = ParticleEffectSystem.PFX_CLAIM_PREFIX + selectedParticleEffectId;
        string owner   = claimKeeper.GetEffectiveOwnerNickname(claimId);

        if (owner == null || claimKeeper.IsMine(claimId))
        {
            particleEffectSystem.DeleteParticleEffect(selectedParticleEffectId);
        }
        else
        {
            popups.Show(
                $"Sorry, can't delete {name} right now. {owner} is editing it.",
                "Ok");
        }
    }