コード例 #1
0
 /// <inheritdoc/>
 public async Task <List <Player> > ReadPlayers(PlayerFilter filter)
 {
     using (var connection = _databaseConnectionFactory.CreateDatabaseConnection())
     {
         return(await ReadPlayers(filter, connection).ConfigureAwait(false));
     }
 }
コード例 #2
0
    public override void TriggerStoryEvent(PlayerFilter playerFilter, GameObject obj)
    {
        CanvasGroupFader fader = obj.GetComponent <CanvasGroupFader>();

        cgf = fader;
        cgf.Display(false);
    }
コード例 #3
0
ファイル: SisterLetter.cs プロジェクト: Syfrex/Owlchemist
 public void OpenLetter(PlayerFilter player)
 {
     this.player = player;
     gameObject.SetActive(true);
     player.gameManagerComponent.OnStopGameTick();
     player.inputComponent.OnBButtonDown += ResumeGame;
 }
コード例 #4
0
ファイル: ChatWindowMV.cs プロジェクト: KrzychuR/CotGBrowser
        private bool IsAcceptedPlayer(string pn)
        {
            if (string.IsNullOrWhiteSpace(pn) || string.IsNullOrWhiteSpace(PlayerFilter))
            {
                return(true);
            }

            if (PlayerFilter[0] == '~')
            {
                if (pn.ToUpper() == PlayerFilter.Substring(1).ToUpper())
                {
                    return(false);
                }
            }
            else
            {
                var users = PlayerFilter.ToUpper().Split(';');
                return(users.Contains(pn.ToUpper()));

                //if (pn.ToUpper() != PlayerFilter.ToUpper())
                //  return false;
            }

            return(true);
        }
コード例 #5
0
 public void SubscribeToButtonEvents(PlayerFilter player)
 {
     this.player = player;
     player.movementComponent.alive       = false;
     player.inputComponent.OnAButtonDown += Respawn;
     player.inputComponent.OnBButtonDown += QuitGame;
 }
コード例 #6
0
        public async Task <List <Player> > GetPlayersAsync(string[] playerTags, PlayerFilter playerFilter = null)
        {
            Ensure.ArgumentNotNullOrEmptyEnumerable(playerTags, nameof(playerTags));

            var response = await GetPlayersResponseAsync(playerTags, playerFilter);

            return(response.GetModel());
        }
コード例 #7
0
        public async Task <Player> GetPlayerAsync(string playerTag, PlayerFilter playerFilter = null)
        {
            Ensure.ArgumentNotNullOrEmptyString(playerTag, nameof(playerTag));

            var response = await GetPlayerResponseAsync(playerTag, playerFilter);

            return(response.GetModel());
        }
コード例 #8
0
    public override bool PerformCollectibleEvent(PlayerFilter player)
    {
        // display letter ui
        player.uiComponent.sisterLetter.OpenLetter(player);

        // return false to also pick up item
        return(false);
    }
コード例 #9
0
 public void TriggerStoryBeat(int index, PlayerFilter player)
 {
     if (beatCollections[index - 1] != null)
     {
         beatCollections[index - 1].storyEvent.TriggerStoryEnd(player, beatCollections[index].storyBeatObject);
     }
     beatCollections[index].storyEvent.TriggerStoryEvent(player, beatCollections[index].storyBeatObject);
     currentStoryBeat++;
 }
コード例 #10
0
    public override void TriggerStoryBegin(PlayerFilter playerFilter, GameObject obj)
    {
        Light          l  = obj.GetComponentInChildren <Light>();
        ParticleSystem ps = obj.GetComponentInChildren <ParticleSystem>();

        l.intensity = 1f;
        playerFilter.vfxComponent.discoverSisterTorchFizzle.Play();

        playerFilter.inputComponent.PulseVibrate(.3f);
    }
コード例 #11
0
ファイル: IsInRangeCheck.cs プロジェクト: Syfrex/Owlchemist
    public override bool ConditionMet(PlayerFilter player, StoryBeatComponent currentBeat)
    {
        if (torchCheck)
        {
            float dst = Vector3.Distance(player.go.transform.position, player.conditionsComponent.firstInteractable.position);
            return(dst < compareDistance);
        }

        return(false);
    }
コード例 #12
0
    public override void TriggerStoryEvent(PlayerFilter playerFilter, GameObject obj)
    {
        canvasObj      = obj;
        currentText    = 0;
        player         = playerFilter;
        introText      = obj.GetComponentInChildren <Text>();
        introText.text = introTexts[currentText];

        player.gameManagerComponent.OnStopGameTick?.Invoke();

        player.inputComponent.OnAButtonDown += UpdateText;
    }
