void onCompletedTeamInfoSent(OnlineTeam team)
    {
        if (team.MemberCount != GameData.CurrentTeam.MemberCount)
        {
            return;
        }

        if (team.TeamAlias == GameData.CurrentTeam.TeamAlias)
        {
            return;
        }

        if (doesTeamsListContainTeam(team.TeamAlias))
        {
            return;
        }

        PackedScene         scene = (PackedScene)ResourceLoader.Load("Scenes/AdvancedComponents/OnlineTeamInfoField.tscn");
        OnlineTeamInfoField field = (OnlineTeamInfoField)scene.Instance();

        field.Initialize(team, team.Players.Count, "Challenge");

        if (disabledTeamsAliases.Contains(team.TeamAlias) || GameData.CurrentTeam.CaptainAlias != SessionData.User.Alias)
        {
            field.SetEnabled(false);
        }

        teamsList.AddChild(field);
    }
Exemplo n.º 2
0
    void onUncompletedTeamSent(OnlineTeam team)
    {
        PackedScene         scene = (PackedScene)ResourceLoader.Load("Scenes/AdvancedComponents/OnlineTeamInfoField.tscn");
        OnlineTeamInfoField field = (OnlineTeamInfoField)scene.Instance();

        field.Initialize(team, team.Players.Count, "Join");

        teamsList.AddChild(field);
    }
    void addTeamToTeamsList(OnlineTeam team)
    {
        PackedScene         scene = (PackedScene)ResourceLoader.Load("Scenes/AdvancedComponents/OnlineTeamInfoField.tscn");
        OnlineTeamInfoField field = (OnlineTeamInfoField)scene.Instance();

        field.Initialize(team, team.Players.Count, "");
        field.SetButtonVisible(false);

        teamsList.AddChild(field);
    }
Exemplo n.º 4
0
 void onTeamChoosed(OnlineTeamInfoField sender)
 {
     for (int i = 0; i < teamsList.GetChildCount(); i++)
     {
         if (teamsList.GetChild(i) == sender)
         {
             GameData.CurrentTeam = sender.Team;
             disableEvents();
             GetTree().ChangeScene("Scenes/SelectFootballerScene.tscn");
         }
     }
 }
    bool doesTeamsListContainTeam(string teamAlias)
    {
        for (int i = 0; i < teamsList.GetChildCount(); i++)
        {
            OnlineTeamInfoField field = (OnlineTeamInfoField)teamsList.GetChild(i);
            if (field.Team.TeamAlias == teamAlias)
            {
                return(true);
            }
        }

        return(false);
    }
    OnlineTeam getTeam(string teamAlias)
    {
        for (int i = 0; i < teamsList.GetChildCount(); i++)
        {
            OnlineTeamInfoField field = (OnlineTeamInfoField)teamsList.GetChild(i);
            if (field.Team.TeamAlias == teamAlias)
            {
                return(field.Team);
            }
        }

        return(null);
    }
    void setTeamEnabled(string teamAlias, bool enabled)
    {
        for (int i = 0; i < teamsList.GetChildCount(); i++)
        {
            OnlineTeamInfoField field = (OnlineTeamInfoField)teamsList.GetChild(i);
            if (field.Team.TeamAlias == teamAlias)
            {
                field.SetEnabled(enabled);
                break;
            }
        }

        if (enabled)
        {
            disabledTeamsAliases.Remove(teamAlias);
        }
        else
        {
            disabledTeamsAliases.Add(teamAlias);
        }
    }
 void onChallengeTriggerd(OnlineTeamInfoField sender)
 {
     RequestCaller.RequestChallenge(GameData.CurrentTeam.TeamAlias, sender.Team.TeamAlias);
     disabledTeamsAliases.Add(sender.Team.TeamAlias);
     sender.SetEnabled(false);
 }