Firstborn/Library/PackageCache/com.unity.ads@4.4.2/Editor/DevX/Settings/GameIdsUi.cs
Schaken-Mods 9092858a58 updated to the latest editor
I updated everything to the latest Unity Editor. Also realized I had the wrong shaders on my hairs, those are fixed and the hairs look MUCH better!
2023-05-07 17:43:11 -05:00

50 lines
1.4 KiB
C#

#if SERVICES_SDK_CORE_ENABLED
using UnityEditor.Advertisements;
using UnityEngine.UIElements;
namespace UnityEngine.Advertisements.Editor
{
class GameIdsUi : VisualElement
{
VisualElement m_Container;
public GameIdsUi()
{
m_Container = UiUtils.GetUiFromTemplate(UiConstants.UiTemplatePaths.GameIds);
if (m_Container is null)
{
var message = string.Format(
UiConstants.Formats.TemplateNotFound, nameof(UiConstants.UiTemplatePaths.GameIds));
Debug.LogError(message);
return;
}
Add(m_Container);
RefreshGameIds();
}
public void RefreshGameIds()
{
SetUpGameIdFor(RuntimePlatform.IPhonePlayer, UiConstants.UiElementNames.AppleGameId);
SetUpGameIdFor(RuntimePlatform.Android, UiConstants.UiElementNames.AndroidGameId);
MarkDirtyRepaint();
}
void SetUpGameIdFor(RuntimePlatform platform, string fieldName)
{
var gameIdField = m_Container.Q<TextField>(fieldName);
if (gameIdField is null)
{
return;
}
var gameId = AdvertisementSettings.GetGameId(platform)
?? UiConstants.LocalizedStrings.Unavailable;
gameIdField.SetValueWithoutNotify(gameId);
}
}
}
#endif