Exemple #1
0
        public Map JsonModel2Map(MapJsonModel mapJson)
        {
            Map StageMap = new Map();

            StageMap.Name              = mapJson.Name;
            StageMap.Description       = mapJson.Description;
            StageMap.GameOverCondition = mapJson.GameOverCondition;
            StageMap.Blocks            = new List <Block>();
            // 填充blocks的strains数据
            foreach (var b in mapJson.Blocks)
            {
                var bb = b as Block;
                bb.Strains         = new StrainController().Text2Strains_Npc(b.StrainsInfo);
                bb.PublicChemicals = SemanticObjectController.GenerateText2ChemicalsWithCountInfo(b.ChemicalNamesInfo);
                StageMap.Blocks.Add(b as Block);
            }
            StageMap.PlayerOwnedChemicals = SemanticObjectController.GenerateText2ChemicalsWithCountInfo(mapJson.PlayerOwnedChemicalsDescription);
            return(StageMap);
        }
 public Strain JsonModel2Strain_Npc(StrainJsonModel s)
 {
     return(new Strain {
         Name = s.Name,
         Owner = s.Owner,
         BasicRace = Local.FindRaceByName(s.BasicRaceName),
         Population = s.Population,
         PlayerSelectedGenes = SemanticObjectController.GenerateText2RegGeneObjects(s.PlayerSelectedGenesName),
         PrivateChemicals = string.IsNullOrEmpty(s.PrivateChemicalInfos) ? new List <Chemical>() : SemanticObjectController.GenerateText2ChemicalsWithCountInfo(s.PrivateChemicalInfos)
     });
 }