private bool CheckSelectItem(itemList _selectedItem, ShopItem _currentShopItem, int _ID) { int isExistNB = checkExistType(_selectedItem, _currentShopItem); for (int i = 0; i < seletedItensArray.Count; i++) { var currentSelected = seletedItensArray[i] as itemList; if (_selectedItem.id == currentSelected.id) { seletedItensArray.RemoveAt(i); seletedIDSArray.RemoveAt(i); setInitClotheByType(_selectedItem.itemtype.ToString()); _currentShopItem.unselectItem(); return(false); } } if (isExistNB != -1) { GameObject oldItem = itensShop[(int)seletedIDSArray[isExistNB]] as GameObject; ShopItem oldShopItem = oldItem.GetComponent <ShopItem>(); oldShopItem.unselectItem(); seletedItensArray.RemoveAt(isExistNB); seletedIDSArray.RemoveAt(isExistNB); } seletedItensArray.Add(_selectedItem); seletedIDSArray.Add(_ID); _currentShopItem.selectItem(); return(true); }
public void runList(itemList currentList) { foreach (item item in currentList.items) { StartCoroutine(startUpTime(item.spawnAfterSeconds, item, currentList.xOffset, currentList.yOffset, currentList.leftSide, currentList.randomizeOffset)); } currentList.alreadyDone = true; }
private void createClothesMenu() { GameObject currentLeftRow = new GameObject(); GameObject currentRigthRow = new GameObject(); numberOfRow = Mathf.Floor((forsale.Length / 6)) + 1; if (forsale.Length % 6 == 0) { numberOfRow -= 1; } int contItens = 0; if (forsale.Length > 0) { for (int i = 0; i < (numberOfRow * 6); i++) { if (contItens == 0) { currentLeftRow = Instantiate(rowShopping, new Vector3(30, 0, 0), Quaternion.identity); currentLeftRow.transform.parent = leftLockerRoom.transform.GetChild(0).GetChild(0);//this.transform; currentRigthRow = Instantiate(rowShopping, new Vector3(30, 0, 0), Quaternion.identity); currentRigthRow.transform.parent = rightLockerRoom.transform.GetChild(0).GetChild(0);//this.transform; } GameObject currentItemShop; bool isPlaceHolder = (i > (forsale.Length - 1)) ? true : false; //(contItens < forsale.Length); itemList currentItemList = new itemList(); if (contItens < 3) { currentItemShop = Instantiate(shopItem, new Vector3(0, 0, 0), Quaternion.identity); currentItemShop.transform.parent = currentLeftRow.transform;//this.transform; } else { currentItemShop = Instantiate(shopItem, new Vector3(0, 0, 0), Quaternion.identity); currentItemShop.transform.parent = currentRigthRow.transform;//this.transform; } if (!isPlaceHolder) { currentItemList = forsale[i]; } setClothes(currentItemShop, isPlaceHolder, currentItemList); itensShop.Add(currentItemShop); contItens++; if (contItens >= 6) { contItens = 0; } } } }
void OnEnable() { if (main != null) { Destroy(this); } else { main = this; } }
private int checkExistType(itemList _selectedItem, ShopItem _currentShopItem) { for (int i = 0; i < seletedItensArray.Count; i++) { itemList currentSelected = seletedItensArray[i] as itemList; if (_selectedItem.itemtype == currentSelected.itemtype && _selectedItem.id != currentSelected.id) { return(i); } } return(-1); }
private void setClothes(GameObject _currentItemShop, bool isPlaceHolder, itemList _currentItemList) { ShopItem currentItem = _currentItemShop.GetComponent <ShopItem>(); if (!isPlaceHolder) { currentItem.setNameItem(_currentItemList.itemName); currentItem.setPriceItem(_currentItemList.price); currentItem.setItemImg(_currentItemList.figure); } else { currentItem.setPlaceHolder(); } }
protected void passiveList_OnItemDataBound(object sender, RepeaterItemEventArgs e) { switch (e.Item.ItemType) { case ListItemType.Header: Literal infocaption = (Literal)e.Item.FindControl("InfoCaption"); Literal TotalCount = (Literal)e.Item.FindControl("TotalCount"); Literal divstart = (Literal)e.Item.FindControl("divStart"); Literal divend = (Literal)e.Item.FindControl("divEnd"); Literal Description = (Literal)e.Item.FindControl("Description"); HyperLink InfoIcon = (HyperLink)e.Item.FindControl("Info"); divstart.Text = "<div id='" + pl.ID + "' class='passiveSectionHeadDescription' style='display: none;'>"; Description.Text = "<div>" + pl.Description + "</div>"; divend.Text = "</div>"; InfoIcon.Attributes.Add("href", "#"); InfoIcon.ImageUrl = Root.Domain + "/profile/modules/passivelist/Images/info.png"; if (pl.TotalCount != string.Empty) { TotalCount.Text = "(" + pl.TotalCount + ")"; } infocaption.Text = pl.InfoCaption; break; case ListItemType.Footer: HyperLink moreurl = (HyperLink)e.Item.FindControl("moreurl"); if (pl.MoreURL.Trim() != string.Empty) { moreurl.NavigateUrl = pl.MoreURL; } else { moreurl.Visible = false; } break; default: itemList il = (itemList)e.Item.DataItem; HyperLink itemurl = (HyperLink)e.Item.FindControl("itemUrl"); itemurl.NavigateUrl = il.ItemURL; itemurl.Text = il.ItemURLText; break; } }
private void Add_Button_Click(object sender, RoutedEventArgs e) { if (_inPlaylist) // neu playlist ton tai thi moi duoc add vao { var screen = new Microsoft.Win32.OpenFileDialog(); screen.Filter = "Mp3 (*.MP3)|*.MP3|" + "All file (*.*)|*.*"; screen.Multiselect = true; // cho phep chon nhieu bai if (screen.ShowDialog() == true) { foreach (var item in screen.FileNames) { var info = new FileInfo(item); _fullPaths.Add(info); Mp3FileReader reader = new Mp3FileReader(info.FullName); TimeSpan duration1 = reader.TotalTime; var time = duration1.TotalSeconds; var filename = _fullPaths[_fullPaths.Count - 1].Name; var converter = new NameConverter(); var shortname = converter.Convert(filename, null, null, null).ToString(); var duration = TimeSpan.FromSeconds(time).ToString(@"mm\:ss"); //Debug.WriteLine($"{shortname}"); var itemBinding = new itemList(); itemBinding.Name = shortname; itemBinding.Index = _fullPaths.Count - 1; itemBinding.Timeduration = duration; items.Add(itemBinding); Indexes.Add(_fullPaths.Count - 1); } } _isPlaying = false; PlayIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Play; } else { System.Windows.MessageBox.Show("Please Create playlist to add file..."); } }
var(itemList, itemListBuffer) = (ValueTuple <List <TItem>, ConcurrentQueue <List <TItem> > >)taskState;
private void Load_button_Click(object sender, RoutedEventArgs e) { var screen = new Microsoft.Win32.OpenFileDialog(); screen.Filter = "Text files (*.TXT)|*.TXT|" + "All file (*.*)|*.*"; if (screen.ShowDialog() == true) { var filename_playlist = screen.FileName; var temp = new FileInfo(filename_playlist); var reader = new StreamReader(filename_playlist); var firstLine = reader.ReadLine(); // luu tong so bai hat co trong playlist if (firstLine == null) { System.Windows.MessageBox.Show("File error! Can't load playlist. Please choose another file.."); } else { if (items.Count > 0) { _player.Pause(); _timer.Stop(); } int count = int.Parse(firstLine); // so luong var FileNameplaylist = temp.Name; var secondLine = reader.ReadLine(); // luu bai hat phat cuoi cung truoc khi save - khong su dung var token = FileNameplaylist.Split(new string[] { "." }, StringSplitOptions.None); name_playlist.Text = token[0]; _fullPaths = new List <FileInfo>(); items = new BindingList <itemList>(); Indexes = new List <int>(); _lastIndex = -1; _isPlaying = false; PlayIcon.Kind = MaterialDesignThemes.Wpf.PackIconKind.Play; _isShuffle = false; _inPlaylist = true; // == 1:lap vo tan ; == 0: lap 1 lans _modeReplay = -1; for (int i = 0; i < count; i++) { var info = new FileInfo(reader.ReadLine()); _fullPaths.Add(info); Mp3FileReader reader1 = new Mp3FileReader(info.FullName); TimeSpan duration1 = reader1.TotalTime; var time = duration1.TotalSeconds; var filename = _fullPaths[_fullPaths.Count - 1].Name; var converter = new NameConverter(); var shortname = converter.Convert(filename, null, null, null).ToString(); var duration = TimeSpan.FromSeconds(time).ToString(@"mm\:ss"); //Debug.WriteLine($"{shortname}"); var itemBinding = new itemList(); itemBinding.Name = shortname; itemBinding.Index = _fullPaths.Count - 1; itemBinding.Timeduration = duration; items.Add(itemBinding); Indexes.Add(_fullPaths.Count - 1); // } listmusic_playlist.ItemsSource = items; } System.Windows.MessageBox.Show("Load thanh cong"); } else { // Khong load file } }
private void Window_Loaded(object sender, RoutedEventArgs e) { string load_playlist = isLastPlayList(); if (load_playlist == "") { System.Windows.MessageBox.Show("Khong co playlist de load"); } else { var reader = new StreamReader(load_playlist); var firstLine = reader.ReadLine(); // luu tong so bai hat co trong playlist if (firstLine == null) { System.Windows.MessageBox.Show("File error! Can't load playlist. Please choose another file.."); } else { int count = int.Parse(firstLine); // so luong var secondLine = reader.ReadLine(); // luu bai hat phat cuoi cung truoc khi save - khong su dung var token = load_playlist.Split(new string[] { "." }, StringSplitOptions.None); // tach .txt name_playlist.Text = token[0]; var curSong = new FileInfo(secondLine); var nameSong = curSong.Name; var converter1 = new NameConverter(); var shortnameSong = converter1.Convert(nameSong, null, null, null).ToString(); NameSong.Text = shortnameSong; _fullPaths = new List <FileInfo>(); items = new BindingList <itemList>(); Indexes = new List <int>(); _lastIndex = -1; _isPlaying = false; _isShuffle = false; _inPlaylist = true; //== 1:lap vo tan ; == 0: lap 1 lans _modeReplay = -1; for (int i = 0; i < count; i++) { var info = new FileInfo(reader.ReadLine()); _fullPaths.Add(info); var filename = _fullPaths[_fullPaths.Count - 1].Name; if (filename == curSong.Name) // tim index { _lastIndex = i; // cap nhat lastIndex // MessageBox.Show($"{_lastIndex}"); } var converter = new NameConverter(); var shortname = converter.Convert(filename, null, null, null).ToString(); Mp3FileReader reader_mp3 = new Mp3FileReader(info.FullName); TimeSpan duration1 = reader_mp3.TotalTime; var time = duration1.TotalSeconds; var duration = TimeSpan.FromSeconds(time).ToString(@"mm\:ss"); //Debug.WriteLine($"{shortname}"); var itemBinding = new itemList(); itemBinding.Name = shortname; itemBinding.Index = _fullPaths.Count - 1; itemBinding.Timeduration = duration; items.Add(itemBinding); Indexes.Add(_fullPaths.Count - 1); } listmusic_playlist.ItemsSource = items; _isLoaded = true; System.Windows.MessageBox.Show("Load successfully.."); } } }