protected override void HandleAvatarCreationForStageCreation(EvtStageCreated evt, out bool sendStageReady) { List <MonoSpawnPoint> avatarSpawnPointList = new List <MonoSpawnPoint>(); foreach (string str in evt.avatarSpawnNameList) { int namedSpawnPointIx = Singleton <StageManager> .Instance.GetStageEnv().GetNamedSpawnPointIx(str); avatarSpawnPointList.Add(Singleton <StageManager> .Instance.GetStageEnv().spawnPoints[namedSpawnPointIx]); } if (evt.isBorn) { this.CreateMPAvatars(); } Singleton <AvatarManager> .Instance.InitAvatarsPos(avatarSpawnPointList); Singleton <MonsterManager> .Instance.InitMonstersPos(evt.offset); if (!Singleton <MPManager> .Instance.isMaster) { MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Level_PeerStageReady>(); Packet_Level_PeerStageReady.StartPacket_Level_PeerStageReady(pc.builder); Packet_Level_PeerStageReady.AddState(pc.builder, PingPongEnum.Request); pc.Finish <Packet_Level_PeerStageReady>(Packet_Level_PeerStageReady.EndPacket_Level_PeerStageReady(pc.builder)); Singleton <MPManager> .Instance.SendReliableToPeer(0x21800001, 1, pc); } sendStageReady = false; }
private void OnAuthority_PeerStageReady(MPRecvPacketContainer recvPc) { Packet_Level_PeerStageReady ready = recvPc.As <Packet_Level_PeerStageReady>(); this._readyPeerCount++; if (this._readyPeerCount == Singleton <MPManager> .Instance.peer.totalPeerCount) { MPSendPacketContainer pc = Singleton <MPManager> .Instance.CreateSendPacket <Packet_Level_PeerStageReady>(); Packet_Level_PeerStageReady.StartPacket_Level_PeerStageReady(pc.builder); Packet_Level_PeerStageReady.AddState(pc.builder, PingPongEnum.Response); pc.Finish <Packet_Level_PeerStageReady>(Packet_Level_PeerStageReady.EndPacket_Level_PeerStageReady(pc.builder)); Singleton <MPManager> .Instance.SendReliableToOthers(0x21800001, pc); EvtStageReady evt = new EvtStageReady { isBorn = true }; Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal); } }