XmdsVirtual.Message.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System.Collections.Generic;
  2. using XmdsCommon.Message;
  3. using XmdsCommon.Plugin;
  4. using XmdsCommonServer.Message;
  5. namespace XmdsCommonServer.Plugin
  6. {
  7. partial class XmdsVirtual
  8. {
  9. public virtual void ReceiveMsgR2B(object status)
  10. {
  11. }
  12. /// <summary>
  13. /// 技能变更.
  14. /// </summary>
  15. protected virtual void OnPlayerSkillsChanged(PlayerSkillChangeEventR2B evt)
  16. {
  17. FormatLog("OnPlayerPropertiesChanged", null);
  18. if (evt != null)
  19. {
  20. switch (evt.OperateID)
  21. {
  22. case PlayerSkillChangeEventR2B.SkillOperate.Replace:
  23. this.mSkillHelper.ReplaceSkill(evt.SkillList);
  24. break;
  25. case PlayerSkillChangeEventR2B.SkillOperate.Add:
  26. this.mSkillHelper.AddSkill(evt.SkillList);
  27. break;
  28. case PlayerSkillChangeEventR2B.SkillOperate.Remove:
  29. this.mSkillHelper.RemoveSkill(evt.SkillList);
  30. break;
  31. case PlayerSkillChangeEventR2B.SkillOperate.Reset:
  32. this.ResetSkill(evt.SkillList);
  33. break;
  34. default: break;
  35. }
  36. }
  37. else
  38. {
  39. FormatLog("OnPlayerSkillsChanged Error :XmdsUnitSkillInfoEventB2C.Props is null", null);
  40. }
  41. }
  42. public void ResetSkill(List<GameSkill> SkillList)
  43. {
  44. this.DestorySkill();
  45. this.mSkillHelper = new XmdsSkillHelper();
  46. this.mSkillHelper.ResetSkill(SkillList, this);
  47. }
  48. public bool AddHP(PropertyChangeEventR2B.ValueType type, float v,bool show)
  49. {
  50. switch (type)
  51. {
  52. case PropertyChangeEventR2B.ValueType.Percent:
  53. int r = (int)(this.MirrorProp.MaxHP *
  54. (v / XmdsSkillTemplate.DamageCalculator.XmdsDamageCalculator.PERER));
  55. //SendMsgToClient(string.Format("{0}{1}", Tips_AddHP, r));
  56. this.AddHP(r, this.mUnit, show);
  57. break;
  58. case PropertyChangeEventR2B.ValueType.Value:
  59. //SendMsgToClient(string.Format("{0}{1}", Tips_AddHP, v));
  60. this.AddHP((int)v, this.mUnit, show);
  61. break;
  62. }
  63. return true;
  64. }
  65. /// <summary>
  66. /// 属性变更.
  67. /// </summary>
  68. protected void OnPlayerPropertiesChanged(XmdsUnitPropEventB2C evt)
  69. {
  70. if (evt != null && evt.Props != null)
  71. {
  72. FormatLog("OnPlayerPropertiesChanged", null);
  73. //重置属性.
  74. mProp.ServerData.Prop = evt.Props;
  75. InitBaseData(mProp.ServerData.Prop);
  76. //刷新属性.
  77. UnitPropRefresh(MirrorProp);
  78. this.mCardModule.ReloadCardSkillWeight();
  79. SyncBattlePropsFields(PlayerBattlePropChangeEventB2C.MASK_ALL);
  80. }
  81. else
  82. {
  83. FormatLog("OnPlayerPropertiesChanged Error :OnPlayerPropertiesChanged.Props is null", null);
  84. }
  85. }
  86. }
  87. }