Exemple #1
0
    private void InformDraftDisplayOfChoices(List <NetCache.CardDefinition> choices)
    {
        DraftDisplay display = DraftDisplay.Get();

        if (display != null)
        {
            if (choices.Count == 0)
            {
                DraftDisplay.DraftMode mode;
                if (this.m_chest == null)
                {
                    mode = DraftDisplay.DraftMode.ACTIVE_DRAFT_DECK;
                    this.m_deckActiveDuringSession = true;
                }
                else
                {
                    mode = DraftDisplay.DraftMode.IN_REWARDS;
                }
                display.SetDraftMode(mode);
            }
            else
            {
                display.SetDraftMode(DraftDisplay.DraftMode.DRAFTING);
                display.AcceptNewChoices(choices);
            }
        }
    }
Exemple #2
0
        internal ArenaDraftData()
        {
            this.Deck = new List <Triton.Game.Abstraction.EntityDef>();
            DraftDisplay display = DraftDisplay.Get();

            if (display.m_chosenHero != null)
            {
                this.Hero = new Triton.Game.Abstraction.Actor(display.m_chosenHero);
            }
            this.Choices = new List <Triton.Game.Abstraction.Actor>();
            foreach (DraftDisplay.DraftChoice choice in display.m_choices)
            {
                this.Choices.Add(new Triton.Game.Abstraction.Actor(choice.m_actor));
            }
            DefLoader    loader  = DefLoader.Get();
            DraftManager manager = DraftManager.Get();

            foreach (CollectionDeckSlot slot in manager.m_draftDeck.m_slots)
            {
                for (int i = 0; i < slot.Count; i++)
                {
                    this.Deck.Add(new Triton.Game.Abstraction.EntityDef(loader.GetEntityDef(slot.CardID)));
                }
            }
            this.Wins   = manager.m_wins;
            this.Losses = manager.m_losses;
        }
Exemple #3
0
    public bool HandleKeyboardInput()
    {
        if (DraftDisplay.Get() == null)
        {
            return(false);
        }
        if (Input.GetKeyUp(KeyCode.Escape) && DraftDisplay.Get().IsInHeroSelectMode())
        {
            DraftDisplay.Get().DoHeroCancelAnimation();
            return(true);
        }
        if (!ApplicationMgr.IsInternal())
        {
            return(false);
        }
        List <DraftCardVisual> cardVisuals = DraftDisplay.Get().GetCardVisuals();

        if (cardVisuals == null)
        {
            return(false);
        }
        if (cardVisuals.Count == 0)
        {
            return(false);
        }
        int num = -1;

        if (Input.GetKeyUp(KeyCode.Alpha1))
        {
            num = 0;
        }
        else if (Input.GetKeyUp(KeyCode.Alpha2))
        {
            num = 1;
        }
        else if (Input.GetKeyUp(KeyCode.Alpha3))
        {
            num = 2;
        }
        if (num == -1)
        {
            return(false);
        }
        if (cardVisuals.Count < (num + 1))
        {
            return(false);
        }
        DraftCardVisual visual = cardVisuals[num];

        if (visual == null)
        {
            return(false);
        }
        visual.ChooseThisCard();
        return(true);
    }
Exemple #4
0
    private bool CanShowCredits()
    {
        SceneMgr.Mode mode = SceneMgr.Get().GetMode();
        switch (mode)
        {
        case SceneMgr.Mode.GAMEPLAY:
        case SceneMgr.Mode.PACKOPENING:
            break;

        default:
            switch (mode)
            {
            case SceneMgr.Mode.CREDITS:
            case SceneMgr.Mode.ADVENTURE:
                break;

            case SceneMgr.Mode.RESET:
                goto Label_003D;

            default:
                goto Label_003D;
            }
            break;
        }
        return(false);

Label_003D:
        if ((GeneralStore.Get() != null) && GeneralStore.Get().IsShown())
        {
            return(false);
        }
        if (Network.Get().IsFindingGame())
        {
            return(false);
        }
        if (!GameUtils.AreAllTutorialsComplete())
        {
            return(false);
        }
        if (WelcomeQuests.Get() != null)
        {
            return(false);
        }
        if ((ArenaStore.Get() != null) && ArenaStore.Get().IsShown())
        {
            return(false);
        }
        if ((DraftDisplay.Get() != null) && (DraftDisplay.Get().GetDraftMode() == DraftDisplay.DraftMode.IN_REWARDS))
        {
            return(false);
        }
        return(true);
    }
