Inheritance: MonoBehaviour
 void JoinMatch(NetworkID networkID, LobbyManager lobbyManager)
 {
     lobbyManager.matchMaker.JoinMatch(networkID, "", "", "", 0, 0, lobbyManager.OnMatchJoined);
     lobbyManager.backDelegate = lobbyManager.StopClientClbk;
     lobbyManager._isMatchmaking = true;
     lobbyManager.DisplayIsConnecting();
 }
Exemple #2
0
 void JoinMatch(NetworkID networkID, LobbyManager lobbyManager)
 {
     lobbyManager.matchMaker.JoinMatch(networkID, "", "", "", 0, 0, lobbyManager.OnMatchJoined);
     lobbyManager.backDelegate = lobbyManager.StopClientClbk;
     lobbyManager._isMatchmaking = true;
     lobbyManager.DisplayIsConnecting();
     lobbyManager.serverListPanel.gameObject.SetActive(false);
 }
    void Awake()
    {
        networkManager = GameObject.Find("LobbyManager").GetComponent<LobbyManager>();
        availableGames = GameObject.Find("LobbyUIManager").GetComponent<LobbyUIManager>().availableGames;

        button = GetComponent<Button>();
        button.onClick.AddListener(() => { GetGame();});
    }
    // Use this for initialization
    void Start()
    {
        if (!s_Singleton){
            s_Singleton = this;
        }
        Debug.Log("Manager Starting");

        DontDestroyOnLoad (gameObject);
    }
    public void Populate( MatchDesc match, LobbyManager lobbyManager, Color c ) {
        serverInfoText.text = match.name;

        slotInfo.text = match.currentSize.ToString( ) + "/" + match.maxSize.ToString( ); ;

        NetworkID networkID = match.networkId;

        joinButton.onClick.RemoveAllListeners( );
        joinButton.onClick.AddListener( ( ) => { JoinMatch( networkID, lobbyManager ); } );

        GetComponent<Image>( ).color = c;
    }
Exemple #6
0
 void Awake()
 {
     EventStartGame += CmdLoadMiniGame;
     MiniGameManager.EventLoadMinigame += CmdLoadMiniGame;
     if (instance != null)
     {
         Debug.LogError("More than one LobbyManager in scene");
     }
     else
     {
         instance = this;
     }
 }
Exemple #7
0
    IEnumerator Start()
    {
        while (LobbyManager.Instance == null)
        {
            yield return(null);
        }

        lobbyManager = LobbyManager.Instance;

        //Invoke("ListMatches", 1);
        //CancelInvoke("ListMatches");
        InvokeRepeating("ListMatches", 3, refreshMatchFreq);
    }
Exemple #8
0
 void Awake()
 {
     DontDestroyOnLoad(this);
     if (instance != null)
     {
         Debug.LogError("More than one GameManager in scene.");
     }
     else
     {
         instance = this;
     }
     networkLobbyManager = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <MyNetworkLobbyManager>();
 }
    void Awake()
    {
        m_hCurrentLobbyPlayers = new Dictionary<NetworkConnection, LobbyPlayer>();
        m_hCurrentPlayersIntances = new List<GameObject>();
        m_hActors = new List<Actor>();
        GameObject.DontDestroyOnLoad(this.gameObject);

        if (Instance != null)
            throw new Exception("Duplicate Lobby Manager Detected!");

        Instance = this;
        playScene = "DRAIV_Game_LuccaComicsEdition";
    }
    private void Awake()
    {
        // lobbyManager.testLauncher.gameObject.SetActive(false);
        if (buttonImage == null)
        {
            buttonImage = GetComponent <Image>();
        }

        if (lobbyManager == null)
        {
            lobbyManager = GameObject.FindObjectOfType <LobbyManager>(); //어차피 하나 밖에 없겠지?
        }
    }
Exemple #11
0
    public void RefreshList()
    {
        if (lobbyManager == null)
        {
            lobbyManager = GameObject.FindGameObjectWithTag("LMANAGER").GetComponent <LobbyManager>();
        }
        if (lobbyManager.matchMaker == null)
        {
            lobbyManager.StartMatchMaker();
        }

        lobbyManager.matchMaker.ListMatches(0, 20, "", true, 0, 0, onMatchList);
    }
