Пример #1
0
    private void gameEnd()//游戏结束
    {
        isEnd = true;

        RankList rankList = GameObject.Find("RankListDialog").GetComponent <RankList>();
        string   str      = jo.Call <String>("Game_End_Info");

        jo.Call("recyclerview_addItem", str);
        string[] data = str.Split(' ');
        for (int i = 0; i < 4; i++)
        {
            //rank,color,playerName,score,chessNum,totalTime
            rankList.inputRankItem(int.Parse(data[i * 6 + 0]), int.Parse(data[i * 6 + 1]), data[i * 6 + 2],
                                   int.Parse(data[i * 6 + 3]), int.Parse(data[i * 6 + 4]), data[i * 6 + 5]);
        }
        //rankList.testRankList();//插入数据,测试用
        rankList.enableRankListDialog();//显示
        UnityEngine.Object tmpSong = Resources.Load <AudioClip>("Audios/Victory");
        //UnityEngine.Object tmpVictorySong = UnityEditor.AssetDatabase.LoadAssetAtPath("Assets/Audios/Victory.mp3", typeof(AudioClip));
        AudioSource music = GameObject.Find("BGMusic").GetComponent <AudioSource>();

        music.clip = (AudioClip)Instantiate(tmpSong); //切歌
        music.Play();                                 //放歌
    }