private void OnSelectpage(int ie, bool press) { if (mPageIndex == PackPage.Page1) { mPageIndex = PackPage.Page2; } else { mPageIndex = PackPage.Page1; } switch (mPageIndex) { case PackPage.Page1: mSpritePage.ElementAt(0).gameObject.SetActive(true); mSpritePage.ElementAt(1).gameObject.SetActive(false); break; case PackPage.Page2: mSpritePage.ElementAt(0).gameObject.SetActive(false); mSpritePage.ElementAt(1).gameObject.SetActive(true); break; } UpdatePack(mPageIndex); ShowAllItemCost(); }
private void StartButton_Click(object sender, RoutedEventArgs e) { if (repository.FindUser(TeamName.Text, Passwordbox.Password, out user)) { var packPage = new PackPage(user); NavigationService.Navigate(packPage); } else { MessageBlock.Text = "Введены некорректные данные"; Passwordbox.Password = ""; } }
private void Passwordbox_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { if (TeamName.Text != "") { if (repository.FindUser(TeamName.Text, Passwordbox.Password, out user)) { var packPage = new PackPage(user); NavigationService.Navigate(packPage); } else { MessageBlock.Text = "Введены некорректные данные"; Passwordbox.Password = ""; } } else { TeamName.Focus(); MessageBlock.Text = "Не заполнено поле названия команды"; } } }
private void UpdatePack(PackPage page) { if (PlayerManager.Instance == null) { return; } int index = 0; if (page != PackPage.Page1) { index = 3; } if (PlayerManager.Instance.LocalPlayer != null) { bool isEmpty = true; foreach (var itemCount in PlayerManager.Instance.LocalPlayer.UserGameItemsCount.Values) { if (itemCount != 0) { isEmpty = false; break; } } if (isEmpty) { if (showState == BlankShowState.OpenState) { updateTag = false; ShowBlank(BlankShowState.CloseState); } } else if (showState == BlankShowState.CloseState) { timeStart = Time.time; updateTag = true; ShowBlank(BlankShowState.OpenState); } } for (int i = index; i < index + 3; i++) { int start = i % 3; int count = 0; int itemId = -1; float cd = 0f; UISprite sprite = null; UILabel label = null; CdCountDown cdCount = null; if (PlayerManager.Instance.LocalPlayer != null) { PlayerManager.Instance.LocalPlayer.UserGameItemsCount.TryGetValue(i, out count);//0~6 PlayerManager.Instance.LocalPlayer.UserGameItems.TryGetValue(i, out itemId); PlayerManager.Instance.LocalPlayer.UserGameItemsCoolDown.TryGetValue(i, out cd); } mItemDic.TryGetValue(start, out sprite);//0~3 mItemCountDic.TryGetValue(start, out label); mItemCdDic.TryGetValue(start, out cdCount); label.gameObject.SetActive(false); label.text = ""; cdCount.EndCdCountDown(); if (count != 0 && ConfigReader.ItemXmlInfoDict.ContainsKey(itemId)) { if (ConfigReader.ItemXmlInfoDict[itemId].un8OverlapTimes >= 2 && count > 1) { label.gameObject.SetActive(true); label.text = count.ToString(); } if (cd > 0f && ConfigReader.ItemXmlInfoDict[itemId].un32CdTime > 0f) { cdCount.SetCdShow(true); cdCount.StartCdCountDown(ConfigReader.ItemXmlInfoDict[itemId].un32CdTime, cd); } sprite.gameObject.SetActive(true); sprite.spriteName = ConfigReader.ItemXmlInfoDict[itemId].sIcon; cdCount.GetComponent <UIObjDragEvent>().enabled = true; ShowSelect(start, true); } else { sprite.gameObject.SetActive(false); cdCount.GetComponent <UIObjDragEvent>().enabled = false; ShowSelect(start, false); } } }