示例#1
0
                public override F.IResult Test(object value)
                {
                    if (value is P.Actor)
                    {
                        P.Actor  actor     = value as P.Actor;
                        P.Vector translate = actor.Translate;
                        if (translate != null)
                        {
                            switch (_Coordinate)
                            {
                            case Coordinate.X: return(_filter.Test(translate.X));

                            case Coordinate.Y: return(_filter.Test(translate.Y));

                            case Coordinate.Z: return(_filter.Test(translate.Z));
                            }
                        }
                    }
                    return(F.EMPTY_RESULT);
                }
示例#2
0
        private void _Process(P.Property prop)
        {
            //-> [Actor] Persistent_Level:PersistentLevel.Char_Player_C_0
            //  .ClassName = str:'/Game/FactoryGame/Character/Player/Char_Player.Char_Player_C'
            //  .PathName = str:'Persistent_Level:PersistentLevel.Char_Player_C_0'
            //  .EntityObj =
            //	-> [NamedEntity]
            //	  .Children =
            //		/ List with 5 elements:
            //		|-> [Name]
            //		|  .LevelName = str:'Persistent_Level'
            //		|  .PathName = str:'Persistent_Level:PersistentLevel.Char_Player_C_0.TrashSlot'
            //		|  ...
            //		|-> [Name]
            //		|  .LevelName = str:'Persistent_Level'
            //		|  .PathName = str:'Persistent_Level:PersistentLevel.Char_Player_C_0.inventory'
            //		\ end of list

            P.Actor actor = prop as P.Actor;
            if (actor == null)
            {
                return;
            }

            if (str.IsNullOrEmpty(actor.ClassName))
            {
                return;
            }
            string actor_class = actor.ClassName.ToString();

            P.NamedEntity entity = actor.EntityObj as P.NamedEntity;
            if (entity == null)
            {
                return;
            }

            var childs = entity.GetChilds();

            if (!childs.ContainsKey("Children"))
            {
                return;
            }

            P.Properties props = childs["Children"] as P.Properties;
            if (props == null || props.Count == 0)
            {
                return;
            }

            List <P.NamedEntity.Name> names = props.ListOf <P.NamedEntity.Name>();

            foreach (P.NamedEntity.Name name in names)
            {
                string pathname = "";
                if (!str.IsNullOrEmpty(name.PathName))
                {
                    pathname = name.PathName.LastName();
                }

                List <string> classes;
                if (!_classes.ContainsKey(pathname))
                {
                    classes = new List <string>();
                    _classes.Add(pathname, classes);
                }
                else
                {
                    classes = _classes[pathname];
                }
                if (!classes.Contains(actor_class))
                {
                    classes.Add(actor_class);
                }
            }
        }
        //HINT: Methods following are copied from TreePanel.cs, ensure to update those if TreePanel.cs changes!
        private D.DifferenceNode _AddClassRecurs(D.DifferenceNode parent, string path, P.Property prop, out string out_title)
        {
            string classname, fullname, label;

            D.DifferenceNode class_item;

            string ClassName, PathName;

            if (prop is P.Actor)
            {
                P.Actor actor = prop as P.Actor;
                ClassName = actor.ClassName.ToString();
                PathName  = actor.PathName.ToString();
            }
            else if (prop is P.Object)
            {
                P.Object obj = prop as P.Object;
                ClassName = obj.ClassName.ToString();
                PathName  = obj.PathName.ToString();
            }
            else
            {
                out_title = null;
                return(null);
            }

            string remain = ClassName.Substring(path.Length);

            if (remain.Contains('/'))
            {
                classname  = remain.Split('/')[0];
                fullname   = path + classname + "/";
                class_item = _AddOrGetClass(parent, fullname, classname);
                return(_AddClassRecurs(class_item, fullname, prop, out out_title));
            }
            if (remain.Contains('.'))
            {
                string[] classnames = remain.Split('.');
                if (classnames.Length == 2)
                {
                    label = PathName;
                    label = label.Substring(label.LastIndexOf('.') + 1);

                    // Before adding more sub-classes, check for both BP_... and FG... condition
                    if ("BP_" + label != classnames[0] && "FG_" + label != classnames[0])
                    {
                        fullname   = path + classnames[0] + ".";
                        class_item = _AddOrGetClass(parent, fullname, classnames[0]);

                        // Ignore [1] or add both?
                        if (classnames[0] + "_C" != classnames[1])
                        {
                            fullname  += classnames[1];
                            class_item = _AddOrGetClass(class_item, fullname, classnames[1]);
                        }

                        // To collect things following into a sub node ('BP_PlayerState_C_0' with data below):
                        //		.PathName = str:'Persistent_Level:PersistentLevel.BP_PlayerState_C_0.FGRecipeShortcut_#'
                        // with # = [0,9]
                        // Or following ('Char_Player_C_0' with data below):
                        //		.PathName = str:'Persistent_Level:PersistentLevel.Char_Player_C_0.BackSlot'
                        //		.PathName = str:'Persistent_Level:PersistentLevel.Char_Player_C_0.ArmSlot'
                        // Will also take care of showing actual entity in case we're showing
                        // something like an inventory:
                        //		.PathName = str:'Persistent_Level:PersistentLevel.Char_Player_C_0.inventory'
                        string[] labels = PathName.Split('.');
                        if (labels.Length == 3)
                        {
                            fullname  += "." + labels[1];
                            class_item = _AddOrGetClass(class_item, fullname, labels[1]);
                        }
                    }
                    else
                    {
                        class_item = parent;
                    }

                    //return _AddItem(class_item, label, null, null);
                    out_title = label;
                    return(class_item);
                }
                Log.Warning("AddClassRecurs: What to do with '{0}'?", ClassName);
            }

            // At the end of our path, add property
            label = PathName;
            label = label.Substring(label.IndexOf('.') + 1);
            //return _AddItem(parent, label, null, null);
            out_title = label;
            return(parent);
        }