/// <summary> /// 进入场景 /// </summary> void OnEnterScene(byte[] p) { ProtoInt proto = ObjectPool.protoPool.GetOrCreate <ProtoInt>(ProtoPool.ProtoRecycleType.Int); if (proto.Parse(p)) { EventLoadSceneArgs loadSceneCfg = new EventLoadSceneArgs(); loadSceneCfg.index = proto.context; loadSceneCfg.progress = null; loadSceneCfg.complete = SendEnterScene; MonoHelper.GetInstance().LoadSceneAsync(loadSceneCfg); proto.Recycle(); } }
void OnMsgEnterScene(TcpHost.SocketAccept socket, byte[] protoData) { ProtoPlayerInfo p; ProtoInt intP = new ProtoInt(); intP.Parse(protoData); int playerMapID = intP.context; intP.Recycle(); if (playerInfos.TryGetValue((byte)socket.id, out p)) { p.mapID = playerMapID; Debug.LogWarning(socket.id + "进入场景完成"); } }
/// <summary> /// 切换场景完成 /// </summary> void SendEnterScene(int mapID) { ProtoInt intArgs = ObjectPool.protoPool.GetOrCreate <ProtoInt>(ProtoPool.ProtoRecycleType.Int); intArgs.context = mapID; Send(ProtoIDCfg.ENTER_SCENE, intArgs, ProtoType.Importance); intArgs.Recycle(); //船 if (Connection.GetInstance().isHost) { SendActiveObjectProto(new int[] { 19, 0 }); } var player = playerModel.GetPlayerInfo(); if (player != null) { //炮 机舱 SendActiveObjectProto(new int[] { playerModel.GetPlayerInfo().pos, playerModel.GetPlayerInfo().pos + 6 }); } }