Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        dice         = (Dice[])FindObjectsOfType(typeof(Dice));
        bank         = (BankDisplayScript)FindObjectOfType(typeof(BankDisplayScript));
        EV           = (EVDisplayScript)FindObjectOfType(typeof(EVDisplayScript));
        money        = (MoneyDisplayScript)FindObjectOfType(typeof(MoneyDisplayScript));
        eventMessage = (EventMessageDisplay)FindObjectOfType(typeof(EventMessageDisplay));

        // instantiate event and decision cards to use
        EventCard eventCard  = new EventCard("You internalize employee housing, providing on-site housing for all employees", -400, 40);
        EventCard eventCard2 = new EventCard("Country is angered by recent big-business hostile takeover!", 0, -20);

        eventCards.Add(eventCard);
        eventCards.Add(eventCard2);

        Decision        decision  = new Decision("Outsource", 900, -20);
        Decision        decision2 = new Decision("Stay domestic", -200, 30);
        List <Decision> decisions = new List <Decision>();

        decisions.Add(decision);
        decisions.Add(decision2);
        DecisionCard decisionCard = new DecisionCard("Your company has the option to outsource production to a cheaper country for cheap labor.", decisions);

        decisionCards.Add(decisionCard);
    }
Exemplo n.º 2
0
    public void SetupStoryCardCheck()
    {
        if (drawnStoryCard != null)
        {
            Debug.Log("DRAWN STORY CARD: " + drawnStoryCard.name);

            UIUtil.EmptyPanel(questStagePanel);
            questStageBPTotal.text = "";
            questStageNumber.text  = "";

            //setup quest , tournament or event
            if (drawnStoryCard.type == "Event Card")
            {
                currentEvent = (EventCard)drawnStoryCard;
            }
            else if (drawnStoryCard.type == "Tournament Card")
            {
                userInput.ActivateBooleanCheck("Do you want to participate?");
                currentTournament = (TournamentCard)drawnStoryCard;
            }
            else if (drawnStoryCard.type == "Quest Card")
            {
                //store player that first drew the quest card
                QuestState.questDrawer = currentPlayerIndex;
                userInput.ActivateBooleanCheck("Do you want to sponsor this quest?");
                currentQuest = (QuestCard)drawnStoryCard;
            }

            numIterations = 0;
            UIUtil.AddCardToPanel(UIUtil.CreateUIElement(drawnStoryCard, cardPrefab), questPanel);
            drawnStoryCard = null;
        }
    }
Exemplo n.º 3
0
    // public IEnumerator SetCardValue(type_opt _up_type, int _upval, type_opt _dw_type, int _dwval) {
    //     this.up_option = _up_type;
    //     this.up_val = _upval;
    //     this.down_option = _dw_type;
    //     this.down_val = _dwval;

    //     if (this.down_option != type_opt.nil) {
    //         this.up_type_ri.texture =
    //             Resources.Load<Texture2D>("CardPlay/ActionCard/Image/" + up_option.ToString())as Texture2D;
    //         this.dw_type_ri.texture =
    //             Resources.Load<Texture2D>("CardPlay/ActionCard/Image/" + down_option.ToString())as Texture2D;
    //         this.up_val_go.text = (this.up_val).ToString();
    //         this.dw_val_go.text = (this.down_val).ToString();
    //         yield return true;
    //     } else {
    //         this.up_type_ri.texture =
    //             Resources.Load<Texture2D>("CardPlay/ActionCard/Image/sp/" + up_option.ToString())as Texture2D;
    //         this.up_type_rt.sizeDelta = new Vector2(61f, 100f);
    //         this.dw_type_ri.color =
    //             new Color(0f, 0f, 0f, 0f);
    //         this.up_val_go.text = (this.up_val).ToString();
    //         this.dw_val_go.text = "";
    //         yield return true;
    //     }
    // }

    public IEnumerator SetCardValue(EventCard ec_val)
    {
        this.up_option   = ec_val.UpOption;
        this.up_val      = ec_val.UpVal;
        this.down_option = ec_val.DownOption;
        this.down_val    = ec_val.DownVal;

        if (this.down_option != EventCardType.Null)
        {
            this.up_type_ri.texture =
                Resources.Load <Texture2D>("CardPlay/ActionCard/Image/" + up_option.ToString()) as Texture2D;
            this.dw_type_ri.texture =
                Resources.Load <Texture2D>("CardPlay/ActionCard/Image/" + down_option.ToString()) as Texture2D;
            this.up_val_go.text = (this.up_val).ToString();
            this.dw_val_go.text = (this.down_val).ToString();
            yield return(true);
        }
        else
        {
            this.up_type_ri.texture =
                Resources.Load <Texture2D>("CardPlay/ActionCard/Image/sp/" + up_option.ToString()) as Texture2D;
            this.up_type_rt.sizeDelta = new Vector2(61f, 100f);
            this.dw_type_ri.color     =
                new Color(0f, 0f, 0f, 0f);
            this.up_val_go.text = (this.up_val).ToString();
            this.dw_val_go.text = "";
            yield return(true);
        }
    }
