コード例 #1
0
        public void Alert(string message, NotificationType notificationType, int timer)
        {
            string        bgr         = "white";
            List <string> backgrounds = new List <string> {
                "#429cb6", "#54b07d", "#EB5E28", "#F3BB45"
            };                                                                                          //info, success, error, warning

            if (notificationType.Equals(NotificationType.info))
            {
                bgr = backgrounds[0];
            }
            if (notificationType.Equals(NotificationType.success))
            {
                bgr = backgrounds[1];
            }
            if (notificationType.Equals(NotificationType.error))
            {
                bgr = backgrounds[2];
            }
            if (notificationType.Equals(NotificationType.warning))
            {
                bgr = backgrounds[3];
            }

            var msg1 = "Swal.fire({ background: '" + bgr + "', position: 'top', type: '" + notificationType + "', toast: true, title: '" + message + "', showConfirmButton: true, timer: " + timer + " })";
            var msg  = "Swal.fire({ title: '" + notificationType.ToString().ToUpper() + "', html: '" + message + "', type: '" + notificationType + "', timer: '" + timer + "', icon: '" + notificationType + "' })";

            TempData["notification"] = msg;
        }
コード例 #2
0
        public async Task Process()
        {
            bool   isFriendInvitation = _type.Equals(NotificationType.Invitation);
            bool   isGroupInvitation  = _type.Equals(NotificationType.GroupInvitation);
            string notificationDesc   = string.Empty;

            if (isFriendInvitation || isGroupInvitation)
            {
                if (_isAccepted)
                {
                    notificationDesc = await UpdateOrCreateChat().ConfigureAwait(true);
                }
                else
                {
                    if (isFriendInvitation)
                    {
                        notificationDesc = $"User {_currentUser.Email} rejected your invitation.";
                    }
                    else
                    {
                        string chatName = (await GetChat().ConfigureAwait(true))?.Name;
                        notificationDesc = $"User {_currentUser.Email} rejected your invitation about: {chatName}.";
                    }
                }

                InformationNotification = new Notification
                {
                    Sender    = _currentUser,
                    Receiver  = _requester,
                    Type      = NotificationType.Information,
                    Desc      = notificationDesc,
                    ExtraData = string.Empty,
                    Date      = DateTime.Now
                };
            }
        }
コード例 #3
0
        public async Task SendNotifications(int FotoId, NotificationType type, string currentUserId)
        {
            int notificationType = 1;

            if (type.Equals(NotificationType.LIKE))
            {
                try
                {
                    var count = await _likeRepository.GetLikeCount(FotoId);

                    var foto = await _fotoRepository.GetFotoById(FotoId);

                    //var currentUser = await _userRepository.GetCurrentUser(_contextAccessor.HttpContext.User);
                    var notification = new Notification
                    {
                        ApplicationUserIdSend = currentUserId,
                        ApplicationUserId     = foto.ApplicationUserId,
                        NotificationType      = notificationType
                    };

                    //await _notificationRepository.SaveNotification(notification);

                    var likeNotification = new
                    {
                        FotoId,
                        count,
                        notificationType
                    };
                    await Clients.All.SendAsync("Notifications", likeNotification);
                }
                catch (Exception e)
                {
                    e.ToString();
                }
            }
        }
コード例 #4
0
    /**
     * @ Function : Notification Function
     *
     * @ Author : Minjung Kim
     * @ Date : 2020.Jun.07
     * @ History :
     *   - 2020.04.03 Euisung Kim: 최초 작성
     *   - 2020.04.10 Minjung KIM: Modify Function structure and Add disappear message function
     *   - 2020.05.23 Minjung KIM: Add Event Log
     *   - 2020.05.31 Minjung KIM: Add Function Comment
     *   - 2020.06.17 Minjung Kim: Update screen materials
     *   - 2020.06.27 Minjung Kim: Add gameMode check
     **/
    void Update()
    {
        GameObject phoneObj = null;

        try{
            phoneObj = GameObject.FindGameObjectWithTag("left_cellphone");
        }catch (Exception e) {
            Debug.Log("없으면 재시작해야합니다. 로딩까지 좀 걸리지");
        }

        // This function starts when the hint duration is bigger than 0
        if (hintDuration > 0)
        {
            hintDuration -= Time.deltaTime;
            if (hintDuration <= 0)
            {
                Debug.Log("[Notification: Finished]");
                // cellPhoneCanvas.SetActive(false);
                screen.SetTexture("_EmissionMap", basic.texture);
                subtitle.SetActive(false);
                M_EventLogger.EventLogging(GlobalEnv.ACTOR_SYSTEM, GlobalEnv.EVENT_CATE_SYS_MSG, GlobalEnv.EVENT_TYPE_NOTI, "Call_subtitle", "DISAPPEARS");
            }
        }

        // ----------------------------------
        // 1st phone calling, when the user scans first item
        // Content: Seding a Discount Code and budget infomation.
        // ----------------------------------
        string v_first_scan_yn = GameObject.Find("v_first_scan_yn").GetComponent <Text>().text;

        if (notificationType.Equals(NotificationType.First) & v_first_scan_yn.Equals("Y"))
        {
            if (gameMode.Equals(GlobalEnv.GAMEMODE_START))
            {
                Debug.Log("[Notification: Phone Calling], [" + gameMode + "]");
                CallHapticAction(0, 2, 150, 75, leftHand);
                SoundManager.instance.PlaySound(GlobalEnv.SOUND_CALL, lang);
                screen.SetTexture("_EmissionMap", screen_calling1.texture);
                M_EventLogger.EventLogging(GlobalEnv.ACTOR_SYSTEM, GlobalEnv.EVENT_CATE_SYS_MSG, GlobalEnv.EVENT_TYPE_NOTI, "Phone Calling", "Calling");
                Invoke("ChangePhoneScreen", 1.5f);
                notificationType = NotificationType.Second;
                hintDuration     = time;
            }
        }

        // ----------------------------------
        // 2nd text message that when the user does 3 erros to enter a discont code
        // Content: Sending a full discount code.
        // ----------------------------------
        int v_discount_errors = Int32.Parse(GameObject.Find("v_discount_errors").GetComponent <Text>().text);

        if (notificationType.Equals(NotificationType.Second) && v_discount_errors >= 3)
        {
            Debug.Log("[Notification: Message], [" + gameMode + "]");
            CallHapticAction(0, 2, 150, 75, leftHand);
            SoundManager.instance.PlaySound(GlobalEnv.SOUND_MESSAGE, lang);
            screen.SetTexture("_EmissionMap", screen_message.texture);
            M_EventLogger.EventLogging(GlobalEnv.ACTOR_SYSTEM, GlobalEnv.EVENT_CATE_SYS_MSG, GlobalEnv.EVENT_TYPE_NOTI, "Phone Message", "Sent a discount code (User failed to enter the discount code)");
            notificationType = NotificationType.Finished;
        }
    }