public override void Cancel(BaseScene.INPUT_TYPE type, JoystickManager.JOYSTICK_KEY_STATE keyState, JoystickManager.PLAYER_INDEX player) { if (SongCard.IsDownloading()) { if (!buyConfirm.gameObject.activeSelf) { buyConfirm.Show(() => { list.CancelDownload(); }, "正在下载,是否取消?"); } else { buyConfirm.gameObject.SetActive(false); } return; } Sounder.instance.Play("返回按键"); if (buyConfirm.gameObject.activeSelf) { buyConfirm.gameObject.SetActive(false); } else if (alert.gameObject.activeSelf) { alert.gameObject.SetActive(false); return; } else { LoadLevel("Title", false); } }
public override void PressEnter(BaseScene.INPUT_TYPE type, JoystickManager.JOYSTICK_KEY_STATE keyState, JoystickManager.PLAYER_INDEX player) { if (SongCard.IsDownloading()) { if (buyConfirm.gameObject.activeSelf) { buyConfirm.Press(); } return; } if (buyConfirm.gameObject.activeSelf) { buyConfirm.Press(); } else if (alert.gameObject.activeSelf) { alert.gameObject.SetActive(false); return; } else { if (list.Press()) { GoNext(); } } }
internal void CancelDownload() { if (SongCard.cancelCallback != null) { SongCard.cancelCallback(); } downloading = false; }
void Download(SongCard card) { downloading = true; card.Press((b) => { if (b) { LoadCover(); } downloading = false; }); }
public override void Move(int x, int y, BaseScene.INPUT_TYPE type, JoystickManager.JOYSTICK_KEY_STATE keyState, JoystickManager.PLAYER_INDEX player) { if (!GetCanPress()) { return; } if (SongCard.IsDownloading()) { if (buyConfirm.gameObject.activeSelf) { buyConfirm.Move(x); } return; } if (buyConfirm.gameObject.activeSelf) { buyConfirm.Move(x); } else if (alert.gameObject.activeSelf) { return; } else { Sounder.instance.Play("歌曲切换音效"); if (list.downloading) { return; } if (x != 0) { difficult.Move(x); } else if (y != 0) { list.Move(y); } } }
internal bool Press() { SongCard card = curCard; if (card.isDownloaded && DataUtils.GetSongBuy(card.data)) { return(true); } bool needBuy = card.data.price != 0 && !DataUtils.GetSongBuy(card.data); bool hasMoney = DataUtils.GetMoney() >= card.data.price; if (needBuy) { if (hasMoney) { SongListMain.instance.buyConfirm.Show(() => { DataUtils.SetSongBuy(card.data); DataUtils.AddMoney(-card.data.price); card.CheckBuy(); Download(card); Sounder.instance.Play("购买歌曲音效"); }, "使用" + DataUtils.SONG_MONEY + "音乐币购买此音乐"); } else { SongListMain.instance.Alert("每首歌需要100音乐币,您的音乐币不足!"); Sounder.instance.Play("BAD音效"); } } else { Download(card); } return(false); }
private void New_Click(object sender, RoutedEventArgs e) { Songs song1 = new Songs(); SongCard song = new SongCard() { Margin = new Thickness(25) }; var currentPage = ((MainWindow)Application.Current.MainWindow).CurrentPage.Content; if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "AnonimPage")) { song.Add.Visibility = Visibility.Hidden; song.Tresh.Visibility = Visibility.Hidden; song.Pen.Visibility = Visibility.Hidden; song.Visibility = Visibility.Collapsed; } else if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "UserPage")) { song.Add.Visibility = Visibility.Visible; song.Tresh.Visibility = Visibility.Collapsed; song.Pen.Visibility = Visibility.Collapsed; song.Visibility = Visibility.Collapsed; } else if (currentPage == null || (currentPage != null && currentPage.GetType().Name == "AdminPage")) { song.Add.Visibility = Visibility.Hidden; song.Tresh.Visibility = Visibility.Visible; song.Pen.Visibility = Visibility.Visible; song.Visibility = Visibility.Visible; } db.Songs.Add(song1); db.SaveChanges(); db.Songs.Load(); SearchResultList.ItemsSource = db.Songs.Local; }
// Update is called once per frame void FixedUpdate() { if (cards == null || cards.Count == 0 || !initComplete || !isScroll) { return; } if (selectIndex < 0) { selectIndex = 0; } else if (selectIndex >= dataList.Count) { selectIndex = dataList.Count - 1; } float ty = -cards[0].index * cardHeight; float tx = -cards[0].index * xOffset; Vector3 temp = Vector3.one; float selectedY = 0; float selectedX = 0; for (int i = 0; i < cards.Count; i++) { SongCard go = cards[i]; if (go.resetPositionNow) { temp.Set(tx, ty, 0); go.transform.localPosition = temp; go.resetPositionNow = false; } else { temp.Set(tx, go.gameObject.transform.localPosition.y + (ty - go.gameObject.transform.localPosition.y) * speed, 0); go.transform.localPosition = temp; } go.SetHover(go.index == selectIndex); if (reach == REACH_STATE.NONE && Mathf.Abs(ty - go.gameObject.transform.localPosition.y) < 0.1f) { reach = REACH_STATE.REACH; } float targetS = 1; if (go.index == selectIndex) { curCard = go; selectedX = go.transform.localPosition.x; selectedY = go.transform.localPosition.y; targetS = 1.25f; ty -= oneOffset; } else if (go.index == (selectIndex - 1)) { ty -= oneOffset * 1.2f; targetS = 1.1f; } else if (go.index == (selectIndex + 1)) { targetS = 1.1f; ty -= oneOffset * 0.5f; } else if (i == (selectIndex - 2)) { ty -= oneOffset * 0.5f; } temp.Set(go.transform.localScale.x + (targetS - go.transform.localScale.x) * speed, go.transform.localScale.y + (targetS - go.transform.localScale.y) * speed, 1); go.transform.localScale = temp; ty -= (i == selectIndex ? hoverH : normalH) - yOffset; tx -= xOffset; } if (reach == REACH_STATE.REACH) { SongCard g; if (direction < 0) { //向上加 if (cards[0].index > 0) { g = cards[cards.Count - 1]; if (selectIndex <= (dataList.Count - upDownLeave - 1)) { g.SetData(dataList[cards[0].index - 1]); g.resetPositionNow = true; cards.RemoveAt(cards.Count - 1); cards.Insert(0, g); } } } else if (direction > 0) { if ((cards[cards.Count - 1].index + 1) < dataList.Count) { g = cards[0]; if (selectIndex >= upDownLeave) { SongCard sc = cards[cards.Count - 1]; SongData nextData = dataList[sc.data.index + 1]; g.SetData(nextData); g.resetPositionNow = true; cards.RemoveAt(0); cards.Add(g); } } } reach = REACH_STATE.DONE; } temp.Set(transform.localPosition.x + (bornPos.x - selectedX - transform.localPosition.x) * speed, transform.localPosition.y + (-selectedY + hight - transform.localPosition.y) * speed, 0); transform.localPosition = temp; if (firstTime) { speed = .3f; firstTime = false; } }
public async Task UpdateLastPlayedList() { for (int i = 1; i < Variables.PreviouslyPlayed.Count; i++) { switch (i) { case 1: if (Recent1 != null) { Recent1.RemoveFromSuperview(); Recent1.Dispose(); } UIImage one = await Functions.LoadImage(Variables.PreviouslyPlayed[1].AlbumImage); Recent1 = new SongCard(one, Variables.PreviouslyPlayed[1], (float)(Variables.ScreenWidth * .042f), (float)(Variables.ScreenHeight * .75f), (float)(Variables.ScreenWidth * .20f), (float)(Variables.ScreenHeight * .12f)); Recent1.SongClicked += songCardClicked; Recent1.Frame = new CGRect(x: Variables.ScreenWidth * .042, y: (Variables.ScreenHeight * .775), width: (float)(Variables.ScreenWidth * .20f), height: (float)(Variables.ScreenHeight * .12f)); //Recent1.PresentLyrics += asynx; View.AddSubview(Recent1); break; case 2: if (Recent2 != null) { Recent2.RemoveFromSuperview(); Recent2.Dispose(); } UIImage two = await Functions.LoadImage(Variables.PreviouslyPlayed[2].AlbumImage); Recent2 = new SongCard(two, Variables.PreviouslyPlayed[2], (float)(Variables.ScreenWidth * .042f), (float)(Variables.ScreenHeight * .75f), (float)(Variables.ScreenWidth * .20f), (float)(Variables.ScreenHeight * .12f)); Recent2.SongClicked += songCardClicked; Recent2.Frame = new CGRect(x: Variables.ScreenWidth * .042 + (Variables.ScreenWidth * .20f) + Variables.ScreenWidth * .03, y: (Variables.ScreenHeight * .775), width: (float)(Variables.ScreenWidth * .20f), height: (float)(Variables.ScreenHeight * .12f)); View.AddSubview(Recent2); break; case 3: if (Recent3 != null) { Recent3.RemoveFromSuperview(); Recent3.Dispose(); } UIImage three = await Functions.LoadImage(Variables.PreviouslyPlayed[3].AlbumImage); Recent3 = new SongCard(three, Variables.PreviouslyPlayed[3], (float)(Variables.ScreenWidth * .042f), (float)(Variables.ScreenHeight * .75f), (float)(Variables.ScreenWidth * .20f), (float)(Variables.ScreenHeight * .12f)); Recent3.SongClicked += songCardClicked; Recent3.Frame = new CGRect(x: Variables.ScreenWidth * .042 + ((Variables.ScreenWidth * .20f) * 2) + ((Variables.ScreenWidth * .03) * 2), y: (Variables.ScreenHeight * .775), width: (float)(Variables.ScreenWidth * .20f), height: (float)(Variables.ScreenHeight * .12f)); View.AddSubview(Recent3); break; case 4: if (Recent4 != null) { Recent4.RemoveFromSuperview(); Recent4.Dispose(); } UIImage four = await Functions.LoadImage(Variables.PreviouslyPlayed[4].AlbumImage); Recent4 = new SongCard(four, Variables.PreviouslyPlayed[4], (float)(Variables.ScreenWidth * .042f), (float)(Variables.ScreenHeight * .75f), (float)(Variables.ScreenWidth * .20f), (float)(Variables.ScreenHeight * .12f)); Recent4.SongClicked += songCardClicked; Recent4.Frame = new CGRect(x: Variables.ScreenWidth * .042 + ((Variables.ScreenWidth * .20f) * 3) + ((Variables.ScreenWidth * .03) * 3), y: (Variables.ScreenHeight * .775), width: (float)(Variables.ScreenWidth * .20f), height: (float)(Variables.ScreenHeight * .12f)); View.AddSubview(Recent4); break; } } }