/// <summary> /// 检测有没有申请过,添加一条公会申请记录 /// </summary> /// <param name="apply"></param> /// <returns></returns> internal bool JoinApply(NguildApplyInfo apply) { var oldApply = this.Date.Applies.FirstOrDefault(v => v.CharacterId == apply.characterID);//检测申请的玩家之前有没有申请过本公会 if (oldApply != null) { return(false); } //向数据库表中添加一条数据 var dbApply = DBService.Instance.Entities.TGuildApplies.Create(); dbApply.GuildId = apply.GuildId; dbApply.CharacterId = apply.characterID; dbApply.Name = apply.Name; dbApply.Class = apply.Class; dbApply.Level = apply.Level; dbApply.ApplyTime = DateTime.Now; DBService.Instance.Entities.TGuildApplies.Add(dbApply); this.Date.Applies.Add(dbApply); DBService.Instance.Save(); this.timestemp = TimeUtil.timestamp; return(true); }
/// <summary> /// 发送加入公会请求的申批 /// </summary> /// <param name="accept"></param> /// <param name="apply"></param> public void SendGuildJoinApply(bool accept, NguildApplyInfo apply) { Debug.Log("SendGuildJoinApply"); NetMessage message = new NetMessage(); message.Request = new NetMessageRequest(); message.Request.guildJoinRes = new GuildJoinResponse(); message.Request.guildJoinRes.Result = Result.Success; message.Request.guildJoinRes.Apply = apply; message.Request.guildJoinRes.Apply.Result = accept ? ApplyResult.Accpet : ApplyResult.Reject; NetClient.Instance.SendMessage(message); }
// Use this for initialization internal void SetItemInfo(NguildApplyInfo item) { this.info = item; if (this.nickNmae != null) { nickNmae.text = info.Name; } if (this.@class != null) { @class.text = info.Class.ToString(); } if (this.level != null) { level.text = info.Level.ToString(); } }
internal bool JoinAppove(NguildApplyInfo apply) { var oldApply = this.Date.Applies.FirstOrDefault(v => v.CharacterId == apply.characterID && v.Result == 0); if (oldApply == null) { return(false); } oldApply.Result = (int)apply.Result; if (apply.Result == ApplyResult.Accpet) { this.AddMember(apply.characterID, apply.Name, apply.Class, apply.Level, GuildTitle.Nome); } DBService.Instance.Save(); this.timestemp = TimeUtil.timestamp; return(true); }