// Use this for initialization
    void Start()
    {
        filePath = filePath.Replace("\"", "");
        if (File.Exists(filePath))
        {
            iconVisual.material.mainTexture = Rainity.GetFileIcon(filePath);
            //border.material.SetColor("_Color", Rainity.GetAverageColorOfTexture((Texture2D)iconVisual.material.mainTexture));
        }
        else
        {
            UnityEngine.Debug.Log("Please assign a valid file path to the ProgramIcon script on " + transform.name + ".");
        }

        iconParent = transform.GetChild(0);
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        //Set file icon texture demonstration
        if (File.Exists(Environment.SystemDirectory + "\\notepad.exe"))
        {
            iconRenderer.material.mainTexture = Rainity.GetFileIcon(Environment.SystemDirectory + "\\notepad.exe");
        }
        //Set wallpaper image texture demonstration
        wallpaperRenderer.material.mainTexture = Rainity.GetWallpaperImage();
        //Set user avatar texture demonstration
        avatarRenderer.material.mainTexture = Rainity.GetUserAvatar();

        //Create system tray icon (standalone only, editor causes random crashes)
        tray = Rainity.CreateSystemTrayIcon();
        if (tray != null)
        {
            tray.AddItem("Context menu items with attached functions!", ExitApplication);
            tray.AddSeparator();
            tray.AddItem("Exit", ExitApplication);

            tray.SetTitle("Rainity Demo Application");
        }

        //Get information about the weather and assign text
        WeatherObject weather = Rainity.GetWeatherInformation();

        weather_cityState.text   = weather.query.results.channel.location.city + ", " + weather.query.results.channel.location.region;
        weather_temperature.text = weather.query.results.channel.item.condition.temp + "°" + weather.query.results.channel.units.temperature;
        weather_condition.text   = weather.query.results.channel.item.condition.text;
        weather_windSpeed.text   = "Wind speed: " + weather.query.results.channel.wind.speed + weather.query.results.channel.units.speed;

        RainityFile[] files = Rainity.GetFiles("C:\\Users\\Christian\\Desktop");
        foreach (RainityFile file in files)
        {
            Debug.Log(file.fileName);
        }
    }