Example #1
0
    /// <summary>
    /// 更换地图
    /// </summary>
    /// <param name="m"></param>
    void ChangeMap(mapType m)
    {
        //tiles.GetComponent<Image>().sprite = Resources.Load<Sprite>("PNG/Tiles/Terrain" + m.ToString()+"/"+m.ToString().ToLower()+"_"+ num.ToString());
        foreach (Transform item in transform)
        {
            int num = UnityEngine.Random.Range(1, 19);

            string path = "Terrain/" + m.ToString() + "/" + m.ToString().ToLower() + "_" + num.ToString("d2");
            Sprite s    = Resources.Load <Sprite>(path);
            item.GetComponent <Image>().sprite = s;
        }
    }
Example #2
0
    IEnumerator Map()
    {
        var url = "http://maps.googleapis.com/maps/api/staticmap";
        var qs  = "";

        if (centerLocation.address != "")
        {
            qs += "center=" + WWW.UnEscapeURL(centerLocation.address);
        }
        else
        {
            qs += "center=" + WWW.UnEscapeURL(string.Format("{0},{1}", centerLocation.latitude, centerLocation.longitude));
        }


        foreach (var i in markers)
        {
            qs += "&markers=" + string.Format("size:{0}|color:{1}|label:{2}", i.size.ToString().ToLower(), i.color, i.label);
            foreach (var loc in i.locations)
            {
                if (loc.address != "")
                {
                    qs += "|" + WWW.UnEscapeURL(loc.address);
                }
                else
                {
                    qs += "|" + WWW.UnEscapeURL(string.Format("{0},{1}", loc.latitude, loc.longitude));
                }
            }
        }


        qs += "&size=" + mapWidth + "x" + mapHeight;
        qs += "&scale=" + (doubleResolution ? "2" : "15");
        qs += "&zoom=" + zoom.ToString();
        qs += "&maptype=" + mapSelected.ToString().ToLower();

        WWW www = new WWW(url + "?" + qs);

        yield return(www);

        img.texture = www.texture;
        img.SetNativeSize();
    }