Merge remote-tracking branch 'origin/1.9' into 1.9
This commit is contained in:
@@ -33,11 +33,25 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
names.Add(mapping.Name);
|
||||
}
|
||||
_comboBox.Items = names;
|
||||
if (Values[0] is InputEvent inputEvent && names.Contains(inputEvent.Name))
|
||||
var prev = GetValue();
|
||||
if (prev is InputEvent inputEvent && names.Contains(inputEvent.Name))
|
||||
_comboBox.SelectedItem = inputEvent.Name;
|
||||
else if (prev is string name && names.Contains(name))
|
||||
_comboBox.SelectedItem = name;
|
||||
_comboBox.SelectedIndexChanged += OnSelectedIndexChanged;
|
||||
}
|
||||
|
||||
private object GetValue()
|
||||
{
|
||||
if (Values[0] is InputEvent inputEvent)
|
||||
return inputEvent;
|
||||
if (Values[0] is string str)
|
||||
return str;
|
||||
if (Values.Type.Type == typeof(string))
|
||||
return string.Empty;
|
||||
return null;
|
||||
}
|
||||
|
||||
private void OnSetupContextMenu(PropertyNameLabel label, ContextMenu menu, CustomEditor linkedEditor)
|
||||
{
|
||||
var button = menu.AddButton("Set to null");
|
||||
@@ -46,7 +60,16 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
|
||||
private void OnSelectedIndexChanged(ComboBox comboBox)
|
||||
{
|
||||
SetValue(comboBox.SelectedItem == null ? null : new InputEvent(comboBox.SelectedItem));
|
||||
object value = null;
|
||||
if (comboBox.SelectedItem != null)
|
||||
{
|
||||
var prev = GetValue();
|
||||
if (prev is InputEvent)
|
||||
value = new InputEvent(comboBox.SelectedItem);
|
||||
else if (prev is string)
|
||||
value = comboBox.SelectedItem;
|
||||
}
|
||||
SetValue(value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -59,8 +82,11 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Values[0] is InputEvent inputEvent && _comboBox.Items.Contains(inputEvent.Name))
|
||||
var prev = GetValue();
|
||||
if (prev is InputEvent inputEvent && _comboBox.Items.Contains(inputEvent.Name))
|
||||
_comboBox.SelectedItem = inputEvent.Name;
|
||||
else if (prev is string name && _comboBox.Items.Contains(name))
|
||||
_comboBox.SelectedItem = name;
|
||||
else
|
||||
_comboBox.SelectedItem = null;
|
||||
}
|
||||
|
||||
@@ -156,6 +156,12 @@ Action Scripting::ScriptsLoaded;
|
||||
Action Scripting::ScriptsUnload;
|
||||
Action Scripting::ScriptsReloading;
|
||||
Action Scripting::ScriptsReloaded;
|
||||
Action Scripting::Update;
|
||||
Action Scripting::LateUpdate;
|
||||
Action Scripting::FixedUpdate;
|
||||
Action Scripting::LateFixedUpdate;
|
||||
Action Scripting::Draw;
|
||||
Action Scripting::Exit;
|
||||
ThreadLocal<Scripting::IdsMappingTable*, PLATFORM_THREADS_LIMIT> Scripting::ObjectsLookupIdMapping;
|
||||
ScriptingService ScriptingServiceInstance;
|
||||
|
||||
@@ -205,9 +211,9 @@ bool ScriptingService::Init()
|
||||
}
|
||||
|
||||
#if COMPILE_WITHOUT_CSHARP
|
||||
#define INVOKE_EVENT(name)
|
||||
#define INVOKE_EVENT(name) Scripting::name();
|
||||
#else
|
||||
#define INVOKE_EVENT(name) \
|
||||
#define INVOKE_EVENT(name) Scripting::name(); \
|
||||
if (!_isEngineAssemblyLoaded) return; \
|
||||
if (_method_##name == nullptr) \
|
||||
{ \
|
||||
|
||||
@@ -44,6 +44,36 @@ public:
|
||||
/// </summary>
|
||||
static Delegate<> ScriptsReloaded;
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
/// Occurs on scripting update.
|
||||
/// </summary>
|
||||
static Delegate<> Update;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs on scripting late update.
|
||||
/// </summary>
|
||||
static Delegate<> LateUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs on scripting fixed update.
|
||||
/// </summary>
|
||||
static Delegate<> FixedUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs on scripting late fixed update.
|
||||
/// </summary>
|
||||
static Delegate<> LateFixedUpdate;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs on scripting draw update. Called during frame rendering and can be used to invoke custom rendering with GPUDevice.
|
||||
/// </summary>
|
||||
static Delegate<> Draw;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when scripting engine is disposing. Engine is during closing and some services may be unavailable (eg. loading scenes). This may be called after the engine fatal error event.
|
||||
/// </summary>
|
||||
static Delegate<> Exit;
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user