<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — PLease insert this if I am wrong]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=187&amp;type=atom" />
	<updated>2016-07-18T13:34:03Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=187</id>
		<entry>
			<title type="html"><![CDATA[Re: PLease insert this if I am wrong]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=858#p858" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Full example below.<br />This example is made for Online Maps v2.4. The new method is much shorter, faster and easier.<br />So, if you use Online Maps v2.3, please update through the built-in update system.</p><p>Why do you want to use it as an overlay?<br />This overlay completely hide the map, and can be used as base tiles.</p><p>Example:<br /></p><div class="codebox"><pre><code>using System.Collections.Generic;
using UnityEngine;

namespace InfinityCode.OnlineMapsExamples
{
    public class TilesetMapTilerOverlayExample3 : MonoBehaviour
    {
        private List&lt;OverlayItem&gt; loadingOverlays;

        private void CheckDownloadComplete()
        {
            bool hasComplete = false;
            foreach (OverlayItem data in loadingOverlays)
            {
                if (data.www.isDone)
                {
                    if (string.IsNullOrEmpty(data.www.error))
                    {
                        Texture2D texture = new Texture2D(256, 256, TextureFormat.ARGB32, false);
                        data.www.LoadImageIntoTexture(texture);
                        data.tile.overlayBackTexture = texture;
                    }
                    data.Dispose();
                    hasComplete = true;
                }
            }

            if (hasComplete) loadingOverlays.RemoveAll(d =&gt; d.tile == null);
        }

        private void OnStartDownloadTile(OnlineMapsTile tile)
        {
            loadingOverlays.Add(new OverlayItem(tile));
            OnlineMaps.instance.StartDownloadTile(tile);
        }

        private void Start()
        {
            loadingOverlays = new List&lt;OverlayItem&gt;();
            OnlineMaps.instance.OnStartDownloadTile += OnStartDownloadTile;
        }

        private void Update()
        {
            CheckDownloadComplete();
        }

        internal class OverlayItem
        {
            public OnlineMapsWWW www;
            public OnlineMapsTile tile;

            public OverlayItem(OnlineMapsTile tile)
            {
                this.tile = tile;
                www = OnlineMapsUtils.GetWWW(string.Format(&quot;http://tile2.opencyclemap.org/Outdoors/{0}/{1}/{2}.png&quot;, tile.zoom, tile.x, tile.y));
            }

            public void Dispose()
            {
                www.Dispose();
                www = null;
                tile = null;
            }
        }
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-07-18T13:34:03Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=858#p858</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PLease insert this if I am wrong]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=853#p853" />
			<content type="html"><![CDATA[<p>I can not achive, I am not C# expert why do not you give me one line code sample ? <br /><a href="http://tile2.opencyclemap.org/Outdoors/{zoom}/{x}/{y}.png">http://tile2.opencyclemap.org/Outdoors/ … x}/{y}.png</a><br />could you please insert this line in the code of ...<br />TilesetMapTilerOverlayExample.cs .Thanks...</p>]]></content>
			<author>
				<name><![CDATA[gokhanaltintas]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=166</uri>
			</author>
			<updated>2016-07-18T00:32:25Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=853#p853</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: PLease insert this if I am wrong]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=846#p846" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Resources.Load - loads an asset stored at path in a Resources folder.<br /><a href="https://docs.unity3d.com/ScriptReference/Resources.Load.html">https://docs.unity3d.com/ScriptReferenc … .Load.html</a></p><p>If you want to load overlay from the url, use OnlineMapsUtils.GetWWW.<br /><a href="http://infinity-code.com/doxygen/online-maps/classOnlineMapsUtils.html#a6385d6bcea326996cffc2d8f230fe2ca">http://infinity-code.com/doxygen/online … 8f230fe2ca</a></p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2016-07-16T15:50:36Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=846#p846</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[PLease insert this if I am wrong]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=845#p845" />
			<content type="html"><![CDATA[<p>Resources.Load&lt;Texture2D&gt;(string.Format(&quot;OnlineMapsOverlay/{0}/{1}/{2}&quot;, tile.zoom, tile.x,tile.y));<br />Noting is worked may be I have syntax error.<br />can you insert this into above format I awant to overlay this ... only need format...<br /><a href="http://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{zoom}/{y}/{x}">http://services.arcgisonline.com/arcgis … m}/{y}/{x}</a></p><br /><p>....................<br />Resources.Load&lt;Texture2D&gt;(string.Format(&quot;http://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{0}/{1}/{2}&quot;, tile.zoom, tile.x,tile.y));<br />???<br />Resources.Load&lt;Texture2D&gt;(string.Format(&quot;http://services.arcgisonline.com/arcgis/rest/services/World_Physical_Map/MapServer/tile/{0}/{1}/{2}.png&quot;, tile.zoom, tile.x,tile.y));<br />????<br />etcccc</p>]]></content>
			<author>
				<name><![CDATA[gokhanaltintas]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=166</uri>
			</author>
			<updated>2016-07-15T15:53:40Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=845#p845</id>
		</entry>
</feed>
