void RenderMidi(SongSelectItemController item, Midi midi)
        {
            item.titleText.text = GetStringOrUnkonwn(midi.name);
            item.line1Text.text = "by " + GetStringOrUnkonwn(midi.artistName);
            item.line2Text.text = " 0   0x   0%";
            item.action         = () => {
                Debug.Log("ShowMidiDetail");
                //level.selectedDownloadedMidi = midi;
                level.selectedMidiId = midi.id;
                level.Push(level.midiDetailPage);
            };

            var coverUrl = midi.coverUrl;

            if (coverUrl != null)
            {
                web.LoadTexture(coverUrl, job => {
                    var texture = job.GetData();
                    item.imageCutter.Cut(job.GetKey(), texture);
                });
            }
            else
            {
                item.imageCutter.Cut(defaultTexture.name, defaultTexture);
            }
        }
Beispiel #2
0
        void RenderMidiListItem(SongSelectItemController item, Storage.Protos.Api.MidiProto midi)
        {
            Debug.Log("Midi list item");

            item.titleText.text = DownloadedSongSelectPageScheduler.GetStringOrUnkonwn(midi.name);
            item.line1Text.text = "by " + DownloadedSongSelectPageScheduler.GetStringOrUnkonwn(midi.artistName);
            item.line2Text.text = string.Format(" {0:N0}   {1:N0}x   {2:F2}%", midi.avgScore, midi.avgCombo, midi.avgAccuracy * 100);
            item.action         = () => {
                if (level.selectedMidiId != midi._id)
                {
                    level.selectedMidiId = midi._id;
                    InitMidiDetail(false);
                    InitMidiRank();
                }
            };

            var coverUrl = midi.coverUrl;

            if (coverUrl != null)
            {
                Debug.Log("Midi cover url");
                Net.WebCache.instance.LoadTexture(coverUrl, job => {
                    item.imageCutter.Cut(job.GetKey(), job.GetData());
                });
            }
            else
            {
                Debug.Log("Cut midi default");
                item.imageCutter.Cut(defaultTexture.name, defaultTexture);
            }
        }
        void RenderAlbum(SongSelectItemController item, Album album)
        {
            item.titleText.text = GetStringOrUnkonwn(album.name);
            item.line1Text.text = album.midiList.Count + " midis";
            item.line2Text.text = "";
            item.action         = () => {
                selectedAlbum = album;
                RenderMidiList();
            };

            var coverUrl = FindFirstCoverUrl(album.midiList);

            if (coverUrl != null)
            {
                web.LoadTexture(coverUrl, job => {
                    var texture = job.GetData();
                    item.imageCutter.Cut(job.GetKey(), texture);
                });
            }
            else
            {
                item.imageCutter.Cut(defaultTexture.name, defaultTexture);
            }
        }