Exemplo n.º 4
0
    public void AddEvent(EventCard which)
    {
        if (PlayerPrefsX.GetBool(which.name))
        {
            switch (which.myType)
            {
            case EventCard.eType.Curse:
                if (!curseCards.Contains(which))
                {
                    curseCards.Add(which);
                }

                break;

            case EventCard.eType.Bonus:
                if (!bonusCards.Contains(which))
                {
                    bonusCards.Add(which);
                }

                break;

            case EventCard.eType.Mis:
                if (!miscCards.Contains(which))
                {
                    miscCards.Add(which);
                }
                break;
            }
        }
    }
Exemplo n.º 5
0
    public void ActivateBonus(string which)
    {
        print("Activating Bonus: " + which);
        chosenEvent = bonusCards[FindString(which, 1)];

        switch (which)
        {
        case "FaceMelter":
            lazarDamages = true;
            StartCoroutine(TurnOffBool(() => lazarDamages = false, GameManager.GM.eventDuration + animTotalTime));
            break;

        case "BGH":
            bigGameHunter = true;
            StartCoroutine(TurnOffBool(() => bigGameHunter = false, GameManager.GM.eventDuration + animTotalTime));
            break;

        case "Twinsanity":
            doubleMatchNum     = Random.Range(4, 7);
            chosenEvent.effect = "Match-" + doubleMatchNum + "s spawn double minions!";
            StartCoroutine(TurnOffBool(() => doubleMatchNum = 0, GameManager.GM.eventDuration));
            break;

        case "ResearchBonus":
            researchRate = 2;
            StartCoroutine(TurnOffBool(() => researchRate = 1, GameManager.GM.eventDuration));
            break;

        case "SwapQueen":
            infiniteSwap = true;
            StartCoroutine(TurnOffBool(() => infiniteSwap = false, GameManager.GM.eventDuration + animTotalTime));

            break;
        }
    }
Exemplo n.º 6
0
    private void GenerateEventDeck()
    {
        eventDeck = new List <EventCard>();
        List <string> paths = new List <string>
        {
            "Cards/Event/Stonk",
            "Cards/Event/Reloaded",
            "Cards/Event/Lightning",
            "Cards/Event/Nothing",
        };

        // load cards
        foreach (string path in paths)
        {
            for (int i = 0; i < 3; i++)
            {
                eventDeck.Add(Resources.Load(path) as EventCard);
            }
        }

        // shuffle cards
        for (int i = 0; i < eventDeck.Count; i++)
        {
            EventCard temp        = eventDeck[i];
            int       randomIndex = Random.Range(i, eventDeck.Count);
            eventDeck[i]           = eventDeck[randomIndex];
            eventDeck[randomIndex] = temp;
        }

        //set index to 0
        eventIdx = 0;
    }
Exemplo n.º 7
0
    // Start Event
    // Display the description of the event
    void Event()
    {
        EventCard currentEvent = eventDeck[turn - 1];

        // Show description
        Debug.Log(currentEvent.description);

        // Show voting options
        // Handle Event
        // Show voting options and effects
        Debug.Log(currentEvent.effects[0]);
        Debug.Log(currentEvent.effectStrengths[0]);

        // Vote on event
        int finalVote = Vote(currentEvent);

        Debug.Log(finalVote);

        // If there is combat
        if (currentEvent.combat)
        {
            if (avatar.health > 0 || currentEvent.nonPlayerCharacter.health > 0)
            {
                HandleCombat(currentEvent);
            }
        }
    }
