Example #1
0
        bool HasAny(out bool needsDepth, out bool needsOverlay)
        {
            needsDepth = needsOverlay = false;
            for (int i = 0; i < highlightGroups.Count; i++)
            {
                HighlightGroup group = highlightGroups[i];

                group.Clean();

                if (group.renderers.Count > 0)
                {
                    if (group.sortingType == SortingType.DepthFilter)
                    {
                        needsDepth = true;
                    }
                    else
                    {
                        needsOverlay = true;
                    }
                }

                // if (needsDepth && needsOverlay) return true;
            }
            return(needsDepth || needsOverlay);
        }
 void SetActiveFlags(HighlightGroup g, float active)
 {
     // Debug.Log("set active " + active);
     HandleChildrenFlags(g, active);
     HandleNoChildrenFlags(g, active);
     HandleSpecialFlags(g, active);
 }
Example #3
0
        void RenderLoop(int stagedLayer, SortingType sortType, bool clear, bool useGroupColor, Color overrideColor)
        {
            if (!useGroupColor)
            {
                Shader.SetGlobalColor(_Color, overrideColor);
            }


            bool clearedCamera = false;

            for (int i = 0; i < highlightGroups.Count; i++)
            {
                HighlightGroup group = highlightGroups[i];
                if (group.sortingType == sortType)
                {
                    TempCam.clearFlags = clearedCamera || !clear ? CameraClearFlags.Nothing : CameraClearFlags.Color;
                    // if (clear) {
                    // }

                    clearedCamera = true;

                    if (useGroupColor)
                    {
                        Shader.SetGlobalColor(_Color, group.highlightColor);
                    }

                    group.Stage(stagedLayer);
                    TempCam.RenderWithShader(DrawSimple, "");
                    group.Unstage();
                }
            }
        }
 void HandleNoChildrenGroup(HighlightGroup g, float val, bool up)
 {
     foreach (GameObject obj in g.objsNoChildren)
     {
         if (obj != null && obj.GetComponent <MeshRenderer>() != null)
         {
             SetHighlightOnMesh(val, obj.GetComponent <MeshRenderer>(), up);
         }
     }
 }
 void HandleNoChildrenFlags(HighlightGroup g, float active)
 {
     foreach (GameObject obj in g.objsNoChildren)
     {
         if (obj != null && obj.GetComponent <MeshRenderer>() != null)
         {
             SetActiveFlagOnMesh(obj.GetComponent <MeshRenderer>(), active);
         }
     }
 }
 void HandleSpecialFlags(HighlightGroup g, float active)
 {
     foreach (SpecificMaterialIndexItem s in g.CustomMatItems)
     {
         if (s.Obj.GetComponent <MeshRenderer>() != null)
         {
             foreach (int i in s.Index)
             {
                 SetActiveFlagOnMaterial(s.Obj.GetComponent <MeshRenderer>().materials[i], active);
             }
         }
     }
 }
 void HandleSpecialGroup(HighlightGroup g, float val, bool up)
 {
     foreach (SpecificMaterialIndexItem s in g.CustomMatItems)
     {
         if (s.Obj.GetComponent <MeshRenderer>() != null)
         {
             foreach (int i in s.Index)
             {
                 SetHighlightOnMaterial(val, s.Obj.GetComponent <MeshRenderer>().materials[i], up);
             }
         }
     }
 }
Example #8
0
 public HighlightGroup GetGroup(string id)
 {
     if (m_Groups.ContainsKey(id))
     {
         return(m_Groups[id]);
     }
     else
     {
         HighlightGroup newGroup = new HighlightGroup(id);
         m_Groups.Add(id, newGroup);
         return(newGroup);
     }
 }
