Example #1
0
    private void Start()
    {
        _steamManager = SteamNetworkManager.Instance;
        _steamManager.premadeLobbyRef = this;

        if (SteamManager.Initialized)
        {
            m_LobbyChatMessage = Callback <LobbyChatMsg_t> .Create(OnLobbyChatMessage);
        }
    }
    void Start()
    {
        // init
        Instance = this;
        // DontDestroyOnLoad(this);

        LogFilter.currentLogLevel = LogFilter.Info;

        if (SteamManager.Initialized)
        {
            m_LobbyEntered = Callback <LobbyEnter_t> .Create(OnLobbyEntered);

            m_GameLobbyJoinRequested = Callback <GameLobbyJoinRequested_t> .Create(OnGameLobbyJoinRequested);

            m_LobbyChatUpdate = Callback <LobbyChatUpdate_t> .Create(OnLobbyChatUpdate);

            m_LobbyMatchList = CallResult <LobbyMatchList_t> .Create(OnLobbyMatchList);
        }
        else
        {
            Debug.LogWarning("SteamManager not initialized !");
        }

        UNETServerController.Init();

        // check if game started via friend invitation
        string[] args  = System.Environment.GetCommandLineArgs();
        string   input = "";

        for (int i = 0; i < args.Length; i++)
        {
            if (args [i] == "+connect_lobby" && args.Length > i + 1)
            {
                input = args [i + 1];
            }
        }

        if (!string.IsNullOrEmpty(input))
        {
            // Invite accepted, launched game. Join friend's game
            ulong lobbyId = 0;

            if (ulong.TryParse(input, out lobbyId))
            {
                JoinLobby(new CSteamID(lobbyId));
            }
        }
    }
Example #3
0
    void Awake()
    {
        Instance = this;
        DontDestroyOnLoad(this);

        LogFilter.currentLogLevel = LogFilter.Info;

        if (SteamManager.Initialized)
        {
            m_LobbyEntered = Callback <LobbyEnter_t> .Create(OnLobbyEntered);

            m_GameLobbyJoinRequested = Callback <GameLobbyJoinRequested_t> .Create(OnGameLobbyJoinRequested);

            m_LobbyChatUpdate = Callback <LobbyChatUpdate_t> .Create(OnLobbyChatUpdate);

            m_LobbyMatchList = CallResult <LobbyMatchList_t> .Create(OnLobbyMatchList);
        }

        UNETServerController.Init();
    }