Exemplo n.º 8
0
        /// <summary>
        /// 正常的结算流程:结算牌放结算区,结算完毕后进入弃牌堆
        /// </summary>
        /// <param name="game"></param>
        /// <param name="useEventCard"></param>
        /// <param name="card"></param>
        /// <param name="effect"></param>
        //public static async Task NormalUse(Game game, PlayerAction.FreeUse useOneCard, Card card, Func<Game, PlayerAction.FreeUse, Task> effect)
        //{
        //    if (card is EventCard eventCard)
        //        await UseEventCard(game, useOneCard, eventCard, effect);
        //    else if (card is ActionCard actionCard)
        //        await UseActionCard(game, useOneCard, actionCard, effect);
        //}

        public static async Task UseEventCard <T>(Game game, T useEventCard, EventCard card, Func <Game, T, Task> effect) where T : PlayerAction.ChooseDirectionResponse
        {
            Player player = game.GetPlayer(useEventCard.PlayerId);
            await player.DropEventCard(game, card);

            game.AddUsingCard(card);
            game.AddUsingInfo(new UsingInfo()
            {
                Card = card,
                Info = $"{player.Hero.Name}使用了{card.Name}",
            });
            await game.EventSystem.Call(EventEnum.changeEventDirection, game.ActivePlayerSeat(), game, useEventCard);

            await game.EventSystem.Call(EventEnum.BeforeEventCardEffect, game.ActivePlayerSeat(), game, card);

            await effect(game, useEventCard);

            await game.EventSystem.Call(EventEnum.AfterEventCardEffect, game.ActivePlayerSeat(), game, card);

            game.RemoveUsingCard(card);
            if (!game.ChainEventDeck.Contains(card))
            {
                game.UsedEventDeck.Add(card);
            }
        }
Exemplo n.º 9
0
    private void CreateEventCards()
    {
        Vector3 position = eventCard.transform.position;

        if (EventsService.events.Length > 0)
        {
            eventCard.SetActive(true);
        }
        else
        {
            noEventsCard.SetActive(true);
        }

        foreach (Event evt in EventsService.events)
        {
            position = new Vector3(position.x, position.y, position.z);
            GameObject card = (GameObject)Instantiate(eventCard, position, Quaternion.identity);
            card.transform.SetParent(GameObject.Find("List").transform, false);

            EventCard evtCard = card.GetComponent <EventCard>();
            evtCard.UpdateEvent(evt);
        }

        eventCard.gameObject.SetActive(false);
        AlertsService.removeLoadingAlert();
    }
Exemplo n.º 10
0
 // Update is called once per frame
 void Update()
 {
     if (me.getRoleKind() == RoleKind.ContingencyPlanner && me.hasEventCardOnTopOfRoleCard())
     {
         EventCard theCard  = me.getEventCardOnTopOfRoleCard();
         string    cardName = theCard.getName().ToString();
         card.gameObject.SetActive(true);
         card.gameObject.GetComponent <Button>().onClick.AddListener(() => eventCard.click());
         card.transform.GetChild(0).gameObject.GetComponent <Text>().text = cardName;
     }
     else
     {
         card.gameObject.SetActive(false);
         card.gameObject.GetComponent <Button>().onClick.RemoveAllListeners();
     }
     displayCubes();
     if (me.hasEventCardInFront())
     {
         commercialTravelBan.gameObject.SetActive(true);
     }
     else
     {
         commercialTravelBan.gameObject.SetActive(false);
     }
 }
Exemplo n.º 11
0
 public static void TriggerEventCard(EventCard card)
 {
     if (EventCard != null)
     {
         EventCard(card);
     }
 }
