Esempio n. 1
0
        private void LoadApps(bool force)
        {
            if (!DPSettings.isLoaded)
            {
                return;
            }

            if (force)
            {
                foreach (Transform t in _favoriteAppsTrans)
                {
                    Destroy(t.gameObject);
                }

                foreach (Transform t in _appsTrans)
                {
                    Destroy(t.gameObject);
                }

                favoriteApps.Clear();
                apps.Clear();
            }

            foreach (StartMenuAppSer appSer in DPSettings.config.startMenu.apps)
            {
                //See if the app is already added:
                AppIcon app    = null;
                AppIcon favApp = null;

                bool found = false;
                foreach (AppIcon temp in apps)
                {
                    if (temp.appKey == appSer.appKey)
                    {
                        app   = temp;
                        found = true;
                        break;
                    }
                }

                //If we found the main icon exists, we need to find the identical favorite app icon (if needed)
                if (found && appSer.isFavorite)
                {
                    foreach (AppIcon temp in favoriteApps)
                    {
                        if (temp.appKey == appSer.appKey)
                        {
                            favApp = temp;
                            break;
                        }
                    }
                }

                if (!found)
                {
                    app = Instantiate(_appIconPF, _appsTrans).GetComponent <AppIcon>();
                    apps.Add(app);

                    if (appSer.isFavorite)
                    {
                        favApp = Instantiate(_appIconPF, _favoriteAppsTrans).GetComponent <AppIcon>();
                        favoriteApps.Add(favApp);
                    }
                }

                app.appKey = appSer.appKey;
                app.SetIsFavorite(appSer.isFavorite);
                app.SetIsCustomApp(appSer.isCustomApp);
                app.icon.texture = _customAppManager.FetchAppIcon(app.appKey);
                app.filePath     = appSer.filePath;
                app.text.SetText(appSer.appTitle);

                if (favApp != null)
                {
                    favApp.appKey = appSer.appKey;
                    favApp.SetIsFavorite(true);
                    favApp.SetIsCustomApp(appSer.isCustomApp);
                    favApp.icon.texture = _customAppManager.FetchAppIcon(app.appKey);
                    favApp.filePath     = appSer.filePath;
                    favApp.text.SetText(appSer.appTitle);
                }
            }

            loaded = true;
        }
Esempio n. 2
0
 public void LaunchAppIcon(AppIcon appIcon)
 {
 }