Пример #1
0
        /// <summary>
        /// 获取消息对象
        /// </summary>
        /// <param name="type">消息类别</param>
        /// <param name="score">成绩</param>
        /// <returns>消息对象</returns>
        private MyMsgEntity GetMessage(Constant.MessageType type, int score)
        {
            BitmapImage imgMsg   = null;
            string      dispMsg  = string.Empty;
            string      scoreMsg = Constant.MsgScore;

            switch (type)
            {
            case Constant.MessageType.Shy:
            {
                imgMsg  = bitImgShy;
                dispMsg = Constant.MsgSaySorry;
                break;
            };

            case Constant.MessageType.Good:
            {
                imgMsg  = bitImgGood;
                dispMsg = Constant.MsgCongratulation;
                break;
            }

            case Constant.MessageType.VeryGood:
            {
                imgMsg  = bitImgVeryGood;
                dispMsg = Constant.MsgPraise;
                break;
            }

            case Constant.MessageType.GodLike:
            {
                imgMsg  = bitImgGodLike;
                dispMsg = Constant.MsgTalent;
                break;
            }

            case Constant.MessageType.MyGod:
            {
                imgMsg  = bitImgGodLike;
                dispMsg = Constant.MsgMyGod;
                break;
            }

            default:
            {
                //imgMsg = bitImgShy;
                //dispMsg = (string)this.FindResource("");
                //scoreMsg = (string)this.FindResource("");
                break;
            }
            }
            return(new MyMsgEntity(imgMsg, scoreMsg + score, dispMsg));
        }
Пример #2
0
        /// <summary>
        /// 设置消息内容和大小
        /// </summary>
        /// <param name="myMessage">消息对象</param>
        /// <param name="level">游戏级别</param>
        /// <param name="score">游戏得分</param>
        public void SetMessage(MyMessage myMessage, int level, int score)
        {
            this.myMessage = myMessage;
            Constant.MessageType type = Constant.MessageType.Shy;
            if (score > 80)
            {
                switch (level)
                {
                case 3:
                case 4:
                {
                    type = Constant.MessageType.Good;
                    break;
                }

                case 5:
                {
                    type = Constant.MessageType.VeryGood;
                    break;
                }

                case 6:
                {
                    type = Constant.MessageType.GodLike;
                    break;
                }

                case 7:
                case 8:
                case 9:
                case 10:
                {
                    type = Constant.MessageType.MyGod;
                    break;
                }

                default:
                {
                    break;
                }
                }
            }
            myMessage.MyMsgClass = GetMessage(type, score * level); //设置消息内容
            myMessage.Height     = 84;                              //消息高度
            myMessage.Width      = 450;                             //消息宽度
        }