[TASK] Initial commit with basic product setup

This commit is contained in:
2019-08-18 13:50:14 +02:00
commit 01a66a8e1f
2548 changed files with 167528 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
namespace Mapbox.Examples
{
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Mapbox.Unity.MeshGeneration.Interfaces;
public class MakiHelper : MonoBehaviour, IFeaturePropertySettable
{
public static RectTransform Parent;
public static GameObject UiPrefab;
private GameObject _uiObject;
public void Set(Dictionary<string, object> props)
{
if (Parent == null)
{
var canv = GameObject.Find("PoiCanvas");
var ob = new GameObject("PoiContainer");
ob.transform.SetParent(canv.transform);
Parent = ob.AddComponent<RectTransform>();
UiPrefab = Resources.Load<GameObject>("MakiUiPrefab");
}
if (props.ContainsKey("maki"))
{
_uiObject = Instantiate(UiPrefab);
_uiObject.transform.SetParent(Parent);
_uiObject.transform.Find("Image").GetComponent<Image>().sprite = Resources.Load<Sprite>("maki/" + props["maki"].ToString() + "-15");
if (props.ContainsKey("name"))
{
_uiObject.GetComponentInChildren<Text>().text = props["name"].ToString();
}
}
}
public void LateUpdate()
{
if (_uiObject)
_uiObject.transform.position = Camera.main.WorldToScreenPoint(transform.position);
}
}
}