Thomas ICHÉ
5 年前
当前提交
41aa70e7
共有 16 个文件被更改,包括 299 次插入 和 35 次删除
-
2Editor/GameViewLink/LinkGameView.cs
-
7Editor/GameplayIngredients-Editor.asmdef
-
18Editor/HierarchyHints/HierarchyHints.cs
-
107Resources/Default_VirtualCameraManager.prefab
-
4Runtime/Controllers/KeyboardGamepadPlayerInput.cs
-
4Runtime/GameplayIngredients.asmdef
-
2Runtime/LevelScripting/Actions/FocusUIAction.cs
-
18Runtime/LevelScripting/Callable.cs
-
2Runtime/Managers/Implementations/LevelStreamingManager.cs
-
21Runtime/Managers/Implementations/VirtualCameraManager.cs
-
30Editor/PropertyDrawers/UITogglePropertyDrawer.cs
-
11Editor/PropertyDrawers/UITogglePropertyDrawer.cs.meta
-
53Runtime/LevelScripting/Actions/ToggleUIAction.cs
-
11Runtime/LevelScripting/Actions/ToggleUIAction.cs.meta
-
33Runtime/LevelScripting/Logic/PlatformLogic.cs
-
11Runtime/LevelScripting/Logic/PlatformLogic.cs.meta
|
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
using UnityEditor; |
|||
|
|||
namespace GameplayIngredients.Editor |
|||
{ |
|||
[CustomPropertyDrawer(typeof(Actions.ToggleUIAction.UIToggle))] |
|||
public class UITogglePropertyDrawer : PropertyDrawer |
|||
{ |
|||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) |
|||
{ |
|||
var toggle = property.FindPropertyRelative("State"); |
|||
var obj = property.FindPropertyRelative("Selectable"); |
|||
|
|||
var toggleRect = new Rect(position); |
|||
toggleRect.xMin = toggleRect.xMax - 80; |
|||
|
|||
var objRect = new Rect(position); |
|||
objRect.xMax -= 80; |
|||
|
|||
toggle.intValue = EditorGUI.IntPopup(toggleRect, toggle.intValue, labels, values); |
|||
obj.objectReferenceValue = EditorGUI.ObjectField(objRect, obj.objectReferenceValue, typeof(Selectable), true); |
|||
} |
|||
|
|||
static GUIContent[] labels = { new GUIContent("Disable"), new GUIContent("Enable"), new GUIContent("Toggle") }; |
|||
static int[] values = { 0, 1, 2 }; |
|||
} |
|||
} |
|||
|
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 205551f5f51d20a4c85e2a619e35df8a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using NaughtyAttributes; |
|||
using UnityEngine; |
|||
using UnityEngine.UI; |
|||
|
|||
namespace GameplayIngredients.Actions |
|||
{ |
|||
public class ToggleUIAction : ActionBase |
|||
{ |
|||
[ReorderableList] |
|||
public UIToggle[] Targets; |
|||
|
|||
public override void Execute(GameObject instigator = null) |
|||
{ |
|||
foreach (var target in Targets) |
|||
{ |
|||
if (target.Selectable == null) |
|||
{ |
|||
Debug.Log("Target is null, ignoring"); |
|||
} |
|||
else |
|||
{ |
|||
switch (target.State) |
|||
{ |
|||
case UIToggle.UIToggleState.Disable: |
|||
target.Selectable.interactable = false; |
|||
break; |
|||
case UIToggle.UIToggleState.Enable: |
|||
target.Selectable.interactable = true; |
|||
break; |
|||
case UIToggle.UIToggleState.Toggle: |
|||
target.Selectable.interactable = !target.Selectable.interactable; |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
[System.Serializable] |
|||
public struct UIToggle |
|||
{ |
|||
[System.Serializable] |
|||
public enum UIToggleState |
|||
{ |
|||
Disable = 0, |
|||
Enable = 1, |
|||
Toggle = 2 |
|||
} |
|||
|
|||
public Selectable Selectable; |
|||
public UIToggleState State; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 3d984678c21b1754da3b073c268f8304 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using NaughtyAttributes; |
|||
using System.Collections; |
|||
using System.Linq; |
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
|
|||
namespace GameplayIngredients.Logic |
|||
{ |
|||
public class PlatformLogic : LogicBase |
|||
{ |
|||
public enum InclusionMode |
|||
{ |
|||
IsTarget, |
|||
IsNotTarget |
|||
} |
|||
|
|||
[ReorderableList] |
|||
public RuntimePlatform[] platforms; |
|||
|
|||
public InclusionMode inclusionMode = InclusionMode.IsTarget; |
|||
|
|||
[ReorderableList] |
|||
public Callable[] Calls; |
|||
|
|||
public override void Execute(GameObject instigator = null) |
|||
{ |
|||
|
|||
if(platforms.Contains(Application.platform) == (inclusionMode == InclusionMode.IsTarget)) |
|||
Call(Calls, instigator); |
|||
} |
|||
} |
|||
} |
|||
|
|
|||
fileFormatVersion: 2 |
|||
guid: 3a2d9e7c18466144eaae9232d1d52e61 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {fileID: 2800000, guid: 6d0a734cdedf48d478f3fcc7612af66f, type: 3} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue