67 lines
1.5 KiB
C#
67 lines
1.5 KiB
C#
|
|
using Godot;
|
|
using System.Collections.Generic;
|
|
using System;
|
|
namespace Rokojori
|
|
{
|
|
[Tool]
|
|
[GlobalClass,Icon("res://addons/rokojori_action_library/Icons/SensorManager.svg")]
|
|
public partial class SensorManagerSetup: Node
|
|
{
|
|
[Export]
|
|
public bool initializeOnReady = true;
|
|
|
|
[Export]
|
|
public Sensor[] sensors = [];
|
|
|
|
[Export]
|
|
public SensorGroup[] sensorGroups = [];
|
|
|
|
[Export]
|
|
public bool processSensors = true;
|
|
|
|
[Export]
|
|
public Node[] autoScanForSensors = [];
|
|
|
|
[Export]
|
|
public bool autoScanParent = true;
|
|
|
|
[Export]
|
|
public bool separateMouseAndKeyboardTracking = false;
|
|
|
|
[Export]
|
|
public Action onActiveDeviceChange;
|
|
|
|
[Export]
|
|
public bool showRegistratedSensors = true;
|
|
|
|
public override void _Ready()
|
|
{
|
|
if ( Engine.IsEditorHint() )
|
|
{
|
|
return;
|
|
}
|
|
|
|
var sm = this.CreateChild<SensorManager>( "SensorManager" );
|
|
|
|
sm.sensors = sensors;
|
|
sm.sensorGroups = sensorGroups;
|
|
sm.processSensors = processSensors;
|
|
sm.autoScanForSensors = autoScanForSensors;
|
|
sm.separateMouseAndKeyboardTracking = separateMouseAndKeyboardTracking;
|
|
sm.onActiveDeviceChange = onActiveDeviceChange;
|
|
sm.showRegistratedSensors = showRegistratedSensors;
|
|
|
|
if ( autoScanParent )
|
|
{
|
|
sm.autoScanForSensors = Arrays.Add( sm.autoScanForSensors, GetParent() );
|
|
}
|
|
|
|
if ( initializeOnReady )
|
|
{
|
|
sm.Initialize();
|
|
}
|
|
}
|
|
|
|
}
|
|
} |