Exemplo n.º 1
0
        public bool MatchesHighlight(HighlightType highlightType, uint thingId)
        {
            switch (highlightType)
            {
                case HighlightType.None:
                    return false;
                case HighlightType.All:
                    return true;
                case HighlightType.Segment:

                    foreach (PathPoint p in path)
                    {
                        if (p.segmentId == thingId)
                            return true;
                    }

                    break;
                case HighlightType.Building:
                    if (sourceBuilding == thingId || targetBuilding == id)
                        return true;
                    break;
                case HighlightType.Vehicle:
                    if (id == thingId && type == EntityType.Vehicle)
                        return true;
                    break;
                case HighlightType.Citizen:

                    if (id == thingId && type == EntityType.Citizen)
                        return true;
                    break;
            }
            return false;
        }
Exemplo n.º 2
0
		void Awake()
		{
			MeshFilter mf = GetComponent<MeshFilter>();

			if(mf == null || mf.sharedMesh == null)
				highlightType = HighlightType.Bounds;

			switch( highlightType )
			{
				case HighlightType.Wireframe:
					mesh = GenerateWireframe( mf.sharedMesh );
					material = pb_BuiltinResource.GetMaterial(pb_BuiltinResource.mat_Wireframe);
					break;

				case HighlightType.Bounds:

					Bounds bounds = mf != null && mf.sharedMesh != null ? mf.sharedMesh.bounds : new Bounds(Vector3.zero, Vector3.one);
					mesh = GenerateBounds( bounds );
					material = pb_BuiltinResource.GetMaterial(pb_BuiltinResource.mat_UnlitVertexColor);
					break;

				case HighlightType.Glow:
					mesh = mf.sharedMesh;
					material = pb_BuiltinResource.GetMaterial(pb_BuiltinResource.mat_Highlight);
					break;
			}

			mesh.RecalculateBounds();
			material.SetVector("_Center", mesh.bounds.center);
			
			Graphics.DrawMesh(mesh, transform.localToWorldMatrix, material, 0);
		}
        public PathController(QueryTool tool)
        {
            queryTool = tool;
            currentHighlightType = HighlightType.None;

            Config.instance.eventConfigChanged += () => { OnConfigChanged(); };

            Log.info("Load Line Material...");

            Color red = new Color(1, 0, 0);
            Color gold = new Color(1, 0.9f, 0);

            string lineShader = ResourceLoader.loadResourceString("Materials/Shaders/TransparentVertexLit.shader");

            lineMaterial = new Material(lineShader);
            lineMaterial.color = red;
            lineMaterial.SetColor("_Emission", red);
            lineMaterial.SetColor("_SpecColor", Color.black); //Disable shine effect
            lineMaterial.mainTexture = ResourceLoader.loadTexture("Materials/NewSkin.png");
            lineMaterial.renderQueue = 100;

            lineMaterialHighlight = new Material(lineMaterial);
            lineMaterialHighlight.color = gold;
            lineMaterialHighlight.SetColor("_Emission", gold);
            lineMaterial.renderQueue = 101;

            Texture pin = ResourceLoader.loadTexture("Materials/Pin.png");

            activeSegmentIndicator = Billboard.Create(Billboard.CreateSpriteMaterial(pin, Color.green));
            vehicleIndicator = Billboard.CreateSpriteMaterial(pin, red);
            vehicleIndicatorHighlight = Billboard.CreateSpriteMaterial(pin, gold);

            Log.debug("PathController initialized");
        }
Exemplo n.º 4
0
 private bool getHighlightState(HighlightType type)
 {
     if (highlightStates == null) { //TODO: Solve why the f**k I need to do this... unity u little bitch
         highlightStates = new Dictionary<HighlightType, bool> ()
         {
             {HighlightType.highlighted, false},
             {HighlightType.selected, false}
         };
     }
     return highlightStates[type];
 }
Exemplo n.º 5
0
 private void setHighlightState(HighlightType type, bool state)
 {
     if (highlightStates == null) { //TODO: Solve why the f**k I need to do this... unity u little bitch
         highlightStates = new Dictionary<HighlightType, bool> ()
         {
             {HighlightType.highlighted, false},
             {HighlightType.selected, false}
         };
     }
     if (this.highlightStates [type] != state) {
         this.highlightStates [type] = state;
         highlightChanged ();
     }
 }
Exemplo n.º 6
0
 private void DetermineType()
 {
     if (toHighlight is PartValue)
     {
         highlightType = HighlightType.Part;
     }
     else if (toHighlight is ListValue)
     {
         highlightType = HighlightType.Parts;
     }
     else if (toHighlight is ElementValue)
     {
         highlightType = HighlightType.Element;
     }
 }
Exemplo n.º 7
0
 public void SetHighlight(HighlightType type, uint thingId)
 {
     if (currentReport != null)
     {
         paths.SetHighlight(type, thingId);
         if (type == HighlightType.None)
         {
             ui.SetHighlightData(null, 0);
         }
         else
         {
             ui.SetHighlightData(currentReport.CountEntiesTypes(type, thingId), currentReport.allEntities.Length);
         }
     }
 }