Example #9
0
        public void UnHighlightRenderer(Renderer renderer)
        {
            for (int i = 0; i < highlightGroups.Count; i++)
            {
                HighlightGroup group = highlightGroups[i];
                if (group.renderers.Contains(renderer))
                {
                    group.Remove(renderer);
                }
            }
            bool needsDepth, needsOverlay;
            bool renderingHighlighted = HasAny(out needsDepth, out needsOverlay);

            enabled = renderingHighlighted;
        }
 void HandleChildrenFlags(HighlightGroup g, float active)
 {
     foreach (GameObject obj in g.objsAndChildren)
     {
         if (obj != null)
         {
             if (obj.GetComponent <MeshRenderer>() != null)
             {
                 SetActiveFlagOnMesh(obj.GetComponent <MeshRenderer>(), active);
             }
             foreach (MeshRenderer m in obj.GetComponentsInChildren <MeshRenderer>())
             {
                 SetActiveFlagOnMesh(m, active);
             }
         }
     }
 }
 void HandleChildrenGroup(HighlightGroup g, float val, bool up)
 {
     foreach (GameObject obj in g.objsAndChildren)
     {
         if (obj != null)
         {
             if (obj.GetComponent <MeshRenderer>() != null)
             {
                 SetHighlightOnMesh(val, obj.GetComponent <MeshRenderer>(), up);
             }
             foreach (MeshRenderer m in obj.GetComponentsInChildren <MeshRenderer>())
             {
                 SetHighlightOnMesh(val, m, up);
             }
         }
     }
 }
        private void highlightSelectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string LookFor = string.Empty;

            LookFor = editor.ActiveTextAreaControl.TextArea.SelectionManager.SelectedText;

            // if there's text selected, highlight all!
            if (!_highlightGroups.ContainsKey(editor))
            {
                _highlightGroups[editor] = new HighlightGroup(editor);
            }
            HighlightGroup     group   = _highlightGroups[editor];
            TextEditorSearcher _search = new TextEditorSearcher();

            _search.Document = editor.Document;

            group.ClearMarkers();


            _search.LookFor            = LookFor;
            _search.MatchCase          = true;
            _search.MatchWholeWordOnly = true;

            bool looped = false;
            int  offset = 0, count = 0;

            for (; ;)
            {
                TextRange range = _search.FindNext(offset, false, out looped);
                if (range == null || looped)
                {
                    break;
                }
                offset = range.Offset + range.Length;
                count++;

                var m = new TextMarker(range.Offset, range.Length,
                                       TextMarkerType.SolidBlock, Color.Orange, Color.Black);
                group.AddMarker(m);
            }

            editor.Invalidate();
            editor.Refresh();
        }
Example #13
0
        private void btnSerch_Click(object sender, EventArgs e)
        {
            var _editor = txtSchemaXML;

            if (!_highlightGroups.ContainsKey(_editor))
            {
                _highlightGroups[_editor] = new HighlightGroup(_editor);
            }
            HighlightGroup group = _highlightGroups[_editor];

            group.ClearMarkers();

            TextEditorSearcher _search = new TextEditorSearcher();

            _search.LookFor            = txtLookFor.Text;
            _search.MatchCase          = false;
            _search.MatchWholeWordOnly = false;
            _search.Document           = _editor.Document;

            bool looped = false;
            int  offset = 0, count = 0;

            for (; ;)
            {
                TextRange range = _search.FindNext(offset, false, out looped);
                if (range == null || looped)
                {
                    break;
                }
                offset = range.Offset + range.Length;
                count++;

                TextMarker m = new TextMarker(range.Offset, range.Length, TextMarkerType.SolidBlock, Color.Yellow, Color.Black);
                group.AddMarker(m);
            }
            if (count == 0)
            {
                MessageBox.Show("没有找到你要查找的内容", "提示");
            }

            Folding();
        }
    IEnumerator StartReturnHighlightObjs(HighlightGroup g)
    {
        if (g != null)
        {
            Debug.Log("Return highlights");
            float val = 1;
            while (val > 0)
            {
                HandleChildrenGroup(g, val, false);
                HandleNoChildrenGroup(g, val, false);
                HandleSpecialGroup(g, val, false);

                val -= Time.fixedDeltaTime * SpeedScale * 8;
                yield return(new WaitForSeconds(.01f));
            }
            HandleChildrenGroup(g, 0, false);
            HandleNoChildrenGroup(g, 0, false);
            HandleSpecialGroup(g, 0, false);
        }
    }
    IEnumerator StartHighlightObjs(HighlightGroup g)
    {
        float val = 0;

        while (val < 1)
        {
            HandleChildrenGroup(g, val, true);
            HandleNoChildrenGroup(g, val, true);
            HandleSpecialGroup(g, val, true);
            val += Time.fixedDeltaTime * SpeedScale;
            yield return(new WaitForSeconds(.01f));
        }

        HandleChildrenGroup(g, 1, true);
        HandleNoChildrenGroup(g, 1, true);
        HandleSpecialGroup(g, 1, true);


        //SetActiveFlags(g,0);
    }
 public SaveHighlightOrderResponse SaveHighlight(SaveHighlightOrderRequest request)
 {
     try
     {
         var selectOption = DataContext.SelectOptions.Include(x => x.RoleGroups).First(x => x.Id == request.Id);
         //DataContext.SelectOptions.Attach(selectOption);
         if (request.Order.HasValue)
         {
             selectOption.Order = request.Order.Value;
         }
         if (request.IsActive.HasValue)
         {
             selectOption.IsActive = request.IsActive.Value;
         }
         if (request.GroupId != 0)
         {
             var group = new HighlightGroup {
                 Id = request.GroupId
             };
             DataContext.HighlightGroups.Attach(group);
             selectOption.Group = group;
         }
         if (request.RoleGroupIds.Count() > 0)
         {
             selectOption.RoleGroups = DataContext.RoleGroups.Where(x => request.RoleGroupIds.Contains(x.Id)).ToList();
         }
         DataContext.SaveChanges();
         return(new SaveHighlightOrderResponse
         {
             IsSuccess = true,
             Message = "You have been successfully save highlight order"
         });
     }
     catch (InvalidOperationException e) {
         return(new SaveHighlightOrderResponse
         {
             IsSuccess = false,
             Message = "An error occured, please contact the administrator for further information"
         });
     }
 }