Exemple #12
0
    void Start()
    {
        Instance = this;
        string ip = ConnectionManager.GetLocalIP();

        if (ip == "")
        {
            ip = "*" + Server.GetLocalIPAddress();
        }

        ipText.text = "IP: " + ip;
        UpdateNames();
    }
Exemple #13
0
        public static IGame GetGame(string name, Sender sender, LobbyManager lobbys)
        {
            var game = GetAllGames().FirstOrDefault(p => p.Name == name.KebabCaseToPascalCase());

            if (game == null)
            {
                return(null);
            }
            ConstructorInfo ctor     = game.GetConstructor(new[] { typeof(Sender), typeof(LobbyManager) });
            object          instance = ctor.Invoke(new object[] { sender, lobbys });

            return((IGame)instance);
        }
Exemple #14
0
    void Start()
    {
        s_Singleton  = this;
        lobbyHooks   = GetComponent <LobbyHook>();
        currentPanel = mainMenuPanel;

        backButton.gameObject.SetActive(false);
        GetComponent <Canvas>().enabled = true;

        DontDestroyOnLoad(gameObject);

        SetServerInfo("Offline", "None");
    }
    public void Populate(MatchInfoSnapshot match, LobbyManager lobbyManager, Color c)
    {
        serverInfoText.text = match.name;

        slotInfo.text = match.currentSize.ToString() + "/" + match.maxSize.ToString();;

        NetworkID networkID = match.networkId;

        joinButton.onClick.RemoveAllListeners();
        joinButton.onClick.AddListener(() => { JoinMatch(networkID, lobbyManager); });

        GetComponent <Image>().color = c;
    }
        public Given_a_lobby_is_open_When_new_game_started_within_period()
        {
            var lobby = new Lobby {
                Id = "lobby"
            };

            lobbys = ObjectMother.GetLobbyManager(new List <Lobby> {
                lobby
            });
            Task.Delay(1000).Wait();
            lobby.NewGame(null);
            lobbys.CloseInactive(1);
        }
        private string HandleMatchRes(Request ctx)
        {
            StreamReader reader = new StreamReader(ctx.Body);
            string       req    = reader.ReadToEnd();

            try
            {
                var   baseData = JObject.Parse(req);
                var   status   = baseData.Value <string>("status");
                var   matchid  = baseData.Value <string>("match_id");
                Lobby lob;
                if (!LobbyManager.LobbyID.TryGetValue(matchid, out lob))
                {
                    return("doesntexist");
                }
                if (status == "events")
                {
                    var events = baseData.Value <JArray>("events");
                    foreach (var eve in events)
                    {
                        LobbyManager.HandleEvent((GameEvents)eve.Value <int>("event_type"), eve, lob);
                    }
                }
                else if (status == "completed")
                {
                    var data = JsonConvert.DeserializeObject <Model.MatchData>(baseData.ToString());
                    data.mod      = Mods.Mods.ByID(lob.mod).name;
                    data.ranked   = lob.LobbyType == LobbyType.Matchmaking;
                    data          = data.ConvertData();
                    data.steamids = data.teams[0].players.Select(x => x.steam_id).Union(data.teams[1].players.Select(y => y.steam_id)).ToArray();
                    data.date     = DateTime.UtcNow.ToUnixTime();
                    log.DebugFormat("Match complete, {0} ranked: {1}, mod: {2}", lob.id, data.ranked, data.mod);
                    HandleMatchComplete(data, lob);
                }
                else if (status == "load_failed")
                {
                    HandleLoadFail(matchid, baseData.Value <JArray>("failed_players")); //parse the players property here for mroe reliable data
                }
                else if (status == "shutdown")
                {
                    log.DebugFormat("Received shutdown event for lobby [{0}]", lob.id);
                }
                else
                {
                    log.Debug(req);
                }
                return("success");
            }
            catch (Exception ex) { log.Error("Issue parsing match result data", ex); }
            return("fail");
        }
        private static void HandleMatchComplete(Model.MatchData toObject, Lobby lob)
        {
            var mod = Mods.Mods.ByID(lob.mod);

            if (mod != null)
            {
                toObject.mod = mod.name;
            }
            else
            {
                toObject.mod = lob.mod;
            }
            LobbyManager.OnMatchComplete(toObject);
        }
        public string ProLobbyUrl(string proId)
        {
            if (string.IsNullOrEmpty(proId))
            {
                return(null);
            }

            var webClient    = new WebClient();
            var lobbyManager = new LobbyManager(webClient);

            var result = GameWorker.GetProLobbyUrl(lobbyManager, proId);

            return(result);
        }
