Repository URL to install this package:
|
Version:
2025.1.8 ▾
|
io.gs2.unity.sdk.uikit
/
Editor
/
Gs2AdReward
/
View
/
Enabler
/
Gs2AdRewardOwnPointPointEnablerEditorExtension.cs
|
|---|
/*
* Copyright 2016 Game Server Services, Inc. or its affiliates. All Rights
* Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable CheckNamespace
// ReSharper disable RedundantNameQualifier
// ReSharper disable RedundantAssignment
// ReSharper disable NotAccessedVariable
// ReSharper disable RedundantUsingDirective
// ReSharper disable Unity.NoNullPropagation
// ReSharper disable InconsistentNaming
#pragma warning disable CS0472
using Gs2.Unity.Gs2AdReward.ScriptableObject;
using Gs2.Unity.UiKit.Gs2AdReward.Context;
using UnityEditor;
using UnityEngine;
namespace Gs2.Unity.UiKit.Gs2AdReward.Editor
{
[CustomEditor(typeof(Gs2AdRewardOwnPointPointEnabler))]
public class Gs2AdRewardOwnPointPointEnablerEditorExtension : UnityEditor.Editor
{
public override void OnInspectorGUI() {
var original = target as Gs2AdRewardOwnPointPointEnabler;
if (original == null) return;
var context = original.GetComponent<Gs2AdRewardOwnPointContext>() ?? original.GetComponentInParent<Gs2AdRewardOwnPointContext>(true);
if (context == null) {
EditorGUILayout.HelpBox("Gs2AdRewardOwnPointContext not found.", MessageType.Error);
if (GUILayout.Button("Add Context")) {
original.gameObject.AddComponent<Gs2AdRewardOwnPointContext>();
}
}
else {
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.ObjectField("Context", context.gameObject, typeof(Gs2AdRewardOwnPointContext), false);
EditorGUI.indentLevel++;
context.Point = EditorGUILayout.ObjectField("Point", context.Point, typeof(OwnPoint), false) as OwnPoint;
if (context.Point != null) {
EditorGUI.indentLevel++;
EditorGUILayout.TextField("NamespaceName", context.Point?.NamespaceName?.ToString());
EditorGUI.indentLevel--;
}
EditorGUI.indentLevel--;
EditorGUI.EndDisabledGroup();
}
serializedObject.Update();
EditorGUILayout.PropertyField(serializedObject.FindProperty("expression"), true);
if (original.expression == Gs2AdRewardOwnPointPointEnabler.Expression.In || original.expression == Gs2AdRewardOwnPointPointEnabler.Expression.NotIn) {
EditorGUILayout.PropertyField(serializedObject.FindProperty("enablePoints"), true);
} else {
EditorGUILayout.PropertyField(serializedObject.FindProperty("enablePoint"), true);
}
EditorGUILayout.PropertyField(serializedObject.FindProperty("target"), true);
serializedObject.ApplyModifiedProperties();
}
}
}