Esempio n. 1
0
        //释放
        public void UnLoad()
        {
            MusicCustom.Clear();
            GroupModuls.Clear();
            GroupFloors.Clear();
            GroupColSounds.Clear();
            ResetPoints.Clear();
            Sectors.Clear();

            LevelAssetBundle.Unload(true);
            LevelAssetBundle = null;
            LoadStatus       = GameModStatus.NotInitialize;
        }
Esempio n. 2
0
        public void Init(IDirectoryInfo d)
        {
            if (StartDirectory == null)
            {
                StartDirectory = d;
            }
            Sectors.Clear();
            Text             = "Memory report: " + d.FullName;
            CurrentDirectory = d;
            var list  = Stuff.GetAllFiles(d);
            var total = list.Sum(z => z.Length);

            TotalLen = total;
            var rootl = d.GetFiles().Sum(z => z.Length);

            if (rootl > 0)
            {
                Sectors.Add(new ReportSectorInfo()
                {
                    Name = ".root", Length = rootl, Tag = d, Percentage = (float)rootl / total
                });
            }
            foreach (var item in d.GetDirectories())
            {
                var f = Stuff.GetAllFiles(item);
                var l = f.Sum(z => z.Length);
                Sectors.Add(new ReportSectorInfo()
                {
                    Name       = item.Name,
                    Length     = l,
                    Percentage = (float)l / total,

                    Tag = item
                });
            }
            Sectors = Sectors.OrderByDescending(z => z.Percentage).ToList();

            listView1.Items.Clear();
            foreach (var item in Sectors)
            {
                listView1.Items.Add(new ListViewItem(new string[] { item.Name, Stuff.GetUserFriendlyFileSize(item.Length), (item.Percentage * 100).ToString("F") + "%" })
                {
                    Tag = item
                });
            }
            //listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            //listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Esempio n. 3
0
        private void ReadLevelDefGroup(XmlNode nodeBaseInfo)
        {
            foreach (XmlNode node in nodeBaseInfo.ChildNodes)
            {
                switch (node.Name)
                {
                case "Moduls":
                {
                    Sectors.Clear();
                    foreach (XmlNode node2 in node.ChildNodes)
                    {
                        LevelGroupModul group = new LevelGroupModul();
                        group.ModulName = node2.Name;

                        if (node2.Attributes["packageName"] != null)
                        {
                            group.ModulPackage = node2.Attributes["packageName"].Value;
                        }

                        foreach (XmlNode node3 in node2.ChildNodes)
                        {
                            if (node3.Name == "Object")
                            {
                                group.Objects.Add(node3.InnerText);
                            }
                        }

                        GroupModuls.Add(group);
                    }
                    break;
                }

                case "Floors":
                {
                    Sectors.Clear();
                    foreach (XmlNode node2 in node.ChildNodes)
                    {
                        LevelGroup group = new LevelGroup();
                        group.Name = node2.Name;

                        foreach (XmlNode node3 in node2.ChildNodes)
                        {
                            if (node3.Name == "Object")
                            {
                                group.Objects.Add(node3.InnerText);
                            }
                        }

                        GroupFloors.Add(group);
                    }
                    break;
                }

                case "ColSounds":
                {
                    Sectors.Clear();
                    foreach (XmlNode node2 in node.ChildNodes)
                    {
                        LevelGroup group = new LevelGroup();
                        group.Name = node2.Name;

                        foreach (XmlNode node3 in node2.ChildNodes)
                        {
                            if (node3.Name == "Object")
                            {
                                group.Objects.Add(node3.InnerText);
                            }
                        }

                        GroupColSounds.Add(group);
                    }
                    break;
                }

                case "LevelStart": LevelStart = node.InnerText; break;

                case "LevelEnd": LevelEnd = node.InnerText; break;

                case "ResetPoints":
                {
                    ResetPoints.Clear();
                    foreach (XmlNode node2 in node.ChildNodes)
                    {
                        if (node2.Name == "ResetPoint")
                        {
                            ResetPoints.Add(node2.InnerText);
                        }
                    }
                    break;
                }

                case "Sectors":
                {
                    Sectors.Clear();
                    foreach (XmlNode node2 in node.ChildNodes)
                    {
                        if (node2.Name == "Sector")
                        {
                            LevelGroupSector sector = new LevelGroupSector();
                            if (node2.Attributes["sectorStart"] != null)
                            {
                                sector.SectorStart = node2.Attributes["sectorStart"].Value;
                            }

                            foreach (XmlNode node3 in node2.ChildNodes)
                            {
                                if (node3.Name == "Object")
                                {
                                    sector.Objects.Add(node3.InnerText);
                                }
                            }

                            Sectors.Add(sector);
                        }
                    }
                    break;
                }
                }
            }
        }