mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +00:00
pass ui handle in Plugin::on_ui_message
This commit is contained in:
@@ -2124,7 +2124,7 @@ impl Engine {
|
||||
};
|
||||
|
||||
for plugin in self.plugins.iter_mut() {
|
||||
plugin.on_ui_message(&mut context, &message);
|
||||
plugin.on_ui_message(&mut context, &message, ui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ use crate::{
|
||||
};
|
||||
use fyrox_core::define_as_any_trait;
|
||||
use fyrox_core::visitor::error::VisitError;
|
||||
use fyrox_ui::UserInterface;
|
||||
use std::{
|
||||
ops::{Deref, DerefMut},
|
||||
path::Path,
|
||||
@@ -317,12 +318,14 @@ pub trait Plugin: PluginAsAny + Visit + Reflect {
|
||||
fn on_graphics_context_destroyed(&mut self, #[allow(unused_variables)] context: PluginContext) {
|
||||
}
|
||||
|
||||
/// The method will be called when there is any message from main user interface instance
|
||||
/// of the engine.
|
||||
/// The method will be called when there is any message from a user interface (UI) instance
|
||||
/// of the engine. Use `ui_handle` parameter to find out from which UI the message has come
|
||||
/// from.
|
||||
fn on_ui_message(
|
||||
&mut self,
|
||||
#[allow(unused_variables)] context: &mut PluginContext,
|
||||
#[allow(unused_variables)] message: &UiMessage,
|
||||
#[allow(unused_variables)] ui_handle: Handle<UserInterface>,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ dylib-engine = ["fyrox/dylib"]
|
||||
use fyrox::{
|
||||
core::pool::Handle, core::visitor::prelude::*, core::reflect::prelude::*,
|
||||
event::Event,
|
||||
gui::message::UiMessage,
|
||||
gui::{message::UiMessage, UserInterface},
|
||||
plugin::{Plugin, PluginContext, PluginRegistrationContext},
|
||||
scene::Scene,
|
||||
};
|
||||
@@ -205,6 +205,7 @@ impl Plugin for Game {
|
||||
&mut self,
|
||||
_context: &mut PluginContext,
|
||||
_message: &UiMessage,
|
||||
_ui_handle: Handle<UserInterface>
|
||||
) {
|
||||
// Handle UI events here.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user