Exemplo n.º 8
0
        public async Task<JsonResult> GetBrowseContent(HighlightType highlightType, EntityType entityType, int page, int pageSize, CategoryType categoryType, ContentTypes contentType, long? entityId)
        {

            var pageDetails = new PageDetails(page);
            pageDetails.ItemsPerPage = pageSize;
            var entityHighlightFilter = new EntityHighlightFilter(highlightType, categoryType, entityId, contentType);
            var highlightEntities = await GetHighlightEntities(entityType, entityHighlightFilter, pageDetails);

            

            // It creates the prefix for id of links
            SetSiteAnalyticsPrefix(highlightType);
            var result = new JsonResult
            {
                Data = new
                {
                    entities = highlightEntities,
                    pageInfo = pageDetails
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
            return result;

        }
Exemplo n.º 9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="type">The highligh type for this colorscheme</param>
 public ColorScheme(HighlightType type)
 {
     highlightType = type;
 }
Exemplo n.º 10
0
        private static async Task<Collection<AdminEntityDetails>> GetContents(HighlightType highlightType, string categoryId, List<long> doNotInclude)
        {
            Collection<AdminEntityDetails> entities = new Collection<AdminEntityDetails>();
            IEntityService entityService = DependencyResolver.Current.GetService(typeof(IEntityService)) as IEntityService;
            var results = await entityService.GetContents(new EntityHighlightFilter(highlightType, int.Parse(categoryId, CultureInfo.InvariantCulture).ToEnum<int, CategoryType>(CategoryType.All), null));

            foreach (var item in results.Where(fc => !doNotInclude.Contains(fc.ID)))
            {
                AdminEntityDetails entity = new AdminEntityDetails();
                Mapper.Map(item, entity);
                entity.CategoryName = Resources.ResourceManager.GetString(item.CategoryID.ToEnum<int, CategoryType>(CategoryType.All).ToString(), Resources.Culture);

                entities.Add(entity);
            }

            return entities;
        }
Exemplo n.º 11
0
 public Char(char c)
 {
     this.c = c;
     style  = StyleIndex.None;
     type   = HighlightType.Defaul;
 }
Exemplo n.º 12
0
 public HighlightRange(int start, int end, HighlightType type)
 {
     Start = start;
     End   = end;
     Type  = type;
 }
Exemplo n.º 13
0
		public Highlighting(HighlightType type, int position, int length)
		{
			Type = type;
			Position = position;
			Length = length;
		}
Exemplo n.º 14
0
        private void udESP()
        {
            while (!terminate)
            {
                try
                {
                    if (espEnabled)
                    {
                        if (dManager.d_ref)
                        {
                            dManager.drawing_esp.Clear();
                            Collider[] cols = Physics.OverlapSphere(Information.player.transform.position, distance, RayMasks.DAMAGE_CLIENT);
                            foreach (Collider c in cols)
                            {
                                if (DamageTool.getPlayer(c.transform) != null)
                                {
                                    SDG.Unturned.Player ut = DamageTool.getPlayer(c.transform);
                                    if (esp_player)
                                    {
                                        if (ut.gameObject == null)
                                        {
                                            continue;
                                        }
                                        SteamPlayer ply      = Tool.getSteamPlayer(ut.gameObject);
                                        bool        isFriend = ComponentManager.friend_manager.exists(ply.playerID.steamID.m_SteamID);
                                        float       dist     = (float)Math.Round(Tool.getDistance(ut.transform.position));
                                        Vector3     c2s      = MainCamera.instance.WorldToScreenPoint(ut.transform.position);
                                        Highlighter h        = ut.gameObject.GetComponent <Highlighter>();

                                        if (c2s.z <= 0)
                                        {
                                            continue;
                                        }

                                        c2s.x = c2s.x - 64f;
                                        c2s.y = (Screen.height - (c2s.y + 1f)) - 12f;

                                        if (Array.Exists(dManager.drawing_esp.ToArray(), a => a.pos == c2s))
                                        {
                                            continue;
                                        }

                                        dManager.drawing_esp.Add(new DrawType((p_name ? ply.playerID.nickName : "") + (p_distance ? "[" + dist + "]" : ""), c2s, (isFriend ? Information.esp_friends : Information.esp_players), p_name || p_distance, ut.gameObject, Tool.BoundsToScreenRect(c.bounds)));


                                        if (draw_highlight)
                                        {
                                            if (h == null)
                                            {
                                                h = ut.gameObject.AddComponent <Highlighter>();
                                                h.OccluderOn();
                                                h.SeeThroughOn();
                                                h.ConstantOn((isFriend ? Information.esp_friends : Information.esp_players));
                                            }
                                            HighlightType ht = dManager.highlights.Find(a => a.h == h);
                                            if (ht == null)
                                            {
                                                dManager.highlights.Add(new HighlightType(h, ut.gameObject));
                                            }
                                            else
                                            {
                                                ht.hasUd = true;
                                            }
                                        }
                                        continue;
                                    }
                                }

                                if (DamageTool.getZombie(c.transform))
                                {
                                    SDG.Unturned.Zombie ut = DamageTool.getZombie(c.transform);
                                    if (esp_zombie)
                                    {
                                        if (ut.gameObject == null && !ut.isDead)
                                        {
                                            continue;
                                        }
                                        float       dist = (float)Math.Round(Tool.getDistance(ut.transform.position));
                                        Vector3     c2s  = Camera.main.WorldToScreenPoint(ut.transform.position);
                                        Highlighter h    = ut.gameObject.GetComponent <Highlighter>();

                                        if (c2s.z <= 0)
                                        {
                                            continue;
                                        }

                                        c2s.x = c2s.x - 64f;
                                        c2s.y = (Screen.height - (c2s.y + 1f)) - 12f;

                                        if (Array.Exists(dManager.drawing_esp.ToArray(), a => a.pos == c2s))
                                        {
                                            continue;
                                        }

                                        dManager.drawing_esp.Add(new DrawType((z_name ? getZombieName(ut) : "") + (z_distance ? "[" + dist + "]" : ""), c2s, Information.esp_zombies, z_name || z_distance, ut.gameObject, Tool.BoundsToScreenRect(c.bounds)));

                                        if (draw_highlight)
                                        {
                                            if (h == null)
                                            {
                                                h = ut.gameObject.AddComponent <Highlighter>();
                                                h.OccluderOn();
                                                h.SeeThroughOn();
                                                h.ConstantOn(Information.esp_zombies);
                                            }
                                            HighlightType ht = dManager.highlights.Find(a => a.h == h);
                                            if (ht == null)
                                            {
                                                dManager.highlights.Add(new HighlightType(h, ut.gameObject));
                                            }
                                            else
                                            {
                                                ht.hasUd = true;
                                            }
                                        }
                                        continue;
                                    }
                                }
                            }
                            dManager.d_ref = false;
                        }
                    }
                    else
                    {
                        dManager.rm_highlights = true;
                        dManager.drawing_esp.Clear();
                    }
                }
                catch (Exception ex)
                {
                    Debug.LogException(ex);
                }
            }
        }
 public override void PreservePreviousState()
 {
     m_PreviousState = m_ShapeData?.View?.Highlight ?? HighlightType.Normal;
 }
        /**
         * <summary>Creates a new instance of the 'Object: Highlight' Action, set to highlight an object in the scene</summary>
         * <param name = "objectToAffect">The Highlight component to affect</param>
         * <param name = "highlightType">What type of highlighting effect to perform</param>
         * <param name = "isInstant">If True, then the effect will be performed instantly</param>
         * <returns>The generated Action</returns>
         */
        public static ActionHighlight CreateNew_SceneObject(Highlight objectToAffect, HighlightType highlightType, bool isInstant = false)
        {
            ActionHighlight newAction = (ActionHighlight)CreateInstance <ActionHighlight>();

            newAction.whatToHighlight = WhatToHighlight.SceneObject;
            newAction.highlightObject = objectToAffect;
            newAction.highlightType   = highlightType;
            newAction.isInstant       = isInstant;
            return(newAction);
        }
Exemplo n.º 17
0
 private bool getHighlightState(HighlightType type)
 {
     if (highlightStates == null) { //TODO: Solve why the f**k I need to do this... unity u little bitch
             highlightStates =createHighlightStateTable();
     }
     return highlightStates[type];
 }
        public static InterfacePropertyGenerator Property(string name, string stringNamespace, string type, bool get, bool set, bool withNamespace = true, HighlightType highlightType = HighlightType.Type)
        {
            var interfaceProp = new InterfacePropertyGenerator();

            interfaceProp.name            = name;
            interfaceProp.withNamespace   = withNamespace;
            interfaceProp.stringNamespace = stringNamespace;
            interfaceProp.stringType      = type;
            interfaceProp.isStringType    = true;
            interfaceProp.highlightType   = highlightType;
            interfaceProp.get             = (get ? "get".ConstructHighlight() + "; " : string.Empty);
            interfaceProp.set             = (set ? "set".ConstructHighlight() + "; " : string.Empty);
            return(interfaceProp);
        }
Exemplo n.º 19
0
    /// <summary>
    /// Add a new highlighted area that belongs to a script
    /// </summary>
    /// <param name="a_area">List of hexes that make an area</param>
    /// <param name="a_borderColour">Colour of line that marks edge of area</param>
    /// <param name="a_fillColour">Colour of the filled area inside the border</param>
    /// <param name="a_script">The script which owns this area</param>
    /// <param name="a_excludedHexes">List of hexes that shouldn't be highlighted</param>
    public void HighLightArea(List <Hex> a_area, Color a_borderColour, Color a_fillColour, MonoBehaviour a_script, List <Hex> a_excludedHexes = null, HighlightType a_highlightType = 0)
    {
        // invert the thickness available in the inspector
        inverseThickness = 1.0f - borderThickness;

        // And new dictionary key if doesn't exist
        if (!highlightedAreas.ContainsKey(a_script))
        {
            highlightedAreas.Add(a_script, new List <GameObject>());
        }

        // Create two new game objects, one for border and one for inner area
        GameObject areaGO = new GameObject("AreaHighlight");

        areaGO.transform.SetParent(holder, false);

        // border gameObject is a child of the area gameObject
        GameObject borderGO = new GameObject("BorderHighlight");

        borderGO.transform.SetParent(areaGO.transform, false);

        borderGO.transform.position = new Vector3(0.0f, areaGO.transform.position.y + 0.01f);

        // add the area gameObject to the script which called this function
        highlightedAreas[a_script].Add(areaGO);

        foreach (var hex in a_area)
        {
            GameObject hexGO = Instantiate(hexHighlightPrefab, hex.transform.position, hexHighlightPrefab.transform.rotation);
            hexGO.transform.parent = areaGO.transform;

            Renderer hexRenderer = hexGO.GetComponent <Renderer>();

            hexRenderer.material.color = a_fillColour;

            switch (a_highlightType)
            {
            case HighlightType.DEFAULT:
                hexRenderer.material.SetTexture("_AlphaTex", defaultTexture);
                break;

            case HighlightType.EXCLAMATION:
                hexRenderer.material.SetTexture("_AlphaTex", exclamationTexture);
                break;

            case HighlightType.FLAME:
                hexRenderer.material.SetTexture("_AlphaTex", flameTexture);
                break;

            case HighlightType.BURNING:
                hexRenderer.material.SetTexture("_AlphaTex", burningTexture);
                break;

            default:
                hexRenderer.material.SetTexture("_AlphaTex", defaultTexture);
                break;
            }
        }

        MeshRenderer borderRenderer = borderGO.AddComponent <MeshRenderer>();

        borderRenderer.material       = borderMaterial;
        borderRenderer.material.color = a_borderColour;

        Mesh borderMesh = borderGO.AddComponent <MeshFilter>().mesh;

        //Mesh areaMesh = areaGO.AddComponent<MeshFilter>().mesh;

        Clear();

        TriangulateBorder(ref a_area, ref a_excludedHexes);

        borderMesh.SetVertices(vertices);
        borderMesh.SetUVs(0, uvs);
        borderMesh.SetTriangles(triangles, 0);

        borderMesh.RecalculateNormals();

        //Clear();

        //TriangulateArea(ref a_area, ref a_excludedHexes);

        //areaMesh.SetVertices(vertices);
        //areaMesh.SetUVs(0, uvs);
        //areaMesh.SetTriangles(triangles, 0);

        //areaMesh.RecalculateNormals();
    }
        public static InterfacePropertyGenerator Property(string name, Type type, bool get, bool set, HighlightType highlightType = HighlightType.Type)
        {
            var interfaceProp = new InterfacePropertyGenerator();

            interfaceProp.name          = name;
            interfaceProp.type          = type;
            interfaceProp.isStringType  = false;
            interfaceProp.highlightType = highlightType;
            interfaceProp.get           = (get ? "get".ConstructHighlight() + "; " : string.Empty);
            interfaceProp.set           = (set ? "set".ConstructHighlight() + "; " : string.Empty);
            return(interfaceProp);
        }
 private void DrawHighlight(Highlight highlight)
 {
     ColorGlyph[][] drawn = Screen.GetCurrent(MapUI.RowOffset, MapUI.ColOffset, GameUniverse.MapHeight, GameUniverse.MapWidth);
     if (highlight.Type == MapHighlightType.SinglePoint)
     {
         ColorGlyph currentGlyph = drawn[GameUniverse.MapHeight - 1 - highlight.Destination.Y][highlight.Destination.X];
         ColorGlyph highlighted  = Screen.GetHighlighted(currentGlyph, HighlightType.TargetingValidFocused);
         DrawToMap(highlight.Destination.Y, highlight.Destination.X, highlighted);
     }
     else              // path or line
     {
         IList <Point> valid   = highlight.LineOrPath;
         IList <Point> invalid = null;
         if (highlight.BlockedPoint != null)
         {
             valid   = new List <Point>();
             invalid = new List <Point>();
             bool blocked = false;
             for (int i = 0; i < highlight.LineOrPath.Count; ++i)
             {
                 if (blocked)
                 {
                     invalid.Add(highlight.LineOrPath[i]);
                 }
                 else
                 {
                     valid.Add(highlight.LineOrPath[i]);
                     if (highlight.LineOrPath[i] == highlight.BlockedPoint.Value)
                     {
                         blocked = true;
                     }
                 }
             }
         }
         if (highlight.Radius != null)
         {
             if (highlight.BlockedPoint != null)
             {
                 foreach (Point p in highlight.CellsInRadius)
                 {
                     if (!valid.Contains(p))
                     {
                         invalid.Add(p);                                                // don't overwrite valid with invalid
                     }
                 }
             }
             else
             {
                 foreach (Point p in highlight.CellsInRadius)
                 {
                     if (!valid.Contains(p))
                     {
                         valid.Add(p);
                     }
                 }
             }
         }
         foreach (Point p in valid)
         {
             ColorGlyph    currentGlyph  = drawn[GameUniverse.MapHeight - 1 - p.Y][p.X];
             HighlightType highlightType = highlight.Destination == p ? HighlightType.TargetingValidFocused : HighlightType.TargetingValid;
             ColorGlyph    highlighted   = Screen.GetHighlighted(currentGlyph, highlightType);
             DrawToMap(p.Y, p.X, highlighted);
         }
         if (!valid.Contains(highlight.Destination))
         {
             Point         p             = highlight.Destination;
             ColorGlyph    currentGlyph  = drawn[GameUniverse.MapHeight - 1 - p.Y][p.X];
             HighlightType highlightType = highlight.Destination == p ? HighlightType.TargetingValidFocused : HighlightType.TargetingValid;
             ColorGlyph    highlighted   = Screen.GetHighlighted(currentGlyph, highlightType);
             DrawToMap(p.Y, p.X, highlighted);
         }
         if (invalid != null)
         {
             foreach (Point p in invalid)
             {
                 ColorGlyph    currentGlyph  = drawn[GameUniverse.MapHeight - 1 - p.Y][p.X];
                 HighlightType highlightType = highlight.Destination == p ? HighlightType.TargetingInvalidFocused : HighlightType.TargetingInvalid;
                 ColorGlyph    highlighted   = Screen.GetHighlighted(currentGlyph, highlightType);
                 DrawToMap(p.Y, p.X, highlighted);
             }
         }
     }
 }
Exemplo n.º 22
0
        // Mouse moving
        public override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (selecting)
            {
                ClearHighlighted();
                RenderMultiSelection();
            }
            else
            {
                // ano - a lot of this is from codeimp's buildermodes plugins
                if (e.Button == MouseButtons.None)
                {
                    Linedef l = General.Map.Map.NearestLinedefRange(
                        mousemappos,
                        HIGHLIGHT_RANGE / renderer.Scale);

                    Thing t = MapSet.NearestThingSquareRange(
                        General.Map.ThingsFilter.VisibleThings,
                        mousemappos,
                        HIGHLIGHT_THINGS_RANGE / renderer.Scale);

                    Vertex v = General.Map.Map.NearestVertexSquareRange(
                        mousemappos,
                        HIGHLIGHT_VERTICES_RANGE / renderer.Scale);

                    Sector  s  = null;
                    Linedef ls = l;
                    if (ls == null)
                    {
                        ls = General.Map.Map.NearestLinedef(mousemappos);
                    }

                    if (ls != null)
                    {
                        // Check on which side of the linedef the mouse is
                        float side = ls.SideOfLine(mousemappos);

                        if (side > 0)
                        {
                            // Is there a sidedef here?
                            if (ls.Back != null)
                            {
                                s = ls.Back.Sector;
                            }
                        }
                        else if (ls.Front != null)
                        {
                            s = ls.Front.Sector;
                        }
                    }

                    HighlightType htype = HighlightType.Null;

                    if (v != null)
                    {
                        htype = HighlightType.Vertex;
                    }


                    if (t != null)
                    {
                        if (htype == HighlightType.Null)
                        {
                            htype = HighlightType.Thing;
                        }
                        else if (htype == HighlightType.Vertex &&
                                 v.DistanceToSq(mousemappos) > t.DistanceToSq(mousemappos))
                        {
                            // figure out which is closer and highlight that one
                            htype = HighlightType.Thing;
                        }
                    }


                    if (l != null)
                    {
                        switch (htype)
                        {
                        case HighlightType.Vertex:
                            break;

                        case HighlightType.Thing:
                            if (l.SafeDistanceToSq(mousemappos, false) < t.DistanceToSq(mousemappos))
                            {
                                // figure out which is closer and highlight that one
                                htype = HighlightType.Linedef;
                            }
                            break;

                        default:
                            htype = HighlightType.Linedef;
                            break;
                        }
                    }

                    if (htype == HighlightType.Null && s != null)
                    {
                        htype = HighlightType.Sector;
                    }

                    switch (htype)
                    {
                    case HighlightType.Linedef:
                        HighlightLinedef(l);
                        break;

                    case HighlightType.Sector:
                        HighlightSector(s);
                        break;

                    case HighlightType.Vertex:
                        HighlightVertex(v);
                        break;

                    case HighlightType.Thing:
                        HighlightThing(t);
                        break;

                    case HighlightType.Null:
                    default:
                        // highlight nothing
                        ClearHighlighted();
                        renderer.Present();
                        break;
                    } // switch
                }

                if (renderer.StartOverlay(true))
                {
                    DrawCursor();

                    renderer.Finish();
                    renderer.Present();
                }
            }
        }
Exemplo n.º 23
0
 public HighlightRange(Match match, HighlightType type)
 {
     Start = match.Index;
     End   = match.Index + match.Length;
     Type  = type;
 }
Exemplo n.º 24
0
        public Dictionary<string, int> CountEntiesTypes(HighlightType type = HighlightType.All, uint id = 0)
        {
            Dictionary<string,int> typeCounts = new Dictionary<string,int>();
            for (int i = 0; i < allEntities.Length; i++)
            {
                if (!allEntities[i].MatchesHighlight(type, id))
                    continue;

                int val = 0;
                typeCounts.TryGetValue(allEntities[i].serviceType, out val);
                typeCounts[allEntities[i].serviceType] = val+1;
            }

            return typeCounts;
        }
        override public void ShowGUI(List <ActionParameter> parameters)
        {
            whatToHighlight = (WhatToHighlight)EditorGUILayout.EnumPopup("What to highlight:", whatToHighlight);

            if (whatToHighlight == WhatToHighlight.SceneObject)
            {
                parameterID = Action.ChooseParameterGUI("Object to highlight:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID      = 0;
                    highlightObject = null;
                }
                else
                {
                    highlightObject = (Highlight)EditorGUILayout.ObjectField("Object to highlight:", highlightObject, typeof(Highlight), true);

                    constantID      = FieldToID <Highlight> (highlightObject, constantID);
                    highlightObject = IDToField <Highlight> (highlightObject, constantID, false);
                }
            }
            else if (whatToHighlight == WhatToHighlight.InventoryItem)
            {
                if (!inventoryManager)
                {
                    inventoryManager = AdvGame.GetReferences().inventoryManager;
                }

                if (inventoryManager)
                {
                    // Create a string List of the field's names (for the PopUp box)
                    List <string> labelList = new List <string>();

                    int i = 0;
                    if (parameterID == -1)
                    {
                        invNumber = -1;
                    }

                    if (inventoryManager.items.Count > 0)
                    {
                        foreach (InvItem _item in inventoryManager.items)
                        {
                            labelList.Add(_item.label);
                            if (_item.id == invID)
                            {
                                invNumber = i;
                            }
                            i++;
                        }

                        if (invNumber == -1)
                        {
                            ACDebug.LogWarning("Previously chosen item no longer exists!");
                            invNumber = 0;
                            invID     = 0;
                        }

                        //
                        parameterID = Action.ChooseParameterGUI("Inventory item:", parameters, parameterID, ParameterType.InventoryItem);
                        if (parameterID >= 0)
                        {
                            invNumber = Mathf.Min(invNumber, inventoryManager.items.Count - 1);
                            invID     = -1;
                        }
                        else
                        {
                            invNumber = EditorGUILayout.Popup("Inventory item:", invNumber, labelList.ToArray());
                            invID     = inventoryManager.items[invNumber].id;
                        }
                        //
                    }

                    else
                    {
                        EditorGUILayout.HelpBox("No inventory items exist!", MessageType.Info);
                        invID     = -1;
                        invNumber = -1;
                    }
                }
            }

            highlightType = (HighlightType)EditorGUILayout.EnumPopup("Highlight type:", highlightType);
            if (highlightType == HighlightType.Enable || highlightType == HighlightType.Disable)
            {
                isInstant = EditorGUILayout.Toggle("Is instant?", isInstant);
            }

            AfterRunningOption();
        }
Exemplo n.º 26
0
 public bool HasAnyHighlightType(HighlightType type)
 {
     return((HighlightType & type) != HighlightType.None);
 }
Exemplo n.º 27
0
 /// <summary>
 /// Use to add a single token expressing syntax highlighting.
 /// </summary>
 /// <param name="descriptorRecognition">Enum of DescriptorRecognition</param>
 /// <param name="token">The open token.</param>
 /// <param name="highlightType">Enum of HighlightType</param>s
 /// <param name="color">The color to highlight.</param>
 /// <param name="font">The font to highlight.</param>
 public void AddHighlightDescriptor(DescriptorRecognition descriptorRecognition, string token, HighlightType highlightType,
                                    Color color, Font font, UsedForAutoComplete used)
 {
     Descriptors.Add(new HighlightDescriptor(token, color, font, highlightType, descriptorRecognition, used));
 }
Exemplo n.º 28
0
 public void HighlightTiles(IEnumerable<TerrainTile> tiles, HighlightType type)
 {
     ClearHighlight();
     var prefab = (type == HighlightType.Move) ? MovementOverlay : AttackOverlay;
     foreach (var tile in tiles) {
         var overlay = (GameObject)Instantiate(prefab);
         overlay.transform.position = tile.SurfaceCenter;
         overlay.transform.parent = transform;
         _currentOverlay.Add(overlay);
     }
 }
Exemplo n.º 29
0
 private void setHighlightState(HighlightType type, bool state)
 {
     if (highlightStates == null) { //TODO: Solve why the f**k I need to do this... unity u little bitch
         highlightStates = createHighlightStateTable();
     }
     if (this.highlightStates [type] != state) {
         this.highlightStates [type] = state;
         highlightChanged ();
     }
 }
Exemplo n.º 30
0
        public void SetHighlight(HighlightType type, uint id)
        {
            if (currentReport == null) {
                return;
            }

            if (currentHighlight == id && currentHighlightType == type) {
                return;
            }

            for(int index=0; index < currentReport.allEntities.Length; index++) {
                bool match = currentReport.allEntities[index].MatchesHighlight(type,id);
                pathsVisualizations[index].GetComponent<Renderer>().material = match ? lineMaterialHighlight : lineMaterial;
                vehicleIcons[index].GetComponent<Renderer>().material = match ? vehicleIndicatorHighlight : vehicleIndicator;
            }

            currentHighlight = id;
            currentHighlightType = type;
        }
Exemplo n.º 31
0
    /// <summary>
    /// Highlights the tiles in range.
    /// </summary>
    /// <param name="unit">Unit.</param>
    /// <param name="x">The x coordinate.</param>
    /// <param name="z">The z coordinate.</param>
    /// <param name="range">Range.</param>
    /// <param name="tileColor">Tile color.</param>
    /// <param name="highlightType">Highlight type.</param>
    private void HighlightTilesInRange(Unit unit, float x, float z, int range, Color tileColor, HighlightType highlightType)
    {
        Dictionary <Vector3, Object> discoveredTiles = _tileDiscoverer.DiscoverTilesInRange((int)x, (int)z, range);

        foreach (Vector3 tile in discoveredTiles.Keys)
        {
            HighlightTile(unit, tile.x, tile.z, tileColor, highlightType);
        }
    }
Exemplo n.º 32
0
        public void highlightNodes(String path, HighlightType highlightType)
        {
            String name;
            int instance;

            path = GetErrorNode(path, out name, out instance);

            EditorWindow editor = network.getEditor();
            if (editor != null)
            {
                editor.highlightNode(name, instance, highlightType);
            }

            while (path != null && path.Length > 0)
            {
                String netname = name;
                path = GetErrorNode(path, out name, out instance);
                foreach (Network n in macroList)
                {
                    if (n.NameString == netname &&
                        n.getEditor() != null)
                    {
                        n.getEditor().highlightNode(name, instance, highlightType);
                        break;
                    }
                }
            }
        }
Exemplo n.º 33
0
    private void ProcessGameplay()
    {
        // raycast
        RaycastHit hit;
        Ray        ray         = game_camera.ScreenPointToRay(Input.mousePosition);
        bool       intersected = Physics.Raycast(ray, out hit);
        float      size        = HexGridManager.instance.cell_size;

        bool ui_in_use = EventSystem.current.IsPointerOverGameObject();

        // cursor position
        if (intersected)
        {
            Vector3 cursor_cube_coordinates = HexGrid.CartesianToCubeRounded(hit.point, size);

            if (!ui_in_use)
            {
                HexGridManager.instance.HighlightCellCube(cursor_cube_coordinates, HighlightType.Selection, true);
            }
        }

        // move selection
        List <Vector3> steer_positions     = new List <Vector3>();
        List <Vector3> all_steer_positions = new List <Vector3>();

        player_car.GetAvailableSteerPositions(steer_positions);
        player_car.GetAllSteerPositions(all_steer_positions);

        if (Input.GetMouseButtonDown(0) && !ui_in_use)
        {
            Vector3 cell_position    = HexGrid.CartesianToCubeRounded(hit.point, size);
            Vector3 current_position = player_car.GetCurrentPosition();

            bool collision = false;
            foreach (Vector3 position in steer_positions)
            {
                Vector3 traced_position = TracePath(player_car, current_position, position, out collision);
                if (traced_position != cell_position)
                {
                    continue;
                }

                player_car.SetDesiredPosition(position);
                break;
            }
        }

        // player car
        {
            Vector3 current_position = player_car.GetCurrentPosition();
            Vector3 desired_position = player_car.GetDesiredPosition();

            HexGridManager.instance.HighlightCellCube(current_position, HighlightType.Selection);

            bool collision = false;
            foreach (Vector3 position in all_steer_positions)
            {
                Vector3 traced_position = TracePath(player_car, current_position, position, out collision);
                bool    is_available    = steer_positions.Contains(position);

                HighlightType type = (is_available) ? HighlightType.ActionableSteer : HighlightType.Steer;

                bool is_desired = (position == desired_position);
                if (is_desired)
                {
                    HexGridManager.instance.AddCellIconCube(traced_position, IconType.MovePoint);
                }

                if (collision)
                {
                    HexGridManager.instance.AddCellIconCube(traced_position, IconType.CollisionDamage);
                }

                HexGridManager.instance.HighlightCellCube(traced_position, type);
            }
        }

        // turrets
        foreach (Turret turret in turrets.Values)
        {
            if (!turret.IsReadyToFire())
            {
                continue;
            }

            Vector3 fire_position = turret.GetFirePosition();

            HexGridManager.instance.HighlightCellCube(fire_position, HighlightType.Collision);
            HexGridManager.instance.AddCellIconCube(fire_position, IconType.HitDamage);
        }

        // check win / lose conditions
        bool all_enemies_dead = true;
        bool all_players_dead = true;

        bool player_reached_finish = false;
        bool enemy_reached_fiinsh  = false;

        foreach (Car car in cars.Values)
        {
            if (car.GetLap() >= track.num_laps)
            {
                if (car.team == player_team)
                {
                    player_reached_finish = true;
                }
                else
                {
                    enemy_reached_fiinsh = true;
                }
            }

            if (car.GetHealth() != 0)
            {
                if (car.team == player_team)
                {
                    all_players_dead = false;
                }
                else
                {
                    all_enemies_dead = false;
                }
            }
        }

        if (all_enemies_dead || player_reached_finish)
        {
            state = GameState.Win;
        }
        else if (all_players_dead || enemy_reached_fiinsh)
        {
            state = GameState.Lose;
        }
    }
Exemplo n.º 34
0
 public HighlightRange(Group group, HighlightType type)
 {
     Start = group.Index;
     End   = group.Index + group.Length;
     Type  = type;
 }
Exemplo n.º 35
0
        /// <summary>
        /// It creates the prefix for id of links
        /// </summary>
        /// <param name="highlightType">Related / Latest / Top etc.</param>
        protected void SetSiteAnalyticsPrefix(HighlightType highlightType)
        {
            var pageName = string.Empty;

            if (HttpContext.Request.IsAjaxRequest())
            {
                pageName = HttpContext.Request.UrlReferrer.AbsolutePath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
            }
            else
            {
                pageName = HttpContext.Request.Url.AbsolutePath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
            }

            if (highlightType == HighlightType.None)
            {
                ViewData["PrefixId"] = string.Format(CultureInfo.InvariantCulture, "{0}_", pageName);
            }
            else
            {
                ViewData["PrefixId"] = string.Format(CultureInfo.InvariantCulture, "{0}_{1}_", pageName, highlightType.ToString());
            }
        }
        /**
         * <summary>Highlights an inventory item.</summary>
         * <param name = "_id">The ID number of the inventory item (see InvItem) to highlight</param>
         * <param name = "_type">The type of highlighting effect to perform (Enable, Disable, PulseOnce, PulseContinuously)</param>
         */
        public void HighlightItem(int _id, HighlightType _type)
        {
            highlightItem = GetItem (_id);
            if (highlightItem == null) return;

            if (_type == HighlightType.Enable)
            {
                highlightState = HighlightState.Normal;
                pulseDirection = 1;
            }
            else if (_type == HighlightType.Disable)
            {
                highlightState = HighlightState.Normal;
                pulseDirection = -1;
            }
            else if (_type == HighlightType.PulseOnce)
            {
                highlightState = HighlightState.Flash;
                pulse = 0f;
                pulseDirection = 1;
            }
            else if (_type ==  HighlightType.PulseContinually)
            {
                highlightState = HighlightState.Pulse;
                pulse = 0f;
                pulseDirection = 1;
            }
        }
Exemplo n.º 37
0
 public GifEmoteState(int x, int y, int width, int height, List <Word> words, bool selected, HighlightType highlightType, bool disabled, int messageYOffset, int messageXOffset)
 {
     X              = x;
     Y              = y;
     Width          = width;
     Height         = height;
     Words          = words;
     Selected       = selected;
     HighlightType  = highlightType;
     Disabled       = disabled;
     MessageYOffset = messageYOffset;
     MessageXOffset = messageXOffset;
 }
        private OffsetSyntaxHighlightingData CreateOffsetData(NClang.ClangCursor cursor, NClang.ClangCursor parent)
        {
            HighlightType highlightKind = HighlightType.Literal;

            bool useSpellingLocation = false;

            switch (cursor.Kind)
            {
            case NClang.CursorKind.StringLiteral:
            case NClang.CursorKind.CharacterLiteral:
                break;

            case NClang.CursorKind.IntegerLiteral:
            case NClang.CursorKind.FloatingLiteral:
            case NClang.CursorKind.ImaginaryLiteral:
                highlightKind = HighlightType.NumericLiteral;
                break;

            case NClang.CursorKind.Constructor:
            case NClang.CursorKind.Destructor:
            case NClang.CursorKind.TypedefDeclaration:
            case NClang.CursorKind.ClassDeclaration:
            case NClang.CursorKind.TemplateReference:
                useSpellingLocation = true;
                highlightKind       = HighlightType.ClassName;
                break;

            case NClang.CursorKind.EnumDeclaration:
            case NClang.CursorKind.UnionDeclaration:
                useSpellingLocation = true;
                highlightKind       = HighlightType.EnumTypeName;
                break;

            case NClang.CursorKind.TemplateTypeParameter:
                useSpellingLocation = true;
                highlightKind       = HighlightType.InterfaceName;
                break;

            case NClang.CursorKind.TypeReference:
                if (parent.Kind == NClang.CursorKind.CXXBaseSpecifier)
                {
                    highlightKind       = HighlightType.ClassName;
                    useSpellingLocation = true;
                }
                else if (cursor.CursorType.Kind == NClang.TypeKind.Enum)
                {
                    highlightKind = HighlightType.EnumTypeName;
                }
                else if (cursor.CursorType.Kind == NClang.TypeKind.Record && cursor.Spelling.StartsWith("union"))
                {
                    highlightKind = HighlightType.EnumTypeName;
                }
                else
                {
                    highlightKind = HighlightType.ClassName;
                }
                break;

            case NClang.CursorKind.CXXMethod:
            case NClang.CursorKind.FunctionDeclaration:
                useSpellingLocation = true;
                highlightKind       = HighlightType.CallExpression;
                break;

            case NClang.CursorKind.FirstExpression:
                if (parent.Kind == NClang.CursorKind.CallExpression && cursor.CursorType.Kind == NClang.TypeKind.Pointer && cursor.CursorType.PointeeType.Kind == NClang.TypeKind.FunctionProto)
                {
                    useSpellingLocation = true;
                    highlightKind       = HighlightType.CallExpression;
                }
                else
                {
                    return(null);
                }
                break;

            case NClang.CursorKind.MemberReferenceExpression:
                if (parent.Kind == NClang.CursorKind.CallExpression && cursor.CursorType.Kind == NClang.TypeKind.Pointer && cursor.CursorType.PointeeType.Kind == NClang.TypeKind.FunctionProto)
                {
                    useSpellingLocation = true;
                    highlightKind       = HighlightType.CallExpression;
                }
                else if (parent.Kind == NClang.CursorKind.CallExpression && cursor.CursorType.Kind == NClang.TypeKind.Unexposed)
                {
                    useSpellingLocation = true;
                    highlightKind       = HighlightType.CallExpression;
                }
                else
                {
                    return(null);
                }
                break;

            default:
                return(null);
            }

            if (highlightKind == HighlightType.ClassName)
            {
                string spelling = cursor.Spelling;

                if (cursor.Kind == NClang.CursorKind.TypeReference && parent.Kind == NClang.CursorKind.CXXBaseSpecifier)
                {
                    spelling = cursor.Spelling.Replace("class ", string.Empty);
                }
                if (spelling.Length > 1 && spelling.StartsWith("I") && char.IsUpper(spelling[1]))
                {
                    highlightKind = HighlightType.InterfaceName;
                }
            }

            if (useSpellingLocation)
            {
                if (cursor.Kind == NClang.CursorKind.TypeReference && parent.Kind == NClang.CursorKind.CXXBaseSpecifier && cursor.Spelling.StartsWith("class"))
                {
                    return(new OffsetSyntaxHighlightingData()
                    {
                        Start = cursor.Location.SpellingLocation.Offset,
                        Length = cursor.Spelling.Length - 5, // Because spelling includes keyword "class"
                        Type = highlightKind
                    });
                }
                else if ((cursor.Kind == NClang.CursorKind.Destructor || cursor.Kind == NClang.CursorKind.Constructor) && parent.Kind == NClang.CursorKind.ClassTemplate)
                {
                    return(new OffsetSyntaxHighlightingData()
                    {
                        Start = cursor.Location.SpellingLocation.Offset,
                        Length = cursor.Spelling.Length, // TODO select only the name...
                        Type = highlightKind
                    });
                }
                else
                {
                    return(new OffsetSyntaxHighlightingData()
                    {
                        Start = cursor.Location.SpellingLocation.Offset,
                        Length = cursor.Spelling.Length,
                        Type = highlightKind
                    });
                }
            }
            else
            {
                return(new OffsetSyntaxHighlightingData()
                {
                    Start = cursor.CursorExtent.Start.FileLocation.Offset,
                    Length = cursor.CursorExtent.End.FileLocation.Offset - cursor.CursorExtent.Start.FileLocation.Offset,
                    Type = highlightKind
                });
            }
        }
Exemplo n.º 39
0
		public Highlighting(HighlightType type, int position, int length)
		{
			_type = type;
			_position = position;
			_length = length;
		}
Exemplo n.º 40
0
 public HighlightTag(HighlightType type)
     : base(GetFormatNameFromType(type))
 {
 }
        public override void ShowGUI(List<ActionParameter> parameters)
        {
            whatToHighlight = (WhatToHighlight) EditorGUILayout.EnumPopup ("What to highlight:", whatToHighlight);

            if (whatToHighlight == WhatToHighlight.SceneObject)
            {
                parameterID = Action.ChooseParameterGUI ("Object to highlight:", parameters, parameterID, ParameterType.GameObject);
                if (parameterID >= 0)
                {
                    constantID = 0;
                    highlightObject = null;
                }
                else
                {
                    highlightObject = (Highlight) EditorGUILayout.ObjectField ("Object to highlight:", highlightObject, typeof (Highlight), true);

                    constantID = FieldToID <Highlight> (highlightObject, constantID);
                    highlightObject = IDToField <Highlight> (highlightObject, constantID, false);
                }
            }
            else if (whatToHighlight == WhatToHighlight.InventoryItem)
            {
                if (!inventoryManager)
                {
                    inventoryManager = AdvGame.GetReferences ().inventoryManager;
                }

                if (inventoryManager)
                {
                    // Create a string List of the field's names (for the PopUp box)
                    List<string> labelList = new List<string>();

                    int i = 0;
                    if (parameterID == -1)
                    {
                        invNumber = -1;
                    }

                    if (inventoryManager.items.Count > 0)
                    {
                        foreach (InvItem _item in inventoryManager.items)
                        {
                            labelList.Add (_item.label);
                            if (_item.id == invID)
                            {
                                invNumber = i;
                            }
                            i++;
                        }

                        if (invNumber == -1)
                        {
                            ACDebug.LogWarning ("Previously chosen item no longer exists!");
                            invNumber = 0;
                            invID = 0;
                        }

                        //
                        parameterID = Action.ChooseParameterGUI ("Inventory item:", parameters, parameterID, ParameterType.InventoryItem);
                        if (parameterID >= 0)
                        {
                            invNumber = Mathf.Min (invNumber, inventoryManager.items.Count-1);
                            invID = -1;
                        }
                        else
                        {
                            invNumber = EditorGUILayout.Popup ("Inventory item:", invNumber, labelList.ToArray());
                            invID = inventoryManager.items[invNumber].id;
                        }
                        //
                    }

                    else
                    {
                        EditorGUILayout.HelpBox ("No inventory items exist!", MessageType.Info);
                        invID = -1;
                        invNumber = -1;
                    }
                }
            }

            highlightType = (HighlightType) EditorGUILayout.EnumPopup ("Highlight type:", highlightType);
            if (highlightType == HighlightType.Enable || highlightType == HighlightType.Disable)
            {
                isInstant = EditorGUILayout.Toggle ("Is instant?", isInstant);
            }

            AfterRunningOption ();
        }
Exemplo n.º 42
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ColorScheme()
 {
     highlightType = HighlightType.Normal;
 }
		public IBrush GetBrush(HighlightType type)
		{
			IBrush result;

			switch (type)
			{
				case HighlightType.Comment:
					result = CommentBrush;
					break;

				case HighlightType.Identifier:
					result = IdentifierBrush;
					break;

				case HighlightType.Keyword:
					result = KeywordBrush;
					break;

				case HighlightType.Literal:
					result = LiteralBrush;
					break;

                case HighlightType.NumericLiteral:
                    result = NumericLiteralBrush;
                    break;

				case HighlightType.Punctuation:
					result = PunctuationBrush;
					break;

                case HighlightType.InterfaceName:
                    result = InterfaceBrush;
                    break;

				case HighlightType.ClassName:
					result = UserTypeBrush;
					break;

				case HighlightType.CallExpression:
					result = CallExpressionBrush;
					break;

                case HighlightType.EnumTypeName:
                    result = EnumTypeNameBrush;
                    break;

				default:
					result = Brushes.Red;
					break;
			}

			return result;
		}
Exemplo n.º 44
0
        public static Bitmap DrawArrayToBitmap(int canvasWidth, int canvasHeight, int[] arr, HashSet <int> highlightedIndices = null, HighlightType highlightType = HighlightType.Default)
        {
            Bitmap canvas = new Bitmap(canvasWidth, canvasHeight);

            Graphics canvasGraphics = Graphics.FromImage(canvas);

            canvasGraphics.Clear(Color.White);

            StringFormat elementStringFormat = new StringFormat()
            {
                Alignment     = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            };

            Brush borderColor = Brushes.Red;

            for (int i = 0; i < arr.Length; i++)
            {
                HighlightType currentElementHighlight = (highlightedIndices != null && highlightedIndices.Contains(i)) ? highlightType : HighlightType.Default;

                Brush elementColor       = _elementsColorDict[currentElementHighlight];
                Brush elementBorderColor = _elementsBorderColorDict[currentElementHighlight];

                Point position = CalculateElementPosition(canvasWidth, canvasHeight, i);

                Rectangle rectangle = new Rectangle(position.X - INNER_RADIUS, position.Y - INNER_RADIUS, INNER_RADIUS * 2, INNER_RADIUS * 2);

                canvasGraphics.FillEllipse(elementBorderColor, rectangle.Left - BORDER_RADIUS, rectangle.Top - BORDER_RADIUS, rectangle.Width + 2 * BORDER_RADIUS, rectangle.Height + 2 * BORDER_RADIUS);

                canvasGraphics.FillEllipse(Brushes.LightBlue, rectangle);
                canvasGraphics.DrawString(arr[i].ToString(), SystemFonts.DefaultFont, Brushes.Black, rectangle, elementStringFormat);
            }
            return(canvas);
        }