public override void Execute()
 {
     if (NestSelected.Used)
     {
         return;
     }
     Cursor.Nest.AssignShape(NestSelected.Shape);
     Cursor.Nest.AssignFilling(NestSelected.Filling);
     AlphaManager.ForceHideCells(Cursor.Nest.Elements);
     AlphaManager.ForceHighlightCells(Cursor.Nest.Elements, true);
     CursorTr.position = SelectedTr.position;
     AlphaManager.ForceHideCells(NestSelected.Elements);
     Cursor.NestSelected = NestSelected;
     Executor.ExecCoroutine(ChasePointer());
 }
Exemple #2
0
        //[Inject]
        //public ValidateFieldSignal ValidateSignal { get; private set; }

        public override void Execute()
        {
            Retain();
            Dictionary <CellDescriptor, CellFilling> cellsToFill = new Dictionary <CellDescriptor, CellFilling>();
            List <Vector2> coords = new List <Vector2>();

            foreach (CellDescriptor cell in Cursor.Nest.Elements)
            {
                if (!cell.Enabled)
                {
                    continue;
                }
                int            x, y;
                CellDescriptor nearestCell = GetNearestCell(cell, out x, out y);
                if (cellsToFill.ContainsKey(nearestCell) || nearestCell.Enabled || !nearestCell.IsUnderCell(cell))
                {
                    Revoke();
                    return;
                }
                cellsToFill.Add(nearestCell, cell.Filling);
                coords.Add(new Vector2(x, y));
            }
            Cursor.NestSelected.Used = true;
            AlphaManager.ForceHideCells(Cursor.Nest.Elements);
            int i = 0;

            foreach (CellDescriptor cell in cellsToFill.Keys)
            {
                Model.Cells[(int)coords[i].x, (int)coords[i].y].Filling =
                    cell.Filling = cellsToFill[cell];
                Model.Cells[(int)coords[i].x, (int)coords[i].y].Filled =
                    cell.Enabled = true;
                i++;
            }
            AlphaManager.HighlightCells(cellsToFill.Keys, false);
            foreach (NestDescriptor nest in NestGrid.Elements)
            {
                if (!nest.Used)
                {
                    Release();
                    //ValidateSignal.Dispatch();
                    return;
                }
            }
            OverSignal.Dispatch();
            //ValidateSignal.Dispatch();
            Release();
        }
Exemple #3
0
 void Revoke()
 {
     AlphaManager.ForceHideCells(Cursor.Nest.Elements);
     AlphaManager.ForceHighlightCells(Cursor.NestSelected.Elements, true);
     Fail();
 }