Esempio n. 1
0
        public void Init(PlayerInstance role, CSCommon.Data.AchieveData data)
        {
            mRole = role;
            if (data.RoleId != mRole.Id)
            {
                data.RoleId = mRole.Id;
            }
            AchieveUnSerialize(data.Achievement);
            CopyUnSerialize(data.CopyInfo);

            //初始化成就监听
            InitAchieveObjiects();
        }
Esempio n. 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();
                }
            }
        }
Esempio n. 3
0
 public void Save(CSCommon.Data.AchieveData data)
 {
     data.Achievement = AchieveSerialize();
     data.CopyInfo    = CopySerialize();
 }