コード例 #13
0
        public string Serialize(PlayerFilter filter)
        {
            filter = filter ?? new PlayerFilter();
            ResetSerializer();

            Serialize(filter.Query, "q");
            Serialize(filter.PlayerIds, "player");
            Serialize(filter.PlayerIdentityIds, "playeridentity");
            Serialize(filter.TeamIds, "team");

            return(Serializer.ToQueryString());
        }
コード例 #14
0
 public static void SwitchPlayers(PlayerFilter _filter)
 {
     if (_filter == PlayerFilter.PLAYER_ONE)
     {
         p2.enabled = true;
         p1.enabled = false;
     }
     else
     {
         p1.enabled = true;
         p2.enabled = false;
     }
 }
コード例 #15
0
    public void TogglePlayerFilter(string filterName, bool active)
    {
        GameObject filterObject = GameObject.Find(filterName);

        if (filterObject)
        {
            PlayerFilter playerFilter = filterObject.GetComponent <PlayerFilter>();

            if (playerFilter)
            {
                playerFilter.SetActive(true);
            }
        }
    }
コード例 #16
0
    public override bool ConditionMet(PlayerFilter player, StoryBeatComponent currentBeat)
    {
        if (!subbed)
        {
            player.healthComponent.OnPlayerDecreaseGranularHealth += SetHasTakenDamageTrue;
        }
        else
        {
            player.healthComponent.OnPlayerDecreaseGranularHealth -= SetHasTakenDamageTrue;
            Debug.Log("unsubbed");
        }

        return(hasTakenDamage);
    }
コード例 #17
0
    public override bool ConditionMet(PlayerFilter player, StoryBeatComponent currentBeat)
    {
        float dst = Vector3.Distance(player.go.transform.position, currentBeat.transform.position);

        if (dst < (useBeatDistanceThreshold ? currentBeat.firstTriggerThreshold : triggerDistance))
        {
            if (player.inputComponent.aButtonDown)
            {
                return(true);
            }
        }

        return(false);
    }