Exemplo n.º 12
0
    public void ClickEvent(EventCard ec)
    {
        //Debug.Log(ec.eventCardNum);
        switch (ec.eventType)
        {
        case 1:
            LobbyManager.instance.GoBattle(ec.eventContent, ec.eventCardNum);
            break;

        case 2:
            LobbyManager.instance.OpenGameEvent("Treasure", ec.eventCardNum);
            break;

        case 3:
            LobbyManager.instance.OpenGameEvent("HotSpring", ec.eventCardNum);
            break;

        case 4:
            LobbyManager.instance.OpenGameEvent("Bed", ec.eventCardNum);
            break;

        case 5:
            LobbyManager.instance.OpenShop(ec.eventCardNum);
            break;

        case 6:
            EventUpdate(ec.eventCardNum);
            break;

        case 7:
            LobbyManager.instance.TestGoToEnd();
            break;
        }
    }
Exemplo n.º 13
0
    void AfterEventCardUseCheck(int eventCardNum)
    {
        if (LobbyManager.instance.currentEventCardBeNotUse)
        {
            LobbyManager.instance.currentEventCardBeNotUse = false;
            return;
        }

        EventCard eCard = null;

        foreach (EventCard ec in eventCards)
        {
            if (ec.eventCardNum == eventCardNum)
            {
                eCard = ec;
                break;
            }
        }
        if (eCard == null)
        {
            Debug.LogWarning("Found not eventcard");
            return;
        }

        eCard.ShowTip();
        eCard.SetClick(false);
        GetEventCardData(eventCardNum).used = true;
    }
Exemplo n.º 14
0
    /// <summary>
    /// Ajoute la carte event au canvas
    /// </summary>
    /// <param name="player"></param>
    /// <param name="card"></param>
    void CreateEventCard(int player, MYthsAndSteel_Enum.EventCard card)
    {
        GameObject newCard = Instantiate(player == 1? UIInstance.Instance.EventCardObjectRed : UIInstance.Instance.EventCardObjectBlue,
                                         player == 1 ? UIInstance.Instance.RedPlayerEventtransf.GetChild(0).transform.position : UIInstance.Instance.BluePlayerEventtransf.GetChild(0).transform.position,
                                         Quaternion.identity,
                                         player == 1 ? UIInstance.Instance.RedPlayerEventtransf.GetChild(0) : UIInstance.Instance.BluePlayerEventtransf.GetChild(0));

        EventCard newEventCard = new EventCard();

        foreach (EventCard evC in EventCardList._eventSO.EventCardList)
        {
            if (evC._eventType == card)
            {
                newEventCard = evC;
            }
        }
        newCard.GetComponent <EventCardContainer>().AddEvent(newEventCard);

        AddEventToButton(card, newCard);

        if (player == 1)
        {
            EventCardList._eventGamRedPlayer.Insert(1, newCard);
            _eventCardList._eventSO.UpdateVisualUI(EventCardList._eventGamRedPlayer, 1);
        }
        else if (player == 2)
        {
            EventCardList._eventGamBluePlayer.Insert(1, newCard);
            _eventCardList._eventSO.UpdateVisualUI(EventCardList._eventGamBluePlayer, 2);
        }
        else
        {
            Debug.LogError("vous essayez d'ajouter une carte event a un joueur qui n'existe pas");
        }
    }
Exemplo n.º 15
0
 public static ECShortHand ConvertToEC(EventCard ec)
 {
     return(new ECShortHand {
         CardId = ec.Id,
         Position = ec.Position,
         IsInvert = ec.IsInvert,
     });
 }
