mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-15 20:08:54 +03:00
Can now edit text of text nodes and fetch any other nodes in the DOM from ID
This commit is contained in:
@@ -18,12 +18,12 @@ UUID UUIDFromString(const std::string& input)
|
||||
return std::stoull(input);
|
||||
}
|
||||
|
||||
uint64_t FindChildByIDIcall(const Coral::String& canvasUUID, const Coral::String& id, const Coral::String& id2)
|
||||
Coral::String FindChildByIDIcall(const Coral::String& canvasUUID, const Coral::String& id, const Coral::String& id2)
|
||||
{
|
||||
if (!ResourceManager::IsResourceLoaded(UUIDFromString(canvasUUID)))
|
||||
{
|
||||
Logger::Log("Error finding child, canvas is not loaded.", ".net/ui", CRITICAL);
|
||||
return UUID(0);
|
||||
return Coral::String::New(std::to_string(0));
|
||||
}
|
||||
|
||||
Ref<UIResource> uiResource = ResourceManager::GetResource<UIResource>(UUIDFromString(canvasUUID));
|
||||
@@ -32,13 +32,13 @@ uint64_t FindChildByIDIcall(const Coral::String& canvasUUID, const Coral::String
|
||||
searchNode != nullptr)
|
||||
{
|
||||
Ref<Node> foundNode;
|
||||
if (foundNode->FindChildByID(id2, foundNode))
|
||||
if (searchNode->FindChildByID(id2, foundNode))
|
||||
{
|
||||
return foundNode->GetScriptingID();
|
||||
return Coral::String::New(std::to_string(foundNode->GetScriptingID()));
|
||||
}
|
||||
}
|
||||
|
||||
return UUID(0);
|
||||
return Coral::String::New(std::to_string(0));
|
||||
}
|
||||
|
||||
bool HasNativeInstanceICall(const Coral::String& canvasUUID, const Coral::String& nodeUUID, const Coral::String& nodeUUID2)
|
||||
|
||||
@@ -71,13 +71,20 @@ namespace Nuake.Net
|
||||
|
||||
public class Node
|
||||
{
|
||||
internal static unsafe delegate*<NativeString, NativeString, NativeString, NativeString, ulong> FindChildByIDICall;
|
||||
internal static unsafe delegate*<NativeString, NativeString, NativeString, NativeString> FindChildByIDICall;
|
||||
internal static unsafe delegate*<NativeString, NativeString, NativeString, bool> HasNativeInstanceICall;
|
||||
internal static unsafe delegate*<NativeString, NativeString, NativeInstance<Node>> GetNativeInstanceNodeICall;
|
||||
|
||||
public string UUID;
|
||||
public string CanvasUUID;
|
||||
|
||||
public Node() { }
|
||||
public Node(string handle, string canvasHandle )
|
||||
{
|
||||
UUID = handle;
|
||||
CanvasUUID = canvasHandle;
|
||||
}
|
||||
|
||||
public string ID { get; set; } = "";
|
||||
public List<string> Classes { get; set; } = new();
|
||||
|
||||
@@ -94,13 +101,13 @@ namespace Nuake.Net
|
||||
{
|
||||
Engine.Log("Calling FindChildByIDICall with params: " + CanvasUUID + " , " + UUID + " , " + id);
|
||||
|
||||
ulong uuid = FindChildByIDICall(CanvasUUID, CanvasUUID, UUID, id);
|
||||
if (uuid == 0)
|
||||
NativeString uuid = FindChildByIDICall(CanvasUUID, UUID, id);
|
||||
if (uuid.ToString() == "0")
|
||||
{
|
||||
throw new Exception("Node not found");
|
||||
}
|
||||
|
||||
Node? newNode = null;
|
||||
T? newNode = null;
|
||||
//if (HasNativeInstanceICall(CanvasUUID, CanvasUUID, UUID))
|
||||
//{
|
||||
// NativeInstance<Node> handle;
|
||||
@@ -110,11 +117,9 @@ namespace Nuake.Net
|
||||
|
||||
if(newNode == null)
|
||||
{
|
||||
newNode = new Node()
|
||||
{
|
||||
UUID = uuid.ToString(),
|
||||
CanvasUUID = CanvasUUID
|
||||
};
|
||||
newNode = Activator.CreateInstance<T>();
|
||||
newNode.UUID = uuid;
|
||||
newNode.CanvasUUID = CanvasUUID;
|
||||
|
||||
return newNode as T;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user