Exemplo n.º 1
0
    private void OnFactionRequestEvent(int deviceId, FactionType factionType, bool selectType)
    {
        PlayerFactionLinkItem ft         = _conPlayerFactions.GetLinkItemForFaction(factionType);
        RegisteredPlayer      playerOfId = _conPlayers.GetRegisteredPlayerById(deviceId);

        if (selectType)
        {
            if (ft.Player != null)
            {
                return;
            }
            _conPlayerFactions.UnassignPlayerFromItsFaction(playerOfId);
            _conPlayerFactions.AssignPlayerToFaction(playerOfId, factionType);
        }
        else
        {
            if (ft.Player != playerOfId)
            {
                return;
            }
            _conPlayerFactions.UnassignPlayerFromItsFaction(playerOfId);
        }

        if (_conPlayerFactions.GetTakenFactions().Length == _conPlayers.GetCurrentlyRegisteredPlayers(false).Length)
        {
            GoToGameScene();
            return;
        }
        SendUpdateFactions();
    }
Exemplo n.º 2
0
 private void OnPlayerFactionUnassignedEvent(PlayerFactionLinkItem linkItem)
 {
     if (linkItem.FactionType != FactionType)
     {
         return;
     }
     SetActive(null);
 }
Exemplo n.º 3
0
 public ConPlayerFactions()
 {
     FactionsLibrary = Resources.Load<FactionsLibrary>(LibraryLocations.FACTIONS_LIBRARY_LOCATION);
     PlayerFactionLinks = new PlayerFactionLinkItem[Enum.GetNames(typeof(FactionType)).Length - 1];
     FactionType factionType = FactionType.None;
     for(int i = 0; i < PlayerFactionLinks.Length; i++)
     {
         factionType = (FactionType)(i + 1);
         if(factionType != FactionType.None)
             PlayerFactionLinks[i] = new PlayerFactionLinkItem(factionType);
     }
 }
Exemplo n.º 4
0
    private void AwakeCheckFactionItem()
    {
        _selectionIcon.transform.localScale = Vector3.zero;
        PlayerFactionLinkItem item = _conPlayerFactions.GetLinkItemForFaction(FactionType);

        if (item.Player != null)
        {
            OnPlayerFactionAssignedEvent(item);
        }
        else
        {
            OnPlayerFactionUnassignedEvent(item);
        }
    }
Exemplo n.º 5
0
    private void AssignGamePlayersToUI()
    {
        foreach (FactionType ft in Enum.GetValues(typeof(FactionType)))
        {
            GamePlayerSectionUI section = null;
            switch (ft)
            {
            case FactionType.Spartans:
                section = _spartanSection;
                break;

            case FactionType.Vikings:
                section = _vikingSection;
                break;

            case FactionType.Knights:
                section = _knightSection;
                break;

            case FactionType.Samurai:
                section = _samuraiSection;
                break;

            default:
                continue;
            }
            PlayerFactionLinkItem pfli = Ramses.Confactory.ConfactoryFinder.Instance.Get <ConPlayerFactions>().GetLinkItemForFaction(ft);
            if (pfli.Player != null)
            {
                section.DisplayGamePlayer(_buildingsGameSceneTracker.BuildingsGame.GetGamePlayerBy(pfli.Player));
            }
            else
            {
                section.SetFactionSpecifics(ft);
                section.ToggleActivePlayerDisplay(false);
            }
        }
    }