Exemplo n.º 16
0
    /// <summary>
    /// Called to set up the beginning of a turn and the event card of that turn
    /// </summary>
    public void BeginTurn()
    {
        Debug.Log("Turn has begun");

        //Temp testing info
        Debug.Log("Global Stats: Money: " + Money + " | C02: " + Carbon + " | Hope : " + Hope);

        //Pull an event card and remove it from the deck
        activeEventCard = CurrentEventDeck[0];
        CurrentEventDeck.RemoveAt(0);

        //Display Card info
        Debug.Log("Card Event: " + activeEventCard.cardName);
        Debug.Log("Card Description: " + activeEventCard.cardDesc);
        Debug.Log("Card Stats Money: " + activeEventCard.costMoney +
                  " | CO2: " + activeEventCard.costCarbon +
                  " | Hope: " + activeEventCard.hope);

        EventCardDisplay.Instance.SetCardAndDisplay(activeEventCard);

        //Update Money, Carbon and Hope
        Money  += activeEventCard.costMoney;
        Carbon += activeEventCard.costCarbon;
        Hope   += activeEventCard.hope;

        //Display updated stats
        Debug.Log("Global Stats: Money: " + Money + " | C02: " + Carbon + " | Hope : " + Hope);

        //Warn if hope card must be played
        if (PlayerMustPlayHope())
        {
            Debug.Log("A positive hope card must be played");
        }

        HandManager.Instance.SetCardDisplays(newCards);
        PrintPlayerHand();

        // The game should not *automatically* end here
        // Left this in in case its used in the future

        /*
         * if (PlayerMustPlayHope() && !PlayerHasHopeCard() && Money < 5)
         * {
         *
         *  Debug.Log("There are no valid hope cards in your hand and you " +
         *            "do not have enough money to redraw your hand. You lose");
         *  // gameOver = true;
         *  // TurnActive = false;
         *  // EndTurn();
         * } else
         * {
         *  TurnActive = true;
         * }
         */

        TurnActive         = true;
        CurrentTurnNumber += 1;
    }
Exemplo n.º 17
0
 public EventCardWrapper(EventCard card, string guid = "")
 {
     if (guid == "")
     {
         guid = System.Guid.NewGuid().ToString();
     }
     CardId = card.Id;
     Guid   = guid;
 }
Exemplo n.º 18
0
        public void PlayEventCard(EventCard eventCard, City?city = null)
        {
            var eventPlayed = new PlayerEventPlayed()
            {
                PlayerId = CurrentPlayerId, EventCard = eventCard, City = city
            };

            PlayEventCard(eventPlayed);
        }
Exemplo n.º 19
0
 public void CreateCard()
 {
     _currentCard = new EventCard();
     _createdDeck.EventCards.Add(_currentCard);
     _currentCardIndex = _createdDeck.EventCards.Count - 1;
     _currentCard.CardsToBlockNames = new string[0];
     UpdateCardInfo();
     _wasSaved = false;
 }
Exemplo n.º 20
0
        public void PlayEventCard(EventCard eventCard, int playerId, City?city = null)
        {
            var eventPlayed = new PlayerEventPlayed()
            {
                EventCard = eventCard, PlayerId = playerId, City = city
            };

            PlayEventCard(eventPlayed);
        }
    /// <summary>
    /// Loads all card data from a large string containing the info in CSV format.
    /// </summary>
    /// <param name="csv">The string containing card info in CSV format</param>
    public void LoadCSVText(string csv)
    {
        Debug.Log("Loading CSV Text...");
        // Parses CSV into a format where each line is separated and split further into a list of cells
        List <List <string> > parsedCsv = ParseCSV(csv);

        foreach (List <string> line in parsedCsv)
        {
            Card thisCard;
            if (line[1].ToLower() == "action")
            { // this is an Action Card
                thisCard = new ActionCard();
                MasterActionDeck.Add((ActionCard)thisCard);
            }
            else if (line[1].ToLower() == "event")
            { // this is an Event Card
                thisCard = new EventCard();
                if (int.Parse(line[10]) == 1)
                { // this is a super positive event card
                    PositiveEventCards.Add((EventCard)thisCard);
                }
                else if (int.Parse(line[11]) == 1)
                { // this is a super negative event card
                    SuperNegativeEventCards.Add(line[12], (EventCard)thisCard);
                }
                else
                { // this is just a normal event card
                    MasterEventDeck.Add((EventCard)thisCard);
                }
            }
            else
            { // We don't recognize this card's type
                Debug.LogError("Unknown card type " + line[1]);
                continue;
            }

            // Add basic card info from the corresponding slots in the CSV line
            int.TryParse(line[0], out thisCard.cardNumber);
            thisCard.cardName = line[3];
            thisCard.cardDesc = line[5];
            int.TryParse(line[6], out thisCard.costCarbon);
            int.TryParse(line[7], out thisCard.costMoney);
            int.TryParse(line[8], out thisCard.hope);
            int.TryParse(line[9], out thisCard.momentum);

            // Load card image from the corresponding file path for that image
            // e.g., "ActionCards/2-Choose Public Transport"
            thisCard.cardImage = Resources.Load <Sprite>(
                (line[1].ToLower() == "action" ? "ActionCards" : "EventCards")
                + "/" + thisCard.cardNumber.ToString() + "-" + thisCard.cardName);
        }

        Debug.Log("Done loading CSV!");
        // Cards are all loaded and ready to go; time to pass this off to the GameManager
        GameManager.Instance.SetupGame();
    }
