public void Initialize(Repository repository, string fileName)
        {
            FileName    = fileName;
            _repository = repository;

            string textureSetName = fileName;

            pathTextBox.Text = _repository.MakeObjectFilePath(fileName);
            FullPath         = _repository.MakeObjectFilePath(fileName, true);

            SR1Repository.Object existingObject = repository.Objects.Objects.Find(x => x.ObjectName == fileName);
            if (existingObject != null && existingObject.TextureSet != "")
            {
                textureSetName = existingObject.TextureSet;
            }

            TexSet currentTextureSet = null;

            foreach (TexSet textureSet in _repository.TextureSets.TexSets)
            {
                textureSetCombo.Items.Add(textureSet.Name);

                if (textureSet.Name == textureSetName)
                {
                    currentTextureSet = textureSet;
                }
            }

            if (currentTextureSet != null)
            {
                textureSetCombo.SelectedIndex = currentTextureSet.Index;
            }
            else
            {
                textureSetCombo.Items.Add(fileName);
                textureSetCombo.SelectedIndex = _repository.TextureSets.Count;
            }
        }
Esempio n. 2
0
        public void Initialize(Repository repository, string fileName, SR1_File file)
        {
            FileName    = fileName;
            _repository = repository;

            string textureSetName = fileName;

            pathTextBox.Text = _repository.MakeLevelFilePath(fileName);
            FullPath         = _repository.MakeLevelFilePath(fileName, true);

            Level existingLevel = repository.Levels.Levels.Find(x => x.UnitName == fileName);

            if (existingLevel != null && existingLevel.TextureSet != "")
            {
                textureSetName = existingLevel.TextureSet;
            }

            TexSet currentTextureSet = null;

            foreach (TexSet textureSet in _repository.TextureSets.TexSets)
            {
                textureSetCombo.Items.Add(textureSet.Name);

                if (textureSet.Name == textureSetName)
                {
                    currentTextureSet = textureSet;
                }
            }

            if (currentTextureSet != null)
            {
                textureSetCombo.SelectedIndex = currentTextureSet.Index;
            }
            else
            {
                textureSetCombo.Items.Add(fileName);
                textureSetCombo.SelectedIndex = _repository.TextureSets.Count;
            }

            foreach (string objectName in file._ObjectNames)
            {
                string lowerCase = objectName.ToLower();
                if (_repository.Objects.Find(x => x.ObjectName == lowerCase) == null)
                {
                    requiredObjectList.Items.Add(lowerCase);
                }
            }

            SR1Structures.Level   level   = (SR1Structures.Level)file._Structures[0];
            SR1Structures.Terrain terrain = (SR1Structures.Terrain)file._Structures[level.terrain.Offset];

            _multiSignals = (SR1Structures.SR1_StructureSeries <SR1Structures.MultiSignal>)file._Structures[level.SignalListStart.Offset];
            _portalList   = (SR1Structures.StreamUnitPortalList)file._Structures[terrain.StreamUnits.Offset];

            this.portalList.Items.Clear();
            foreach (SR1Structures.StreamUnitPortal portal in _portalList.portals)
            {
                this.portalList.Items.Add(portal.tolevelname);
                this.portalList.SetItemChecked(this.portalList.Items.Count - 1, true);
            }
        }