Topic: A Picture is worth...

a thousand lines of code, and a whole lot of thanks!

I figure you guys don't get to see too much in the way of what your users do with your hard work, so I wanted to post this as a way to say thanks for the asset, and especially thanks for the support here in the forums.

These are player generated city icons as NGUI layered sprite markers overlaying a google map that had their positions validated as valid by the "detect water by texture" example.

Not counting "I don't know what the hell I'm doing!" time, the map portions took about 6 hours total. When I did this in a browser via javascript, it took me at least 3 days worth of coding to get something not nearly as nice.

Post's attachments

Attachment icon first unity screenshot.png 250.05 kb, 119 downloads since 2016-03-05 

Re: A Picture is worth...

I am having one issue however with the NGUI marker system example:

At zoom level 3, if I scroll the map horizontally to the left, when my markers approach the right side of the screen window my markers all teleport out into the middle of the ocean (see image attached).

I'm pretty sure it has to do with the  "p.x += 360;" code in the example below, but I'm not sure what this was intended to do, so I'm not sure how to fix it. Any thoughts?

        private void OnMapUpdated()
        {
            Vector2 tl = OnlineMaps.instance.topLeftPosition;
            Vector2 br = OnlineMaps.instance.bottomRightPosition;

            Rect rect = new Rect(tl.x, br.y, br.x - tl.x, tl.y - br.y);
            if (rect.width < 0) rect.width += 360;
            // eventually need to iterate over all marker lists
            foreach (CityMarker marker in cityMarkers)
            {
                Vector2 p = marker.position;
                GameObject go = marker.gameObject;

                if (!rect.Contains(p))
                {
                    p.x += 360;

                    if (!rect.Contains(p))
                    {
                        if (go.activeSelf) go.SetActive(false);
                        continue;
                    }
                }

                if (!go.activeSelf) go.SetActive(true);
Post's attachments

Attachment icon teleporting markers.png 60 kb, 121 downloads since 2016-03-06 

Re: A Picture is worth...

Hello.

Yes you are right. The problem was in this line.
Fixed a bug in the example (attached).

Post's attachments

Attachment icon NGUICustomMarkerSystemExample.cs 2.97 kb, 374 downloads since 2016-03-07 

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: A Picture is worth...

Alex Vertax wrote:

Hello.

Yes you are right. The problem was in this line.
Fixed a bug in the example (attached).

Perfect, works like a charm. Thanks again!