Beispiel #1
0
        /// <summary>
        /// 加载搜索结果
        /// </summary>
        public void LoadResult()
        {
            List <IRecovableOperation> operations = new List <IRecovableOperation>();
            List <Vector2Int>          way        = new List <Vector2Int>();
            int finalCost = 0;

            Logger.Instance.PrintInfo("正在载入搜索数据...");
            try
            {
                operations = MazeIO.ReadSearchDataFromFile(resultPath,
                                                           cellObjs.ConvertAll(row => row.ConvertAll(obj => obj.GetComponent <ICellObj>())), out way, out finalCost);
            }
            catch (FileNotFoundException)
            {
                Logger.Instance.PrintError($"无法打开路径为\"{resultPath}\"的搜索文件!");
            }
            catch (Exception)
            {
                Logger.Instance.PrintError("加载搜索数据时出现未知错误!");
            }

            operations.Add(new PathDrawOperation(way, pathDrawer));
            progressMgr.LoadOperationChain(new OperationChain(operations, -1));
            pathDrawer.HidePath();
            StatusBar.Instance.SetFinalCost(finalCost);
            Logger.Instance.PrintInfo("迷宫数据已加载");
        }
Beispiel #2
0
 public void Undo()
 {
     drawer.HidePath();
 }