/// <summary> /// 是否挂载了某个类型的脚本 /// </summary> /// <typeparam name="TScript">类名</typeparam> /// <returns>结果</returns> public bool ContainScript <TScript>() { int count = ICall_ScriptComponent_GetScriptInstanceCount(this); for (int i = 0; i < count; ++i) { ScriptableClass sc = ICall_ScriptComponent_GetScriptObject(this, i); if (null != sc) { if (sc is TScript) { return(true); } } } return(false); }
/// <summary> /// 通过类名获得脚本实例 /// </summary> /// <typeparam name="TScript">类名</typeparam> /// <returns>返回脚本实例</returns> public TScript GetScriptObject <TScript>() where TScript : ScriptableClass { int count = ICall_ScriptComponent_GetScriptInstanceCount(this); for (int i = 0; i < count; ++i) { ScriptableClass sc = ICall_ScriptComponent_GetScriptObject(this, i); if (null != sc) { if (sc is TScript) { return(sc as TScript); } } } return(null); }
private static extern void ICall_ScriptableClass_SetName(ScriptableClass self, String name);
private static extern void ICall_ScriptableClass_Release(ScriptableClass self);
private static extern Actor ICall_ScriptableClass_GetOwner(ScriptableClass self);
private static extern String ICall_ScriptableClass_GetName(ScriptableClass self);
extern private static void ICall_ScriptableClass_Release(ScriptableClass self);
extern private static String ICall_ScriptableClass_GetName(ScriptableClass self);
extern private static void ICall_ScriptableClass_SetName(ScriptableClass self, String name);
extern private static Actor ICall_ScriptableClass_GetOwner(ScriptableClass self);