Exemple #1
0
        private void LoadLevel()
        {
            FileInfo file  = f_files[f_selectInfoIndex];
            FBLevel  level = new FBLevel();

            FBTools.FillLevel(file.FullName, ref level);
            Map.LoadLevel(level);
        }
Exemple #2
0
        private void SaveLevel()
        {
            //获取当前加载的关卡
            FBLevel level = Map.Level;

            //临时索引点
            List <FBCoords> list = null;

            //收集塔点
            list = new List <FBCoords>();
            for (int i = 0; i < Map.Grids.Count; i++)
            {
                FBGrid g = Map.Grids[i];
                if (g.CanHold)
                {
                    FBCoords c = new FBCoords(g.Index_X, g.Index_Y);
                    list.Add(c);
                }
            }
            level.Holders = list;

            //收集寻路点
            list = new List <FBCoords>();
            for (int i = 0; i < Map.Road.Count; i++)
            {
                FBGrid   g = Map.Road[i];
                FBCoords c = new FBCoords(g.Index_X, g.Index_Y);
                list.Add(c);
            }
            level.Path = list;

            //保存
            string fileName = f_files[f_selectInfoIndex].FullName;

            FBTools.SaveLevel(fileName, level);
            //弹框
            EditorUtility.DisplayDialog("保存关卡数据", "保存成功", "确定");
        }