// Use this for initialization private void Start() { originalPosition = transform.position; parent = transform.parent.gameObject; highlightParent = GetComponentInParent<Highlight>(); source = GetComponentInParent<AudioSource>(); }
void Start() { if (MousePick.instance != null) { MousePick.instance.AddReceiver(this); } if (this.ParentObject == null) this.ParentObject = transform.parent.GetComponent<SmartObject>(); this.highlight = this.ParentObject.GetComponent<Highlight>(); }
/// <summary> /// A text formatting. /// </summary> public Formatting() { capsStyle = CapsStyle.none; strikethrough = StrikeThrough.none; script = Script.none; highlight = Highlight.none; underlineStyle = UnderlineStyle.none; misc = Misc.none; rPr = new XElement(XName.Get("rPr", DocX.w.NamespaceName)); }
/// <summary> /// A text formatting. /// </summary> public Formatting() { capsStyle = CapsStyle.none; strikethrough = StrikeThrough.none; script = Script.none; highlight = Highlight.none; underlineStyle = UnderlineStyle.none; misc = Misc.none; // Use current culture by default language = CultureInfo.CurrentCulture; rPr = new XElement(XName.Get("rPr", DocX.w.NamespaceName)); }
public MenuScreen( CubeGame game ) : base(game) { verString = "v1.0"; currentHighlight = Highlight.NewGame; cSelected = new Color(0, 240, 255, 255); isFading = true; cNewGame = Color.White; cLoadGame = Color.White; //cLevelEdit = Color.White; cControls = Color.White; cExit = Color.White; resetTime = 0.5f; }
public PauseScreen( CubeGame game ) : base(game) { currentHighlight = Highlight.ResumeGame; cSelected = new Color(0, 240, 255, 255); isFading = true; cResumeGame = Color.White; //cSaveGame = Color.White; cControls = Color.White; cQuit = Color.White; bg = new Rectangle(game.GraphicsDevice.Viewport.Width / 4, game.GraphicsDevice.Viewport.Height / 4, game.GraphicsDevice.Viewport.Width / 2, game.GraphicsDevice.Viewport.Height / 2); bStart = new Vector2(game.GraphicsDevice.Viewport.Width / 2 - sResumeGame.Width / 2, 150); }
void OnLoad() { highlightedWords.Clear(); if (!File.Exists(filePath)) { Console.WriteLine("[ChatHighlighter] " + filePath + " not found. Creating new."); OnSave(); } DirectoryInfo di = new DirectoryInfo(filePath); try { using (TextReader tr = new StreamReader(di.FullName, Encoding.UTF8)) { string line = tr.ReadLine(); char[] separator = new char[1]; separator[0] = ';'; while (!string.IsNullOrEmpty(line)) { string[] highlight = line.Split(separator); if (!string.IsNullOrEmpty(highlight[0]) && !string.IsNullOrEmpty(highlight[1])) { Highlight h = new Highlight(highlight[0], highlight[1]); highlightedWords.Add(h); } else { Console.WriteLine("[ChatHighlighter] ERROR: Invalid entry in ChatHighlights.txt detected."); } line = tr.ReadLine(); } } } catch (Exception ex) { Console.WriteLine("[ChatHighlighter] ERROR: " + ex.Message); } }
public static Annotation TemporaryAnnotation(this Highlight highlight) { PreviewControl previewControl = PreviewMethods.GetPreviewControl(); if (previewControl == null) { return(null); } PdfViewControl pdfViewControl = previewControl.GetPdfViewControl(); if (pdfViewControl == null) { return(null); } Document document = pdfViewControl.Document; if (document == null) { return(null); } Location location = previewControl.ActiveLocation; if (location == null) { return(null); } Annotation temporaryAnnotation = new Annotation(location); temporaryAnnotation.Quads = highlight.AsAnnotationQuads().TemporaryQuads(); temporaryAnnotation.OriginalColor = System.Drawing.Color.FromArgb(255, 255, 255, 0); temporaryAnnotation.Visible = true; return(temporaryAnnotation); }
public async Task <IActionResult> UpdateHighlight(int highlightId, [FromBody] HighlightResource highlightResource) { Highlight highlight = await highlightService.FindAsync(highlightId); if (highlight == null) { ProblemDetails problem = new ProblemDetails { Title = "Failed getting the highlight.", Detail = "The database does not contain a highlight with that id.", Instance = "795CDB7E-DB46-4A24-8F12-7557BDD79D15" }; return(NotFound(problem)); } mapper.Map(highlightResource, highlight); highlightService.Update(highlight); highlightService.Save(); return(Ok(mapper.Map <Highlight, HighlightResourceResult>(highlight))); }
protected override void GetClassificationSpans(List <ClassificationSpan> result, SnapshotSpan span, Options options) { if (this.CacheHighlights(options)) { foreach (ITextSnapshotLine line in GetSpanLines(span)) { string text = line.GetText(); if (!string.IsNullOrEmpty(text)) { Highlight highlight = this.highlights.FirstOrDefault(h => h.Pattern.IsMatch(text)); if (highlight != null) { // If the matched highlight type is None, then we'll get a null classificationType and not classify this line. IClassificationType classificationType; if (Classifications.TryGetValue(highlight.HighlightType, out classificationType) && classificationType != null) { result.Add(new ClassificationSpan(line.Extent, classificationType)); } } } } } }
public void CreateValidOptionalParamsTests( ResourceId resourceId, Alias alias, Label label, Caption caption, Search search, Match match, Web web, Highlight highlight, Require require, SelectionDefault selectionDefault, OptionCount optionCount) { // Get option alias var optionAlias = GetOptionsAlias()[new Random().Next(GetOptionsAlias().Count)]; // Generate properties var properties = GenerateProperties(Commons.FieldTypeAPI, label, optionCount, optionAlias, caption, search, match, web, highlight, require, selectionDefault); // Generate request var request = GenerateRequest(Parameters.Create, GenerateCreateInfos(resourceId, properties, alias)); // Execute test ExecuteCreateTest(request.ToJson()); }
private AutomationElement TopWindowLocator(UIACondition selfCondition, AutomationElementCollection matchedElements) { int matchIndex = 0; foreach (AutomationElement element in matchedElements) { string caption = element.Current.Name; if (Utility.StringSimiliarityCompare(selfCondition.Text, caption, 50)) { if (selfCondition.Index == matchIndex) { Highlight.HighlightThread(element); selfCondition.AutomationElement = element; return selfCondition.AutomationElement; } else { matchIndex++; } } } return null; }
public void CanHighlightHtml() { const string input = @" <html> <head> <title>Foobar</title> </head> <body> <h1>Title</h1> <p>This is some Foobar text</p> <pre><code class=""language-html""> <html> <head> <title>Hi Mom!</title> </head> <body> <p>Hello, world! Pretty me up! </body> </html> </code></pre> </body> </html>"; IDocument document = new TestDocument(input); IExecutionContext context = new TestExecutionContext() { JsEngineFunc = () => new TestJsEngine() }; Highlight highlight = new Highlight(); // When List <IDocument> results = highlight.Execute(new[] { document }, context).ToList(); // Then Assert.IsTrue(results[0].Content.Contains("language-html hljs")); }
public static Highlight TryCreate(OutputHighlight highlight, IContentType contentType) { Highlight result = null; // We shouldn't encounter an empty pattern, but we'll check for it anyway // since we can't really highlight empty lines. if (!string.IsNullOrEmpty(highlight.Pattern)) { // We don't need to validate against OutputClassifierProvider.GetOutputContentTypes() here. // The OutputHighlight class already tries to do that. Here we're passed a known valid type, // and we just need to see if it's in the OutputHighlight's pre-verified list. if (highlight.ContentTypes.Any(ct => Utilities.IsContentOfType(contentType, ct))) { Regex pattern = new Regex(highlight.Pattern, highlight.MatchCase ? RegexOptions.None : RegexOptions.IgnoreCase); result = new Highlight() { HighlightType = highlight.Highlight, Pattern = pattern }; } } return(result); }
public static List <Tile> FindPath(Tile startingTile, Tile endingTile, List <Tile> enemyLocation) { List <TilePath> closed = new List <TilePath>(); List <TilePath> open = new List <TilePath>(); TilePath originPath = new TilePath(); originPath.addFirstTile(startingTile); open.Add(originPath); while (open.Count > 0) { TilePath current = open[0]; open.Remove(open[0]); if (closed.Select(x => x.lastTile).ToList().Contains(current.lastTile)) { if (current.pathCost >= closed.Where(x => x.lastTile == current.lastTile).First().pathCost) { continue; } else { closed.Remove(closed.Where(x => x.lastTile == current.lastTile).First()); } } if (current.lastTile == endingTile) { //current.listOfTiles.Remove (startingTile); return(current.listOfTiles); } closed.Add(current); Highlight.AllExpand(current, enemyLocation, open); } return(null); }
/// <summary> /// Returns html SyntaxHighlighter expects to understand. /// </summary> /// <remarks> /// Config params are based on <see cref="http://alexgorbatchev.com/SyntaxHighlighter/manual/configuration/"/> /// and <see cref="https://en.support.wordpress.com/code/posting-source-code/"/>. Only part of all params I /// think useful are supported here. /// </remarks> public override string Process() { if (Content.IsNullOrEmpty()) { return(""); } string brush = GetBrush(); string firstline = Firstline.IsNullOrEmpty() ? "" : $"; first-line: {Firstline}"; string gutter = Gutter.IsNullOrEmpty() ? "" : $"; gutter: {Gutter}"; string highlight = Highlight.IsNullOrEmpty() ? "" : $"; highlight: [{Highlight}]"; string htmlscript = Htmlscript.IsNullOrEmpty() ? "" : $"; html-script: {Htmlscript}"; // massage the code to make syntaxhighlighter happy, olw mixes in p, br and /n StringBuilder sb = new StringBuilder(Content); Content = sb.Replace("<p>", "") .Replace("</p>", "") .Replace("<br>", "\n") .Replace("\n\n", "\n") .ToString(); return($"<pre class=\"{brush}{firstline}{gutter}{highlight}{htmlscript}\">{Content}</pre>"); }
/// <summary> /// When hovering over an object or item its name and description is shown as a tooltip on the bottom-left of the screen. /// The first letter of the object's name is always capitalized if the object has been given a name. /// If there is description it is shown in parentheses. /// </summary> public void OnHoverStart() { Highlight.HighlightThis(gameObject); string displayName = null; if (string.IsNullOrWhiteSpace(articleName)) { displayName = gameObject.ExpensiveName(); } else { displayName = articleName; } //failsafe if (string.IsNullOrWhiteSpace(displayName)) { displayName = "error"; } UIManager.SetToolTip = displayName.First().ToString().ToUpper() + displayName.Substring(1) + (string.IsNullOrEmpty(articleDescription) ? "" : $" ({ articleDescription })"); }
public virtual void GetPreviousHighlight(TimeSpan?currentTimeSpan, ref MediaFile currentMediaFile, out Highlight currentHighlight) { if (currentTimeSpan == null) { currentTimeSpan = new TimeSpan(); } currentHighlight = null; if (currentMediaFile == null) { return; } currentHighlight = currentMediaFile.Highlights.OrderByBegin().LastOrDefault(h => h.Begin < currentTimeSpan); if (currentHighlight != null) { return; } if (!HaveMediaWithHighlights()) { return; } foreach (MediaFile media in GetMediasBefore(currentMediaFile)) { if (!media.Highlights.Any()) { continue; } currentMediaFile = media; currentHighlight = currentMediaFile.Highlights.OrderByEnd().LastOrDefault(); break; } }
public Caret(IUIStyle style, TView textInformation) : base(style) { if (textInformation == null) { throw new ArgumentNullException(nameof(textInformation)); } styleDefinition = StyleSystem.StylesFor <TextStyleDefinition>(); TextInformation = textInformation; TextInformation.Document.DocumentModified += UpdatePositions; startPosition = null; endPosition = TextInformation.Document.CreatePosition(0, Bias.Backward); selectionHighlight = new Highlight <TDocument>(startPosition, endPosition, Style); textInformation.Highlighter.AddHighlight(selectionHighlight); blinkAnimation = new StepValue(0, 1) { Duration = 1, Loop = AnimationLoop.Loop }; Style.ValueChanged += OnStyleChanged; }
private void Awake() { _highlightComponent = GetComponent <Highlight>(); _renderer = GetComponent <Renderer>(); }
/// <summary> /// Processes any relevant find syntax (eg. $1 style groupings in regex). /// </summary> /// <returns>Modified <c>replace</c> string (eg. with group substitutions in regular expressions)</returns> public virtual string ProcessReplacementSyntax(string replace, Highlight match) { return replace; }
/// <summary> /// Moves the underline due to user operations (typing) /// </summary> protected virtual void MoveHighlight(Highlight u, int start, int end) { // u.Start = start; // u.End = end; u.MoveTo(start, end); }
/// <summary> /// Removes an existing underline /// </summary> public virtual void RemoveHighlight(Highlight h) { RemoveAdorner(h.BodyAdorner); if (CurrentMatch != null && h.IsBeforeOrAt(CurrentMatch)) iteratingHighlightPtr--;//we have to move the iteratorPTR back since a highlight before it was deleted //if startHighlightIndex is after where highlight is, then it must be decremented //eg highlight indexes:0 1 2 3 //startHighlightIndex=2 //remove highlight #1, means startHighlightIndex=>2-1=1 //but if remove highlight #3, startHighlightIndex doesnt change if(startHighlightIndex>=highlights.Count || h.IsBeforeOrAt(highlights[startHighlightIndex])) startHighlightIndex--; highlights.Remove(h); if(scrollBarHighlightHandler!=null)scrollBarHighlightHandler.Remove(h.ScrollBarAdorner); }
/*--------------------------------------------------------------------------------------------*/ private Highlight CalculateHighlight(IHoverCursorData pCursor) { var high = new Highlight(); high.Cursor = pCursor; if ( !Application.isPlaying ) { return high; } Vector3 useCursorPos = pCursor.WorldPosition; if ( pCursor.IsRaycast ) { var worldRay = new Ray(pCursor.WorldPosition, pCursor.WorldRotation*pCursor.RaycastLocalDirection); RaycastResult raycast; high.NearestWorldPos = ProximityProvider.GetNearestWorldPosition(worldRay, out raycast); high.RaycastResult = raycast; useCursorPos = raycast.WorldPosition; Debug.DrawLine(worldRay.origin, useCursorPos, Color.cyan); } else { high.NearestWorldPos = ProximityProvider.GetNearestWorldPosition(pCursor.WorldPosition); high.RaycastResult = null; } high.Distance = (useCursorPos-high.NearestWorldPos).magnitude; high.Progress = Mathf.InverseLerp(InteractionSettings.HighlightDistanceMax, InteractionSettings.HighlightDistanceMin, high.Distance); return high; }
internal bool Handles(Highlight match) { for (int i = 0; i < highlights.Count; i++) { if (highlights[i] == match) return true; } return false; }
/// <summary> /// Registers a Highlight /// </summary> protected virtual bool RegisterHighlight(Highlight highlight){ #if DEBUG if (Keyoti.RapidFindReplace.WPF.RapidFindReplaceControlViewModel.simulateSlow) System.Threading.Thread.Sleep(80); #endif if (!IsRegistered(highlight)) { highlights.Add(highlight); if(highlight.BodyAdorner!=null)highlight.BodyAdorner.RenderImpossible += adorner_RenderImpossible; highlight.RunTextShift += highlight_RunTextShift; if (AdornerLayer != null) AdornerLayer.Add(highlight.BodyAdorner); if(scrollBarHighlightHandler!=null)scrollBarHighlightHandler.AttachTo(highlight); return true; } else return false; }
internal void AttachTo(Highlight highlight) { highlight.ScrollBarAdorner = CreateScrollBarHighlightAdorner(highlight.BodyAdorner); Add(highlight.ScrollBarAdorner); }
/// <summary> /// Add log record to DataBase (LOGLIST LIST) /// </summary> /// <param name="logMessage"></param> /// <param name="LogLevel"></param> /// <param name="ColorHoghlight"></param> public static void AddLog(string logMessage, LogLevel LogLevel = LogLevel.Critical, Highlight ColorHighlight = Highlight.Normal, string logProcedure = "") { //Add to list LogRecord LogRec = new LogRecord(); LogRec.Time = DateTime.Now; LogRec.Procedure = logProcedure; LogRec.Message = logMessage; LogRec.LogLevel = LogLevel; LogRec.Highlight = ColorHighlight; LOGLIST.Add(LogRec); }
/// <summary> /// For use with Append() and AppendLine() /// </summary> ///<param name="highlight">The highlight to apply to the last appended text.</param> /// <returns>This Paragraph with the last appended text highlighted.</returns> /// <example> /// Append text to this Paragraph and then highlight it. /// <code> /// // Create a document. /// using (DocX document = DocX.Create(@"Test.docx")) /// { /// // Insert a new Paragraph. /// Paragraph p = document.InsertParagraph(); /// /// p.Append("I am ") /// .Append("highlighted").Highlight(Highlight.green) /// .Append(" I am not"); /// /// // Save this document. /// document.Save(); /// }// Release this document from memory. /// </code> /// </example> public Paragraph Highlight(Highlight highlight) { switch (highlight) { case Novacode.Highlight.none: break; default: { ApplyTextFormattingProperty(XName.Get("highlight", DocX.w.NamespaceName), string.Empty, new XAttribute(XName.Get("val", DocX.w.NamespaceName), highlight.ToString())); break; } } return this; }
public override void Update( GameTime gameTime ) { base.Update( gameTime ); // Fade effect for highlighted menu button if (isFading) { cSelected.A -= 3; if (cSelected.A == 0) isFading = false; } else { cSelected.A += 3; if (cSelected.A == 255) isFading = true; } GamePadState NewPadState = GamePad.GetState(PlayerIndex.One); KeyboardState NewKeyState = Keyboard.GetState(); // Change highlighted button for "up" if ((NewKeyState.IsKeyDown(Keys.Up) && OldKeyState.IsKeyUp(Keys.Up)) || (NewPadState.IsButtonDown(Buttons.DPadUp) && OldPadState.IsButtonUp(Buttons.DPadUp))) { sfxButtonPressed.Play(); switch (currentHighlight) { case Highlight.ResumeGame: break; //case Highlight.SaveGame: // currentHighlight = Highlight.ResumeGame; // break; case Highlight.Controls: //currentHighlight = Highlight.SaveGame; currentHighlight = Highlight.ResumeGame; break; case Highlight.QuitToMenu: currentHighlight = Highlight.Controls; break; default: break; } } // Change highlighted button for "down" if ((NewKeyState.IsKeyDown(Keys.Down) && OldKeyState.IsKeyUp(Keys.Down)) || (NewPadState.IsButtonDown(Buttons.DPadDown) && OldPadState.IsButtonUp(Buttons.DPadDown))) { sfxButtonPressed.Play(); switch (currentHighlight) { case Highlight.ResumeGame: //currentHighlight = Highlight.SaveGame; currentHighlight = Highlight.Controls; break; //case Highlight.SaveGame: // currentHighlight = Highlight.Controls; // break; case Highlight.Controls: currentHighlight = Highlight.QuitToMenu; break; case Highlight.QuitToMenu: break; default: break; } } if ((NewKeyState.IsKeyDown(Keys.Enter) && OldKeyState.IsKeyUp(Keys.Enter)) || (NewPadState.IsButtonDown(Buttons.A) && OldPadState.IsButtonUp(Buttons.A))) { sfxButtonPressed2.Play(); switch (currentHighlight) { case Highlight.ResumeGame: Back(); break; case Highlight.SaveGame: break; case Highlight.Controls: ScreenManager.PushScreen( new ControlsScreen( Game ) ); break; case Highlight.QuitToMenu: ScreenManager.PauseMenuToMainMenu(2); break; default: break; } } if ((NewKeyState.IsKeyDown(Keys.Escape) && OldKeyState.IsKeyUp(Keys.Escape))) Back(); OldPadState = NewPadState; OldKeyState = NewKeyState; }
public override void Update( GameTime gameTime ) { base.Update( gameTime ); resetTime -= (float)gameTime.ElapsedGameTime.TotalSeconds; // Fade effect for highlighed menu button if (isFading) { cSelected.A -= 3; if (cSelected.A == 0) isFading = false; } else { cSelected.A += 3; if (cSelected.A == 255) isFading = true; } GamePadState NewPadState = GamePad.GetState(PlayerIndex.One); KeyboardState NewKeyState = Keyboard.GetState(); if (resetTime < 0) { // Change highlighted button on "up" if ((NewKeyState.IsKeyDown(Keys.Up) && OldKeyState.IsKeyUp(Keys.Up)) || (NewPadState.IsButtonDown(Buttons.DPadUp) && OldPadState.IsButtonUp(Buttons.DPadUp))) { sfxButtonPressed.Play(); switch (currentHighlight) { case Highlight.NewGame: break; case Highlight.LoadGame: currentHighlight = Highlight.NewGame; break; //case Highlight.LevelEditor: // currentHighlight = Highlight.LoadGame; // break; case Highlight.Controls: //currentHighlight = Highlight.LevelEditor; currentHighlight = Highlight.NewGame; break; case Highlight.Exit: //currentHighlight = Highlight.Controls; currentHighlight = Highlight.Controls; break; default: break; } } // Level editor is not accessible by normal means: // L + E on keyboard, or left and right bumper on the gamepad if ((NewKeyState.IsKeyDown(Keys.L) && NewKeyState.IsKeyDown(Keys.E)) || (NewPadState.IsButtonDown(Buttons.LeftShoulder) && NewPadState.IsButtonDown(Buttons.RightShoulder))) { ScreenManager.PushScreen(new EditScreen(Game)); } // Change highlighted button on "down" if ((NewKeyState.IsKeyDown(Keys.Down) && OldKeyState.IsKeyUp(Keys.Down)) || (NewPadState.IsButtonDown(Buttons.DPadDown) && OldPadState.IsButtonUp(Buttons.DPadDown))) { sfxButtonPressed.Play(); switch (currentHighlight) { case Highlight.NewGame: //currentHighlight = Highlight.LoadGame; currentHighlight = Highlight.Controls; break; case Highlight.LoadGame: //currentHighlight = Highlight.LevelEditor; currentHighlight = Highlight.Controls; break; //case Highlight.LevelEditor: // currentHighlight = Highlight.Controls; // break; case Highlight.Controls: currentHighlight = Highlight.Exit; break; case Highlight.Exit: break; default: break; } } if ((NewKeyState.IsKeyDown(Keys.Enter) && OldKeyState.IsKeyUp(Keys.Enter)) || (NewPadState.IsButtonDown(Buttons.A) && OldPadState.IsButtonUp(Buttons.A))) { sfxButtonPressed2.Play(); switch (currentHighlight) { case Highlight.NewGame: PlayableCube playCube = new PlayableCube(Game); playCube.Load("_level0"); //playCube.Load( "enemy" ); PlayScreen playScreen = new PlayScreen(Game, playCube); ScreenManager.PushScreen(playScreen); break; case Highlight.LoadGame: Stream saveStream = StorageManager.Instance.OpenWriteFile("CyberCube.sav"); // Saving functionality here. Stream loadStream = StorageManager.Instance.OpenReadFile("CyberCube.sav"); // Loading functionality here. StorageManager.Instance.Finish(); break; //case Highlight.LevelEditor: // ScreenManager.PushScreen(new EditScreen(Game)); // break; case Highlight.Controls: ScreenManager.PushScreen( new ControlsScreen( Game ) ); break; case Highlight.Exit: Game.Exit(); break; default: break; } } } OldPadState = NewPadState; OldKeyState = NewKeyState; }
/// <summary> /// Uses any enabled text matchers to process any relevant find syntax (eg. \1 style groupings in regex). /// </summary> public virtual string ProcessReplacementSyntax(string replacement, Highlight match) { string newReplace = replacement; foreach (ITextMatcher matcher in textMatchers) { newReplace = matcher.ProcessReplacementSyntax(newReplace, match); } return newReplace; }
// Use this for initialization void Start() { controller = Grid.controller; shade = Instantiate(Grid.prefabLoader.highlight,new Vector3(x,y,0),Quaternion.identity) as Highlight; shade.transform.parent = transform; highlight (Highlight.CLEAR); makeFog(); }
/// <summary> /// Determines whether a Highlight is registered. /// </summary> protected virtual bool IsRegistered(Highlight highlight){ highlights.Sort(highlightComparer); return highlights.BinarySearch(highlight, highlightComparer)>-1; }
private void SetHighlight(Highlight hl) { var rends = GetComponentsInChildren<Renderer>(); foreach(var rend in rends) { foreach(var mat in rend.materials) { // Remove old color switch(mHighlight) { case Highlight.Hover: mat.color -= new Color(0.7f, 0.7f, 0.7f); break; case Highlight.Select: mat.color -= new Color(0.0f, 0.7f, 0.7f); break; case Highlight.Collision: mat.color -= new Color(0.7f, 0.0f, 0.0f); break; } // Add new color switch(hl) { case Highlight.Hover: mat.color += new Color(0.7f, 0.7f, 0.7f); break; case Highlight.Select: mat.color += new Color(0.0f, 0.7f, 0.7f); break; case Highlight.Collision: mat.color += new Color(0.7f, 0.0f, 0.0f); break; } } } mHighlight = hl; }
/*--------------------------------------------------------------------------------------------*/ private Highlight CalculateHighlight(IHoverCursorData pCursor) { var high = new Highlight(); high.Cursor = pCursor; if ( !Application.isPlaying ) { return high; } high.NearestWorldPos = ProximityProvider.GetNearestWorldPosition(pCursor.WorldPosition); high.Distance = (pCursor.WorldPosition-high.NearestWorldPos).magnitude; high.Progress = Mathf.InverseLerp(InteractionSettings.HighlightDistanceMax, InteractionSettings.HighlightDistanceMin, high.Distance); return high; }
public void OnHoverEnd() { Highlight.DeHighlight(); UIManager.SetToolTip = string.Empty; }
void Awake() { highlight = GameObject.FindWithTag("Highlight").GetComponent<Highlight>(); mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraControls>(); gameInstance = this; gui = new UI(); gui.Initialize(); buildables = GetComponent<BuildableRegistry>(); //must be before state, because state references this in initialization state = new PlayerState(); }
//call this function whenever saving a modified project file, saves everything within public static Boolean updateProject(Project project) { int updatedReadings = 0; int updatedWritings = 0; foreach (Reading r in project.readings) { if (r.deleted) { deleteReading(r); } else if (r.readingId <= 0) //if true, reading is new { Reading tempReading = createReading(r.projectId, r.title, "", r.text, "", new DateTime(r.dateYear, getMonthNum(r.dateMonth), r.dateDay), r.publisherName, r.city, r.yearPublished); r.readingId = tempReading.readingId; } else if (r.modified) { updateReading(r.readingId, r.title, r.text, "", new DateTime(r.dateYear, getMonthNum(r.dateMonth), r.dateDay), r.publisherName, "", r.yearPublished); updatedReadings++; } //Authors deleteAuthors(r.readingId); foreach (Author author in r.authors) { Author tempAuthor = createAuthor(r.readingId, author.first, author.middle, author.last); author.authorId = tempAuthor.authorId; } //ReadingTags deleteReadingTagLinks(r.readingId); foreach (ReadingTag tag in r.readingTags) { ReadingTag tempRTag = createReadingTag(r.readingId, tag.tag); tag.tagId = tempRTag.tagId; } //Highlights and HighlightTags foreach (Highlight highlight in r.highlights) { deleteHighlightTagLinks(highlight.highlightId); } deleteHighlights(r.readingId); foreach (Highlight highlight in r.highlights) { Highlight tempHighlight = createHighlight(r.readingId, highlight.isQuote, highlight.charNum, highlight.charCount); foreach (HighlightTag tag in highlight.highlightTags) { HighlightTag tempHTag = createHighlightTag(tempHighlight.highlightId, tag.tag); tag.tagId = tempHTag.tagId; } highlight.highlightId = tempHighlight.highlightId; } r.modified = false; } for (int i = project.readings.Count - 1; i >= 0; i--) //loop through backwards and delete as encountered { if (project.readings.ElementAt(i).modified) { project.readings.RemoveAt(i); } } foreach (Writing w in project.writings) { if (w.deleted) { deleteWriting(w); } else if (w.writingId <= 0) { Writing tempWriting = createWriting(w.projectId, w.text); w.writingId = tempWriting.writingId; } else if (w.modified) { updateWriting(w); updatedWritings++; } w.modified = false; } for (int i = project.writings.Count - 1; i >= 0; i--) { if (project.writings.ElementAt(i).modified) { project.writings.RemoveAt(i); } } String message = ""; if (updatedReadings == 0 && updatedWritings != 0) { message = updatedWritings + " Writings Updated."; } else if (updatedWritings == 0 && updatedReadings != 0) { message = updatedReadings + " Readings Updated."; } else if (updatedWritings != 0 && updatedReadings != 0) { message = updatedReadings + " Readings Updated and " + updatedWritings + " Writings Updated."; } if (updatedWritings != 0 || updatedReadings != 0) { PopupForm popup = new PopupForm(message); popup.Show(); } return(true); }
/// <summary> /// Processes any relevant find syntax (eg. $1 style groupings in regex). /// </summary> /// <returns>Modified <c>replace</c> string (eg. with group substitutions in regular expressions)</returns> public override string ProcessReplacementSyntax(string replace, Highlight match) { return Regex.Replace(match.Text, queryPattern, replace); }
static JObject Build(Highlight highlight) { var fields = new JObject(); foreach (var field in highlight.Fields) fields.Add(new JProperty(field, new JObject())); var queryStringCriteria = new JObject(new JProperty("fields", fields)); if (!string.IsNullOrWhiteSpace(highlight.PostTag)) queryStringCriteria.Add(new JProperty("post_tags", new JArray(highlight.PostTag))); if (!string.IsNullOrWhiteSpace(highlight.PreTag)) queryStringCriteria.Add(new JProperty("pre_tags", new JArray(highlight.PreTag))); return queryStringCriteria; }
void Awake() { highlight = GameObject.FindWithTag("Highlight").GetComponent<Highlight>(); mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraControls>(); gameInstance = this; gui = new UI(); gui.Initialize(); state = new PlayerState(); }