Exemple #1
0
        public static void WriteProperty(this ExportEntry export, UProperty prop)
        {
            var props = export.GetProperties();

            props.AddOrReplaceProp(prop);
            export.WriteProperties(props);
        }
        public static void CondenseArchetypes(this ExportEntry stmActor)
        {
            while (stmActor.Archetype is ExportEntry archetype)
            {
                var archProps = archetype.GetProperties();
                foreach (UProperty prop in archProps)
                {
                    if (!stmActor.GetProperties().ContainsNamedProp(prop.Name))
                    {
                        stmActor.WriteProperty(prop);
                    }
                }

                stmActor.Archetype = archetype.Archetype;
            }
        }
Exemple #3
0
        public static bool RemoveProperty(this ExportEntry export, string propname)
        {
            var       props        = export.GetProperties();
            UProperty propToRemove = null;

            foreach (UProperty prop in props)
            {
                if (prop.Name.Name == propname)
                {
                    propToRemove = prop;
                    break;
                }
            }

            //outside for concurrent collection modification
            if (propToRemove != null)
            {
                props.Remove(propToRemove);
                export.WriteProperties(props);
                return(true);
            }

            return(false);
        }
Exemple #4
0
 public static T GetProperty <T>(this ExportEntry export, string name) where T : UProperty
 {
     return(export.GetProperties().GetProp <T>(name));
 }