Пример #1
0
        private void duplicateGuidList_SelectionChanged(object sender, EventArgs e)
        {
            if (duplicatesListBox.SelectedIndex >= 0)
            {
                UnrealGUID guid = duplicateGuids[duplicatesListBox.SelectedIndex];
                aLabel.Text            = "A: " + guid.A;
                bLabel.Text            = "B: " + guid.B;
                cLabel.Text            = "C: " + guid.C;
                dLabel.Text            = "D: " + guid.D;
                generateButton.Enabled = true;

                BoolProperty bHasCrossLevelPaths = guid.export.GetProperty <BoolProperty>("bHasCrossLevelPaths");
                if (bHasCrossLevelPaths != null && bHasCrossLevelPaths == true)
                {
                    crossLevelPathsLabel.Visible = true;
                }
                else
                {
                    crossLevelPathsLabel.Visible = false;
                }
            }
            else
            {
                generateButton.Enabled       = false;
                aLabel.Text                  = "A: ";
                bLabel.Text                  = "B: ";
                cLabel.Text                  = "C: ";
                dLabel.Text                  = "D: ";
                crossLevelPathsLabel.Visible = false;
            }
        }
Пример #2
0
 private void generateButton_Click(object sender, EventArgs e)
 {
     if (duplicatesListBox.SelectedIndex >= 0)
     {
         UnrealGUID guid = duplicateGuids[duplicatesListBox.SelectedIndex];
         SharedPathfinding.GenerateNewRandomGUID(guid.export);
         populateDuplicateGUIDs();
     }
 }
Пример #3
0
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }
            UnrealGUID other = (UnrealGUID)obj;

            return(other.A == A && other.B == B && other.C == C && other.D == D);
        }
Пример #4
0
        /// <summary>
        /// Fetches an UnrealGUID object from a GUID struct.
        /// </summary>
        /// <param name="guidStruct"></param>
        /// <returns></returns>
        public static UnrealGUID GetGUIDFromStruct(StructProperty guidStruct)
        {
            int        a    = guidStruct.GetProp <IntProperty>("A");
            int        b    = guidStruct.GetProp <IntProperty>("B");
            int        c    = guidStruct.GetProp <IntProperty>("C");
            int        d    = guidStruct.GetProp <IntProperty>("D");
            UnrealGUID guid = new UnrealGUID();

            guid.A = a;
            guid.B = b;
            guid.C = c;
            guid.D = d;
            return(guid);
        }
Пример #5
0
        /// <summary>
        /// Fetches the NavGuid object as a UnrealGUID
        /// </summary>
        /// <param name="export"></param>
        /// <returns></returns>
        public static UnrealGUID GetNavGUID(IExportEntry export)
        {
            StructProperty navGuid = export.GetProperty <StructProperty>("NavGuid");

            if (navGuid != null)
            {
                UnrealGUID guid = GetGUIDFromStruct(navGuid);
                guid.export = export;
                return(guid);
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
        private void populateDuplicateGUIDs()
        {
            navGuidLists   = new Dictionary <string, List <UnrealGUID> >();
            duplicateGuids = new List <UnrealGUID>();

            IExportEntry level = null;

            foreach (IExportEntry exp in pcc.Exports)
            {
                if (exp.ClassName == "Level" && exp.ObjectName == "PersistentLevel")
                {
                    level = exp;
                    break;
                }
            }
            int start = 0x4;

            if (level != null)
            {
                start = PathfindingEditor.findEndOfProps(level);
            }
            //Read persistent level binary
            byte[] data = level.Data;

            uint exportid = BitConverter.ToUInt32(data, start);

            start += 4;
            uint numberofitems = BitConverter.ToUInt32(data, start);
            int  countoffset   = start;
            int  itemcount     = 2;

            start += 8;
            while (itemcount < numberofitems)
            {
                //get header.
                uint itemexportid = BitConverter.ToUInt32(data, start);
                if (itemexportid - 1 < pcc.Exports.Count && itemexportid > 0)
                {
                    IExportEntry   exportEntry = pcc.Exports[(int)itemexportid - 1];
                    StructProperty navguid     = exportEntry.GetProperty <StructProperty>("NavGuid");
                    if (navguid != null)
                    {
                        int        a   = navguid.GetProp <IntProperty>("A");
                        int        b   = navguid.GetProp <IntProperty>("B");
                        int        c   = navguid.GetProp <IntProperty>("C");
                        int        d   = navguid.GetProp <IntProperty>("D");
                        UnrealGUID nav = new UnrealGUID();
                        nav.A              = a;
                        nav.B              = b;
                        nav.C              = c;
                        nav.D              = d;
                        nav.export         = exportEntry;
                        nav.levelListIndex = itemcount;

                        List <UnrealGUID> list;
                        if (navGuidLists.TryGetValue(nav.ToString(), out list))
                        {
                            list.Add(nav);
                        }
                        else
                        {
                            list = new List <UnrealGUID>();
                            navGuidLists[nav.ToString()] = list;
                            list.Add(nav);
                        }
                    }
                    start += 4;
                    itemcount++;
                }
                else
                {
                    //INVALID or empty item encountered. We don't care right now though.
                    start += 4;
                    itemcount++;
                }
            }


            duplicatesListBox.Items.Clear();
            foreach (List <UnrealGUID> guidList in navGuidLists.Values)
            {
                if (guidList.Count > 1)
                {
                    Debug.WriteLine("Number of duplicates: " + guidList.Count);
                    //contains duplicates
                    foreach (UnrealGUID guid in guidList)
                    {
                        //Debug.WriteLine(guid.levelListIndex + " Duplicate: " + guid.export.ObjectName);
                        duplicateGuids.Add(guid);
                        duplicatesListBox.Items.Add(guid.levelListIndex + " " + guid.export.Index + " " + guid.export.ObjectName + "_" + guid.export.indexValue);
                    }
                }
                else
                {
                    Debug.WriteLine("Not a duplicate ");
                }
            }
        }