static MethodBase TargetMethod(object instance) { #if MANAGED return(AccessToolsShim.Method(UnityTypes.TMP_Text?.ClrType, "SetText", new[] { typeof(StringBuilder) })); #else return(AccessToolsShim.Method(UnityTypes.TMP_Text?.ClrType, "SetText", new[] { typeof(Il2CppSystem.Text.StringBuilder) })); #endif }
static MethodBase TargetMethod(object instance) { #if MANAGED return(AccessToolsShim.Method(UnityTypes.TMP_Text?.ClrType, "SetCharArray", new[] { typeof(int[]), typeof(int), typeof(int) })); #else return(AccessToolsShim.Method(UnityTypes.TMP_Text?.ClrType, "SetCharArray", new[] { typeof(UnhollowerBaseLib.Il2CppStructArray <int>), typeof(int), typeof(int) })); #endif }
/// <summary> /// Attempt to translated the provided untranslated text. Will be used in a "coroutine", /// so it can be implemented in an asynchronous fashion. /// </summary> public IEnumerator Translate(ITranslationContext context) { var wwwContext = new WwwTranslationContext(context); // allow implementer of HttpEndpoint to do anything before starting translation var setup = OnBeforeTranslate(wwwContext); if (setup != null) { while (setup.MoveNext()) { yield return(setup.Current); } } // prepare request OnCreateRequest(wwwContext); if (wwwContext.RequestInfo == null) { wwwContext.Fail("No request object was provided by the translator."); } var request = wwwContext.RequestInfo; var url = request.Address; var data = request.Data; var headers = request.Headers; // execute request var www = CreateWww(request.Address, data != null ? Encoding.UTF8.GetBytes(data) : null, headers); // wait for completion yield return(www); // extract error string error = (string)AccessToolsShim.Property(ClrTypes.WWW, "error").GetValue(www, null); if (error != null) { wwwContext.Fail("Error occurred while retrieving translation. " + error); } // extract text var text = (string)AccessToolsShim.Property(ClrTypes.WWW, "text").GetValue(www, null); if (text == null) { wwwContext.Fail("Error occurred while extracting text from response."); } wwwContext.ResponseData = text; // extract text OnExtractTranslation(wwwContext); }
public static void SetAllDirtyEx(this object ui) { if (ui == null) { return; } var type = ui.GetType(); if (ClrTypes.Graphic != null && ClrTypes.Graphic.IsAssignableFrom(type)) { ClrTypes.Graphic.CachedMethod(SetAllDirtyMethodName).Invoke(ui); } else { AccessToolsShim.Method(type, MarkAsChangedMethodName)?.Invoke(ui, null); } }
public static void SetAllDirtyEx(this object ui) { if (ui == null) { return; } var type = ui.GetUnityType(); if (UnityTypes.Graphic != null && UnityTypes.Graphic.IsAssignableFrom(type)) { UnityTypes.Graphic.ClrType.CachedMethod(SetAllDirtyMethodName).Invoke(ui); } else if (!ui.TryCastTo <SpriteRenderer>(out _)) { var clrType = ui.GetType(); AccessToolsShim.Method(clrType, MarkAsChangedMethodName)?.Invoke(ui, null); } }
public static void SetAllDirtyEx(this object ui) { if (ui == null) { return; } if (ui is Graphic graphic) { graphic.SetAllDirty(); } else { // lets attempt some reflection for several known types var type = ui.GetType(); AccessToolsShim.Method(type, MarkAsChangedMethodName)?.Invoke(ui, null); } }
public void ResetScrollIn(object ui) { if (!_hasCheckedTypeWriter) { _hasCheckedTypeWriter = true; if (UnityTypes.Typewriter != null) { var component = ui as Component; if (ui != null && component.GetComponent(UnityTypes.Typewriter.UnityType).TryCastTo <MonoBehaviour>(out var typeWriter)) { _typewriter = typeWriter; } } } if (_typewriter != null) { AccessToolsShim.Method(UnityTypes.Typewriter.ClrType, "OnEnable")?.Invoke(_typewriter, null); } }
public void ResetScrollIn(object graphic) { if (!_hasCheckedTypeWriter) { _hasCheckedTypeWriter = true; if (ClrTypes.Typewriter != null) { var ui = graphic as Component; if (ui != null) { _typewriter = (MonoBehaviour)ui.GetComponent(ClrTypes.Typewriter); } } } if (_typewriter != null) { AccessToolsShim.Method(ClrTypes.Typewriter, "OnEnable")?.Invoke(_typewriter, null); } }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.UILabel, "OnEnable")); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(typeof(AssetBundle), "LoadFromMemory_Internal", typeof(byte[]), typeof(uint)) ?? AccessToolsShim.Method(typeof(AssetBundle), "LoadFromMemory", typeof(byte[]), typeof(uint))); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Property(typeof(AssetBundle), "mainAsset").GetGetMethod()); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.GUI, "DoButtonGrid", new[] { typeof(Rect), typeof(int), typeof(GUIContent[]), typeof(string[]), typeof(int), typeof(GUIStyle), typeof(GUIStyle), typeof(GUIStyle), typeof(GUIStyle), ClrTypes.GUI_ToolbarButtonSize, typeof(bool[]) })); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.GUI, "DoToggle", new[] { typeof(Rect), typeof(int), typeof(bool), typeof(GUIContent), typeof(GUIStyle) })); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.TextMeshProUGUI, "OnEnable")); }
static bool Prepare(object instance) { var returnMainAsset = AccessToolsShim.Method(typeof(AssetBundle), "returnMainAsset", new[] { typeof(AssetBundle) }); return(returnMainAsset != null); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Property(ClrTypes.TMP_Text, "maxVisibleCharacters")?.GetSetMethod()); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.TMP_Text, "SetCharArray", new[] { typeof(int[]), typeof(int), typeof(int) })); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(typeof(AssetBundle), "returnMainAsset", new[] { typeof(AssetBundle) })); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(typeof(Resources), "LoadAll", typeof(string), typeof(Type))); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Property(typeof(AssetBundleRequest), "allAssets").GetGetMethod()); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(typeof(AssetBundle), "LoadAssetWithSubAssetsAsync_Internal", typeof(string), typeof(Type))); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(typeof(AssetBundle), "LoadAll", typeof(Type))); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Property(ClrTypes.TextMeshPro, "text").GetSetMethod()); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.GUI, "BeginGroup", new[] { typeof(Rect), typeof(GUIContent), typeof(GUIStyle), typeof(Vector2) })); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.TMP_Text, "SetText", new[] { typeof(string), typeof(float), typeof(float), typeof(float) })); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.GUI, "DoRepeatButton", new[] { typeof(Rect), typeof(GUIContent), typeof(GUIStyle), typeof(FocusType) })); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.TextWindow, "SetText", new Type[] { typeof(string) })); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.GUI, "DoButton", new[] { typeof(Rect), typeof(GUIContent), typeof(IntPtr) })); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Property(ClrTypes.TMP_Text, "text")?.GetGetMethod()); }
static MethodBase TargetMethod(object instance) { return(AccessToolsShim.Method(ClrTypes.GUI, "DoWindow", new[] { typeof(int), typeof(Rect), typeof(WindowFunction), typeof(GUIContent), typeof(GUIStyle), typeof(GUISkin), typeof(bool) })); }