Example #17
0
 public void HighlightRenderer(Renderer renderer, int highlightGroupIndex)
 {
     for (int i = 0; i < highlightGroups.Count; i++)
     {
         HighlightGroup group = highlightGroups[i];
         if (group.renderers.Contains(renderer))
         {
             if (i != highlightGroupIndex)
             {
                 group.Remove(renderer);
             }
         }
         else
         {
             if (i == highlightGroupIndex)
             {
                 group.Add(renderer);
                 enabled = true;
             }
         }
     }
 }
 private void MarkScriptMessages(Dictionary <TextEditorControl, HighlightGroup> highlightGroups, IEnumerable <TextRange> highlightRanges, Color color)
 {
     try
     {
         if (!highlightGroups.ContainsKey(_teScriptResults))
         {
             highlightGroups[_teScriptResults] = new HighlightGroup(_teScriptResults);
         }
         var group = highlightGroups[_teScriptResults];
         foreach (var textRange in highlightRanges)
         {
             var m = new TextMarker(textRange.Offset, textRange.Length,
                                    TextMarkerType.SolidBlock, color, Color.Black);
             @group.AddMarker(m);
         }
         _teScriptResults.Refresh();
     }
     catch (Exception ex)
     {
         _log.Error("Error marking script messages");
         _log.Error(ex.Message, ex);
     }
 }
    public void UpdateData(int cat, int subCat)
    {
        HighlightGroup prevGroup = null;

        StopAllCoroutines();

        if (CurrentlyHighlightedObjs != null)
        {
            prevGroup = CurrentlyHighlightedObjs;
            //StartCoroutine(StartReturnHighlightObjs(prevGroup));
            //StopCoroutine(StartHighlightObjs(prevGroup));
            SetActiveFlags(prevGroup, 0);
            ObjectToUnhighlight.Add(prevGroup);
        }



        HighlightGroup_Group group = Exterior;

        CurrentlyHighlightedObjs = null;

        if (cat == 1)
        {
            group = Exterior;
        }
        else if (cat == 2)
        {
            group = Battery;
        }
        else if (cat == 3)
        {
            group = Motor;
        }
        else if (cat == 4)
        {
            group = Chassis;
        }

        //when on one only have bottoms
        if (cat == 1 && (subCat == 1 || subCat == 4))
        {
            SetSensors(SensorsBottom, true);
        }
        else
        {
            SetSensors(SensorsBottom, false);
        }


        if (cat == 1 && subCat == 4)
        {
            SetSensors(SensorsTop, true);
        }
        else
        {
            SetSensors(SensorsTop, false);
        }

        if (cat != 0 && group.groups.Count >= subCat && subCat != -1)
        {
            CurrentlyHighlightedObjs = group.groups[subCat];
            SetActiveFlags(CurrentlyHighlightedObjs, 1);
            //tag mats that will be used in next highlight
            // unhighlight(knowng which ones not to do cause theyre marke as active within shader)
            // if(prevGroup != null)
            //StartCoroutine(StartReturnHighlightObjs(prevGroup));

            StartCoroutine(StartHighlightObjs(CurrentlyHighlightedObjs));
        }
        else
        {
            if (prevGroup != null)
            {
                SetActiveFlags(prevGroup, 0);
            }
            //if(prevGroup != null)
            //StartCoroutine(StartReturnHighlightObjs(prevGroup));
        }
    }
Example #20
0
        private void btnHighlightAll_Click(object sender, EventArgs e)
        {
            if (!_highlightGroups.ContainsKey(_editor))
                _highlightGroups[_editor] = new HighlightGroup(_editor);
            HighlightGroup group = _highlightGroups[_editor];

            if (string.IsNullOrEmpty(LookFor))
                // Clear highlights
                group.ClearMarkers();
            else {
                _search.LookFor = txtLookFor.Text;
                _search.MatchCase = chkMatchCase.Checked;
                _search.MatchWholeWordOnly = chkMatchWholeWord.Checked;

                bool looped = false;
                int offset = 0, count = 0;
                for(;;) {
                    TextRange range = _search.FindNext(offset, false, out looped);
                    if (range == null || looped)
                        break;
                    offset = range.Offset + range.Length;
                    count++;

                    var m = new TextMarker(range.Offset, range.Length,
                            TextMarkerType.SolidBlock, Color.Yellow, Color.Black);
                    group.AddMarker(m);
                }
                if (count == 0)
                    MessageBox.Show("Search text not found.");
                else
                    Close();
            }
        }