Core/NetworkPackage/DTCFile/ServerPack/HC0_CrossRealm/DTCC002_tagGCCrossRealmPKStartMatch.cs
@@ -7,19 +7,30 @@ public class DTCC002_tagGCCrossRealmPKStartMatch : DtcBasic { public class DTCC002_tagGCCrossRealmPKStartMatch : DtcBasic { CrossServerOneVsOneModel crossServerModel { get { return ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>(); } } public static event Action CrossServerStartMatchEvent; public override void Done(GameNetPackBasic vNetPack) { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); HC002_tagGCCrossRealmPKStartMatch vNetData = vNetPack as HC002_tagGCCrossRealmPKStartMatch; crossServerModel.IsMatching = true; if(CrossServerStartMatchEvent != null) var vNetData = vNetPack as HC002_tagGCCrossRealmPKStartMatch; if (vNetData.IsRobot == 1) { CrossServerStartMatchEvent(); ClientCrossServerOneVsOne.FakeMatchOk(); } else { crossServerModel.IsMatching = true; if (CrossServerStartMatchEvent != null) { CrossServerStartMatchEvent(); } } } Core/NetworkPackage/ServerPack/HC0_CrossRealm/HC002_tagGCCrossRealmPKStartMatch.cs
@@ -1,15 +1,20 @@ using UnityEngine; using System.Collections; // C0 02 跨服PK开始匹配 #tagGCCrossRealmPKStartMatch public class HC002_tagGCCrossRealmPKStartMatch : GameNetPackBasic { public HC002_tagGCCrossRealmPKStartMatch () { _cmd = (ushort)0xC002; } public override void ReadFromBytes (byte[] vBytes) { } } // C0 02 跨服PK开始匹配 #tagGCCrossRealmPKStartMatch public class HC002_tagGCCrossRealmPKStartMatch : GameNetPackBasic { public byte IsRobot; // 是否匹配机器人 public HC002_tagGCCrossRealmPKStartMatch() { _cmd = (ushort)0xC002; } public override void ReadFromBytes(byte[] vBytes) { TransBytes(out IsRobot, vBytes, NetDataType.BYTE); } } System/CrossServerOneVsOne/CrossServerOneVsOneModel.cs
@@ -21,11 +21,9 @@ public bool isClickCoolTime { get; set; } public event Action UpdateMatchStateEvent; private bool _isMatching; public bool IsMatching { public bool IsMatching { get { return _isMatching; } set { set { _isMatching = value; if (UpdateMatchStateEvent != null) { @@ -75,12 +73,6 @@ public void OnSwitchAccount() { IsMatching = false; if (clientMatchClock != null) { Clock.Stop(clientMatchClock); clientMatchClock = null; } } public void OnPlayerLoginOk() @@ -457,7 +449,6 @@ } } Clock clientMatchClock; BuffModel buffDatas { get { return ModelCenter.Instance.GetModel<BuffModel>(); } } /// <summary> ///0-取消匹配; 1-进行匹配 @@ -467,47 +458,10 @@ { if (type == 1 && TryGetMatchTip()) return; if (type == 1) { var danLevel = CrossServerOneVsOnePlayerInfo.Instance.DanLV; if (ClientCrossServerOneVsOne.TryClientCrossServerOneVsOne(danLevel)) { var onMatchPackage = new HC002_tagGCCrossRealmPKStartMatch(); GameNetSystem.Instance.PushPackage(onMatchPackage, ServerType.Main); var randomWaitSeconds = UnityEngine.Random.Range(3, 8); clientMatchClock = Clock.AlarmAt(DateTime.Now + new TimeSpan(randomWaitSeconds * TimeSpan.TicksPerSecond), () => { IsMatching = false; if (GameNetSystem.Instance.netState == GameNetSystem.NetState.Connected) { ClientCrossServerOneVsOne.FakeMatchOk(); } }); } else { var match = new CC101_tagCMCrossRealmPKMatch(); match.Type = (byte)type; GameNetSystem.Instance.SendInfo(match); CrossServerOneVsOneRewardModel.PkType = buffDatas.PkType; } } else { if (clientMatchClock != null) { Clock.Stop(clientMatchClock); clientMatchClock = null; IsMatching = false; } else { var match = new CC101_tagCMCrossRealmPKMatch(); match.Type = (byte)type; GameNetSystem.Instance.SendInfo(match); CrossServerOneVsOneRewardModel.PkType = buffDatas.PkType; } } var match = new CC101_tagCMCrossRealmPKMatch(); match.Type = (byte)type; GameNetSystem.Instance.SendInfo(match); CrossServerOneVsOneRewardModel.PkType = buffDatas.PkType; } public void SendBuyMatchCount() System/CrossServerOneVsOneClient/ClientCrossServerOneVsOneStage.cs
@@ -139,6 +139,11 @@ { var sendInfo = new CA231_tagCMClientStartCustomScene(); GameNetSystem.Instance.SendInfo(sendInfo); if (PlayerDatas.Instance.hero!=null ) { PlayerDatas.Instance.hero.Behaviour.StartHandupAI(); } } private void OnClientPVPResult(bool win) @@ -243,10 +248,6 @@ { PersonalEnemy.ReleasePlayer(opponentPlayer); opponentPlayer.Destroy(); } else { } ClientCrossServerOneVsOne.FakeRoundEnd(fightInfo.isOver, fightInfo.roundCount, fightInfo.roundWinnerIds.ToArray());