摘要:
分析装备显示头盔自定义按钮保存到数据库 下次登录按钮状态自动保存代码分析参考...
分析装备显示头盔自定义按钮保存到数据库 下次登录按钮状态自动保存代码分析参考
===================================================================== D:\MYmir3\Source\Server\Models\PlayerObject.cs //登陆的时候读取按钮状态 Enqueue(new S.HelmetToggle { HideHelmet = Character.HideHelmet }); public void HelmetToggle(bool value) { if (Character.HideHelmet == value) return; Character.HideHelmet = value; SendShapeUpdate(); Enqueue(new S.HelmetToggle { HideHelmet = Character.HideHelmet }); } ===================================================================== D:\MYmir3\Source\Client\Scenes\Views\CharacterDialog.cs //角色页面创建按钮 ShowHelmetBox = new DXCheckBox { Parent = CharacterTab, Hint = "显示头盔", ReadOnly = true, }; ShowHelmetBox.Location = new Point(215 + 39 - ShowHelmetBox.Size.Width, 58 - ShowHelmetBox.Size.Height); ShowHelmetBox.MouseClick += (o, e) => { CEnvir.Enqueue(new C.HelmetToggle{ HideHelmet = ShowHelmetBox.Checked}); }; ===================================================================== D:\MYmir3\Source\Client\Scenes\Views\AutoPotionDialog.cs 创建按钮同上代码 ===================================================================== D:\MYmir3\Source\Server\DBModels\CharacterInfo.cs //啥意思具体还没研究出来 public bool HideHelmet { get { return _HideHelmet; } set { if (_HideHelmet == value) return; var oldValue = _HideHelmet; _HideHelmet = value; OnChanged(oldValue, value, "HideHelmet"); } } private bool _HideHelmet; ===================================================================== D:\MYmir3\Source\Client\Envir\CConnection.cs public void Process(S.HelmetToggle p) { GameScene.Game.CharacterBox.ShowHelmetBox.Checked = !p.HideHelmet; } ===================================================================== D:\MYmir3\Source\Server\Envir\SConnection.cs public void Process(C.HelmetToggle p) { if (Stage != GameStage.Game) return; Player.HelmetToggle(p.HideHelmet); } ===================================================================== D:\MYmir3\Source\Library\Network\ClientPackets.cs public sealed class HelmetToggle : Packet { public bool HideHelmet { get; set; } } =====================================================================
还没有评论,来说两句吧...