Skip to main content

engage/generated/unity_engine/events/
unityevent.rs

1// @generated by il2cpp-bindgen — do not edit by hand.
2
3#[cfg(feature = "unity_engine-events-unityevent-types")]
4mod __types {
5    #[allow(unused_imports)] use ::unity::prelude::*;
6
7    use super::*;
8    use crate::{
9        system::object::{IObject, Object},
10        unity_engine::events::unityeventbase::{IUnityEventBase, UnityEventBase},
11    };
12
13    #[doc=include_str!(concat!(env!("CARGO_MANIFEST_DIR"),"/","docs/unity_engine/events/unityevent/UnityEvent.md"))]
14    #[::unity::class(namespace = "UnityEngine.Events", name = "UnityEvent")]
15    #[parent(crate::unity_engine::events::unityeventbase::UnityEventBase)]
16    pub struct UnityEvent {
17        #[offset(40)]
18        #[rename(name = "m_InvokeArray")]
19        pub m_invoke_array: ::unity::Array<crate::system::object::Object>,
20    }
21}
22
23#[cfg(feature = "unity_engine-events-unityevent-types")]
24pub use __types::*;
25
26#[cfg(feature = "unity_engine-events-unityevent")]
27impl UnityEvent {
28    #[doc = "`GetDelegate(crate::unity_engine::events::unityaction::UnityAction)` overload"]
29    pub fn get_delegate_2(
30        action: impl ::core::convert::Into<crate::unity_engine::events::unityaction::UnityAction>,
31    ) -> crate::unity_engine::events::baseinvokablecall::BaseInvokableCall {
32        unsafe {
33            ::unity::il2cpp_call!((::unity::module_base()+0x3793bf0usize)as*mut u8,crate::unity_engine::events::baseinvokablecall::BaseInvokableCall;
34(crate::unity_engine::events::unityaction::UnityAction)::core::convert::Into::into(action))
35        }
36    }
37}
38
39#[cfg(feature = "unity_engine-events-unityevent")]
40pub trait IUnityEventMethods: IUnityEvent {
41    #[doc = "`.ctor()` overload"]
42    fn ctor(self) -> () {
43        unsafe {
44            let __receiver = <UnityEvent as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
45            ::unity::il2cpp_call!((::unity::module_base()+0x3793a80usize)as*mut u8,();
46(UnityEvent)__receiver)
47        }
48    }
49    #[doc = "`AddListener(crate::unity_engine::events::unityaction::UnityAction)` overload"]
50    fn add_listener(self, call: impl ::core::convert::Into<crate::unity_engine::events::unityaction::UnityAction>) -> () {
51        unsafe {
52            let __receiver = <UnityEvent as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
53            ::unity::il2cpp_call!((::unity::module_base()+0x3793b70usize)as*mut u8,();
54(UnityEvent)__receiver,(crate::unity_engine::events::unityaction::UnityAction)::core::convert::Into::into(call))
55        }
56    }
57    #[doc = "`RemoveListener(crate::unity_engine::events::unityaction::UnityAction)` overload"]
58    fn remove_listener(self, call: impl ::core::convert::Into<crate::unity_engine::events::unityaction::UnityAction>) -> () {
59        unsafe {
60            let __receiver = <UnityEvent as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
61            ::unity::il2cpp_call!((::unity::module_base()+0x3793c70usize)as*mut u8,();
62(UnityEvent)__receiver,(crate::unity_engine::events::unityaction::UnityAction)::core::convert::Into::into(call))
63        }
64    }
65    #[doc = "`FindMethod_Impl(::unity::Il2CppString, ::unity::SystemType)` overload"]
66    fn find_method_impl(
67        self,
68        name: impl ::core::convert::Into<::unity::Il2CppString>,
69        target_obj_type: impl ::core::convert::Into<::unity::SystemType>,
70    ) -> crate::system::reflection::methodinfo::MethodInfo {
71        unsafe {
72            let __receiver = <UnityEvent as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
73            {
74                let __vt = ::unity::Cast::get_class(__receiver).raw().get_vtable();
75                let __vi = *__vt.get(6usize).unwrap_or_else(|| {
76                    panic!(
77                        "unity: virtual slot {}
78 out of range (vtable len {}
79) on the runtime class behind {}
80 (method `{}
81`)",
82                        6usize,
83                        __vt.len(),
84                        <UnityEvent as ::unity::ClassIdentity>::NAME,
85                        "FindMethod_Impl",
86                    )
87                });
88                let __inner: extern "C" fn(
89                    UnityEvent,
90                    ::unity::Il2CppString,
91                    ::unity::SystemType,
92                    ::unity::OptionalMethod,
93                ) -> crate::system::reflection::methodinfo::MethodInfo = ::core::mem::transmute(__vi.method_ptr);
94                let __mi: ::unity::OptionalMethod = ::core::option::Option::Some(&*(__vi.method_info as *const ::unity::MethodInfo as *const ()));
95                __inner(
96                    __receiver,
97                    ::core::convert::Into::into(name),
98                    ::core::convert::Into::into(target_obj_type),
99                    __mi,
100                )
101            }
102        }
103    }
104    #[doc = "`GetDelegate(crate::system::object::Object, crate::system::reflection::methodinfo::MethodInfo)` overload"]
105    fn get_delegate(
106        self,
107        target: impl ::core::convert::Into<crate::system::object::Object>,
108        the_function: impl ::core::convert::Into<crate::system::reflection::methodinfo::MethodInfo>,
109    ) -> crate::unity_engine::events::baseinvokablecall::BaseInvokableCall {
110        unsafe {
111            let __receiver = <UnityEvent as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
112            {
113                let __vt = ::unity::Cast::get_class(__receiver).raw().get_vtable();
114                let __vi = *__vt.get(7usize).unwrap_or_else(|| {
115                    panic!(
116                        "unity: virtual slot {}
117 out of range (vtable len {}
118) on the runtime class behind {}
119 (method `{}
120`)",
121                        7usize,
122                        __vt.len(),
123                        <UnityEvent as ::unity::ClassIdentity>::NAME,
124                        "GetDelegate",
125                    )
126                });
127                let __inner: extern "C" fn(
128                    UnityEvent,
129                    crate::system::object::Object,
130                    crate::system::reflection::methodinfo::MethodInfo,
131                    ::unity::OptionalMethod,
132                ) -> crate::unity_engine::events::baseinvokablecall::BaseInvokableCall = ::core::mem::transmute(__vi.method_ptr);
133                let __mi: ::unity::OptionalMethod = ::core::option::Option::Some(&*(__vi.method_info as *const ::unity::MethodInfo as *const ()));
134                __inner(
135                    __receiver,
136                    ::core::convert::Into::into(target),
137                    ::core::convert::Into::into(the_function),
138                    __mi,
139                )
140            }
141        }
142    }
143    #[doc = "`Invoke()` overload"]
144    fn invoke(self) -> () {
145        unsafe {
146            let __receiver = <UnityEvent as ::unity::FromIlInstance>::from_il_instance(<Self as ::unity::SystemObject>::as_instance(self));
147            ::unity::il2cpp_call!((::unity::module_base()+0x3793f50usize)as*mut u8,();
148(UnityEvent)__receiver)
149        }
150    }
151}
152
153#[cfg(feature = "unity_engine-events-unityevent")]
154impl<__T: IUnityEvent> IUnityEventMethods for __T {}
155
156#[cfg(feature = "unity_engine-events-unityevent")]
157impl UnityEvent {
158    pub fn ctor_method_info() -> &'static ::unity::il2cpp::MethodInfo {
159        <Self as ::unity::ClassIdentity>::class().raw().get_methods()[0]
160    }
161
162    pub fn add_listener_method_info() -> &'static ::unity::il2cpp::MethodInfo {
163        <Self as ::unity::ClassIdentity>::class().raw().get_methods()[1]
164    }
165
166    pub fn remove_listener_method_info() -> &'static ::unity::il2cpp::MethodInfo {
167        <Self as ::unity::ClassIdentity>::class().raw().get_methods()[2]
168    }
169
170    pub fn find_method_impl_method_info() -> &'static ::unity::il2cpp::MethodInfo {
171        <Self as ::unity::ClassIdentity>::class().raw().get_methods()[3]
172    }
173
174    pub fn get_delegate_method_info() -> &'static ::unity::il2cpp::MethodInfo {
175        <Self as ::unity::ClassIdentity>::class().raw().get_methods()[4]
176    }
177
178    pub fn get_delegate_2_method_info() -> &'static ::unity::il2cpp::MethodInfo {
179        <Self as ::unity::ClassIdentity>::class().raw().get_methods()[5]
180    }
181
182    pub fn invoke_method_info() -> &'static ::unity::il2cpp::MethodInfo {
183        <Self as ::unity::ClassIdentity>::class().raw().get_methods()[6]
184    }
185}
186
187#[cfg(feature = "unity_engine-events-unityevent")]
188impl UnityEvent {
189    #[doc = "Direct (non-virtual) call to `UnityEvent`'s own `FindMethod_Impl`. Bypasses the vtable, so it won't hit an override/patch — use it for base calls."]
190    pub unsafe fn find_method_impl(
191        this: impl ::core::convert::Into<::unity::IlInstance>,
192        name: ::unity::Il2CppString,
193        target_obj_type: ::unity::SystemType,
194    ) -> crate::system::reflection::methodinfo::MethodInfo {
195        let __mi = Self::find_method_impl_method_info();
196        let __inner: extern "C" fn(
197            ::unity::IlInstance,
198            ::unity::Il2CppString,
199            ::unity::SystemType,
200            ::unity::OptionalMethod,
201        ) -> crate::system::reflection::methodinfo::MethodInfo = ::core::mem::transmute(__mi.method_ptr);
202        __inner(this.into(), name, target_obj_type, ::core::option::Option::None)
203    }
204
205    #[doc = "Direct (non-virtual) call to `UnityEvent`'s own `GetDelegate`. Bypasses the vtable, so it won't hit an override/patch — use it for base calls."]
206    pub unsafe fn get_delegate(
207        this: impl ::core::convert::Into<::unity::IlInstance>,
208        target: crate::system::object::Object,
209        the_function: crate::system::reflection::methodinfo::MethodInfo,
210    ) -> crate::unity_engine::events::baseinvokablecall::BaseInvokableCall {
211        let __mi = Self::get_delegate_method_info();
212        let __inner: extern "C" fn(
213            ::unity::IlInstance,
214            crate::system::object::Object,
215            crate::system::reflection::methodinfo::MethodInfo,
216            ::unity::OptionalMethod,
217        ) -> crate::unity_engine::events::baseinvokablecall::BaseInvokableCall = ::core::mem::transmute(__mi.method_ptr);
218        __inner(this.into(), target, the_function, ::core::option::Option::None)
219    }
220}
221
222#[cfg(feature = "unity_engine-events-unityevent")]
223impl UnityEvent {
224    #[doc = "`.ctor()` — no args"]
225    pub fn new() -> Self {
226        let this = <Self as ::unity::FromIlInstance>::instantiate().unwrap_or_else(|| {
227            panic!(
228                "{}
229::{}
230 failed to instantiate",
231                ::core::stringify!(UnityEvent),
232                ::core::stringify!(new),
233            )
234        });
235        <Self as IUnityEventMethods>::ctor(this);
236        this
237    }
238}
239
240#[cfg(feature = "unity_engine-events-unityevent")]
241#[doc(hidden)]
242pub mod prelude {
243    pub use super::{IUnityEvent, IUnityEventMethods, UnityEvent};
244    #[cfg(feature = "system-object")]
245    pub use crate::system::object::IObjectMethods;
246    #[cfg(feature = "unity_engine-events-unityeventbase")]
247    pub use crate::unity_engine::events::unityeventbase::IUnityEventBaseMethods;
248    pub use crate::{system::object::IObject, unity_engine::events::unityeventbase::IUnityEventBase};
249}