Exemple #5
0
    private void OnError()
    {
        if (SceneMgr.Get().IsModeRequested(SceneMgr.Mode.DRAFT))
        {
            Network.DraftError draftError = Network.GetDraftError();
            DraftDisplay       display    = DraftDisplay.Get();
            switch (draftError)
            {
            case Network.DraftError.DE_UNKNOWN:
                Debug.LogError("DraftManager.OnError - UNKNOWN EXCEPTION - Talk to Brode or Fitch.");
                return;

            case Network.DraftError.DE_NO_LICENSE:
                Debug.LogWarning("DraftManager.OnError - No License.  What does this mean???");
                return;

            case Network.DraftError.DE_RETIRE_FIRST:
                Debug.LogError("DraftManager.OnError - You cannot start a new draft while one is in progress.");
                return;

            case Network.DraftError.DE_NOT_IN_DRAFT:
                if (display != null)
                {
                    display.SetDraftMode(DraftDisplay.DraftMode.NO_ACTIVE_DRAFT);
                }
                return;

            case Network.DraftError.DE_NOT_IN_DRAFT_BUT_COULD_BE:
                if (!Options.Get().GetBool(Option.HAS_SEEN_FORGE, false))
                {
                    DraftDisplay.Get().SetDraftMode(DraftDisplay.DraftMode.NO_ACTIVE_DRAFT);
                    return;
                }
                this.RequestDraftStart();
                return;

            case Network.DraftError.DE_FEATURE_DISABLED:
                Debug.LogError("DraftManager.OnError - The Arena is currently disabled. Returning to the hub.");
                if (!SceneMgr.Get().IsModeRequested(SceneMgr.Mode.HUB))
                {
                    SceneMgr.Get().SetNextMode(SceneMgr.Mode.HUB);
                    Error.AddWarningLoc("GLOBAL_FEATURE_DISABLED_TITLE", "GLOBAL_FEATURE_DISABLED_MESSAGE_FORGE", new object[0]);
                }
                return;
            }
            Debug.LogError("DraftManager.onError - UNHANDLED ERROR - please send this to Brode. ERROR: " + draftError.ToString());
        }
    }
 public void ChooseThisCard()
 {
     if (!GameUtils.IsAnyTransitionActive())
     {
         Log.Arena.Print(string.Format("Client chooses: {0} ({1})", this.m_actor.GetEntityDef().GetName(), this.m_actor.GetEntityDef().GetCardId()), new object[0]);
         if (this.m_actor.GetEntityDef().IsHero())
         {
             DraftDisplay.Get().OnHeroClicked(this.m_cardChoice);
         }
         else
         {
             this.m_chosen = true;
             DraftManager.Get().MakeChoice(this.m_cardChoice);
         }
     }
 }
Exemple #7
0
    private bool OnFindGameEvent(FindGameEventData eventData, object userData)
    {
        switch (eventData.m_state)
        {
        case FindGameState.BNET_ERROR:
        case FindGameState.SERVER_GAME_CANCELED:
        case FindGameState.CLIENT_ERROR:
            DraftDisplay.Get().HandleGameStartupFailure();
            break;

        case FindGameState.CLIENT_CANCELED:
            Network.TrackClient(Network.TrackLevel.LEVEL_INFO, Network.TrackWhat.TRACK_CANCEL_MATCHMAKER);
            DraftDisplay.Get().HandleGameStartupFailure();
            break;
        }
        return(false);
    }
Exemple #8
0
 private void OnChosen()
 {
     Network.DraftChosen chosenAndNext = Network.GetChosenAndNext();
     if (this.m_currentSlot == 0)
     {
         Log.Arena.Print(string.Format("DraftManager.OnChosen(): hero={0} premium={1}", chosenAndNext.ChosenCard.Name, chosenAndNext.ChosenCard.Premium), new object[0]);
         this.m_draftDeck.HeroCardID    = chosenAndNext.ChosenCard.Name;
         this.m_draftDeck.HeroCardFlair = new CardFlair(chosenAndNext.ChosenCard.Premium);
     }
     else
     {
         this.m_draftDeck.AddCard(chosenAndNext.ChosenCard.Name, chosenAndNext.ChosenCard.Premium);
     }
     this.m_currentSlot++;
     if ((this.m_currentSlot > 30) && (DraftDisplay.Get() != null))
     {
         DraftDisplay.Get().DoDeckCompleteAnims();
     }
     this.InformDraftDisplayOfChoices(chosenAndNext.NextChoices);
 }
 public override void Unload()
 {
     this.m_unloading = true;
     DraftDisplay.Get().Unload();
     this.m_unloading = false;
 }