Exemplo n.º 22
0
    public bool StoryCardDone()
    {
        if (isDoneStoryEvent)
        {
            //discard story card into story discard pile
            if (currentEvent != null)
            {
                List <Card> cards = new List <Card>();
                cards.Add(currentEvent);
                GameUtil.DiscardCards(storyDeck, cards, storyDeckDiscardPileUIButton);
                // storyDeckDiscardPileUIButton.myCard = currentEvent;
                //storyDeckDiscardPileUIButton.ChangeTexture();
                //storyDeck.discard.Add(currentEvent);
            }
            else if (currentQuest != null)
            {
                List <Card> cards = new List <Card>();
                cards.Add(currentQuest);
                GameUtil.DiscardCards(storyDeck, cards, storyDeckDiscardPileUIButton);
                //storyDeckDiscardPileUIButton.myCard = currentQuest;
                //storyDeckDiscardPileUIButton.ChangeTexture();
                //storyDeck.discard.Add(currentQuest);
            }
            else if (currentTournament != null)
            {
                List <Card> cards = new List <Card>();
                cards.Add(currentTournament);
                GameUtil.DiscardCards(storyDeck, cards, storyDeckDiscardPileUIButton);
                //storyDeckDiscardPileUIButton.myCard = currentTournament;
                //storyDeckDiscardPileUIButton.ChangeTexture();
                //storyDeck.discard.Add(currentTournament);
            }

            isDoneStoryEvent  = false;
            currentEvent      = null;
            currentQuest      = null;
            currentTournament = null;

            //reset players participation
            GameUtil.ResetPlayers(players);
            UIUtil.EmptyPanel(questPanel);
            System.Array.Clear(queriedCards, 0, queriedCards.Length);

            //reset turn to draw new story card
            drawStoryCard = true;
            GameUtil.ToggleDeckAnimation(storyDeckUIButton, drawStoryCard);
            userInput.DeactivateUI();      // just in case
            UIUtil.UpdatePlayerTurn(this); // go to next turn

            return(true);
        }

        return(false);
    }
        public EventCard Build(CardDefinition card)
        {
            if (card.CardType != Domain.CardType.Event)
            {
                throw new Exception("Card is not an event.");
            }
            var @event = new EventCard(card.Name, card.Faction, card.Affiliation, card.Cost.Value);

            //TODO - add behaviors
            return(@event);
        }
Exemplo n.º 24
0
        public void GetIconClasses_Should_ReturnCorrectClasses_When_ClanIsUnicorn_And_TypeIsEvent()
        {
            const string expected = "d-none d-sm-inline-block fa fa-fw fa-bolt fg-dark-unicorn";
            var          card     = new EventCard {
                Clan = Clan.Unicorn
            };
            var viewModel = new CardsListViewModel();

            var result = viewModel.GetIconClasses(card);

            result.Should().Be(expected);
        }
Exemplo n.º 25
0
    //probably not totally extendable (the toggle should send in a bool?) but should work for now
    //also, for persistence, should keep track of what players want on or off.
    public void AddRemoveEvent(EventCard which)
    {
        //save this option:
        if (refEventTog != null)
        {
            PlayerPrefsX.SetBool(which.name, refEventTog.isOn); //also need to take in toggle ;\\\
        }
        //print("setting " + which.name + " " + refEventTog.isOn);
        switch (which.myType)
        {
        case EventCard.eType.Curse:
            if (curseCards.Contains(which))
            {
                curseCards.Remove(which);
            }
            else
            {
                if (PlayerPrefsX.GetBool(which.name))
                {
                    curseCards.Add(which);
                }
            }
            break;

        case EventCard.eType.Bonus:
            if (bonusCards.Contains(which))
            {
                bonusCards.Remove(which);
            }
            else
            {
                if (PlayerPrefsX.GetBool(which.name))
                {
                    bonusCards.Add(which);
                }
            }
            break;

        case EventCard.eType.Mis:
            if (miscCards.Contains(which))
            {
                miscCards.Remove(which);
            }
            else
            {
                if (PlayerPrefsX.GetBool(which.name))
                {
                    miscCards.Add(which);
                }
            }
            break;
        }
    }
