Exemplo n.º 1
0
    private IEnumerator MostrarImagen(PS2Items item)
    {
        Texture2D texture = new Texture2D(0, 0, TextureFormat.RGBA32, false);

        texture.filterMode = FilterMode.Trilinear;
        var newTexture = new Texture2D(2, 2);

        if (item.Picture == "")
        {
            item.Picture = "http://www.bfegy.com/cdn/7/2014/444/ps2-game-cover-template_179589.jpg";
        }
        WWW www = new WWW(item.Picture);

        yield return(www);

        Debug.Log("Why on earh is this never called?");

        www.LoadImageIntoTexture(texture);

        Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.0f, 0.0f), 1.0f);

        float AR = 0;
        float XX = 0;
        float YY = 0;

        if (texture.height >= 492)
        {
            AR = (float)texture.width / (float)texture.height;
            YY = Mathf.Min(texture.width, (874));
            XX = YY * AR;

            if (XX > 492)
            {
                XX = 492;
                YY = 492 / AR;
            }
        }
        else
        {
            AR = (float)texture.width / (float)texture.height;
            XX = Mathf.Min(texture.width, (492));
            YY = XX / AR;
        }

        PanelVideoImagen.gameObject.GetComponent <RectTransform> ().sizeDelta = new Vector2(XX, Mathf.RoundToInt(YY));
        PanelVideoImagen.gameObject.SetActive(true);
        PanelVideoImagen.sprite = sprite;
    }
Exemplo n.º 2
0
    void Start()
    {
        System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
        FechaHora.text = System.DateTime.Now.AddHours(-3).ToShortTimeString() + "\n" + System.DateTime.Now.AddHours(-3).ToLongDateString();
        StartCoroutine(ActualizarFechaHora());



        if (Application.platform == RuntimePlatform.PS4)
        {
            /*Uncomment when test is sucsesfull */
            try
            {
                FreeMountUsb();
            }
            catch (Exception ex) { txtCamino.text = "Failed to free mount usb's " + ex.Message; }
        }

        string path = @"G:\Games\Playstation\PS2";

        var charDataFile = Resources.Load <TextAsset>("PS2DB");
        //StreamReader reader = new StreamReader(ms, System.Text.Encoding.UTF8, true);
        StreamReader reader = new StreamReader(new MemoryStream(charDataFile.bytes));

        DataTable     dttemp    = ConvertToDataTable(reader);
        List <string> lstofisos = new List <string> ();

        USBType typeofusb = USBType.None;

        string USBPath0    = "/usb0/PS2/";
        string USBPath1    = "/usb1/PS2/";
        string mntUsbPath0 = "mnt/usb0/PS2/";
        string mntUsbPath1 = "mnt/usb0/PS2/";

        if (Directory.Exists(USBPath0) || Directory.Exists(mntUsbPath0))
        {
            typeofusb = USBType.USB0;
        }
        if (Directory.Exists(USBPath1) || Directory.Exists(mntUsbPath1))
        {
            typeofusb = USBType.USB1;
        }
        if (typeofusb == USBType.None)
        {
            //no usb found
            //or no path found
        }



        DirectoryInfo d = null;

        if (typeofusb == USBType.USB0)
        {
            camino = "/usb0/ps2/";
            d      = new DirectoryInfo(USBPath0);
        }

        if (typeofusb == USBType.USB1)
        {
            camino = "/usb1/ps2/";
            d      = new DirectoryInfo(USBPath1);
        }
        if (typeofusb == USBType.None)
        {
            d = new DirectoryInfo(path);
        }
        if (Directory.Exists(d.FullName))
        {
            FileInfo[] fileinfo = d.GetFiles("*.iso");
            foreach (var item in fileinfo)
            {
                //load each ps2 iso item into
                //our custom db
                lstofisos.Add(item.FullName);
            }
        }

        List <PS2Items> items = new List <PS2Items> ();

        for (int i = 0; i < lstofisos.Count; i++)
        {
            //read asb data
            string id          = GetPS2ID(lstofisos [i]);
            var    exmapleitem = new PS2Items();
            exmapleitem.PS2ID = id;
            //exmapleitem.Message = id;// (id,dttemp);
            exmapleitem.Path      = lstofisos[i];
            exmapleitem.PS2_Title = GetNameFromID(id, dttemp);
            exmapleitem.Region    = GetRegionFromID(id, dttemp);
            exmapleitem.Picture   = GetImageFromID(id, dttemp);
            items.Add(exmapleitem);
        }

        listofgames = items;
        CrearDirectorio(items);

        posOriginal  = PanelVideo.transform.localPosition;
        sizeOriginal = PanelVideo.GetComponent <RectTransform>().sizeDelta;
    }