|
|
@@ -18,16 +18,12 @@ public class PKGameMode_OnlinePK : GameMode {
|
|
|
public PKGameMode_OnlinePK(GameMgr gameMgr) : base(gameMgr) {
|
|
|
GlobalData.pkMatchType = PKMatchType.OnlinePK;
|
|
|
|
|
|
- bool hasSocketPlayer = false;
|
|
|
- if (GameObject.Find("SocketPlayer") == null) {
|
|
|
- PKMatchingView.MoniMatchForTestInGameScene(() => {
|
|
|
- myPlayerIndex = GlobalData.playerIndexInRoom;
|
|
|
- ToInitGameView();
|
|
|
- });
|
|
|
- } else {
|
|
|
- hasSocketPlayer = true;
|
|
|
+ socketPlayer = SocketPlayer.NewInstance();
|
|
|
+ socketPlayer.onRoomReadyComplete = () => {
|
|
|
myPlayerIndex = GlobalData.playerIndexInRoom;
|
|
|
- }
|
|
|
+ ToInitGameView();
|
|
|
+ };
|
|
|
+ socketPlayer.onReceivePKGameData = onReceivePKGameData;
|
|
|
|
|
|
gameLogic.InitAppearPlayerIndexes();
|
|
|
gameLogic.SetCurrentPlayerIndexToNext();
|
|
|
@@ -35,16 +31,10 @@ public class PKGameMode_OnlinePK : GameMode {
|
|
|
//记录可射击的靶子
|
|
|
targetBody = GameObject.Find("GameArea/TargetObject/TargetBody").GetComponent<TargetBody>();
|
|
|
GameObject.FindObjectOfType<ArmBow>().validTargets.Add(targetBody);
|
|
|
- if (hasSocketPlayer) {
|
|
|
- ToInitGameView();
|
|
|
- }
|
|
|
//禁止动作-相机和手臂
|
|
|
BanBowReady();
|
|
|
|
|
|
AutoSwitchBanUserControlBow();
|
|
|
-
|
|
|
- socketPlayer = GameObject.Find("SocketPlayer").GetComponent<SocketPlayer>();
|
|
|
- socketPlayer.onReceivePKGameData = onReceivePKGameData;
|
|
|
}
|
|
|
|
|
|
void ToInitGameView() {
|