/** CreateCanvas */ public static UnityEngine.GameObject CreateCameraCanvas(string a_name, UnityEngine.Transform a_parent_transform, UnityEngine.Camera a_camera) { UnityEngine.GameObject t_gameobject = new UnityEngine.GameObject(a_name); //parent t_gameobject.GetComponent <UnityEngine.Transform>().SetParent(a_parent_transform); //layer t_gameobject.layer = UnityEngine.LayerMask.NameToLayer("UI"); //canvas UnityEngine.Canvas t_canvas = t_gameobject.AddComponent <UnityEngine.Canvas>(); { t_canvas.renderMode = UnityEngine.RenderMode.ScreenSpaceCamera; t_canvas.worldCamera = a_camera; } //canvasscaler UnityEngine.UI.CanvasScaler t_canvasscaler = t_gameobject.AddComponent <UnityEngine.UI.CanvasScaler>(); { } //graphicraycaster UnityEngine.UI.GraphicRaycaster t_graphicraycaster = t_gameobject.AddComponent <UnityEngine.UI.GraphicRaycaster>(); { } return(t_gameobject); }
protected virtual void TryCreateCanvasAndGraphics() { Canvas v_canvasOptimizer = GetComponent <Canvas>(); UnityEngine.UI.GraphicRaycaster v_graphicsRaycasting = GetComponent <UnityEngine.UI.GraphicRaycaster>(); if (UseCanvasRaycasterOptimization && FullScreenRendering) { if (FullScreenRendering) { if (v_canvasOptimizer == null) { v_canvasOptimizer = gameObject.AddComponent <Canvas>(); } if (v_graphicsRaycasting == null) { v_graphicsRaycasting = gameObject.AddComponent <UnityEngine.UI.GraphicRaycaster>(); } } } else { if (v_graphicsRaycasting != null) { DestroyUtils.Destroy(v_canvasOptimizer); } if (v_canvasOptimizer != null) { DestroyUtils.DestroyImmediate(v_graphicsRaycasting); } } }
int UnityEngineUIGraphicRaycaster_g_get_blockingObjects(RealStatePtr L, int gen_param_count) { ObjectTranslator translator = this; UnityEngine.UI.GraphicRaycaster gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.blockingObjects); return(1); }
int UnityEngineUIGraphicRaycaster_g_get_ignoreReversedGraphics(RealStatePtr L, int gen_param_count) { ObjectTranslator translator = this; UnityEngine.UI.GraphicRaycaster gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); LuaAPI.lua_pushboolean(L, gen_to_be_invoked.ignoreReversedGraphics); return(1); }
int UnityEngineUIGraphicRaycaster_g_get_renderOrderPriority(RealStatePtr L, int gen_param_count) { ObjectTranslator translator = this; UnityEngine.UI.GraphicRaycaster gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, gen_to_be_invoked.renderOrderPriority); return(1); }
public void Awake() { if (m_instance == null) { m_instance = this; } m_graphicRaycaster = GetComponentInParent <UnityEngine.UI.GraphicRaycaster>(); GetButtonDown = DefaultGetButtonDown; }
int UnityEngineUIGraphicRaycaster_s_set_blockingObjects(RealStatePtr L, int gen_param_count) { ObjectTranslator translator = this; UnityEngine.UI.GraphicRaycaster gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); UnityEngine.UI.GraphicRaycaster.BlockingObjects gen_value; translator.Get(L, 2, out gen_value); gen_to_be_invoked.blockingObjects = gen_value; return(0); }
public override void ReadFrom(object obj) { base.ReadFrom(obj); if (obj == null) { return; } UnityEngine.UI.GraphicRaycaster o = (UnityEngine.UI.GraphicRaycaster)obj; ignoreReversedGraphics = o.ignoreReversedGraphics; blockingObjects = (uint)o.blockingObjects; }
/// <summary> /// Write the specified value using the writer. /// </summary> /// <param name="value">Value.</param> /// <param name="writer">Writer.</param> public override void Write(object value, ISaveGameWriter writer) { UnityEngine.UI.GraphicRaycaster graphicRaycaster = (UnityEngine.UI.GraphicRaycaster)value; writer.WriteProperty("ignoreReversedGraphics", graphicRaycaster.ignoreReversedGraphics); writer.WriteProperty("blockingObjects", graphicRaycaster.blockingObjects); writer.WriteProperty("useGUILayout", graphicRaycaster.useGUILayout); writer.WriteProperty("enabled", graphicRaycaster.enabled); writer.WriteProperty("tag", graphicRaycaster.tag); writer.WriteProperty("name", graphicRaycaster.name); writer.WriteProperty("hideFlags", graphicRaycaster.hideFlags); }
static int _g_get_renderOrderPriority(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.GraphicRaycaster __cl_gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); LuaAPI.xlua_pushinteger(L, __cl_gen_to_be_invoked.renderOrderPriority); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(1); }
static int _s_set_ignoreReversedGraphics(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.GraphicRaycaster __cl_gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); __cl_gen_to_be_invoked.ignoreReversedGraphics = LuaAPI.lua_toboolean(L, 2); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(0); }
static int _g_get_eventCamera(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.GraphicRaycaster __cl_gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); translator.Push(L, __cl_gen_to_be_invoked.eventCamera); } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(1); }
static int _g_get_blockingObjects(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.GraphicRaycaster gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); translator.Push(L, gen_to_be_invoked.blockingObjects); } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(1); }
public override object WriteTo(object obj, System.Collections.Generic.Dictionary <long, UnityEngine.Object> objects) { obj = base.WriteTo(obj, objects); if (obj == null) { return(null); } UnityEngine.UI.GraphicRaycaster o = (UnityEngine.UI.GraphicRaycaster)obj; o.ignoreReversedGraphics = ignoreReversedGraphics; o.blockingObjects = (UnityEngine.UI.GraphicRaycaster.BlockingObjects)blockingObjects; return(o); }
static int _s_set_blockingObjects(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.GraphicRaycaster __cl_gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); UnityEngine.UI.GraphicRaycaster.BlockingObjects __cl_gen_value; translator.Get(L, 2, out __cl_gen_value); __cl_gen_to_be_invoked.blockingObjects = __cl_gen_value; } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(0); }
static StackObject *get_eventCamera_7(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.UI.GraphicRaycaster instance_of_this_method = (UnityEngine.UI.GraphicRaycaster) typeof(UnityEngine.UI.GraphicRaycaster).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.eventCamera; return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
static StackObject *get_ignoreReversedGraphics_2(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.UI.GraphicRaycaster instance_of_this_method = (UnityEngine.UI.GraphicRaycaster) typeof(UnityEngine.UI.GraphicRaycaster).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.ignoreReversedGraphics; __ret->ObjectType = ObjectTypes.Integer; __ret->Value = result_of_this_method ? 1 : 0; return(__ret + 1); }
static StackObject *set_ignoreReversedGraphics_3(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Boolean @value = ptr_of_this_method->Value == 1; ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.UI.GraphicRaycaster instance_of_this_method = (UnityEngine.UI.GraphicRaycaster) typeof(UnityEngine.UI.GraphicRaycaster).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.ignoreReversedGraphics = value; return(__ret); }
/// <summary> /// 获取鼠标下UI /// </summary> public static void GetMouseUI(UnityEngine.UI.GraphicRaycaster canvasGraphic, EventSystem eventSystem) { PointerEventData eventData = new PointerEventData(eventSystem); eventData.pressPosition = Input.mousePosition; eventData.position = Input.mousePosition; List <RaycastResult> list = new List <RaycastResult>(); canvasGraphic.Raycast(eventData, list); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { Debug.LogFormat("鼠标下检测到的UI: {0} {1} ", i, list[i].gameObject); } } }
static StackObject *set_blockingObjects_5(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 2); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); UnityEngine.UI.GraphicRaycaster.BlockingObjects @value = (UnityEngine.UI.GraphicRaycaster.BlockingObjects) typeof(UnityEngine.UI.GraphicRaycaster.BlockingObjects).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.UI.GraphicRaycaster instance_of_this_method = (UnityEngine.UI.GraphicRaycaster) typeof(UnityEngine.UI.GraphicRaycaster).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.blockingObjects = value; return(__ret); }
int UnityEngineUIGraphicRaycaster_m_Raycast(RealStatePtr L, int gen_param_count) { ObjectTranslator translator = this; UnityEngine.UI.GraphicRaycaster gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); { UnityEngine.EventSystems.PointerEventData _eventData = (UnityEngine.EventSystems.PointerEventData)translator.GetObject(L, 2, typeof(UnityEngine.EventSystems.PointerEventData)); System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> _resultAppendList = (System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>)translator.GetObject(L, 3, typeof(System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>)); gen_to_be_invoked.Raycast(_eventData, _resultAppendList); return(0); } }
UnityEngine.UI.Image CreateToolsCanvas() { var actS = UnityEngine.SceneManagement.SceneManager.GetActiveScene(); var actS2 = UnityEngine.SceneManagement.SceneManager.GetSceneByBuildIndex(0); if (actS2 != null) { UnityEngine.SceneManagement.SceneManager.SetActiveScene(actS2); } GameObject canvasGo = new GameObject(); canvasGo.name = "[Interface]"; Canvas canvas = canvasGo.AddComponent <Canvas>(); canvas.renderMode = RenderMode.ScreenSpaceOverlay; UnityEngine.UI.CanvasScaler canvasScaler = canvasGo.AddComponent <UnityEngine.UI.CanvasScaler>(); UnityEngine.UI.GraphicRaycaster canvasRaycaster = canvasGo.AddComponent <UnityEngine.UI.GraphicRaycaster>(); GameObject backgroundGo = new GameObject(); backgroundGo.name = "fx-background"; backgroundGo.transform.SetParent(canvasGo.transform); RectTransform rectTr = backgroundGo.AddComponent <RectTransform>(); rectTr.anchorMin = new Vector2(0, 0); rectTr.anchorMax = new Vector2(1, 1); rectTr.pivot = new Vector2(0.5f, 0.5f); rectTr.anchoredPosition = new Vector2(0, 0); rectTr.sizeDelta = Vector2.zero; rectTr.ForceUpdateRectTransforms(); CanvasRenderer canvasRenderer = backgroundGo.AddComponent <CanvasRenderer>(); UnityEngine.UI.Image image = backgroundGo.AddComponent <UnityEngine.UI.Image>(); image.enabled = false; canvasGo.transform.SetAsLastSibling(); if (actS != null) { UnityEngine.SceneManagement.SceneManager.SetActiveScene(actS); } return(image); }
public UnityEngine.UI.GraphicRaycaster __Gen_Delegate_Imp21(object p0) { #if THREAD_SAFE || HOTFIX_ENABLE lock (luaEnv.luaEnvLock) { #endif RealStatePtr L = luaEnv.rawL; int errFunc = LuaAPI.pcall_prepare(L, errorFuncRef, luaReference); ObjectTranslator translator = luaEnv.translator; translator.PushAny(L, p0); PCall(L, 1, 1, errFunc); UnityEngine.UI.GraphicRaycaster __gen_ret = (UnityEngine.UI.GraphicRaycaster)translator.GetObject(L, errFunc + 1, typeof(UnityEngine.UI.GraphicRaycaster)); LuaAPI.lua_settop(L, errFunc - 1); return(__gen_ret); #if THREAD_SAFE || HOTFIX_ENABLE } #endif }
static StackObject *Raycast_6(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 3); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> @resultAppendList = (System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>) typeof(System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 2); UnityEngine.EventSystems.PointerEventData @eventData = (UnityEngine.EventSystems.PointerEventData) typeof(UnityEngine.EventSystems.PointerEventData).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); ptr_of_this_method = ILIntepreter.Minus(__esp, 3); UnityEngine.UI.GraphicRaycaster instance_of_this_method = (UnityEngine.UI.GraphicRaycaster) typeof(UnityEngine.UI.GraphicRaycaster).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); instance_of_this_method.Raycast(@eventData, @resultAppendList); return(__ret); }
static int _m_Raycast(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); UnityEngine.UI.GraphicRaycaster __cl_gen_to_be_invoked = (UnityEngine.UI.GraphicRaycaster)translator.FastGetCSObj(L, 1); try { { UnityEngine.EventSystems.PointerEventData eventData = (UnityEngine.EventSystems.PointerEventData)translator.GetObject(L, 2, typeof(UnityEngine.EventSystems.PointerEventData)); System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> resultAppendList = (System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>)translator.GetObject(L, 3, typeof(System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>)); __cl_gen_to_be_invoked.Raycast(eventData, resultAppendList); return(0); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } }
public static bool IsPointerOverGameObject(Canvas canvas, Vector2 screenPosition) { if (isOnUI) { return(true); } if (EventSystem.current == null) { return(false); } PointerEventData eventDataCurrentPosition = new PointerEventData(EventSystem.current); eventDataCurrentPosition.position = screenPosition; UnityEngine.UI.GraphicRaycaster uiRaycaster = canvas.gameObject.GetComponent <UnityEngine.UI.GraphicRaycaster>(); m_list.Clear(); uiRaycaster.Raycast(eventDataCurrentPosition, m_list); return(m_list.Count > 0); }
/// <summary> /// Read the data into the specified value. /// </summary> /// <param name="value">Value.</param> /// <param name="reader">Reader.</param> public override void ReadInto(object value, ISaveGameReader reader) { UnityEngine.UI.GraphicRaycaster graphicRaycaster = (UnityEngine.UI.GraphicRaycaster)value; foreach (string property in reader.Properties) { switch (property) { case "ignoreReversedGraphics": graphicRaycaster.ignoreReversedGraphics = reader.ReadProperty <System.Boolean> (); break; case "blockingObjects": graphicRaycaster.blockingObjects = reader.ReadProperty <UnityEngine.UI.GraphicRaycaster.BlockingObjects> (); break; case "useGUILayout": graphicRaycaster.useGUILayout = reader.ReadProperty <System.Boolean> (); break; case "enabled": graphicRaycaster.enabled = reader.ReadProperty <System.Boolean> (); break; case "tag": graphicRaycaster.tag = reader.ReadProperty <System.String> (); break; case "name": graphicRaycaster.name = reader.ReadProperty <System.String> (); break; case "hideFlags": graphicRaycaster.hideFlags = reader.ReadProperty <UnityEngine.HideFlags> (); break; } } }
/// <summary> /// 获取鼠标下T类型组件(仅最上层UI) /// </summary> public static T GetMouseUIComponent <T>(UnityEngine.UI.GraphicRaycaster canvasGraphic, EventSystem eventSystem) { PointerEventData eventData = new PointerEventData(eventSystem); eventData.pressPosition = Input.mousePosition; eventData.position = Input.mousePosition; List <RaycastResult> list = new List <RaycastResult>(); canvasGraphic.Raycast(eventData, list); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { T t = list[i].gameObject.GetComponent <T>(); if (t != null) { //Debug.LogFormat("鼠标下检测到的UI: {0} {1} ", i, list[i].gameObject); return(t); } } } return(default(T)); }
internal void BuffIcon_Awake(On.RoR2.UI.BuffIcon.orig_Awake orig, RoR2.UI.BuffIcon self) { orig(self); if (self.transform.parent.name == "BuffDisplayRoot") { if (mod.config.BuffTooltips.Value) { UnityEngine.UI.GraphicRaycaster raycaster = self.transform.parent.GetComponent <UnityEngine.UI.GraphicRaycaster>(); if (raycaster == null) { self.transform.parent.gameObject.AddComponent <UnityEngine.UI.GraphicRaycaster>(); } self.gameObject.AddComponent <RoR2.UI.TooltipProvider>(); } if (mod.config.BuffTimers.Value) { GameObject TimerText = new GameObject("TimerText"); RectTransform timerRect = TimerText.AddComponent <RectTransform>(); RoR2.UI.HGTextMeshProUGUI timerTextMesh = TimerText.AddComponent <RoR2.UI.HGTextMeshProUGUI>(); TimerText.transform.SetParent(self.transform); timerTextMesh.enableWordWrapping = false; timerTextMesh.alignment = mod.config.BuffTimersTextAlignmentOption; timerTextMesh.fontSize = mod.config.BuffTimersFontSize.Value; timerTextMesh.faceColor = Color.white; timerTextMesh.text = ""; timerRect.localPosition = Vector3.zero; timerRect.anchorMin = new Vector2(1, 0); timerRect.anchorMax = new Vector2(1, 0); timerRect.localScale = Vector3.one; timerRect.sizeDelta = new Vector2(48, 48); timerRect.anchoredPosition = new Vector2(-24, 24); } } }
/// <summary> /// Read the data using the reader. /// </summary> /// <param name="reader">Reader.</param> public override object Read(ISaveGameReader reader) { UnityEngine.UI.GraphicRaycaster graphicRaycaster = SaveGameType.CreateComponent <UnityEngine.UI.GraphicRaycaster> (); ReadInto(graphicRaycaster, reader); return(graphicRaycaster); }