浏览代码

Fixed Level Streaming Manager / Additional Check to Messager / Added OnButtonDownHook

/main
Thomas ICHÉ 6 年前
当前提交
db960e31
共有 7 个文件被更改,包括 65 次插入23 次删除
  1. 20
      Resources/Default_LevelStreamingManager.prefab
  2. 14
      Runtime/Hooks/OnKeyDownHook.cs
  3. 10
      Runtime/Hooks/OnMessageHook.cs
  4. 4
      Runtime/LevelStreaming/LevelStreamingManager.cs
  5. 2
      Runtime/Messager/Messager.cs
  6. 27
      Runtime/Hooks/OnButtonDownHook.cs
  7. 11
      Runtime/Hooks/OnButtonDownHook.cs.meta

20
Resources/Default_LevelStreamingManager.prefab


- {fileID: 4237660106701817725}
- {fileID: 4237660106123981089}
- {fileID: 4237660106447583619}
- {fileID: 4237660107457405504}
m_Father: {fileID: 4237660107855997384}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4237660107457405504}
m_Children: []
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 8}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 0, y: 0.5}
m_AnchoredPosition: {x: 240, y: -16}
m_SizeDelta: {x: 480, y: 8}
m_Pivot: {x: 0.5, y: 0}
--- !u!222 &4237660106447583617
CanvasRenderer:

m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4237660107457405505}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -5}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_Father: {fileID: 4237660106447583619}
m_RootOrder: 0
m_Father: {fileID: 4237660105901699950}
m_RootOrder: 3
m_AnchoredPosition: {x: 0, y: -4}
m_AnchoredPosition: {x: 0, y: -16}
m_SizeDelta: {x: 40, y: 8}
m_Pivot: {x: 0, y: 0}
--- !u!222 &4237660107457405534

14
Runtime/Hooks/OnKeyDownHook.cs


{
public class OnKeyDownHook : HookBase
{
public enum ActionType
{
KeyDown,
KeyUp
}
public Callable[] OnKeyDownEvent;
public Callable[] OnKeyDown;
public Callable[] OnKeyUpEvent;
public Callable[] OnKeyUp;
Callable.Call(OnKeyDownEvent, gameObject);
Callable.Call(OnKeyDown, gameObject);
Callable.Call(OnKeyUpEvent, gameObject);
Callable.Call(OnKeyUp, gameObject);
}
}
}

10
Runtime/Hooks/OnMessageHook.cs


void Execute()
{
Callable.Call(OnMessageRecieved, gameObject);
try
{
Callable.Call(OnMessageRecieved, gameObject);
}
catch(System.Exception e)
{
UnityEngine.Debug.LogError(string.Format("Exception Caught while catching message '{0}' on Object '{1}'", MessageName, gameObject.name));
UnityEngine.Debug.LogException(e);
}
}

4
Runtime/LevelStreaming/LevelStreamingManager.cs


// Update UI
PercentageText.text = ((int)(m_CurrentPercentage * 100)) + "%";
ProgressBar.GetComponent<RectTransform>().localScale = new Vector2(m_CurrentPercentage, 1.0f);
Vector2 size = ProgressBar.GetComponent<RectTransform>().sizeDelta;
size.x = m_CurrentPercentage * ProgressBarContainer.GetComponent<RectTransform>().sizeDelta.x;
ProgressBar.GetComponent<RectTransform>().sizeDelta = size;
//Debug
if (EnableDebug)

2
Runtime/Messager/Messager.cs


{
var currentEvent = m_RegisteredEvents[eventName];
currentEvent -= action;
if (currentEvent == null)
if (currentEvent == null || currentEvent.GetInvocationList().Length == 0)
m_RegisteredEvents.Remove(eventName);
}

27
Runtime/Hooks/OnButtonDownHook.cs


using NaughtyAttributes;
using UnityEngine;
namespace GameplayIngredients.Hooks
{
public class OnButtonDownHook : HookBase
{
public string Button = "Fire1";
[ReorderableList]
public Callable[] OnButtonDown;
[ReorderableList]
public Callable[] OnButtonUp;
void Update()
{
if (Input.GetButtonDown(Button))
Callable.Call(OnButtonDown, gameObject);
if (Input.GetButtonUp(Button))
Callable.Call(OnButtonUp, gameObject);
}
}
}

11
Runtime/Hooks/OnButtonDownHook.cs.meta


fileFormatVersion: 2
guid: 05f246f96cd54614b8232876837d4746
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: c912dd6c3d709974b8973f6e19c10e08, type: 3}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存