private void OnCardOverTile(CardOverTileEvent obj) { hoverTile = obj.tile; cardOverTile = obj.card; Card card = obj.card.card; if (towersPlaced.ContainsKey(obj.tile)) { if (card.cardType == CardType.Tower) { SimulateUpgrade(towersPlaced[obj.tile], card); } else if (card.cardType == CardType.PropertyModifier) { SimulateModifier(towersPlaced[obj.tile], card); } } else { DispatchTileVFXRequestEvent(obj.tile, card.element); if (card.cardType == CardType.Tower) { PlaceVisualTowerAtTile(obj.tile, card.element); } } }
public List <int> CheckCardContainer(CardContainer container) { List <int> tmp = null; switch (container) { case CardContainer.Hand: tmp = handCards; break; case CardContainer.Field: tmp = fieldCards; break; case CardContainer.Attack: tmp = attackingCards; break; case CardContainer.Grave: tmp = deadCards; break; default: Debug.LogError("CantFindCardIn CardContainer"); break; } return(tmp); }
GameObject CreateCardAndContainer() { Card card = Instantiate(cardPrefab); GameObject containerObj = Instantiate(cardContainerPrefab, cardLibraryUI.libraryContainer.transform); cardContainerObjects.Add(containerObj); CardContainer container = cardContainerObjects.Last().GetComponentInChildren <CardContainer>(); container.SetSize(CARD_SCALE); container.buttonsOnFocus = false; container.offsetOnFocus = false; container.scaleOnFocus = true; container.onBeginDrag += () => OnBeginDrag(container); container.onPointerUp += (dragging) => { if (dragging) { OnEndDrag(container); } else { onClickCard?.Invoke(card); } }; container.onDrag += () => onDragCard(container.GetCard()); container.SetCard(card); card.OnCardPlaced = Close; return(containerObj); }
private void StartSelectionForContainerObj(GameObject containerObj, BehaviorSystem.SavedCardPack existingPack = null) { CardContainer container = containerObj.GetComponentInChildren <CardContainer>(); if (container.GetCard().GetModel().IsBuiltin()) { containerObj.SetActive(false); } else { bool startSelected = existingPack != null && existingPack.uris.Contains(container.GetCard().GetModel().GetUri()); container.StartSelectionMode( (selected) => { if (selection == null) { return; } if (selected) { selection.selectedCards.Add(container.GetCard().GetModel().GetUri()); } else { selection.selectedCards.Remove(container.GetCard().GetModel().GetUri()); } }, startSelected); } }
void OnEndDrag(CardContainer container) { onEndDragCard(container.GetCard()); currentDraggingContainer = null; // Show(); Close(); }
void OnBeginDrag(CardContainer container) { onBeginDragCard(container.GetCard()); currentDraggingContainer = container; Hide(); //Close(); }
// initial state of Computron public void Start() { // acquire Scene References commandStream = FindObjectOfType <Interpreter>(); cardContainer = GameObject.FindWithTag("RegisterContainer").GetComponent <CardContainer>(); InputBox = this.transform.parent.Find("Input").gameObject; OutputBox = this.transform.parent.Find("Output").gameObject; StepButton = GameObject.FindWithTag("Step"); // initialize starting parameters transform.position = RestWaypoint.transform.position; current = null; previous = null; // kick off the state machine currentState = ACTOR_STATE.IDLE; error = false; conditionalResult = null; CurrentValue = null; SecondValue = null; stepping = false; step = false; implicitSubmit = false; stepCount = 0; StartCoroutine(ActorStateMachine()); }
public void FinalizeHandModifierOperation(HashSet <CardContainer> pickedCards) { if (pickedCards == null || pickedCards.Count == 0) { return; } CardContainer[] cards = new CardContainer[pickedCards.Count]; pickedCards.CopyTo(cards); switch (currentHandModifier) { case HandModifier.RedrawRandomCards: break; case HandModifier.Draw: break; case HandModifier.Redraw: DispatchCardsConsumeRequestEvent(cards); DispatchDrawRandomCardsRequestEvent(cards.Length); break; case HandModifier.RedrawHand: break; case HandModifier.ResourceChange: break; case HandModifier.Sell: DispatchResourceChangeRequestEvent(pickedCards.Count * currentHandModifierValue); break; } DispatchCardsConsumeRequestEvent(cards); }
/// <summary> /// 通过诊断Agg获取诊断卡集合 /// </summary> /// <returns></returns> private List <CardContainer> getCardListByCidiagAgg() { //诊断信息卡集合 List <CardContainer> cardList = new List <CardContainer>(); CidiagAggDO[] aggDOs = model.GetCidiagAggDOs(this.Id_ent); if (aggDOs == null || aggDOs.Length == 0) { return(cardList); } foreach (CidiagAggDO aggDO in aggDOs) { CardContainer cardInfo = this.getCardInfo(aggDO.getParentDO()); cardInfo.RootId = "~"; //设置诊断卡内容区域显示 List <CiDiagItemDO>[] t = this.GetCiDiagItemList(aggDO.getCiDiagItemDO()); cardInfo.DataSource = t; cardList.Add(cardInfo); } return(cardList); }
IEnumerator DrawCard(int amount) { Battle.frozen = true; for (int i = 0; i < amount; i++) { Card card = battle.drawPile[i]; currentCardsInHand.Add(card); GameObject tmpCard = Instantiate(baseCard, transform); CardContainer container = tmpCard.GetComponent <CardContainer>(); tmpCard.SetActive(true); tmpCard.name = $"{currentCardsInHand.Count}"; LeanTween .moveX(tmpCard, baseCard.transform.position.x + (80f * i), 0.45f) .setEaseInCubic(); container.card = card; battle.DrawCard(); yield return(new WaitForSeconds(0.55f)); } Battle.frozen = false; }
public CardPickedEvent(CardContainer card, bool picked, int maxAmount, int amountPicked) { this.card = card; this.picked = picked; this.maxAmount = maxAmount; this.amountPicked = amountPicked; }
private void FindOverCard(CardContainer deck, MouseEventArgs args) { var frontCard = FindFrontCard(deck); Point point; if (frontCard == null) { point = deck.TransformToAncestor(Application.Current.MainWindow).Transform(new Point(0, 0)); frontCard = new Card() { CurrentDeck = deck.ContainerName, CardName = null, CardShape = null, CardValue = 0 }; } else { point = frontCard.TransformToAncestor(Application.Current.MainWindow).Transform(new Point(0, 0)); } if (args.GetPosition(_mainCanvas).X >= point.X && args.GetPosition(_mainCanvas).X <= point.X + deck.ActualWidth && args.GetPosition(_mainCanvas).Y >= point.Y - 70 && args.GetPosition(_mainCanvas).Y <= point.Y + deck.ActualHeight + 70) { if (_gameViewModel.ValidateCard(frontCard.CurrentDeck, frontCard.CardName, frontCard.CardShape, frontCard.CardValue) == DeckMatch.NotFound) { return; } SetIsMouseOver(deck, true, frontCard); } else { SetIsMouseOver(deck, false, frontCard); } }
public void Init() { var obj = new GameObject(); _deck = obj.AddComponent <CardContainer>(); _deck.Init(); }
void Awake() { gamecontroller = GameObject.FindWithTag("GameController").GetComponent <GameController>(); leaderboard = GameObject.FindWithTag("GameController").GetComponent <Leaderboard>(); waypointContainer = GameObject.FindGameObjectWithTag("WaypointContainer").GetComponent <WaypointContainer>(); cardContainer = GameObject.FindGameObjectWithTag("WaypointContainer").GetComponent <CardContainer>(); }
private void RemoveCard(object sender, RoutedEventArgs e) { Button button = (Button)sender; CardContainer card = (CardContainer)button.DataContext; CardCollection.Instance.RemoveCard(card.LoadedCard.Id); }
public Card ReplaceCard(ICardModel unassignedCard, CardContainer container) { int index = model.GetIndexOf(container.GetCard().GetCardAssignment()); cardManager.UnassignCard(container.GetCard().GetCardAssignment()); return(AcceptCard(unassignedCard, index)); }
private void SetContainersList(CardContainer container) { var containerViewModel = new ContainerViewModel(); if (container.Card != null) { if (container.Card.Path != Properties.Resources.BackCardPath) { containerViewModel.CardName = container.Card.CardName; containerViewModel.CardShape = container.Card.CardShape; containerViewModel.CardValue = container.Card.CardValue; containerViewModel.DeckName = container.Card.CurrentDeck; containerViewModel.CardPath = container.Card.Path; _containers.Add(containerViewModel); _lastContainer = containerViewModel; } else { _parentContainer = container; } } if (container.SubContainer != null) { SetContainersList(container.SubContainer); var currentIndex = _containers.IndexOf(containerViewModel); if (containerViewModel != _lastContainer && currentIndex >= 0) { containerViewModel.SubContainer = _containers.ElementAt(currentIndex + 1); } } }
private void FindCardContainer(CardContainer container, Card card) { if (container == null) { return; } if (container.SubContainer != null) { if (container.Card != null) { if (container.Card.CardName == card.CardName && container.Card.CardShape == card.CardShape) { if (container.SubContainer == null) { return; } _moveableContainer = container; return; } } _parentContainer = container; FindCardContainer(container.SubContainer, card); } }
/// <summary> /// 通过临床诊断获取诊断展现卡的对象 /// </summary> /// <param name="cidiag">临床诊断</param> /// <returns></returns> private CardContainer getCardInfo(CiDiagDO cidiag) { CardContainer cardInfo = new CardContainer(group); if (cidiag.Sd_ditp == CiDictCodeConst.SD_OPDI || cidiag.Sd_ditp == CiDictCodeConst.SD_FIRST || cidiag.Sd_ditp == CiDictCodeConst.SD_INHOSPITAL) { cardInfo.CardPosition = CardPosition.right; } else { cardInfo.CardPosition = CardPosition.left; } cardInfo.CardTitle = cidiag.Name_ditp; //info1.CardContent = "1,眼硅胶排异反应\n2,肺移植失败——1321324341435436547667879809-0=-"; if ((bool)cidiag.Fg_sign) { cardInfo.CardPerson = cidiag.Signname; cardInfo.CardTime = Convert.ToDateTime(cidiag.Dt_sign.ToString()); } else { cardInfo.CardPerson = cidiag.Empname; cardInfo.CardTime = Convert.ToDateTime(cidiag.Dt_di.ToString()); } return(cardInfo); }
public void CancelDraggedCard(Card card) { pointerState = PointerState.MouseOver; foreach (CardDeck slot in cardSlots) { slot.ToggleReplaceIndicator(false); foreach (CardContainer container in slot.containers) { if (container != null) { container.ToggleReplaceIndicator(false); } } } if (mouseOverSlot != null) { mouseOverSlot.EndFocus(); mouseOverSlot = null; } if (mouseOverContainer != null) { mouseOverContainer.EndFocus(); mouseOverContainer = null; } }
public void NewDay(bool isFirstDay = false) { if (IsGameOver) { return; } if (!isFirstDay) { PassDays++; } Debug.Log("NewDay PassDays = " + PassDays); _isShowCard = false; if (PassDays >= 5 && PassDays % 5 == 0) { CardContainer.ShowMsgCard("联盟的固定补给终于心不甘情不愿地发下来了", new CardConfigData { Yesmoney = 5, Nomoney = 5 }); } else if (_msgDict.ContainsKey(PassDays) && _msgDict[PassDays].Count > _msgIndex) { CardContainer.ShowMsgCard(_msgDict[PassDays][_msgIndex]); _msgIndex++; } else { _isShowCard = true; CardContainer.ShowNextCard(); } EventManager.TriggerEvent(GameEvent.NewDay); }
private void RemoveFromDeck(object sender, RoutedEventArgs e) { Button button = (Button)sender; CardContainer card = (CardContainer)button.DataContext; DeckManager.Instance.ActiveDeck.ReduceCard(card.LoadedCard.Id); }
public void EndDrag() { transform.SetParent(container.transform); transform.localScale = Vector3.one; rectTransform.anchoredPosition = Vector2.zero; draggingOverContainer = null; SetDragFeedback(false); }
private void GenerateCardContainer(Card card) { CardContainer cardContainer = Instantiate(cardContainerPrefab, cardContainerPoolParent); cardContainer.Initialize(card); baseCardContainers.Add(cardContainer); cardContainer.gameObject.SetActive(false); }
public void ReplacePlayerDeck(CardContainer newPlayerDeckObject) { var index = GameComponentsLookup.PlayerDeck; var component = CreateComponent <PlayerDeckComponent>(index); component.PlayerDeckObject = newPlayerDeckObject; ReplaceComponent(index, component); }
public void ReplaceSkillCardContainer(CardContainer newContainerObject) { var index = GameComponentsLookup.SkillCardContainer; var component = CreateComponent <SkillCardContainerComponent>(index); component.ContainerObject = newContainerObject; ReplaceComponent(index, component); }
public void TransformCreature(Creature to_transform, Creature to_copy) { int position = to_transform.container.CardPosition(to_transform); CardContainer initial_container = to_transform.container; RemoveCardFromPlay(to_transform); CreateToken(initial_container, to_copy, position); }
//use JSON data to generate a specific deck public void LoadDeck(string filepath) { //load card data object from file CardContainer newCards = GameSaveManager.LoadCards(filepath); //convert data object into card array to populate tableaus GameObject[] cards = GameSaveManager.loadDeck(newCards); //assign shuffled deck to tableaus for (int i = 0; i < 52; i++) { if (i >= 0 && i < 7) { tableaus[0].GetComponent <CardDropArea>().cardStack.Push(cards[i]); cards[i].transform.SetParent(tableaus[0].transform); } else if (i >= 7 && i < 14) { tableaus[1].GetComponent <CardDropArea>().cardStack.Push(cards[i]); cards[i].transform.SetParent(tableaus[1].transform); } else if (i >= 14 && i < 21) { tableaus[2].GetComponent <CardDropArea>().cardStack.Push(cards[i]); cards[i].transform.SetParent(tableaus[2].transform); } else if (i >= 21 && i < 28) { tableaus[3].GetComponent <CardDropArea>().cardStack.Push(cards[i]); cards[i].transform.SetParent(tableaus[3].transform); } else if (i >= 28 && i < 34) { tableaus[4].GetComponent <CardDropArea>().cardStack.Push(cards[i]); cards[i].transform.SetParent(tableaus[4].transform); } else if (i >= 34 && i < 40) { tableaus[5].GetComponent <CardDropArea>().cardStack.Push(cards[i]); cards[i].transform.SetParent(tableaus[5].transform); } else if (i >= 40 && i < 46) { tableaus[6].GetComponent <CardDropArea>().cardStack.Push(cards[i]); cards[i].transform.SetParent(tableaus[6].transform); } else { tableaus[7].GetComponent <CardDropArea>().cardStack.Push(cards[i]); cards[i].transform.SetParent(tableaus[7].transform); } } foreach (GameObject tableau in tableaus) { tableau.GetComponent <CardDropArea>().updateStack(); } }
public void EndTurn() { this.SetPromptText("Turn Ending!"); this.FrozePlayer(); Invoke("EndTurnSecond", 1); if (selectedCard != null) { selectedCard.transform.position = new Vector2(selectedCard.transform.position.x, selectedCard.transform.position.y - CardContainer.SelectedCardYOffset); selectedCard = null; } }
public Card FindCardIn(CardContainer cc, Card card) { Card value = null; List <int> tmp = CheckCardContainer(cc); if (tmp != null) { value = FindCardIn(tmp, card); } return(value); }
/// <summary> /// 设置卡片容器 /// </summary> public void SetCardContainer(CardContainer container) { this.container = container; }
public IList<Card> DrawCards(Player drawer, CardContainer deck, int count = 1) { IList<Card> retval = deck.Draw(count); _game.NotifyPlayers( p => p.OnDrawCards(drawer, retval), p => p.OnDrawCardsNotVisible(drawer, count)); return retval; }
public Player() { Hand = new CardContainer(); Deck = new CardContainer(); DiscardPile = new CardContainer(); }