Exemplo n.º 1
0
 /// <summary>
 /// Evaluate the profile value using the provided profile settings object and a profile id.
 /// </summary>
 /// <param name="profileSettings">The profile settings object.</param>
 /// <param name="profileId">The profile id.</param>
 /// <returns>The evaluated string stored in the referenced profile variable.</returns>
 public string GetValue(AddressableAssetProfileSettings profileSettings, string profileId)
 {
     if (profileSettings == null)
     {
         Debug.LogWarning("ProfileValueReference: AddressableAssetProfileSettings object is null.");
         return(null);
     }
     if (string.IsNullOrEmpty(profileId))
     {
         Debug.LogWarning("ProfileValueReference: GetValue called with invalid profileId.");
         return(null);
     }
     return(profileSettings.EvaluateString(profileId, profileSettings.GetValueById(profileId, m_Id)));
 }
            internal string GetValueById(string variableId)
            {
                var i = values.FindIndex(v => v.id == variableId);

                if (i >= 0)
                {
                    return(values[i].value);
                }


                if (m_ProfileParent == null)
                {
                    return(null);
                }

                return(m_ProfileParent.GetValueById(m_InheritedParent, variableId));
            }
            internal static string Evaluate(AddressableAssetProfileSettings ps, string profileId, string idString)
            {
                string baseValue = ps.GetValueById(profileId, idString);

                return(ps.EvaluateString(profileId, baseValue));
            }