private bool DB_CreatGuildCom(CSCommon.Data.GuildCom Guild) { // 产生insert语句 string condition = "GuildId = " + Guild.GuildId; ServerFrame.DB.DBOperator dbOp = ServerFrame.DB.DBConnect.InsertData(condition, Guild, true); return(mDBConnect._ExecuteInsert(dbOp)); }
public void DB_DelGuildCom(CSCommon.Data.GuildCom Guild) { //产生Destroy语句 string condition = "GuildId =" + Guild.GuildId; ServerFrame.DB.DBOperator dbOp = ServerFrame.DB.DBConnect.DestroyData(condition, Guild); mDBConnect._ExecuteDestroy(dbOp); return; }
private void DB_SaveGuildCom(CSCommon.Data.GuildCom Guild) { if (Guild == null) { return; } var condition = "GuildId=" + Guild.GuildId; var dbOp = ServerFrame.DB.DBConnect.UpdateData(condition, Guild, null); mDBConnect._ExecuteUpdate(dbOp); return; }
public void RPC_CreateGuild(ulong roleId, string GuildName, Iocp.NetConnection connect, RPC.RPCForwardInfo fwd) { RPC.PackageWriter retPkg = new RPC.PackageWriter(); var role = GetRole(roleId); if (role == null) { retPkg.Write((sbyte)CSCommon.eRet_CreateGuild.NoRole); retPkg.DoReturnCommand2(connect, fwd.ReturnSerialId); return; } if (role.GuildInstance != null) { retPkg.Write((sbyte)CSCommon.eRet_CreateGuild.RoleHasGuild); retPkg.DoReturnCommand2(connect, fwd.ReturnSerialId); return; } GuildInstance GuildInstance = new GuildInstance(); CSCommon.Data.GuildCom guild = new CSCommon.Data.GuildCom(); guild.GuildName = GuildName; guild.PlanesId = role.RoleData.PlanesId; guild.PresidentName = role.RoleData.Name; guild.MemberNum = 1; if (DB_CreatGuildCom(guild) == false) { retPkg.Write((sbyte)CSCommon.eRet_CreateGuild.SameGuildName); retPkg.DoReturnCommand2(connect, fwd.ReturnSerialId); return; } role.RoleData.GuildId = guild.GuildId; role.RoleData.GuildPost = (byte)CSCommon.eGuildPost.BangZhu; role.GuildInstance = GuildInstance; GuildInstance.GuildData = guild; GuildInstance.Members.Add(roleId, role); GuildManager.Instance.AddGuildInstance(GuildInstance); //存盘,这里后面要改成异步执行 DB_SaveRoleData(role); retPkg.Write((sbyte)CSCommon.eRet_CreateGuild.Succeed); retPkg.DoReturnCommand2(connect, fwd.ReturnSerialId); }
// 生成代码 private void button4_Click(object sender, EventArgs e) { bool bIsClient = this.textBox_Callee.Text == Config.Instance.CurProjectConfig.ClientCallee; if (System.IO.File.Exists(this.textBox_Callee.Text)) { System.IO.StreamWriter sw = new System.IO.StreamWriter(this.textBox_Callee.Text); if (sw != null) { if (bIsClient) { sw.Write(this.textBoxCallee.Text.Replace("SlimDX", "UnityEngine")); } else { sw.Write(this.textBoxCallee.Text); } sw.Close(); } } if (System.IO.File.Exists(this.textBox_Caller.Text)) { System.IO.StreamWriter sw = new System.IO.StreamWriter(this.textBox_Caller.Text); if (sw != null) { if (bIsClient) { sw.Write(this.textBoxCaller.Text.Replace("SlimDX", "UnityEngine")); } else { sw.Write(this.textBoxCaller.Text); } sw.Close(); } } if (bIsClient) { if (System.IO.File.Exists(Config.Instance.CurProjectConfig.ServCppCaller)) { System.IO.StreamWriter sw = new System.IO.StreamWriter(Config.Instance.CurProjectConfig.ServCppCaller); if (sw != null) { sw.Write(this.textBoxCaller.Text.Replace("UnityEngine", "SlimDX")); sw.Close(); } } } else { if (System.IO.File.Exists(Config.Instance.CurProjectConfig.ClientServCaller)) { System.IO.StreamWriter sw = new System.IO.StreamWriter(Config.Instance.CurProjectConfig.ClientServCaller); if (sw != null) { sw.Write(ServCallerToClient.Replace("SlimDX", "UnityEngine")); sw.Close(); } } } //====================== 客户端同步服务器的类结构 ====================== string outStruct = ""; //GetCppStructureDefine只发送基础属性 byte[] x = new byte[3], list<int> y = new list<int>();类似属性都将不发送 outStruct += new CSCommon.Data.RoleInfo().GetCppStructureDefine(); outStruct += new CSCommon.Data.NPCData().GetCppStructureDefine(); outStruct += new CSCommon.Data.RoleDetail().GetCppStructureDefine(); outStruct += new CSCommon.Data.RoleSyncInfo().GetCppStructureDefine(); outStruct += new CSCommon.Data.ItemData().GetCppStructureDefine(); outStruct += new CSCommon.Data.SocialData().GetCppStructureDefine(); outStruct += new CSCommon.Data.SocialRoleInfo().GetCppStructureDefine(); outStruct += new CSCommon.Data.GiftData().GetCppStructureDefine(); outStruct += new CSCommon.Data.TaskData().GetCppStructureDefine(); outStruct += new CSCommon.Data.MailData().GetCppStructureDefine(); outStruct += new CSCommon.Data.GuildCom().GetCppStructureDefine(); outStruct += new CSCommon.Data.RoleCom().GetCppStructureDefine(); outStruct += new CSCommon.Data.Message().GetCppStructureDefine(); outStruct += new CSCommon.Data.SkillData().GetCppStructureDefine(); outStruct += new CSCommon.Data.MartialData().GetCppStructureDefine(); outStruct += new CSCommon.Data.AchieveData().GetCppStructureDefine(); outStruct += new CSCommon.Data.AttrStruct().GetCppStructureDefine(); outStruct += new CSCommon.Data.CityForceData().GetCppStructureDefine(); outStruct += new CSCommon.Data.EfficiencyData().GetCppStructureDefine(); outStruct += new CSCommon.Data.CampForceData().GetCppStructureDefine(); //=================================================================== if (System.IO.File.Exists(Config.Instance.CurProjectConfig.ClientHeader)) { System.IO.StreamWriter sw = new System.IO.StreamWriter(Config.Instance.CurProjectConfig.ClientHeader); if (sw != null) { sw.Write(outStruct); sw.Close(); } } }