public ILevelObj NewObject()
        {
            if (ViewForm.CurList is FakeObjList)
            {
                MessageBox.Show("This list is just for showing the stage model, you can't add objects here");
                return(null);
            }
            string res = null;

            if (ComboBoxDialog.Show("Add object", "Select the object name", ref res, ObjIDNameList.Values.ToArray()) != DialogResult.OK)
            {
                return(null);
            }
            var o = new LevelObj();

            o.Name = res;
            return(o);
        }
Example #2
0
 public ObjList(string _name, IList <dynamic> _bymlNode)
 {
     name = _name;
     if (_bymlNode == null)
     {
         bymlNode = new List <dynamic>();
         return;
     }
     bymlNode = _bymlNode;
     foreach (var o in bymlNode)
     {
         var obj   = new LevelObj(o);
         int objID = obj.ID_int;
         if (Level._HighestID < objID)
         {
             Level._HighestID = objID;
         }
         this.Add(obj);
     }
 }
        public ILevel LoadLevel(string file = null)
        {
            if (file == null)
            {
                var opn = new OpenFileDialog()
                {
                    Filter = LevelFormatFilter
                };
                if (opn.ShowDialog() != DialogResult.OK)
                {
                    return(null);
                }
                file = opn.FileName;
            }

            var res = new Level(file);

            string stageName      = new DirectoryInfo(file).Parent.Name;
            string stageModelPath = $"{ModelsFolder}\\{stageName}.obj";

            if (!File.Exists(stageModelPath))
            {
                byte[] CourseBfres = YAZ0.Decompress(Path.GetDirectoryName(file) + "\\course_model.szs");
                if (BfresConverter.Convert(CourseBfres, ModelsFolder) == null)
                {
                    stageModelPath = null;
                }
            }

            if (stageModelPath != null)
            {
                StageDummyModel           = new LevelObj(false, true);
                StageDummyModel.ModelName = $"{stageName}";
                StageDummyModel.Scale     = new System.Windows.Media.Media3D.Vector3D(1, 1, 1);
                res.objs["StageModel - Can't edit"].Add(StageDummyModel);
            }

            GC.Collect();

            return(res);
        }