Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Monosyne;
- using Monosyne.SceneV2.Resource;
- namespace CaesarsSlots.Common.Utils
- {
- public static class SceneResourceExtensions
- {
- public static SceneObjectResource Find(this SceneResource resource, string id)
- {
- foreach (SceneObjectResource child in resource.Objects.Values)
- {
- SceneObjectResource res = child.Find(resource, id);
- if (res != null)
- {
- return res;
- }
- }
- return null;
- }
- public static SceneObjectResource Find(this SceneObjectResource resource, SceneResource sceneResource, string id)
- {
- if (resource.Properties != null && resource.Properties.ContainsKey("Id"))
- {
- if ((string)resource.Properties["Id"] == id)
- {
- return resource;
- }
- }
- if (resource.Children != null)
- {
- for (int i = 0; i < resource.Children.Length; ++i)
- {
- SceneObjectResource child = (resource.Children[i] is SceneObjectResource)
- ? (SceneObjectResource)resource.Children[i]
- : (SceneObjectResource)sceneResource.Objects[(String)resource.Children[i]];
- SceneObjectResource res = child.Find(sceneResource, id);
- if (res != null)
- {
- return res;
- }
- }
- }
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement