Exemple #1
0
        private void DB_InitGiftData(UserRole role)
        {
            string condition = "OwnerId=" + role.RoleData.RoleId;

            ServerFrame.DB.DBOperator dbOp = ServerFrame.DB.DBConnect.SelectData(condition, new CSCommon.Data.GiftData(), "");
            System.Data.DataTable     tab  = mDBConnect._ExecuteSelect(dbOp, "GiftData");
            if (tab != null && tab.Rows.Count == 1)
            {
                CSCommon.Data.GiftData gd = new CSCommon.Data.GiftData();
                if (ServerFrame.DB.DBConnect.FillObject(gd, tab.Rows[0]))
                {
                    role.GiftData = gd;
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("角色获取礼物数据库执行失败:" + dbOp.SqlCode);
            }
        }
Exemple #2
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();
                }
            }
        }