Exemple #20
0
    public PlayerInfo info;//玩家信息

    private void Start()
    {
        LobbyManager lob = LobbyManager.singleton as LobbyManager;

        //设置初始位置
        transform.position = lob.GetSpawnPos(info.ID - 1);//获取出生点位置

        //Text txt_Name = transform.Find("Canvas/txt_Name").GetComponent<Text>();
        //txt_Name.text = info.name;

        gameObject.name = "Player_" + info.ID;

        Debug.Log("GamePlayerStart");
    }
    internal void AttachAccountToInstance(Account account, LobbyManager manager)
    {
        if (account != null)
        {
            m_AccountRelative       = account;
            m_Manager               = manager;
            m_ConfirmationText.text = GetConfirmationText();
        }

        else
        {
            Debug.LogError("Attempting To Set Friend Removal Instance Account Relative To Null..");
        }
    }
Exemple #22
0
    public void RefreshList()
    {
        if (lobbyManager == null)
        {
            lobbyManager = LobbyManager.singleton.GetComponent <LobbyManager>();
        }

        if (lobbyManager.matchMaker == null)
        {
            lobbyManager.StartMatchMaker();
        }

        lobbyManager.matchMaker.ListMatches(0, this.joinRoomSize, "", true, 0, 0, OnMatchList);
    }
 public void OnClosed(object sender, OnClientDisconnectArgs onClientDisconnectArgs)
 {
     //Delete all lobbies
     if (Instances == null)
     {
         return;
     }
     foreach (var instance in Instances.Values)
     {
         LobbyManager.OnServerShutdown(instance);
     }
     Instances = null;
     Inited    = false;
 }
Exemple #24
0
    public override void OnLobbyServerSceneLoadedForPlayer(NetworkManager manager, GameObject lobbyPlayer, GameObject gamePlayer)
    {
        LobbyPlayer lobby = lobbyPlayer.GetComponent <LobbyPlayer>();

        LobbyManager lm = GetComponent <LobbyManager>();
        // car is the SetupLocalPlayer script.
        SetupLocalPlayer player = gamePlayer.GetComponent <SetupLocalPlayer>();


        // pName and pColor are variables in that script. Thus you can call those values using car.pName.
        // Want to get the team number value here and sync it
        player.pName = lobby.playerName;
        base.OnLobbyServerSceneLoadedForPlayer(manager, lobbyPlayer, gamePlayer);
    }
Exemple #25
0
 void Awake()
 {
     if (allPlayers == null)
     {
         allPlayers = new List <playerDetails>();
     }
     if (Instance)
     {
         Destroy(gameObject);
         return;
     }
     //! DontDestroyOnLoad(gameObject); cause problem after re-joining the game.
     Instance = this;
 }
Exemple #26
0
    public override void Ready(User user)
    {
        instance = this;
        Debug.LogWarning(user.Display(true));
        // Fetch lobbies.
        Manager = Discord.GetLobbyManager();

#if UNITY_EDITOR
        var cr = Manager.GetLobbyCreateTransaction();
        cr.SetCapacity(2);
        cr.SetType(LobbyType.Public);
        Manager.CreateLobby(cr, (Result res, ref Lobby lob) =>
        {
            if (res == Result.Ok)
            {
                JoinLobby(lob);
            }
            else
            {
                log($"Failed created: {res}");
            }
        });

//#else

        var q = Manager.GetSearchQuery();
        q.Distance(LobbySearchDistance.Local);
        q.Limit(5);
        q.Filter("slots", LobbySearchComparison.GreaterThan, LobbySearchCast.Number, "0"); // lobby with space left

        Manager.Search(q, (r) =>
        {
            if (r == Result.Ok)
            {
                var count = Manager.LobbyCount();
                log($"There are {count} lobbies online");
                for (int i = 0; i < count; i++)
                {
                    var lobby = Manager.GetLobbyId(count);
                    log($"At {i}: {lobby}");
                }
            }
            else
            {
                log($"Failed search: {r}");
            }
        });
#endif
    }