Exemplo n.º 26
0
 private void UpdateValues(EventCard card)       //Update card ints;
 {
     _lToArmy   = card.LResultToArmy;
     _lToBelief = card.LResultToBelief;
     _lToMoney  = card.LResultToMoney;
     _lToPeople = card.LResultToPeople;
     //////////////////////////////////
     _rToPeople = card.RResultToPeople;
     _rToMoney  = card.RResultToMoney;
     _rToBelief = card.RResultToBelief;
     _rToArmy   = card.RResultToArmy;
 }
    private void CreateEventRequestsCards()
    {
        int eventsFound = 0;

        Vector3 position = eventCard.transform.position;

        if (EventsService.eventsRequests.Length > 0)
        {
            eventCard.SetActive(true);
        }
        else
        {
            noEventsCard.SetActive(true);
        }

        foreach (EventRequest evtReq in EventsService.eventsRequests)
        {
            Event indexEvt = null;

            foreach (Event evt in EventsService.events)
            {
                if (evt._id == evtReq._appointment._id)
                {
                    indexEvt = evt;
                }
            }

            if (indexEvt == null)
            {
                continue;
            }
            else
            {
                eventsFound += 1;
            }

            position = new Vector3(position.x, position.y, position.z);
            GameObject card = (GameObject)Instantiate(eventCard, position, Quaternion.identity);
            card.transform.SetParent(GameObject.Find("List").transform, false);

            EventCard evtCard = card.GetComponent <EventCard>();
            evtCard.UpdateEventWithStatus(indexEvt, evtReq);
        }

        if (eventsFound == 0)
        {
            noEventsCard.SetActive(true);
        }

        eventCard.gameObject.SetActive(false);
        AlertsService.removeLoadingAlert();
    }
Exemplo n.º 28
0
 public void SkipRight()
 {
     if (_currentCard == _createdDeck.EventCards[_createdDeck.EventCards.Count - 1])
     {
         _currentCard      = _createdDeck.EventCards[0];
         _currentCardIndex = 0;
     }
     else
     {
         _currentCardIndex++;
     }
     UpdateCardInfo();
 }
Exemplo n.º 29
0
 public void SkipLeft()
 {
     if (_currentCard == _createdDeck.EventCards[0])
     {
         _currentCard      = _createdDeck.EventCards[_createdDeck.EventCards.Count - 1];
         _currentCardIndex = _createdDeck.EventCards.Count - 1;
     }
     else
     {
         _currentCardIndex--;
     }
     UpdateCardInfo();
 }
Exemplo n.º 30
0
    public void LoadCard(EventCard c)
    {
        if (c == null)
        {
            return;
        }

        card            = c;
        title.text      = c.title;
        template.sprite = c.template;
        effect.text     = c.effect;
        type.sprite     = c.type;
    }
Exemplo n.º 31
0
    public void ReceiveEvent(EventCard eventCard)
    {
        if (!waitingEvent) return;

        this.eventCard = eventCard;

        objectEvent = Instantiate(Resources.Load<GameObject>("Prefabs/Cards/Card_" + (int)eventCard));
        CardAnimation anim = objectEvent.AddComponent<CardAnimation>();
        anim.StartTransition(1);

        receiveEvent = true;
    }
