public string GenerateOneLeaveMsg(Visitor visitor, LeaveMsg lvm)
        {
            //先根据visitor.HeadiconId查出visitor的头像
            HeadIcon icon = headService.GetEntity(visitor.VisitorIconId.Value);

            StringBuilder sbuilder = new StringBuilder();

            #region 临时回复模板
            // @*临时回复区域*@
            sbuilder.Append("<li id=\"li-comment-" + lvm.Id + "\" class=\"comment byuser " + visitor.VisitorName + "  even thread-even depth-1\">");
            sbuilder.Append("<article class=\"comment-body\" id=\"div-comment-" + lvm.Id + "\">");
            sbuilder.Append("<footer class=\"comment-meta\">");
            sbuilder.Append("<div class=\"comment-author vcard\">");
            //此处最好再在基础类里加一个获取默认值的方法:默认头像,默认博文封面图片,
            string defaultIconPath = ConfigurationManager.AppSettings["DefaultHeadIcon"];
            sbuilder.Append("<img width=\"60\" height=\"60\" class=\"avatar avatar-70 photo\" src=\"" + ((icon != null) ? icon.IconURL : defaultIconPath) + "\" alt=\"" + visitor.VisitorName + "\">	");
            sbuilder.Append("<b class=\"fn\">" + visitor.VisitorName + "</b> <span class=\"says\">say :</span>");
            sbuilder.Append("</div>");
            sbuilder.Append("<div class=\"comment-metadata\">");
            sbuilder.Append("<a href=\"\">");
            sbuilder.Append(lvm.SubTime);
            sbuilder.Append("</a>");
            sbuilder.Append("</div>");
            sbuilder.Append("</footer>");
            sbuilder.Append("<div class=\"comment-content\">");
            sbuilder.Append("<p>" + lvm.LMessage + "</p>");
            sbuilder.Append("</div>");
            sbuilder.Append("</article>");
            sbuilder.Append("</li>");
            #endregion

            return(sbuilder.ToString());
        }
Esempio n. 2
0
 void UpdateIcon()
 {
     if (HeadIcon != null)
     {
         HeadIcon.LoadSprite("icon/" + _Icon);
     }
 }
Esempio n. 3
0
        public ActionResult PublicHeadIcon(int id)
        {
            HeadIcon head = new HeadIcon()
            {
                Id     = id,
                Status = 1
            };

            int val = iconService.Update(head, "Status");

            return(Json(val));
        }
Esempio n. 4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (PlayerId != 0UL)
            {
                hash ^= PlayerId.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (CharacterId != 0)
            {
                hash ^= CharacterId.GetHashCode();
            }
            if (Level != 0)
            {
                hash ^= Level.GetHashCode();
            }
            if (Exp != 0)
            {
                hash ^= Exp.GetHashCode();
            }
            if (Hp != 0)
            {
                hash ^= Hp.GetHashCode();
            }
            if (MaxHp != 0)
            {
                hash ^= MaxHp.GetHashCode();
            }
            if (Mp != 0)
            {
                hash ^= Mp.GetHashCode();
            }
            if (MaxMp != 0)
            {
                hash ^= MaxMp.GetHashCode();
            }
            if (Food != 0)
            {
                hash ^= Food.GetHashCode();
            }
            if (MaxFood != 0)
            {
                hash ^= MaxFood.GetHashCode();
            }
            if (Gold != 0)
            {
                hash ^= Gold.GetHashCode();
            }
            if (HeadIcon != 0)
            {
                hash ^= HeadIcon.GetHashCode();
            }
            if (MapSkillId != 0)
            {
                hash ^= MapSkillId.GetHashCode();
            }
            if (BattleSkillId != 0)
            {
                hash ^= BattleSkillId.GetHashCode();
            }
            hash ^= equips_.GetHashCode();
            return(hash);
        }
        public ActionResult UploadHeadIcon()
        {
            string bucket    = ConfigurationManager.AppSettings["QiNiuBucket"];    //七牛空间
            string localPath = "~/Content/images/tempicon/";                       //本地文件绝对路径

            string qiniuPath = ConfigurationManager.AppSettings["PathOfHeadIcon"]; //七牛路径  "headicon/日期/"

            qiniuPath += "/" + DateTime.Now.ToString("yyyyMMdd") + "/";            //七牛路径 headicon/
            string fileType = ".jpg,.jpeg,.png,.gif";
            int    maxSize  = 5;

            //开始上传
            HttpPostedFileBase file = Request.Files[0];

            if (file != null)
            {
                List <string> extList   = fileType.Split(',').ToList();
                var           extension = Path.GetExtension(file.FileName); //后缀
                if (extension != null && extList.Contains(extension.ToLower()))
                {
                    string extendName = extension.ToLower(); //小写后缀名
                    int    length     = file.ContentLength;  //文件大小
                    if (length > maxSize * 1024 * 1024)
                    {
                        //上传失败
                        string warning = "文件不得大于" + maxSize + "MB";

                        return(Content("<script>window.parent.uploadSuccess('" + warning + "| ');</script>"));
                    }
                    else
                    {
                        if (!Directory.Exists(localPath))   //创建目录
                        {
                            Directory.CreateDirectory(Server.MapPath(localPath));
                        }

                        localPath += file.FileName;
                        file.SaveAs(Server.MapPath(localPath));  //先 保存文件 到本地

                        string qiniufileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + extendName;
                        //上传至七牛
                        qiniuPath += qiniufileName;    //日期/文件名
                        bool uploadflag = QiniuHelper.UploadFile(bucket, qiniuPath, Server.MapPath(localPath));

                        if (uploadflag)
                        {
                            //先删除本地临时图片
                            System.IO.File.Delete(Server.MapPath(localPath));

                            string qiniuUrlIndex = ConfigurationManager.AppSettings["QiNiuURL"];

                            HeadIcon icon = new HeadIcon()
                            {
                                IconName    = qiniufileName, //现文件名
                                IconRawName = file.FileName, //原文件名
                                IconURL     = qiniuUrlIndex + "/" + qiniuPath,
                                Status      = 1,
                                UploadTime  = DateTime.Now
                            };

                            //入库
                            int val = iconService.Add(icon);
                            if (val == 1)
                            {
                                return(Content("<script>window.parent.uploadSuccess('上传成功!|" + icon.IconURL + "');</script>"));
                            }
                            else
                            {
                                return(Content("<script>window.parent.uploadSuccess('上传至七牛成功,但入库时失败!|" + icon.IconURL + "');</script>"));
                            }
                        }
                        else
                        {
                            string warning = "上传至七牛失败";
                            return(Content("<script>window.parent.uploadSuccess('" + warning + "| ');</script>"));
                        }
                    }
                }
                else
                {
                    string warning = "图片格式不对";
                    return(Content("<script>window.parent.uploadSuccess('" + warning + "| ');</script>"));
                }
            }
            else
            {
                string warning = "还没选择文件";
                return(Content("<script>window.parent.uploadSuccess('" + warning + "| ');</script>"));
            }
        }