Exemple #27
0
    // Start is called before the first frame update
    void Start()
    {
        _uniqueInstance = this;
        SettingPlayer();

        _rndNum = PlayerControl._uniqueInstance.RNDNUM;
        _score  = 0.0f;
        _timer[_rndNum].text   = _timeCheck.ToString("N2");
        _myScore[_rndNum].text = "점수 : " + _score.ToString();

        _touchShootUI.SetActive(true);
        _gameStateUI[_rndNum].SetActive(false);
        _gameStateTxt[_rndNum].GetComponent <Text>();
        _gameStateTxt[_rndNum].SetActive(false);
    }
Exemple #28
0
    // Use this for initialization
    void Start()
    {
        canvas        = GameObject.Find("Canvas");
        lobby         = LobbyManager.instance;
        nameText      = GetComponent <Text>();
        rectTransform = GetComponent <RectTransform>();

        if (isLocalPlayer)
        {
            CmdPlayerInit(connectionId);
        }
        DoChangeShip((Ship)playerShip);
        DoChangeTeam(playerTeam);
        OnNameChange(playerName);
    }
Exemple #29
0
        public void Dispose(bool fromlobby = false)
        {
            if (_players.Count > 0)
            {
                matchData.slotId = new int[bMatchData.MaxRoomPlayers];
                this.SendMatchUpdate();
                _players.Clear();
            }
            matchData = null;

            if (!fromlobby)
            {
                LobbyManager.MatchDisposed(this.Id);
            }
        }
Exemple #30
0
    protected override void Awake()
    {
        base.Awake();

        // Adding the hero cards to the hero selector
        foreach (var hero in _HeroesList.Heroes)
        {
            // Adding cards to the
            Instantiate(hero.HeroCard, _HeroCardContainers);
        }
        _NumberOfHeroCards            = _HeroesList.Heroes.Length;
        _IndexOfCurrentlySelectedCard = 0;
        _LobbyManager         = LobbyManager.Instance;
        _PhotonNetworkManager = PhotonNetworkManager.Instance;
    }
Exemple #31
0
 public void SetIsHero()
 {
     if (!lobbyPlayer.isHero)
     {
         CmdSetIsHero(true);
     }
     else
     {
         if (!LobbyManager.ContainsOverlord())
         {
             //  lobbyPlayer.isHero = false;
             CmdSetIsHero(false);
         }
     }
 }
        public static void Main(string[] args)
        {
            Console.WriteLine("Exit the program with q");
            Thread thread = new Thread(new ThreadStart(QforExit));

            thread.Start();

            ServerIP = GetPublicIP();

            Task.Run(async() => await LobbyManager.MakeMatches());

            CreateHostBuilder(args).Build().Run();

            LobbyManager.OnExit();
        }
