예제 #1
0
 /// <summary>
 /// 检查准备时间,时间到了进入场景
 /// </summary>
 void CheckPlayerConnetTime()
 {
     if (MapID == 0 && Time.time - startUpTime > waitConnectTime && curPlayer > 0)
     {
         MapID = 1;
         ProtoInt proto = new ProtoInt();
         proto.context = MapID;
         Broadcast(ProtoIDCfg.ENTER_SCENE, proto);
         waitEnterSceneTime = Time.time;
         gameStatus         = GameStatus.EnterScene;
     }
 }
예제 #2
0
    /// <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();
        }
    }
예제 #3
0
    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 + "进入场景完成");
        }
    }
예제 #4
0
    /// <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 });
        }
    }