Exemplo n.º 32
0
    public void RevealEventCard()
    {
        if( _eventCards.Count == 0)
        {
            _playAreaState = PlayAreaState.PlayerWon;

            ScoreScreenText.text = "You Lose!";

            ScoreScreen.Move ( ScoreScreenScreenPosition.transform.position, ScoreScreenScreenPosition.transform.rotation, 2.0f, null );
        }
        var newEventCard = _eventCards[0];
        _eventCards.RemoveAt(0);

        var objectMover = newEventCard.GetComponent< ObjectMover >();

        objectMover.Move( this.EventCardScreenPosition.position, EventCardScreenPosition.rotation, MoveHeightForNewTile, null );

        if( _eventCardActive )
        {
            objectMover = _eventCardActive.GetComponent< ObjectMover >();
            objectMover.Move( EventCardDiscardPosition.position, EventCardDiscardPosition.rotation, MoveHeightForReturnTile, null );
            //_eventCards.Add(_eventCardActive);
        }

        _eventCardActive = newEventCard;

        _timer = 4.0f;
    }
Exemplo n.º 33
0
 /// <summary>
 /// 事件处理方法
 /// </summary>
 /// <param name="事件"></param>
 /// <param name="game"></param>
 /// <returns></returns>
 public List<string> 事件处理方法(EventCard.全局事件 事件, ActionStatus game)
 {
     List<string> ActionLst = new List<string>();
     if (!沉默状态 && 自身事件效果.触发效果事件类型 == 事件.触发事件类型)
     {
         if (自身事件效果.触发效果事件方向 != CardUtility.目标选择方向枚举.双方)
         {
             if (自身事件效果.触发效果事件方向 == CardUtility.目标选择方向枚举.本方 && (!事件.触发位置.本方对方标识)) return ActionLst;
             if (自身事件效果.触发效果事件方向 == CardUtility.目标选择方向枚举.对方 && (事件.触发位置.本方对方标识)) return ActionLst;
         }
         if (!string.IsNullOrEmpty(自身事件效果.限制信息) && !SelectUtility.符合选择条件(this, 自身事件效果.限制信息))
         {
             return ActionLst;
         }
         ActionLst.Add(Server.ActionCode.strHitEvent + CardUtility.strSplitMark);
         //这里有可能是一个增益表达式!!
         if (自身事件效果.效果编号.StartsWith("A"))
         {
             ActionLst.AddRange(((SpellCard)CardUtility.GetCardInfoBySN(自身事件效果.效果编号)).UseSpell(game));
         }
         else
         {
             Effect.PointEffect t = new Effect.PointEffect();
             string[] opt = 自身事件效果.效果编号.Split("/".ToCharArray());
             t.持续回合 = CardUtility.Max.ToString();
             t.攻击力 = opt[0];
             t.生命值 = opt[1];
             ((Effect.IAtomicEffect)t).DealMinion(game, this);
         }
         潜行特性 = false;
     }
     return ActionLst;
 }
Exemplo n.º 34
0
        private static void LoadOverlordCards(Game game)
        {
            StreamReader reader = new StreamReader(TitleContainer.OpenStream("overlordcards.txt"));
            overlordCards = new List<OverlordCard>();

            int n = int.Parse(reader.ReadLine());
            for (int i = 0; i < n; i++)
            {
                string line = reader.ReadLine();
                if (line.StartsWith("//")) continue;
                OverlordCard card = null;

                string[] data = line.Split(new char[] { ',' }, 9);

                int id = int.Parse(data[0]);
                string type = data[1];
                string name = data[2];
                int amount = int.Parse(data[3]);
                int cost = int.Parse(data[4]);
                int sell = int.Parse(data[5]);
                string description = data[7];

                switch (type)
                {
                    case "Spawn":
                        List<Monster> monsters = new List<Monster>();
                        string[] creaturesToSpawn = data[6].Split('/');
                        for (int j = 0; j < creaturesToSpawn.Length; j++)
                        {
                            for (int k = 0; k < int.Parse(creaturesToSpawn[j].Split(' ')[1]); k++)
                            {
                                monsters.Add(GetMonster(int.Parse(creaturesToSpawn[j].Split(' ')[0])));
                            }
                        }
                        card = new SpawnCard(id, name, description, cost, sell, monsters.ToArray());
                        break;
                    case "Power":
                        card = new PowerCard(id, name, description, cost, sell);
                        break;
                    case "Trap":
                        card = new TrapCard(id, name, description, cost, sell);
                        break;
                    case "Event":
                        card = new EventCard(id, name, description, cost, sell);
                        break;
                }
                if (card != null)
                    overlordCards.Add(card);
            }
        }