Exemple #33
0
    /// <summary>
    /// Link devices to players
    /// </summary>
    private void UpdateLobby()
    {
        LobbyManager lobby = GameManager.Instance.lobbyManager;

        foreach (var device in InputManager.Devices)
        {
            bool alreadyBound = false;

            foreach (var player in players)
            {
                if (device.Meta == player.deviceMeta)
                {
                    alreadyBound = true;

                    if (device.Action2.WasPressed)
                    {
                        playersToRemove.Add(player);
                        GameManager.Instance.PlaySound(SoundEvent.Throw);
                    }
                    else if (device.Action4.WasPressed)
                    {
                        int oldColorId = player.colorId;
                        player.SetColor(GetPlayerColorId(oldColorId + 1));
                        takenPlayerColors[oldColorId] = false;
                        lobby.UpdateZoneColors();
                        GameManager.Instance.PlaySound(SoundEvent.Mash);
                    }
                    break;
                }
            }
            if (alreadyBound)
            {
                continue;
            }

            if (device.Action1)
            {
                CreateNewPlayer(device);
                GameManager.Instance.PlaySound(SoundEvent.Grab);
            }
        }

        foreach (var player in playersToRemove)
        {
            RemovePlayer(player);
        }
        playersToRemove.Clear();
    }
    public override void _Ready()
    {
        // System.Environment.SetEnvironmentVariable("DISCORD_INSTANCE_ID", "0");

        discord         = new Discord.Discord(763426273757495327, (ulong)CreateFlags.Default);
        activityManager = discord.GetActivityManager();
        lobbyManager    = discord.GetLobbyManager();
        userManager     = discord.GetUserManager();

        activityManager.OnActivityJoin += (secret) => {
            lobbyManager.ConnectLobbyWithActivitySecret(secret, (Result result, ref Lobby lobby) =>
            {
                if (result == Result.Ok)
                {
                    GD.Print("Successfully joined a lobby: ", lobby.Id);
                    lobbyId = lobby.Id;
                    UpdateActivity("In lobby...", true, true);
                    UpdateMemberList();
                    EmitSignal("JoinedLobby");
                }
                else
                {
                    GD.PrintErr("Failed to join a lobby: ", result);
                }
            });
        };

        lobbyManager.OnMemberConnect += (lobbyId, userId) =>
        {
            UpdateActivity("In lobby...", false, true);
            UpdateMemberList();
        };

        lobbyManager.OnMemberDisconnect += (lobbyId, userId) =>
        {
            UpdateActivity("In lobby...", false, true);
            UpdateMemberList();
        };

        lobbyManager.OnLobbyMessage += (lobbyId, userId, data) =>
        {
            string message  = Encoding.UTF8.GetString(data);
            string username = lobbyManager.GetMemberUser(lobbyId, userId).Username;
            EmitSignal("ReceivedMessage", username, message);
        };

        UpdateActivity("In menu...", true, false);
    }
 private static void RunCallbacks(Discord discord, LobbyManager lobbyManager)
 {
     try
     {
         while (true)
         {
             discord.RunCallbacks();
             lobbyManager.FlushNetwork();
             Thread.Sleep(1000 / 60);
         }
     }
     finally
     {
         discord.Dispose();
     }
 }
Exemple #36
0
        public void Reconnect()
        {
            _lobbyManager = FindObjectOfType <LobbyManager>();
            _captainsMess = FindObjectOfType <CaptainsMess>();

            if (isLocalPlayer)
            {
                if (_lobbyManager != null && IsReady())
                {
                    _lobbyManager.ChangeReadyStatus();
                }

                _updatePlayerLobbyInfo = true;
                StartCoroutine(RequestForPlayerUpdates());
            }
        }
Exemple #37
0
 public void CheckUIReferences()
 {
     if (lobbyManager == null)
         lobbyManager = GameObject.Find("LobbyManager").GetComponent<LobbyManager>();
 }
Exemple #38
0
 private void Start( ) {
     lobbyManager = GetComponent<LobbyManager>( );
 }
    void Start()
    {
        instance = this;

        _isResponse = false;
        _responseCallback = null;

        // Activate needed objects to play the game
        gameManager.SetActive(true);
        ChangePanel(menuGui);
    }
    protected override void Awake()
    {
        base.Awake();

        m_lobby = LobbyManager.instance;
    }
    private void Start( )
    {
        s_Singleton = this;
        lobbyHooks = GetComponent<LobbyHook>( );
        currentPanel = mainMenuPanel;

        backButton.gameObject.SetActive( true );
        GetComponent<Canvas>( ).enabled = true;

        DontDestroyOnLoad( gameObject );

        SetServerInfo( "Offline", "None" );
    }
	void Start () {
		lobbyManager = GameObject.Find ("LobbyManager").GetComponent<LobbyManager>();
		mLabel = GameObject.Find("Champion_Name_Label").GetComponent<UILabel>();
		mTexture = GameObject.Find("Champion_Portrait").GetComponent<UITexture>();
	}
Exemple #43
0
 void Awake()
 {
     instance = this;
 }
Exemple #44
0
	public void startGame()
	{
		LobbyManager manager = new LobbyManager ();
		manager.startServer ();
		Application.LoadLevel ("select_map");
	}