コード例 #1
0
 public void Flip(List <FlipNode> flipNodes)
 {
     foreach (var node in flipNodes)
     {
         var area = tableBase.map.GetArea(node.pos);
         if (area != null)
         {
             area.father.RemoveOutsides(area);
         }
         ConnectedAreas ca = tableBase.cas.CreateCa();
         area = tableBase.map.CreateNumber(node.pos, ca);
         gamePart.flipBoard.ChangeAround(node.x, node.y,
                                         (int aroundX, int aroundY, int get) => {
             IndexOfList2D pos = new IndexOfList2D(aroundX, aroundY);
             Area neighbour    = tableBase.map.GetArea(pos);
             if (get == 0)
             {
                 if (neighbour == null)
                 {
                     neighbour = tableBase.map.CreateOutside(pos, ca);
                 }
                 else
                 {
                     tableBase.cas.MergeCas(neighbour.father, ca);
                     ca = neighbour.father;
                 }
                 neighbour.neighbours.Add(area);
                 area.neighbours.Add(neighbour);
             }
             return(get);
         }
                                         );
         if (area.neighbours.Count == 0)
         {
             tableBase.map.RemovePos(area.pos);
             tableBase.cas.Remove(ca);
         }
     }
     problemsAndResults = new Dictionary <ConnectedAreas, SearchForCa>();
     foreach (var ca in tableBase.cas.list)
     {
         problemsAndResults[ca] = new SearchForCa(ca);
         problemsAndResults[ca].Process();
     }
     visualizedData();
     if (afterPrecacAction != null)
     {
         afterPrecacAction();
     }
 }
コード例 #2
0
 // Use this for initialization
 public void OnSceneGUI()
 {
     if (searchForCa == null)
     {
         searchForCa = (target as SearchForCaMB).searchForCa;
     }
     if (mainData == null)
     {
         mainData = Singleton.MainData;
     }
     if (searchForCa.ca != null)
     {
         foreach (var minePos in searchForCa.GetMineList())
         {
             SingletonForEditor.DrawABeaultifulButton(minePos, searchForCa.stepResult == SearchingStepResult.GETRESULT ? Color.green : Color.red, null);
         }
         foreach (var number in searchForCa.GetNumberList())
         {
             var point = searchForCa.GetNumberPoint(number);
             SingletonForEditor.DrawABeaultifulButton(number.pos, point == 0 ? Color.grey : Color.yellow, null);
             SingletonForEditor.DrawABeaultifulLabel(number.pos, point.ToString());
             if (point == 0)
             {
                 foreach (var neighbour in number.neighbours)
                 {
                     SingletonForEditor.DrawABeautifulSmallButton(neighbour.pos, Color.grey, null);
                 }
             }
         }
         var iteratingNumber = searchForCa.GetIteratingNumber();
         if (iteratingNumber != null)
         {
             var point = searchForCa.GetNumberPoint(iteratingNumber);
             SingletonForEditor.DrawABeaultifulButton(iteratingNumber.pos, Color.blue, null);
             SingletonForEditor.DrawABeaultifulLabel(iteratingNumber.pos, point.ToString());
             var iteratingOutside = searchForCa.GetIteratingOutside();
             if (iteratingOutside != null)
             {
                 SingletonForEditor.DrawABeaultifulButton(iteratingOutside.pos, Color.blue, null);
             }
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Update is called every frame, if the MonoBehaviour is enabled.
 /// </summary>
 void Update()
 {
     if (searchForCa != null)
     {
         if (step)
         {
             step = false;
             searchForCa.Step();
         }
         if (process)
         {
             process = false;
             searchForCa.Process();
         }
         if (backToStart)
         {
             backToStart = false;
             searchForCa = new SearchForCa(searchForCa.ca);
         }
         if (processWithDelayTime)
         {
             processWithDelayTime = false;
             StartCoroutine(ProcessWithDelayTime());
         }
         if (stopProcess)
         {
             stopProcess = false;
             StopAllCoroutines();
         }
         if (visualizedData)
         {
             visualizedData = false;
             VisualizedData();
         }
     }
 }