code optimization &new helper functions added / modified

- UnityCore namespace changed to UnityEngine
- Object class is no longer a template. FindObjectOfType function set to template
- Added LogComponents function. It helps us retrieve components from the target gameObject.
- Added GetObjectName function to Object structure (same method is available in utils header)
- Added ConvertToSystemString function.
Converts const char to system.string (app::String)
This commit is contained in:
Jadis0x
2024-06-06 20:43:35 +03:00
parent 5ba4784657
commit 0b84c20f4a
14 changed files with 198 additions and 256 deletions

View File

@@ -4,7 +4,7 @@
#include "ClientHelper.h"
#include "players/players.h"
#include "UnityCore.h"
#include "UnityEngine.h"
bool IsSinglePlayer()
{
@@ -46,10 +46,8 @@ bool IsPlayerCrawling(app::GameObject* go)
if (go == NULL)
return false;
app::String* str = reinterpret_cast<app::String*>(il2cpp_string_new("NolanBehaviour"));
if (app::GameObject_GetComponentByName != NULL) {
app::Component* nbComponent = app::GameObject_GetComponentByName(go, str, nullptr);
app::Component* nbComponent = app::GameObject_GetComponentByName(go, ConvertToSystemString("NolanBehaviour"), nullptr);
if (nbComponent) {
app::NolanBehaviour* nb = reinterpret_cast<app::NolanBehaviour*>(nbComponent);
@@ -65,7 +63,7 @@ bool IsPlayerCrawling(app::GameObject* go)
bool IsInGame()
{
app::OptionsHelpers* optionsHelpers = UnityCore::Object<app::OptionsHelpers>::FindObjectOfType("OptionsHelpers");
app::OptionsHelpers* optionsHelpers = UnityEngine::Object::FindObjectOfType<app::OptionsHelpers>("OptionsHelpers");
if (optionsHelpers)
return optionsHelpers->fields._inGame_k__BackingField;