Example #1
0
        /// <summary>
        /// Tries to get the alert of the indicated type
        /// </summary>
        /// <returns>true if found</returns>
        public bool TryGet(AlertType alertType, out AlertPrototype alert)
        {
            if (_typeToIndex.TryGetValue(alertType, out var idx))
            {
                alert = _orderedAlerts[idx];
                return(true);
            }

            alert = null;
            return(false);
        }
Example #2
0
        /// <summary>
        /// Tries to get the alert from the encoded representation
        /// </summary>
        /// <returns>true if successful</returns>
        public bool TryDecode(byte encodedAlert, out AlertPrototype alert)
        {
            if (encodedAlert >= _orderedAlerts.Length)
            {
                alert = null;
                return(false);
            }

            alert = _orderedAlerts[encodedAlert];
            return(true);
        }
Example #3
0
        /// <summary>
        /// Tries to get the alert of the indicated type along with its encoding
        /// </summary>
        /// <returns>true if found</returns>
        public bool TryGetWithEncoded(AlertType alertType, out AlertPrototype alert, out byte encoded)
        {
            if (_typeToIndex.TryGetValue(alertType, out var idx))
            {
                alert   = _orderedAlerts[idx];
                encoded = (byte)idx;
                return(true);
            }

            alert   = null;
            encoded = 0;
            return(false);
        }
Example #4
0
 /// <summary>
 /// Tries to get the compact encoded representation of this alert
 /// </summary>
 /// <returns>true if successful</returns>
 public bool TryEncode(AlertPrototype alert, out byte encoded)
 {
     return(TryEncode(alert.AlertType, out encoded));
 }
Example #5
0
 public ClickAlertEventArgs(IEntity player, AlertPrototype alert)
 {
     Player = player;
     Alert  = alert;
 }
Example #6
0
 /// <summary>
 /// Tries to get the alert of the indicated type
 /// </summary>
 /// <returns>true if found</returns>
 public bool TryGet(AlertType alertType, out AlertPrototype alert)
 {
     return(_typeToAlert.TryGetValue(alertType, out alert));
 }