Ejemplo n.º 1
0
  void End()
  {
    if (m_EndOperationWhenFinished)
    {
      m_EndOperationWhenFinished = false;
      OperationSystem.EndOperation();
    }

    AttemptDeactivate();
  }
Ejemplo n.º 2
0
    public void EndBatch(bool createDialogs = true)
    {
        if (!OperationSystem.s_Frozen)
        {
            var message = "The tile grid was asked to end a batch when " +
                          "no batch had been begun! Proceed with caution.";
            Debug.LogError(message);

            return;
        }

        m_BatchedIndices = null;

        // now, any modal dialogs that want to be spawned by the most
        // recently placed tile will be pushed onto a stack. as long as
        // a modal dialog is still up and running, it is free to modify
        // the deltas in the latest operation. when the last one is
        // closed, the ModalDialogMaster will call OperationSystem.EndOperation,
        // and the user will regain control
        //
        // however, if the latest tile doesn't need to open a dialog
        // window, then we can skip all of that, and we can just call
        // EndOperation here and now

        // the most recently created tile will be null if the last thing
        // the user did was erase something
        if (m_MostRecentlyCreatedTile == null)
        {
            OperationSystem.EndOperation();
            return;
        }

        if (createDialogs)
        {
            var modalDialogAdder = m_MostRecentlyCreatedTile.GetComponent <ModalDialogAdder>();
            if (modalDialogAdder == null)
            {
                OperationSystem.EndOperation();
            }
            else
            {
                modalDialogAdder.RequestDialogsAtTransform();
            }
        }
        else
        {
            OperationSystem.EndOperation();
        }

        // it is understood that the ModalDialogMaster will call
        // EndOperation when the last dialog is closed

        m_MostRecentlyCreatedTile = null;
    }