public void Test()
        {
            Assert.That(GodotPathUtility.GodotPathToResourcePath("res://Engine/Scenes"),
                Is.EqualTo(new ResourcePath("/Scenes")));

            Assert.That(GodotPathUtility.GodotPathToResourcePath("res://Content/Scenes"),
                Is.EqualTo(new ResourcePath("/Scenes")));

            Assert.That(() => GodotPathUtility.GodotPathToResourcePath("res://Scenes"),
                Throws.ArgumentException);
        }
Пример #2
0
        private protected override void SetGodotProperty(string property, object value, GodotAssetScene context)
        {
            base.SetGodotProperty(property, value, context);

            if (property == "texture_normal")
            {
                var          extRef = context.GetExtResource((GodotAsset.TokenExtResource)value);
                ResourcePath godotPathToResourcePath;
                try
                {
                    godotPathToResourcePath = GodotPathUtility.GodotPathToResourcePath(extRef.Path);
                }
                catch (ArgumentException)
                {
                    Logger.Error("TextureButton is referencing non-VFS Godot path {0}.", extRef.Path);
                    return;
                }
                var texture = IoCManager.Resolve <IResourceCache>()
                              .GetResource <TextureResource>(godotPathToResourcePath);
                TextureNormal = texture;
            }
        }