Exemple #1
0
        public void GetRoleDetailByName(ushort planesId, string roleName, Iocp.NetConnection connect, RPC.RPCForwardInfo fwd)
        {
            roleName = ServerFrame.DB.DBConnect.SqlSafeString(roleName);
            UInt16 returnSerialId = fwd.ReturnSerialId;

            AsyncExecuteThreadManager.Instance.AsyncExe(true).Exec = delegate()
            {
                RPC.PackageWriter retPkg = new RPC.PackageWriter();
                var acInfo = mPlayerManager.FindPlayerData(planesId, roleName);

                if (acInfo != null)
                {
                    retPkg.Write((SByte)1);
                    retPkg.Write(acInfo.RoleDetail);
                    retPkg.DoReturnCommand2(connect, returnSerialId);
                }
                else
                {
                    CSCommon.Data.RoleDetail rd    = new CSCommon.Data.RoleDetail();
                    string condition               = "RoleName = \'" + roleName + "\'";
                    ServerFrame.DB.DBOperator dbOp = ServerFrame.DB.DBConnect.SelectData(condition, rd, null);
                    System.Data.DataTable     tab  = DBLoaderConnect._ExecuteSelect(dbOp, "RoleInfo");
                    if (tab == null || tab.Rows.Count != 1)
                    {
                        retPkg.Write((SByte)(-1));
                        retPkg.DoReturnCommand2(connect, returnSerialId);
                    }
                    else
                    {
                        ServerFrame.DB.DBConnect.FillObject(rd, tab.Rows[0]);
                        retPkg.Write((SByte)1);
                        retPkg.Write(rd);
                        retPkg.DoReturnCommand2(connect, returnSerialId);
                    }
                }
            };
        }
Exemple #2
0
 public void RPC_RoleEnterPlanes(RPC.PackageWriter pkg, CSCommon.Data.RoleDetail roledata)
 {
     pkg.Write(roledata);
     pkg.SetMethod(11);
 }
Exemple #3
0
        // 生成代码
        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();
                }
            }
        }