private void ChangeTileColor(List <TileEV> tilesToChange, ref PressStepState token) { bool isClicked = token.PiecePressState == PiecePressState.CLICKED; PieceEV piece = pieceFindService.FindPieceEV(token.PieceEntityId, entitiesDB); int pieceIdtoken = token.PieceEntityId; HighlightState newHighlightState = HighlightService.CalcClickHighlightState(piece.PlayerOwner.PlayerColor); TurnEV currentTurn = turnService.GetCurrentTurnEV(entitiesDB); bool doesPieceBelongToTurnPlayer = currentTurn.TurnPlayer.PlayerColor == piece.PlayerOwner.PlayerColor; foreach (TileEV tileEV in tilesToChange) { entitiesDB.ExecuteOnEntity( tileEV.ID, (ref TileEV tileToChange) => { tileToChange.Highlight.IsHighlighted = isClicked; if (doesPieceBelongToTurnPlayer) { tileToChange.Tile.PieceRefEntityId = isClicked ? (int?)pieceIdtoken : null; } if (isClicked) { tileToChange.Highlight.CurrentColorStates.Add(newHighlightState); } else { tileToChange.Highlight.CurrentColorStates.Remove(newHighlightState); } }); tileEV.ChangeColorTrigger.PlayChangeColor = true; } }
public override async Task <ShortcodeResult> ExecuteAsync(KeyValuePair <string, string>[] args, string content, IDocument document, IExecutionContext context) { var props = args.ToDictionary(Solution, Project, Symbol, BodyOnly); var symbolName = props.GetString(Symbol); var bodyOnly = props.Get <bool?>(BodyOnly) ?? symbolName.StartsWith("m:", StringComparison.InvariantCultureIgnoreCase); if (!context.TryGetCommentIdDocument(symbolName, out var apiDocument, out _)) { return(string.Empty); } var options = HighlightService.HighlightOption.All; if (bodyOnly) { options = HighlightService.HighlightOption.Body; } var comp = apiDocument.Get <Compilation>(CodeAnalysisKeys.Compilation); var symbol = apiDocument.Get <ISymbol>(CodeAnalysisKeys.Symbol); var highlightElement = await HighlightService.Highlight(comp, symbol, options); ShortcodeResult shortcodeResult = $"<pre><code>{highlightElement}</code></pre>"; return(shortcodeResult); }
private void SetHighlighted(bool highlighted) { if (_highlighted == highlighted) { return; } _highlighted = highlighted; if (highlighted) { HighlightService.Params args = HighlightService.Params.Default; args.Duration = HighlightService.Duration.UntilManuallyStopped; args.FlickerSpeed = HighlightService.FlickerSpeed.Slow; args.Intensity = HighlightService.Intensity.Normal; args.AnimStart = HighlightService.AnimStart.MidHighlight; HighlightService.HighlightSprite(_spriteRenderer, args); } else { HighlightService.StopHighlight(_spriteRenderer); } }
public void StopOveringOnDisplay() { if (_spriteRenderer) { HighlightService.StopHighlight(_spriteRenderer); } }
private void Update() { _hoveredEntity.Set(FindHoveredEntity()); if (Input.GetMouseButtonDown(0) && _hoveredEntity.Get() != null) { _selectedEntity = _hoveredEntity.Get().SimEntity; _hoveredEntity.Set(null); } // update higlight if (_hoveredEntity.ClearDirty()) { if (_hoveredEntity.GetPrevious()) { var sprRenderer = _hoveredEntity.GetPrevious().GetComponentInChildren <SpriteRenderer>(); if (sprRenderer) { HighlightService.StopHighlight(sprRenderer); } } if (_hoveredEntity.Get()) { var sprRenderer = _hoveredEntity.Get().GetComponentInChildren <SpriteRenderer>(); if (sprRenderer) { HighlightService.HighlightSprite(sprRenderer, _highlightSettings); } } } UpdateRangeFeedback(); }
public void DeHighlightOtherTeamTilePieces(List <PieceEV> alteredPieces, PlayerColor pieceTeam, IEntitiesDB entitiesDB) { HighlightState highlightStateToRemove = HighlightService.CalcClickHighlightState(pieceTeam); // TODO Remove team highlights based on Team Color, not piece ref id List <TileEV> tiles = tileService.FindAllTileEVs(entitiesDB) .Where(tile => tile.Highlight.IsHighlighted && tile.Highlight.CurrentColorStates.Contains(highlightStateToRemove) ).ToList(); foreach (TileEV tile in tiles) { entitiesDB.ExecuteOnEntity( tile.ID, (ref TileEV tileToChange) => { tileToChange.Highlight.CurrentColorStates.Remove(highlightStateToRemove); tileToChange.Tile.PieceRefEntityId = null; if (!tileToChange.Highlight.CurrentColorStates.Any()) { tileToChange.Highlight.IsHighlighted = false; } }); tile.ChangeColorTrigger.PlayChangeColor = true; } }
public TextEditorViewModel() { DialogService = new DialogService("All files|*.*|Text|*.txt|Java|*.java|C#|*.cs"); FileService = new FileService(Encoding.UTF8); ThemesService = new ThemesService(BasicThemes.AllBasicThemes); HighlightService = new HighlightService(BasicWordsToHighlight.CsWords); RawTextLines = new List <string>(new[] { "" }); }
private void FindAndHighlightTeamTiles(PlayerColor teamColor, TileEV[] tiles, bool excludeCheckViolations) { PieceEV[] teamPieces = pieceFindService.FindPiecesByTeam(teamColor, entitiesDB); HashSet <Vector2> destinationLocations = destinationTileService.CalcDestinationTileLocations(teamPieces, excludeCheckViolations, entitiesDB); HighlightTiles(tiles, destinationLocations, HighlightService.CalcRangeHighlightState(teamColor)); }
protected override void OnEndSurvey(bool wasCompleted) { var sprRenderer = _hoveredEntity.Get()?.GetComponentInChildren <SpriteRenderer>(); if (sprRenderer) { HighlightService.StopHighlight(sprRenderer); } CursorOverlayService.Instance.ResetCursorToDefault(); _selectedEntity = null; }
public void StartOveringOnDisplay() { if (_spriteRenderer) { var highlightParams = HighlightService.Params.Default; highlightParams.Color = _overingHighlightColor; highlightParams.FlickerSpeed = HighlightService.FlickerSpeed.Fast; highlightParams.Intensity = HighlightService.Intensity.High; HighlightService.HighlightSprite(_spriteRenderer, highlightParams); } }
public BotService() { DiscordSocketConfig config = new DiscordSocketConfig { MessageCacheSize = 512 }; Client = new DiscordSocketClient(config); StartTime = DateTime.UtcNow; Settings = null; // Bot services Accounts = null; Chat = new ChatService(this); Scp = new ScpService(this); Dad = new DadService(this); Highlights = new HighlightService(this); }
public void HighlightHandPiece(ref HandPieceEV handPiece, bool isClicked, IEntitiesDB entitiesDB) { HighlightState colorToChange = HighlightService.CalcClickHighlightState(handPiece.PlayerOwner.PlayerColor); entitiesDB.ExecuteOnEntity( handPiece.ID, (ref HandPieceEV handPieceToChange) => { handPieceToChange.Highlight.IsHighlighted = isClicked; if (isClicked) { handPieceToChange.Highlight.CurrentColorStates.Add(colorToChange); } else { handPieceToChange.Highlight.CurrentColorStates.Clear(); } }); handPiece.ChangeColorTrigger.PlayChangeColor = true; }
public override void OnPostSimulationTick() { base.OnPostSimulationTick(); // On player's new turn if (Cache.DEPRECATED_IsNewTurn && Cache.DEPRECATED_CanLocalPlayerPlay) { // Find local pawn's doodle if (Cache.LocalPawn != Entity.Null && BindedSimEntityManaged.InstancesMap.TryGetValue(Cache.LocalPawn, out GameObject localPawnViewGO)) { if (localPawnViewGO.TryGetComponent(out DoodleDisplay doodleDisplay)) { var highlightParams = HighlightService.Params.Default; highlightParams.Color = _newTurnHighlightColor; highlightParams.FlickerSpeed = HighlightService.FlickerSpeed.Fast; highlightParams.Intensity = HighlightService.Intensity.High; HighlightService.HighlightSprite(doodleDisplay.SpriteRenderer, highlightParams); } } } }
public void Step(ref PressStepState token, int condition) { PieceEV piece = pieceFindService.FindPieceEV(token.PieceEntityId, entitiesDB); bool isClicked = token.PiecePressState == PiecePressState.CLICKED; HighlightState colorToChange = HighlightService.CalcClickHighlightState(piece.PlayerOwner.PlayerColor); entitiesDB.ExecuteOnEntity( piece.ID, (ref PieceEV pieceToChange) => { pieceToChange.Highlight.IsHighlighted = isClicked; if (isClicked) { pieceToChange.Highlight.CurrentColorStates.Add(colorToChange); } else { pieceToChange.Highlight.CurrentColorStates.Remove(colorToChange); } }); piece.ChangeColorTrigger.PlayChangeColor = true; }