コード例 #18
0
        /// <inheritdoc/>
        public async Task <List <Player> > ReadPlayers(PlayerFilter filter, IDbConnection connection)
        {
            if (filter is null)
            {
                filter = new PlayerFilter();
            }

            if (connection is null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            var sql = $@"SELECT DISTINCT PlayerId, PlayerRoute, 
                                PlayerIdentityId, PlayerIdentityName, MIN(MatchStartTime) AS FirstPlayed,  MAX(MatchStartTime) AS LastPlayed, 
                                TeamName 
                                FROM {Tables.PlayerInMatchStatistics} AS stats 
                                <<WHERE>>
                                GROUP BY stats.PlayerId, stats.PlayerRoute, stats.PlayerIdentityId, stats.PlayerIdentityName, stats.TeamName";

            var where = new List <string>();
            var parameters = new Dictionary <string, object>();

            if (filter?.PlayerIds?.Count > 0)
            {
                where.Add("stats.PlayerId IN @PlayerIds");
                parameters.Add("@PlayerIds", filter.PlayerIds.Select(x => x.ToString()));
            }

            sql = sql.Replace("<<WHERE>>", where.Count > 0 ? "WHERE " + string.Join(" AND ", where) : string.Empty);

            var rawResults = (await connection.QueryAsync <Player, PlayerIdentity, Team, Player>(sql,
                                                                                                 (player, identity, team) =>
            {
                identity.Team = team;
                identity.Player = player;
                player.PlayerIdentities.Add(identity);
                return(player);
            },
                                                                                                 new DynamicParameters(parameters),
                                                                                                 splitOn: "PlayerIdentityId, TeamName").ConfigureAwait(false)).ToList();

            return(rawResults.GroupBy(x => x.PlayerId).Select(group =>
            {
                var player = group.First();
                player.PlayerIdentities = group.Select(x => x.PlayerIdentities.Single()).OfType <PlayerIdentity>().ToList();
                return player;
            }).ToList());
        }
コード例 #19
0
        public void ItFiltersOutMyFriends()
        {
            State.CreateLeaderboard()
            .AddLeader("eweiss")
            .AddLeader("revans")
            .AddLeader("mburke")
            .AddLeader("jkalhoff")
            .Done();
            var subject = new PlayerFilter("mburke", "revans");
            var args    = BuildArgsFromState();

            subject.Process(State, args);

            Check.That(args.Selected).IsFalse();
            Check.That(args.EligibleTargets.Select(i => i.PlayerName))
            .Not.Contains("mburke", "revans");
        }
コード例 #20
0
        /// <summary>
        /// Gets a list of player identities based on a query
        /// </summary>
        /// <returns>A list of <see cref="PlayerIdentity"/> objects. An empty list if no player identities are found.</returns>
        public async Task <List <PlayerIdentity> > ReadPlayerIdentities(PlayerFilter filter)
        {
            using (var connection = _databaseConnectionFactory.CreateDatabaseConnection())
            {
                var sql = $@"SELECT stats.PlayerIdentityId, stats.PlayerIdentityName, stats.Probability, 
                            COUNT(DISTINCT MatchId) AS TotalMatches, MIN(MatchStartTime) AS FirstPlayed,  MAX(MatchStartTime) AS LastPlayed,
                            stats.PlayerId, stats.PlayerRoute, stats.TeamId, stats.TeamName
                            FROM {Tables.PlayerInMatchStatistics} AS stats 
                            <<WHERE>>
                            GROUP BY stats.PlayerId, stats.PlayerRoute, stats.PlayerIdentityId, stats.PlayerIdentityName, stats.TeamId, stats.TeamName, stats.Probability
                            ORDER BY stats.TeamId ASC, Probability DESC, stats.PlayerIdentityName ASC";

                var where = new List <string>();
                var parameters = new Dictionary <string, object>();

                if (!string.IsNullOrEmpty(filter?.Query))
                {
                    where.Add("stats.PlayerIdentityName LIKE @Query");
                    parameters.Add("@Query", $"%{filter.Query.Replace(" ", "%")}%");
                }

                if (filter?.TeamIds?.Count > 0)
                {
                    where.Add("stats.TeamId IN @TeamIds");
                    parameters.Add("@TeamIds", filter.TeamIds.Select(x => x.ToString()));
                }

                if (filter?.PlayerIdentityIds?.Count > 0)
                {
                    where.Add("stats.PlayerIdentityId IN @PlayerIdentityIds");
                    parameters.Add("@PlayerIdentityIds", filter.PlayerIdentityIds.Select(x => x.ToString()));
                }

                sql = sql.Replace("<<WHERE>>", where.Count > 0 ? "WHERE " + string.Join(" AND ", where) : string.Empty);

                return((await connection.QueryAsync <PlayerIdentity, Player, Team, PlayerIdentity>(sql,
                                                                                                   (identity, player, team) =>
                {
                    identity.Team = team;
                    identity.Player = player;
                    return identity;
                },
                                                                                                   new DynamicParameters(parameters),
                                                                                                   splitOn: "PlayerId, TeamId").ConfigureAwait(false)).ToList());
            }
        }
コード例 #21
0
        public async Task <AutocompleteResultSet> Autocomplete([FromUri] string query, [FromUri] string[] teams)
        {
            if (teams is null)
            {
                throw new ArgumentNullException(nameof(teams));
            }

            var playerQuery = new PlayerFilter {
                Query = query
            };

            foreach (var guid in teams)
            {
                if (guid == null)
                {
                    continue;
                }

                try
                {
                    playerQuery.TeamIds.Add(new Guid(guid));
                }
                catch (FormatException)
                {
                    // ignore that one
                }
            }
            var players = await _playerDataSource.ReadPlayerIdentities(playerQuery).ConfigureAwait(false);

            return(new AutocompleteResultSet
            {
                suggestions = players.Select(x => new AutocompleteResult
                {
                    value = x.PlayerIdentityName,
                    data = new
                    {
                        playerIdentityId = x.PlayerIdentityId.ToString(),
                        playerIdentityName = x.PlayerIdentityName,
                        playerRecord = BuildPlayerRecord(x, playerQuery.TeamIds.Count != 1),
                        teamId = x.Team.TeamId,
                        teamName = x.Team.TeamName
                    }
                })
            });
        }
コード例 #22
0
    public void Initialize()
    {
        if (!initialized)
        {
            return;
        }

        Transform[] worldObjects = GetComponentsInChildren <Transform>();

        inputSystem.Initialize(worldObjects);

        InputComponent       inpC       = playerObject.GetComponent <InputComponent>();
        HealthComponent      healthC    = playerObject.GetComponent <HealthComponent>();
        InteractorComponent  intC       = playerObject.GetComponent <InteractorComponent>();
        MovementComponent    moveC      = playerObject.GetComponent <MovementComponent>();
        InventoryComponent   invC       = playerObject.GetComponent <InventoryComponent>();
        GameManagerComponent gmC        = playerObject.GetComponent <GameManagerComponent>();
        AnimationComponent   animC      = playerObject.GetComponent <AnimationComponent>();
        PlayerStoryComponent storyBeatC = playerObject.GetComponent <PlayerStoryComponent>();
        PlayerEventComponent eventC     = playerObject.GetComponent <PlayerEventComponent>();
        GatheringComponent   gatC       = playerObject.GetComponent <GatheringComponent>();
        UIComponent          uiC        = playerObject.GetComponent <UIComponent>();
        NavMeshComponent     nmC        = playerObject.GetComponent <NavMeshComponent>();
        LightComponent       lC         = playerObject.GetComponent <LightComponent>();
        VFXComponent         vfxC       = playerObject.GetComponent <VFXComponent>();
        CombatComponent      cC         = playerObject.GetComponent <CombatComponent>();
        AudioComponent       aC         = playerObject.GetComponent <AudioComponent>();
        ConditionsComponent  conC       = playerObject.GetComponent <ConditionsComponent>();

        PlayerFilter pf = new PlayerFilter(
            playerObject, inpC, healthC, intC,
            moveC, invC, gmC, animC, storyBeatC,
            eventC, gatC, uiC, nmC, lC, vfxC,
            cC, aC, conC);

        sbs = GetComponent <StoryBeatSystem>();

        for (int i = 0; i < systems.Length; i++)
        {
            systems[i].player = pf;
            systems[i].Initialize(worldObjects);
            systems[i].SetupInputComponent(inputSystem.inputComponent);
        }
    }
コード例 #23
0
        /// <summary>
        /// Test function to call the GetPlayers() method
        /// </summary>
        /// <param name="sessionkey"></param>
        /// <param name="filter"></param>
        /// <returns></returns>
        protected dynamic CallGetPlayers(string sessionkey, PlayerFilter filter)
        {
            JavaScriptSerializer ser = new JavaScriptSerializer();
            string textfilter = ser.Serialize(filter);

            string uri = _api_url + @"\" + @"GetPlayers?SessionKey=" + sessionkey + "&Filter=" + textfilter;
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
            WebResponse response = null;
            String responseString = null;
            response = httpWebRequest.GetResponse();
            using (Stream ReceiveStream = response.GetResponseStream())
            {
                StreamReader reader = new StreamReader(ReceiveStream, Encoding.UTF8);
                responseString = reader.ReadToEnd();

                reader.Close();
                response.Close();
            }
            return GetJsonObject(responseString);
        }
コード例 #24
0
    public override bool PerformCollectibleEvent(PlayerFilter player)
    {
        bool tempTest = false;

        for (int y = 0; y < player.inventoryComponent.InventoryBag.Count; y++)
        {
            if (player.inventoryComponent.InventoryBag[y] != player.inventoryComponent.tempColl)
            {
                tempTest = true;
                break;
            }
        }

        if (tempTest)
        {
            GameObject cart = player.gameManagerComponent.cartInteraction.cart;
            player.inventoryComponent.TransferItemsFromTo(player.inventoryComponent, cart.GetComponent <InventoryComponent>(), true);
        }
        player.gameManagerComponent.isInsideCart = true;
        player.gameManagerComponent.cartInteraction.EnterCart();
        return(true);
    }
コード例 #25
0
    private void HandleCase1() //ChangeFilters in Warrior Zone -- Scene4
    {
        GameObject pFilter = GameObject.Find("ChangableMageFilter1");

        if (pFilter)
        {
            PlayerFilter playerFilter = pFilter.GetComponent <PlayerFilter>();
            playerFilter.allowedPlayers[0] = levelManager.GetMage();
        }

        ParticleSystem particles = pFilter.GetComponent <ParticleSystem>();

        ParticleSystem.MainModule module = particles.main;
        module.startColor = new Color(0, 255, 213, 255);

        levelManager.InstantiatePortal("AnyPlayerTeleporter", new Vector2(-22.21f, -2.135f), new Vector2(-21f, 0.5f));
        levelManager.InstatiateSprite("Arrows/mageArrowDown", new Vector2(-22f, 0.9f));

        GameObject switchObject = GameObject.Find("Switch (2)");

        Destroy(switchObject);
        Destroy(gameObject);
    }
コード例 #26
0
    public override bool ConditionMet(PlayerFilter player, StoryBeatComponent currentBeat)
    {
        if (!hasReset)
        {
            Reset();
            hasReset = true;
        }

        if (player.inputComponent.leftStickInput.magnitude != 0)
        {
            playerMoved = true;
        }

        if (playerMoved)
        {
            currentTime += Time.deltaTime;
        }

        bool returnVal = playerMoved && currentTime >= waitTime;

        hasReset = !returnVal;
        return(returnVal);
    }
コード例 #27
0
        public async Task <IEnumerable <PlayerItem> > SearchPlayers([FromQuery] PlayerFilter filter)
        {
            var request = new HttpRequestMessage(HttpMethod.Get, "api/mydraftdata/PlayerSearch?name=" + filter.name);

            var client = _clientFactory.CreateClient("myDraftData");

            var response = await client.SendAsync(request);

            if (response.IsSuccessStatusCode)
            {
                using var responseStream = await response.Content.ReadAsStreamAsync();

                PullPlayerRequests = await JsonSerializer.DeserializeAsync
                                     <IEnumerable <PlayerItem> >(responseStream);
            }
            else
            {
                GetPullRequestsError = true;
                PullPlayerRequests   = Array.Empty <PlayerItem>();
            }

            return(PullPlayerRequests);
        }
コード例 #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Get our session key first (always)
            string mySessionKey = GetSessionKey("tknudsen", "kkkkkkk");

            // LEAGUES
            // Get all leagues; don't filter
            dynamic leagues = CallGetLeagues(mySessionKey, null);
            int random_league_id = -1171577383; // NHL

            Response.Write("Players with last name Smith in NHL<br/>__________________________________________<br/>");

            // PLAYERS
            // Who do we want to filter for in GetPlayers()?
            PlayerFilter filter = new PlayerFilter() { LastName = "Smith", League = random_league_id };

            // Get those players
            dynamic players = CallGetPlayers(mySessionKey, filter);
            var myplayers = players.Players;

            // Output those players
            foreach (dynamic player in players.Players)
            {
                string teamname = player.CurrentTeam == null ? null : player.CurrentTeam.Name;

                Response.Write(player.FirstName + " " + player.LastName + "(" + teamname + ") <br/>");
            }
        }
