예제 #1
0
    public void SubmitInLocalCharacterSelection(int _playerId)
    {
        if (!PhotonNetwork.offlineMode)
        {
            return;
        }
        if (!TDS_GameManager.PlayersInfo.Any(i => i.PlayerID == _playerId))
        {
            characterSelectionMenu.AddNewPlayer(_playerId);
            return;
        }
        TDS_CharacterSelectionElement _elem = characterSelectionMenu.CharacterSelectionElements.Where(e => (e.PlayerInfo != null) && (e.PlayerInfo.PlayerID == _playerId) && (e.IsUsedLocally)).FirstOrDefault();

        if (_elem)
        {
            if (!_elem.IsLocked)
            {
                //_elem.LockElement(true);
                _elem.ReadyToggle.isOn = true;
                _elem.TriggerToggle();
                return;
            }
        }
        if (TDS_GameManager.PlayersInfo.Any(i => !i.IsReady))
        {
            return;
        }
        TDS_UIManager.Instance?.LoadLevel();
    }
예제 #2
0
    public void CancelInLocalCharacterSelection(int _playerId)
    {
        if (!PhotonNetwork.offlineMode || !TDS_GameManager.PlayersInfo.Any(i => i.PlayerID == _playerId))
        {
            return;
        }
        TDS_CharacterSelectionElement _elem = characterSelectionMenu.CharacterSelectionElements.Where(e => (e.PlayerInfo != null) && (e.PlayerInfo.PlayerID == _playerId) && (e.IsUsedLocally)).FirstOrDefault();

        if (_elem && _elem.IsLocked)
        {
            _elem.ReadyToggle.isOn = false;
            _elem.TriggerToggle();
            return;
        }
        characterSelectionMenu.RemoveLocalPlayer(_playerId);
        if (TDS_GameManager.PlayersInfo.Count == 0)
        {
            TDS_GameManager.PlayersInfo.Clear();
            TDS_UIManager.Instance?.ActivateMenu(UIState.InMainMenu);
        }
    }