|
@@ -1,170 +1,170 @@
|
|
|
-using CommonAI.Data;
|
|
|
+using CommonAI.Data;
|
|
|
using CommonAI.Zone;
|
|
|
-using CommonAI.ZoneClient;
|
|
|
-using System.Collections.Generic;
|
|
|
-using XmdsCommon.Message;
|
|
|
-using XmdsCommon.Plugin;
|
|
|
-
|
|
|
-namespace XmdsCommon.ZoneClient.XmdsClientVirtual
|
|
|
-{
|
|
|
- public class XmdsClientVirtual_Player : XmdsClientVirtual
|
|
|
- {
|
|
|
- public delegate void OnStatusChange();
|
|
|
- public event OnStatusChange OnUnitLvChange;
|
|
|
- public event OnStatusChange OnPKModeChange;
|
|
|
-
|
|
|
- protected PlayerVisibleDataB2C mData = null;
|
|
|
- protected string mPlayerUUID = null;
|
|
|
-
|
|
|
- public override void OnInit(ZoneUnit owner)
|
|
|
- {
|
|
|
- base.OnInit(owner);
|
|
|
-
|
|
|
- mPlayerUUID = owner.PlayerUUID;
|
|
|
- mData = owner.SyncInfo.VisibleInfo as PlayerVisibleDataB2C;
|
|
|
- (owner.Info.Properties as XmdsUnitProperties).ServerData.AvatarList = new List<XmdsAvatarInfo>(mData.AvatarList);
|
|
|
- }
|
|
|
-
|
|
|
- public override void OnDispose(ZoneUnit owner)
|
|
|
- {
|
|
|
- base.OnDispose(owner);
|
|
|
- mData = null;
|
|
|
- OnUnitLvChange = null;
|
|
|
- mPlayerUUID = null;
|
|
|
- }
|
|
|
-
|
|
|
- protected override void MOwner_OnDoEvent(ZoneObject obj, CommonAI.Zone.ObjectEvent e)
|
|
|
- {
|
|
|
- if (e is XmdsUnitBaseInfoEventB2C)
|
|
|
- {
|
|
|
- var evt = e as XmdsUnitBaseInfoEventB2C;
|
|
|
-
|
|
|
- int lv = mData.BaseInfo.UnitLv;
|
|
|
-
|
|
|
- mData.BaseInfo = evt.Props;
|
|
|
-
|
|
|
- if (evt.Props.UnitLv != lv)
|
|
|
- {
|
|
|
- //升级通知.
|
|
|
- if (OnUnitLvChange != null)
|
|
|
- {
|
|
|
- OnUnitLvChange.Invoke();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- else if (e is PlayerPKLvChangeEventB2C)
|
|
|
- {
|
|
|
- var evt = e as PlayerPKLvChangeEventB2C;
|
|
|
- mData.UnitPKInfo.CurPKLevel = evt.CurLv;
|
|
|
- }
|
|
|
- else if (e is PlayerPKValueChangeEventB2C)
|
|
|
- {
|
|
|
- var evt = e as PlayerPKValueChangeEventB2C;
|
|
|
- mData.UnitPKInfo.CurPKValue = evt.CurPKValue;
|
|
|
- }
|
|
|
- else if (e is TestamentChangeEventB2C)
|
|
|
- {
|
|
|
- var evt = e as TestamentChangeEventB2C;
|
|
|
- mData.BaseInfo.Testament = evt.TestamentID;
|
|
|
- }
|
|
|
- else if (e is PlayerPKModeChangeEventB2C)
|
|
|
- {
|
|
|
- PlayerPKModeChangeEventB2C evt = e as PlayerPKModeChangeEventB2C;
|
|
|
- mData.UnitPKInfo.CurPKMode = evt.CurMode;
|
|
|
- }
|
|
|
-
|
|
|
- base.MOwner_OnDoEvent(obj, e);
|
|
|
- }
|
|
|
-
|
|
|
- #region 常用方法.
|
|
|
-
|
|
|
- public PKLevel GetPKLv()
|
|
|
- {
|
|
|
- return mData.UnitPKInfo.CurPKLevel;
|
|
|
- }
|
|
|
-
|
|
|
- public PKInfo GetPKInfo()
|
|
|
- {
|
|
|
- return mData.UnitPKInfo;
|
|
|
- }
|
|
|
-
|
|
|
- public int GetPKValue()
|
|
|
- {
|
|
|
- if (mData == null) { return 0; }
|
|
|
-
|
|
|
- return mData.UnitPKInfo.CurPKValue;
|
|
|
- }
|
|
|
-
|
|
|
- public string GetName()
|
|
|
- {
|
|
|
- return mData.BaseInfo.name;
|
|
|
- }
|
|
|
-
|
|
|
- public int GetServerID()
|
|
|
- {
|
|
|
- return mData.BaseInfo.ServerID;
|
|
|
- }
|
|
|
-
|
|
|
- public string GetGuildID()
|
|
|
- {
|
|
|
- return mData.BaseInfo.GuildID;
|
|
|
- }
|
|
|
-
|
|
|
- public string GetGuildName()
|
|
|
- {
|
|
|
- return mData.BaseInfo.GuildName;
|
|
|
- }
|
|
|
-
|
|
|
- public int GetLv()
|
|
|
- {
|
|
|
- return mData.BaseInfo.UnitLv;
|
|
|
- }
|
|
|
-
|
|
|
- public int GetForceID()
|
|
|
- {
|
|
|
- return mData.BaseInfo.force;
|
|
|
- }
|
|
|
-
|
|
|
- public override string GetPlayerUUID()
|
|
|
- {
|
|
|
- return mPlayerUUID;
|
|
|
- }
|
|
|
-
|
|
|
- public int GetTitleID()
|
|
|
- {
|
|
|
- return mData.BaseInfo.TitleID;
|
|
|
- }
|
|
|
-
|
|
|
- public XmdsUnitBaseInfo GetBaseInfo()
|
|
|
- {
|
|
|
- return mData.BaseInfo;
|
|
|
- }
|
|
|
-
|
|
|
- public bool AllowAutoGuard()
|
|
|
- {
|
|
|
- if (mData != null)
|
|
|
- {
|
|
|
- return mData.UnitSceneInfo.AllowAutoGuard;
|
|
|
- }
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 获得单位特殊状态.
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- public CommonAI.XmdsConstConfig.SpecialState GetSPState()
|
|
|
- {
|
|
|
- if(mData != null)
|
|
|
- {
|
|
|
- return mData.BaseInfo.SPState;
|
|
|
- }
|
|
|
-
|
|
|
- return CommonAI.XmdsConstConfig.SpecialState.None;
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
- }
|
|
|
-}
|
|
|
+using CommonAI.ZoneClient;
|
|
|
+using System.Collections.Generic;
|
|
|
+using XmdsCommon.Message;
|
|
|
+using XmdsCommon.Plugin;
|
|
|
+
|
|
|
+namespace XmdsCommon.ZoneClient.XmdsClientVirtual
|
|
|
+{
|
|
|
+ public class XmdsClientVirtual_Player : XmdsClientVirtual
|
|
|
+ {
|
|
|
+ public delegate void OnStatusChange();
|
|
|
+ public event OnStatusChange OnUnitLvChange;
|
|
|
+ //public event OnStatusChange OnPKModeChange; //屏蔽警告
|
|
|
+
|
|
|
+ protected PlayerVisibleDataB2C mData = null;
|
|
|
+ protected string mPlayerUUID = null;
|
|
|
+
|
|
|
+ public override void OnInit(ZoneUnit owner)
|
|
|
+ {
|
|
|
+ base.OnInit(owner);
|
|
|
+
|
|
|
+ mPlayerUUID = owner.PlayerUUID;
|
|
|
+ mData = owner.SyncInfo.VisibleInfo as PlayerVisibleDataB2C;
|
|
|
+ (owner.Info.Properties as XmdsUnitProperties).ServerData.AvatarList = new List<XmdsAvatarInfo>(mData.AvatarList);
|
|
|
+ }
|
|
|
+
|
|
|
+ public override void OnDispose(ZoneUnit owner)
|
|
|
+ {
|
|
|
+ base.OnDispose(owner);
|
|
|
+ mData = null;
|
|
|
+ OnUnitLvChange = null;
|
|
|
+ mPlayerUUID = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void MOwner_OnDoEvent(ZoneObject obj, CommonAI.Zone.ObjectEvent e)
|
|
|
+ {
|
|
|
+ if (e is XmdsUnitBaseInfoEventB2C)
|
|
|
+ {
|
|
|
+ var evt = e as XmdsUnitBaseInfoEventB2C;
|
|
|
+
|
|
|
+ int lv = mData.BaseInfo.UnitLv;
|
|
|
+
|
|
|
+ mData.BaseInfo = evt.Props;
|
|
|
+
|
|
|
+ if (evt.Props.UnitLv != lv)
|
|
|
+ {
|
|
|
+ //升级通知.
|
|
|
+ if (OnUnitLvChange != null)
|
|
|
+ {
|
|
|
+ OnUnitLvChange.Invoke();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else if (e is PlayerPKLvChangeEventB2C)
|
|
|
+ {
|
|
|
+ var evt = e as PlayerPKLvChangeEventB2C;
|
|
|
+ mData.UnitPKInfo.CurPKLevel = evt.CurLv;
|
|
|
+ }
|
|
|
+ else if (e is PlayerPKValueChangeEventB2C)
|
|
|
+ {
|
|
|
+ var evt = e as PlayerPKValueChangeEventB2C;
|
|
|
+ mData.UnitPKInfo.CurPKValue = evt.CurPKValue;
|
|
|
+ }
|
|
|
+ else if (e is TestamentChangeEventB2C)
|
|
|
+ {
|
|
|
+ var evt = e as TestamentChangeEventB2C;
|
|
|
+ mData.BaseInfo.Testament = evt.TestamentID;
|
|
|
+ }
|
|
|
+ else if (e is PlayerPKModeChangeEventB2C)
|
|
|
+ {
|
|
|
+ PlayerPKModeChangeEventB2C evt = e as PlayerPKModeChangeEventB2C;
|
|
|
+ mData.UnitPKInfo.CurPKMode = evt.CurMode;
|
|
|
+ }
|
|
|
+
|
|
|
+ base.MOwner_OnDoEvent(obj, e);
|
|
|
+ }
|
|
|
+
|
|
|
+ #region 常用方法.
|
|
|
+
|
|
|
+ public PKLevel GetPKLv()
|
|
|
+ {
|
|
|
+ return mData.UnitPKInfo.CurPKLevel;
|
|
|
+ }
|
|
|
+
|
|
|
+ public PKInfo GetPKInfo()
|
|
|
+ {
|
|
|
+ return mData.UnitPKInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int GetPKValue()
|
|
|
+ {
|
|
|
+ if (mData == null) { return 0; }
|
|
|
+
|
|
|
+ return mData.UnitPKInfo.CurPKValue;
|
|
|
+ }
|
|
|
+
|
|
|
+ public string GetName()
|
|
|
+ {
|
|
|
+ return mData.BaseInfo.name;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int GetServerID()
|
|
|
+ {
|
|
|
+ return mData.BaseInfo.ServerID;
|
|
|
+ }
|
|
|
+
|
|
|
+ public string GetGuildID()
|
|
|
+ {
|
|
|
+ return mData.BaseInfo.GuildID;
|
|
|
+ }
|
|
|
+
|
|
|
+ public string GetGuildName()
|
|
|
+ {
|
|
|
+ return mData.BaseInfo.GuildName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int GetLv()
|
|
|
+ {
|
|
|
+ return mData.BaseInfo.UnitLv;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int GetForceID()
|
|
|
+ {
|
|
|
+ return mData.BaseInfo.force;
|
|
|
+ }
|
|
|
+
|
|
|
+ public override string GetPlayerUUID()
|
|
|
+ {
|
|
|
+ return mPlayerUUID;
|
|
|
+ }
|
|
|
+
|
|
|
+ public int GetTitleID()
|
|
|
+ {
|
|
|
+ return mData.BaseInfo.TitleID;
|
|
|
+ }
|
|
|
+
|
|
|
+ public XmdsUnitBaseInfo GetBaseInfo()
|
|
|
+ {
|
|
|
+ return mData.BaseInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ public bool AllowAutoGuard()
|
|
|
+ {
|
|
|
+ if (mData != null)
|
|
|
+ {
|
|
|
+ return mData.UnitSceneInfo.AllowAutoGuard;
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获得单位特殊状态.
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ public CommonAI.XmdsConstConfig.SpecialState GetSPState()
|
|
|
+ {
|
|
|
+ if(mData != null)
|
|
|
+ {
|
|
|
+ return mData.BaseInfo.SPState;
|
|
|
+ }
|
|
|
+
|
|
|
+ return CommonAI.XmdsConstConfig.SpecialState.None;
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
+ }
|
|
|
+}
|