void DisplaySaveTree(SaveTreeBaseRecord parent)
        {
            for (int i = 0; i < parent.Children.Count; i++)
            {
                RecordTypes recordType = parent.Children[i].RecordType;
                if (recordType == RecordTypes.Door || recordType == RecordTypes.Goods)
                {
                    continue;
                }

                string textLabel = recordType.ToString();
                if (recordType == RecordTypes.Item || recordType == RecordTypes.Spell)
                {
                    textLabel += string.Format(" [{0}]", GetItemOrSpellName(parent.Children[i]));
                }

                // Check if item equipped
                if (recordType == RecordTypes.Item)
                {
                    //ItemRecord itemRecord = (ItemRecord)parent.Children[i];
                    //textLabel += string.Format(" [id={0}]", itemRecord.RecordRoot.RecordID);

                    int equippedIndex = GetEquippedIndex(parent.Children[i] as ItemRecord);
                    if (equippedIndex != -1)
                    {
                        //textLabel = string.Format("(*={0:00}) {1}", equippedIndex, textLabel);
                    }
                }

                // Tag container types
                if (recordType == RecordTypes.Container && parent.RecordType == RecordTypes.Character)
                {
                    string[] tags = { " [Weapons & Armor]", " [Magic Items]", " [Clothing & Misc]", " [Ingredients]", " [Wagon]",
                                      " [House]",           " [Ship]",        " [Tavern Rooms]",    " [Item Repairers]" };

                    ContainerRecord containerRecord = (ContainerRecord)parent.Children[i];

                    textLabel += tags[containerRecord.RecordRoot.SpriteIndex];
                }

                EditorGUILayout.LabelField(textLabel);
                GUILayoutHelper.Indent(() =>
                {
                    DisplaySaveTree(parent.Children[i]);
                });
            }
        }
        void DisplaySaveTree(SaveTreeBaseRecord parent)
        {
            for (int i = 0; i < parent.Children.Count; i++)
            {
                RecordTypes recordType = parent.Children[i].RecordType;
                if (recordType == RecordTypes.Door || recordType == RecordTypes.UnknownItemRecord)
                {
                    continue;
                }

                string textLabel = recordType.ToString();
                if (recordType == RecordTypes.Item || recordType == RecordTypes.Spell)
                {
                    textLabel += string.Format(" [{0}]", GetItemOrSpellName(parent.Children[i]));
                }

                // Check if item equipped
                if (recordType == RecordTypes.Item)
                {
                    //ItemRecord itemRecord = (ItemRecord)parent.Children[i];
                    //textLabel += string.Format(" [id={0}]", itemRecord.RecordRoot.RecordID);

                    int equippedIndex = GetEquippedIndex(parent.Children[i] as ItemRecord);
                    if (equippedIndex != -1)
                    {
                        //textLabel = string.Format("(*={0:00}) {1}", equippedIndex, textLabel);
                    }
                }

                // Tag wagon container
                if (recordType == RecordTypes.Container && parent.RecordType == RecordTypes.Character)
                {
                    ContainerRecord containerRecord = (ContainerRecord)parent.Children[i];
                    if (containerRecord.IsWagon)
                    {
                        textLabel += " [Wagon]";
                    }
                }

                EditorGUILayout.LabelField(textLabel);
                GUILayoutHelper.Indent(() =>
                {
                    DisplaySaveTree(parent.Children[i]);
                });
            }
        }
Пример #3
0
        private List <DnsZoneRecord> GetZoneRecords(string zoneFileText, string regexPattern,
                                                    RecordTypes recordType, int nameIndex, int valueIndex, int priorityIndex)
        {
            var _tmp    = new List <DnsZoneRecord>();
            var matches = Regex.Matches(zoneFileText, regexPattern, RegexOptions.Multiline);

            foreach (Match item in matches)
            {
                var match = new DnsZoneRecord();
                match.Name       = ReadGroupValue(item.Groups, nameIndex);
                match.Data       = ReadGroupValue(item.Groups, valueIndex);
                match.RecordType = recordType.ToString();
                match.Priority   = Convert.ToUInt16(ReadGroupValueInt(item.Groups, priorityIndex));

                _tmp.Add(match);
            }

            return(_tmp);
        }
        void DisplaySaveTree(SaveTreeBaseRecord parent)
        {
            for (int i = 0; i < parent.Children.Count; i++)
            {
                RecordTypes recordType = parent.Children[i].RecordType;
                if (recordType == RecordTypes.UnknownTownLink || recordType == RecordTypes.UnknownItemRecord)
                {
                    continue;
                }

                string textLabel = recordType.ToString();
                if (recordType == RecordTypes.Item || recordType == RecordTypes.Spell)
                {
                    textLabel += string.Format(" [{0}]", GetItemOrSpellName(parent.Children[i]));
                }

                EditorGUILayout.LabelField(textLabel);
                GUILayoutHelper.Indent(() =>
                {
                    DisplaySaveTree(parent.Children[i]);
                });
            }
        }