示例#1
0
    public void ShowSummaryScreenProperly()
    {
        view.ShowSummaryScreen(new[]
        {
            new AirdroppingHUDController.ItemModel()
            {
                name         = "item",
                rarity       = "rare",
                subtitle     = "subtitle",
                type         = "collectible",
                thumbnailURL = "url"
            },
            new AirdroppingHUDController.ItemModel()
            {
                name         = "item2",
                rarity       = "rare",
                subtitle     = "subtitle2",
                type         = "collectible",
                thumbnailURL = "url"
            }
        });

        AirdroppingItemPanel[] itemPanel = view.summaryItemsContainer.GetComponentsInChildren <AirdroppingItemPanel>();

        Assert.IsTrue(view.summaryScreen.activeSelf);
        Assert.NotNull(itemPanel);
        Assert.AreEqual(2, itemPanel.Length);
        Assert.AreEqual("item", itemPanel[0].name.text);
        Assert.AreEqual("subtitle", itemPanel[0].subtitle.text);
        Assert.AreEqual("item2", itemPanel[1].name.text);
        Assert.AreEqual("subtitle2", itemPanel[1].subtitle.text);
    }
    public void ApplyState()
    {
        switch (currentState)
        {
        case State.Initial:
            currentItemShown = 0;
            view.SetContentActive(true);
            view.ShowInitialScreen(model.title, model.subtitle);
            break;

        case State.SingleItem:
            view.ShowItemScreen(model.items[currentItemShown], model.items.Length - (currentItemShown + 1));
            break;

        case State.Summary:
            view.ShowSummaryScreen(model.items);
            break;

        case State.Summary_NoItems:
            view.ShowSummaryNoItemsScreen();
            break;

        case State.Finish:
            WebInterface.SendUserAcceptedCollectibles(model.id);

            OnAirdropFinished?.Invoke();

            MoveToNextState();
            break;

        case State.Hidden:
        default:
            model = null;
            view.SetContentActive(false);
            break;
        }
    }