Exemplo n.º 1
0
    /// <summary>
    /// Unblock user input.
    /// Note: Always unlock one specific block, unless you really mean to unlock everything!
    /// </summary>
    /// <param name="blockReason">If not set, it will force unblocking everything.</param>
    public void UnBlock(InputBlockReason blockReason)
    {
        //EB.Debug.Log("[InputBlockerManager]UnBlock: " + blockReason.ToString());
        //EB.Debug.Log(GetStatus());

        // No block in the list, just return.
        if (blockList.Count == 0)
        {
            _isBlocking = false;
            return;
        }

        int removedNum = blockList.RemoveAll(delegate(InputBlockInfo obj) {
            return(blockReason == obj.reason);
        });

        if (removedNum == 0)
        {
            //EB.Debug.Log("[InputBlockerManager]UnBlock: Block reason " + blockReason + " not found. It's been expired or never get triggered!");
        }

        if (blockList.Count == 0)
        {
            _UnBlock();
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Block user's input.
    /// </summary>
    /// <param name="blockReason">For what reason you need to block user's input.</param>
    /// <param name="timer">Timer in seconds.</param>
    public void Block(InputBlockReason blockReason, float timer = 2f)
    {
        //EB.Debug.Log("[InputBlockerManager]Block: " + blockReason.ToString() + ", " + timer.ToString() + "secs");

        if (!_isBlocking)
        {
            _Block();
        }

        InputBlockInfo newBlock = new InputBlockInfo(blockReason, timer);

        blockList.Add(newBlock);
    }
Exemplo n.º 3
0
 public InputBlockInfo(InputBlockReason _reason, float _timer)
 {
     reason      = _reason;
     timer       = _timer;
     triggerTime = RealTime.time;
 }