コード例 #29
0
 public void SubscribeToPause(PlayerFilter player)
 {
     this.player = player;
     player.inputComponent.OnBButtonDown += ReturnToGame;
 }
コード例 #30
0
        public async Task <List <Player> > ReadPlayers(PlayerFilter filter, IDbConnection connection)
        {
            var cachePolicy = _policyRegistry.Get <IAsyncPolicy>(CacheConstants.StatisticsPolicy);

            return(await cachePolicy.ExecuteAsync(async context => await _playerDataSource.ReadPlayers(filter, connection).ConfigureAwait(false), new Context(nameof(ReadPlayers) + _playerFilterSerializer.Serialize(filter))));
        }
コード例 #31
0
ファイル: Advert.cs プロジェクト: nike4613/TshockPLugins
        protected internal Message Register(string message, Color color, TimeSpan delay, TimeSpan begotoff, PlayerFilter filter, MessageSend sent)
        {
            Message msg = new Message()
            {
                Text   = message,
                Color  = color,
                Delay  = delay,
                Offset = begotoff,
                Filter = filter,
                Send   = sent
            };

            msg.Index = messages.AddFirstDefault(msg);

            delays.SublistInitCapacity = messages.Count;

            foreach (List <TimeSpan> la in delays)
            {
                la.Capacity = Math.Max(messages.Count, la.Capacity);
                la.FillToCapacity(TimeSpan.MinValue);
            }

            foreach (TSPlayer ply in TShock.Players)
            {
                if (ply != null)
                {
                    foreach (Message m in messages)
                    {
                        if (!EqualityComparer <Message> .Default.Equals(m, default(Message)) &&
                            delays[ply.Index, m.Index] == TimeSpan.MinValue)
                        {
                            delays[ply.Index, m.Index] = m.Delay - m.Offset;
                        }
                    }
                }
            }

            return(msg);
        }
コード例 #32
0
 public override bool ConditionMet(PlayerFilter player, StoryBeatComponent currentBeat)
 {
     return(player.inputComponent.rightShoulderDown);
 }