Example #1
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     if (_name != "add")
     {
         itemBeingDragged = this;
         startPosition    = transform.position;
         dragging         = true;
         GetComponent <CanvasGroup>().blocksRaycasts = false;
         LauncherObject.iconIsTrashCan = true;
     }
 }
Example #2
0
 public void DeregisterApp(LauncherAppIcon app)
 {
     //Debug.Log("Removing " + app._name);
     for (int i = 0; i < apps.Count; i++)
     {
         if (apps[i]._name == app._name)
         {
             apps.RemoveAt(i); break;
         }
     }
     UpdateIcons();
 }
Example #3
0
    public void CreateApplication()
    {
        LauncherAppIcon app = new LauncherAppIcon {
            title     = title.text,
            _name     = _name.text,
            path      = path.text,
            arguments = arguments.text,
            icon      = LoadPNG(iconPath.text)
        };

        LauncherObject.RegisterApp(app);
        Quit();
    }
Example #4
0
    public Texture2D LoadPNG(string filePath)
    {
        Texture2D tex = null;

        byte[] fileData;
        if (File.Exists(filePath))
        {
            fileData = File.ReadAllBytes(filePath);
            tex      = new Texture2D(2, 2);
            tex.LoadImage(fileData); //..this will auto-resize the texture dimensions.
            tex = LauncherAppIcon.Resize(tex, 48, 48);
        }
        return(tex);
    }
Example #5
0
    // Use this for initialization
    void Start()
    {
        string textureString = PlayerPrefs.GetString("Wallpaper");

        if (textureString != "")
        {
            XmlSerializer xmlDeserializer = new XmlSerializer(typeof(Wallpaper));
            using (TextReader reader = new StringReader(textureString)) {
                Wallpaper retval;
                try {
                    retval = xmlDeserializer.Deserialize(reader) as Wallpaper;
                } catch (Exception e) {
                    Debug.LogError("Could not load wallpaper from XML: " + e.Message + ".\nXML: " + textureString);
                    return;
                }
                texture = new Texture2D(48, 48);
                texture.LoadImage(retval.data);
                texture      = LauncherAppIcon.Resize(texture, Screen.width, Screen.height);
                textureIsNew = true;
            }
        }
    }
Example #6
0
 public void RegisterApp(LauncherAppIcon app)
 {
     apps.Add(app);
     UpdateIcons();
 }