Пример #1
0
        public static bool TryGetScript(string typeName, string scriptName, out TsDelegate del)
        {
            if (typeName == null)
            {
                del = null;
                return(false);
            }
            var origin = typeName;

            do
            {
                if (InstanceScripts.TryGetValue(typeName, scriptName, out del))
                {
                    //If the script is inherited, cache it in the child's script lookup.
                    if (typeName != origin)
                    {
                        InstanceScripts.Add(origin, scriptName, del);
                    }
                    return(true);
                }
            }while (Inherits.TryGetValue(typeName, out typeName));

            del = null;
            return(false);
        }
Пример #2
0
 public static string ObjectGetParent(ITsInstance inst)
 {
     if (Inherits.TryGetValue(inst.ObjectType, out var parent))
     {
         return(parent);
     }
     return("");
 }
Пример #3
0
 public static bool ObjectIs(string type, string expectedType)
 {
     do
     {
         if (type == expectedType)
         {
             return(true);
         }
     }while (Inherits.TryGetValue(type, out type));
     return(false);
 }
Пример #4
0
        public static bool ObjectIsAncestor(string parent, string type)
        {
            while (Inherits.TryGetValue(type, out type))
            {
                if (type == parent)
                {
                    return(true);
                }
            }

            return(false);
        }