public CSCommon.Data.SocialRoleInfo CreateSocialRoleInfo(CSCommon.Data.SocialData data, UserRole role) { CSCommon.Data.SocialRoleInfo info = new CSCommon.Data.SocialRoleInfo(); info.id = data.OtherId; info.name = role.RoleData.Name; info.profession = role.RoleData.Profession; info.camp = role.RoleData.Camp; info.level = role.RoleData.Level; info.socialData = data; if (role.PlanesConnect != null) { info.state = (byte)CSCommon.eOnlineState.Online; } return(info); }
public void RPC_AddSocialByName(string name, byte type, RPC.RPCForwardInfo fwd) { RPC.PackageWriter pkg = new RPC.PackageWriter(); H_RPCRoot.smInstance.HGet_ComServer(pkg).HGet_UserRoleManager(pkg).RPC_AddSocial(pkg, this.PlayerData.RoleDetail.RoleId, name, type); pkg.WaitDoCommand(IPlanesServer.Instance.ComConnect, RPC.CommandTargetType.DefaultType, null).OnFarCallFinished = delegate(RPC.PackageProxy _io, bool bTimeOut) { RPC.PackageWriter retpkg = new RPC.PackageWriter(); sbyte result = _io.ReadSByte(); retpkg.Write(result); if (result == (sbyte)CSCommon.eRet_AddSocial.AddSucceed) { CSCommon.Data.SocialRoleInfo s = new CSCommon.Data.SocialRoleInfo(); _io.Read(s); _io.Read(s.socialData); retpkg.Write(s); retpkg.Write(s.socialData); } retpkg.DoReturnPlanes2Client(fwd); }; }
public void RPC_GetSocialList(byte type, RPC.RPCForwardInfo fwd) { RPC.PackageWriter pkg = new RPC.PackageWriter(); H_RPCRoot.smInstance.HGet_ComServer(pkg).HGet_UserRoleManager(pkg).RPC_GetSocialList(pkg, this.PlayerData.RoleDetail.RoleId, type); pkg.WaitDoCommand(IPlanesServer.Instance.ComConnect, RPC.CommandTargetType.DefaultType, null).OnFarCallFinished = delegate(RPC.PackageProxy _io, bool bTimeOut) { RPC.PackageWriter retPkg = new RPC.PackageWriter(); retPkg.SetSinglePkg(); sbyte result = -1; _io.Read(out result); int count; if (result == -1) { count = 0; retPkg.Write(count); retPkg.DoReturnPlanes2Client(fwd); return; } else if (result == 1) { _io.Read(out count); retPkg.Write(count); for (int i = 0; i < count; i++) { CSCommon.Data.SocialRoleInfo s = new CSCommon.Data.SocialRoleInfo(); _io.Read(s); _io.Read(s.socialData); retPkg.Write(s); retPkg.Write(s.socialData); } retPkg.DoReturnPlanes2Client(fwd); return; } }; }
// 生成代码 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(); } } }