void RemoveCardFromList(CardListItem view) { //ListAbsoluteLayout.Children.Remove(view); ItemsSource.RemoveAt(view.index); PopulateView(); }
public void DrawCards(CardListItem drawingCard) { for (int j = 0; j < cardObjects.Length; j++) { //Debug.Log(j + "---" +cardObjects[j].transform.childCount); if (cardObjects[j].transform.childCount == 0) { GameObject card = Instantiate(cardPrefab); card.GetComponent <Transform>().SetParent(cardObjects[j].transform, true); card.GetComponent <RectTransform>().localPosition = Vector3.zero; card.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); card.AddComponent <CardListItem>(); card.GetComponent <CardListItem>().CopyItem(drawingCard); GameObject nameText = card.transformFindObj("NameText"); GameObject cost1Text = card.transformFindObj("Cost1Text"); GameObject cost2Text = card.transformFindObj("Cost2Text"); GameObject cardImg = card.transformFindObj("CardImg"); GameObject effectText = card.transformFindObj("EffectText"); nameText.GetComponent <Text>().text = drawingCard.c_name; effectText.GetComponent <Text>().text = drawingCard.c_effectDes; cost1Text.GetComponent <Text>().text = GameUtils.NumberToChinese(Convert.ToInt32(drawingCard.c_cost1)); cost2Text.GetComponent <Text>().text = GameUtils.NumberToChinese(Convert.ToInt32(drawingCard.c_cost2)); iTween.MoveFrom(card, new Vector3(-700, 0, 0), 0.5f); break; } } }
public void rewardsSelected() { GameObject obj = EventSystem.current.currentSelectedGameObject; int selectIndex = Convert.ToInt32(obj.name.Split('_')[2]) - 1; card_reward_selected = enemy.GetComponent <EnemyController>().reward_Cards[selectIndex]; rewardGet = true; }
public void MinusButtonClicked() { for (int i = 0; i < transform.childCount; i++) { CardListItem item = transform.GetChild(i).GetComponent <CardListItem>(); item.NumberOfCards = Math.Max(0, item.NumberOfCards - 1); } }
public void PlusButtonClicked() { for (int i = 0; i < transform.childCount; i++) { CardListItem item = transform.GetChild(i).GetComponent <CardListItem>(); item.NumberOfCards++; } }
public List <int> getNumberOfEachCard() { List <int> numberOfEachCard = new List <int>(); for (int i = 0; i < transform.childCount; i++) { CardListItem item = transform.GetChild(i).GetComponent <CardListItem>(); numberOfEachCard.Add(item.NumberOfCards); } return(numberOfEachCard); }
public void CopyItem(CardListItem item) { c_no = item.c_no; c_name = item.c_name; c_type = item.c_type; c_description = item.c_description; c_cost1 = item.c_cost1; c_cost2 = item.c_cost2; c_effect = item.c_effect; c_effectDes = item.c_effectDes; c_wealth2 = item.c_wealth2; }
private void setCard(GameObject tempCard, CardListItem item) { GameObject nameText = tempCard.transformFindObj("NameText"); GameObject cost1Text = tempCard.transformFindObj("Cost1Text"); GameObject cost2Text = tempCard.transformFindObj("Cost2Text"); GameObject cardImg = tempCard.transformFindObj("CardImg"); GameObject effectText = tempCard.transformFindObj("EffectText"); nameText.GetComponent <Text>().text = item.c_name; effectText.GetComponent <Text>().text = item.c_effectDes; cost1Text.GetComponent <Text>().text = GameUtils.NumberToChinese(Convert.ToInt32(item.c_cost1)); cost2Text.GetComponent <Text>().text = GameUtils.NumberToChinese(Convert.ToInt32(item.c_cost2)); }
public static CardListItem DrawACard() { if (PlayerController.drawingCards.Count > 0) { CardListItem cardListItem = PlayerController.drawingCards[0]; PlayerController.drawingCards.RemoveAt(0); return(cardListItem); } else { return(null); } }
public static bool PlayCard(CardListItem cardPlaying) { //与当前费用比较 int card_cost1 = Convert.ToInt32(cardPlaying.c_cost1); int card_cost2 = Convert.ToInt32(cardPlaying.c_cost2); if (PlayerController.power1 - card_cost1 >= 0 && PlayerController.power2 - card_cost2 >= 0) { PlayerController.power1 -= card_cost1; PlayerController.power2 -= card_cost2; return(true); } return(false); }
public CardView(CardListItem item, ScrollView parent) { this.parent = parent; this.item = item; //Populate card with values if (item.attendeeListItem != null) { InitializeAttendeeCard(item.attendeeListItem); } else { InitializePartyCard(item.partyDetailsItem); } BindingContext = this; InitializeComponent(); }
public IList <CardListItem> Cards(PagingOptions paging) { CardEntity creditContractEntity = null; CardListItem creditContractListItem = null; AccountEntity accountEntity = null; PrincipalEntity principalEntity = null; var query = DataProvider.QueryOver(() => creditContractEntity); var accountQuery = query.JoinAlias(x => x.AccountIdObject, () => accountEntity, JoinType.InnerJoin); var principalQuery = query.JoinAlias(x => x.ClientIdObject, () => principalEntity, JoinType.InnerJoin); var projections = Projections.ProjectionList(); projections.Add(Projections.Property(() => creditContractEntity.Number).WithAlias(() => creditContractListItem.Number)); projections.Add(Projections.Property(() => accountEntity.AccountId).WithAlias(() => accountEntity.AccountId)); projections.Add(Projections.Property(() => principalEntity.Name).WithAlias(() => creditContractListItem.PrincipalName)); AddPaging(query, paging); query.Select(projections); return(query.TransformUsing(Transformers.AliasToBean <CardListItem>()).List <CardListItem>()); }
public void Load(DeckMeta deckInfo, List <int> numberOfEachCard) { DestroyChildren(); Sprite[] sprites = Resources.LoadAll <Sprite>(deckInfo.deckImagePath); for (int i = 0; i < deckInfo.numberOfCards; i++) { CardListItem cardListItem = Instantiate(cardListItemPrefab, this.transform); cardListItem.Sprite = sprites[i]; if (numberOfEachCard.Count == deckInfo.numberOfCards) { cardListItem.NumberOfCards = numberOfEachCard[i]; } else { cardListItem.NumberOfCards = 1; } } }
async Task RefreshPage(object sender, int index) { selectedTab = index; //CardListView senderListView = (CardListView)sender; var cloudService = ServiceLocator.Instance.Resolve <ICloudService>(); ICloudTable <PartyDetails> table = cloudService.GetTable <PartyDetails>(); ICollection <PartyDetails> parties = await cloudService.RetreivePartiesWithinRange(searchPosition.Longitude, searchPosition.Latitude, Constants.defaultSearchRange, index); ObservableRangeCollection <CardListItem> sortedItems = new ObservableRangeCollection <CardListItem>(); foreach (var item in parties) { PartyDetailsItem tempItem = new PartyDetailsItem(item); await tempItem.InitializeCard(); CardListItem temp = new CardListItem() { partyDetailsItem = tempItem }; sortedItems.Add(temp); } ((CardListView )_items[index]).ItemsSource = sortedItems; }