public void SetResponseMessage(GhostRoleResponseCode code)
        {
            StopCoroutine(responseOverlayCoroutine);
            waitingOnResponseOverlay.SetActive(false);

            if (code == GhostRoleResponseCode.ClearMessage)
            {
                responseMessageLabel.text = default;
                return;
            }

            // Ignore displaying this particular response message; the success message is more useful.
            if (code == GhostRoleResponseCode.AlreadyWaiting)
            {
                return;
            }

            if (code == GhostRoleResponseCode.Success)
            {
                GhostRoleManager.Instance.TryStopCoroutine(ref clearResponseMessage);
                responseMessageLabel.color = successColor;
            }
            else
            {
                responseMessageLabel.color = warningColor;
                GhostRoleManager.Instance.RestartCoroutine(ClearResponseMessage(), ref clearResponseMessage);
            }

            responseMessageLabel.text = GhostRoleResponseMessage.GetMessageText(code);
        }
        public void DisplayResponseMessage(uint key, GhostRoleResponseCode responseCode)
        {
            if (entries.ContainsKey(key) == false)
            {
                return;
            }

            entries[key].SetResponseMessage(responseCode);
        }
        /// <summary>
        /// Sends a message to the specific player, informing them about the outcome of their request for a ghost role.
        /// </summary>
        public static NetMessage SendTo(ConnectedPlayer player, uint key, GhostRoleResponseCode code)
        {
            NetMessage msg = new NetMessage
            {
                roleID       = key,
                responseCode = (int)code,
            };

            SendTo(player, msg);
            return(msg);
        }
示例#4
0
 /// <summary>
 /// Gets the verbose text associated with the given response code.
 /// </summary>
 public static string GetMessageText(GhostRoleResponseCode responseCode)
 {
     return(stringDict[responseCode]);
 }