Search Unity

App bad running in PSV....

Discussion in 'PSM' started by MikiraSora0409, Feb 21, 2015.

  1. MikiraSora0409

    MikiraSora0409

    Joined:
    Feb 8, 2015
    Posts:
    1
    Hey guys,I'm a newbie and studying anything about 2D and unity. :D
    But I have a serious trouble with running 2D game application in PSV.When I run in Unity Editor mode ,it's fine.

    but run in PSV...

    it makes me so mad almsot......I dont sure what kind of error was happen(include mp3audio cant play).Maybe I almost use NGUI(3.6.8).
    and maybe I set a wrong path without manul.So I parse IO codes and check them if they wrong...


    Codes about IO:
    Code (CSharp):
    1. public void ChangeBackgroudPic(Dictionary<string, string> BeatmapInfoDic) {
    2.         string picName = BeatmapInfoDic[@"BackgroudPicName"];
    3.         picName = picName.Replace(@".jpg",string.Empty);
    4.         string id = BeatmapInfoDic[@"BeatmapSetID"];
    5.         var tex = Resources.Load(id + @"/" + picName,typeof(Texture))as Texture;  
    6.         gameObject.GetComponent<UITexture>().mainTexture = tex;/*
    7.         float targerX = 960;
    8.         float targerY = 544;
    9.         float m_Scale_X;
    10.         float m_Scale_Y;
    11.         m_Scale_X = targerX / 960.0f;
    12.         m_Scale_Y = targerY / 544.0f;
    13.         if (m_Scale_X == 0)
    14.             Debug.LogError(@"m_Scale_X=0!");
    15.         if (m_Scale_Y == 0)
    16.             Debug.LogError(@"m_Scale_Y=0!");
    17.         if ((m_Scale_X == 0) || (m_Scale_Y == 0))
    18.             return;*/
    19.         Rect rect=new Rect();
    20.  
    21.         float texH = tex.height;
    22.         float texW = tex.width;
    23.         float widW = 960.0f;
    24.         float fixedH=544.0f; //
    25.         if (texW > widW)
    26.         {
    27.             float widH = widW * texH / texW / fixedH;
    28.  
    29.             rect.height = widH;
    30.             rect.width = 1;
    31.             rect.x = 0;
    32.             rect.y = (1 - widH) / 2;
    33.         }
    34.         else {//I dont know how to clip:P
    35.             rect.height = 1;
    36.             rect.width = 1;
    37.             rect.x = 0;
    38.             rect.y = 0;
    39.         }
    40.        
    41.  
    42.         gameObject.GetComponent<UITexture>().uvRect = rect;
    43.     }
    44. }
    Code (CSharp):
    1. public void ChangeAudio(Dictionary<string, string> BeatmapInfoDic) {
    2.         var audio = BeatmapInfoDic[@"AudioFilename"];
    3.         audio=audio.Replace(@".mp3",string.Empty);
    4.         var id = BeatmapInfoDic[@"BeatmapSetID"];
    5.         var previewtime = BeatmapInfoDic[@"PreviewTime"];
    6.         var path =id + @"/" + audio;
    7.        
    8.             if(/*string.Compare(previousPath,path)!=0*/id!=previousID){
    9.                 Resources.UnloadAsset(audioClip);
    10.                 previousID = id;
    11.                 //var path = audio;
    12.  
    13.                 audioClip = Resources.Load(path,typeof(AudioClip)) as AudioClip;
    14.  
    15.                 //Debug.Log(@"ClipLength="+audioClip.length);
    16.                 source.clip = audioClip;
    17.                 source.volume = 0;
    18.                 source.time =float.Parse(previewtime)/ 1000.0f;
    19.                 source.SetScheduledStartTime(Convert.ToDouble(source.time));
    20.                 source.SetScheduledEndTime(Convert.ToDouble(audioClip.length));
    21.        
    22.                 source.loop = true;
    23.                 source.Play();
    24.            
    25.         }
    26.            
    27.      
    28.     }
    Please excuse my English:p