public void SpawnIcon(App app)
    {
        PhysicalAppIcon icon = Instantiate(IconPrefab);

        icon.App = app;
        icon.GetComponent <Transform>().position = GetComponent <Transform>().position;
    }
Example #2
0
    public void Deserialize()
    {
        if (!File.Exists(jsonPath))
        {
            return;
        }

        string json = File.ReadAllText(jsonPath);
        PhysicalIconDataCollection iconData = JsonUtility.FromJson <PhysicalIconDataCollection>(json);
        List <App> apps = Interop.Apps;

        foreach (var data in iconData.Datas)
        {
            App app = apps.First(a => a.PackageName == data.PackageName);
            if (app != null)
            {
                PhysicalAppIcon icon = Instantiate(IconPrefab);
                icon.App = app;
                Transform iconTrans = icon.GetComponent <Transform>();
                iconTrans.position = data.Position;
                iconTrans.rotation = data.Rotation;
            }
        }
    }