示例#1
0
 public void Clear()
 {
     BoardOS.bvus.ForceComplete(true);
     while (currentPointOfTime >= 0)
     {
         if (inventoryHistory[currentPointOfTime] != null)
         {
             inventoryHistory[currentPointOfTime].UpdateAvailability(true);
         }
         for (int i = gridHistory[currentPointOfTime].Count - 1; i >= 0; i--)
         {
             GridChange change = gridHistory[currentPointOfTime][i];
             BoardOS.ForceChange(change.gridPos, -1, BoardOS.GetTileID(change.gridPos) != -1, false);
         }
         currentPointOfTime--;
     }
     gridPresent.Clear();
     gridHistory.Clear();
     inventoryHistory.Clear();
     bRedo.interactable   = false;
     bUndo.interactable   = false;
     bSubmit.interactable = false;
     bClear.interactable  = false;
 }
示例#2
0
    public void Undo(bool lightsUp)
    {
        if (currentPointOfTime < 0)
        {
            return;
        }
        //Debug.Log("Undo | " + currentPointOfTime);
        BoardOS.bvus.ForceComplete(lightsUp);

        if (inventoryHistory[currentPointOfTime] != null)
        {
            inventoryHistory[currentPointOfTime].UpdateAvailability(true);
        }
        for (int i = gridHistory[currentPointOfTime].Count - 1; i >= 0; i--)
        {
            GridChange change = gridHistory[currentPointOfTime][i];
            BoardOS.ForceChange(change.gridPos, change.originalElementID, lightsUp, false);
        }
        currentPointOfTime--;
        gridPresent.Clear();

        bRedo.interactable = true;
        bUndo.interactable = (currentPointOfTime >= 0);
    }
示例#3
0
    public void Redo()
    {
        if (currentPointOfTime >= gridHistory.Count - 1)
        {
            return;
        }
        //Debug.Log("Redo | " + (currentPointOfTime + 1));
        BoardOS.bvus.ForceComplete(true);

        if (inventoryHistory[currentPointOfTime + 1] != null)
        {
            inventoryHistory[currentPointOfTime + 1].UpdateAvailability(false);
        }
        for (int i = 0; i < gridHistory[currentPointOfTime + 1].Count; i++)
        {
            GridChange change = gridHistory[currentPointOfTime + 1][i];
            BoardOS.ForceChange(change.gridPos, change.changedElementID, true, false);//
        }
        currentPointOfTime++;
        gridPresent.Clear();

        bRedo.interactable = (currentPointOfTime < gridHistory.Count - 1);
        bUndo.interactable = true;
    }