// MARK: Fetch

    public void presentFetch(Objectives.FetchResponse response)
    {
        Debug.Log(response.objectives.Length + " Objectives Fetched !");

        var initializationScript = FindObjectOfType <ObjectivesInitialization>();
        var windowView           = initializationScript.gameObjectivesTitle;

        var pageIndex = response.currentIndex / response.objectives.Length;

        windowView.text = pageIndex < QUEST_SET_NAMES.Length ?
                          QUEST_SET_NAMES[pageIndex]
                            : DEFAULT_QUEST_SET_NAME;

        var objectivesViews = initializationScript.objectivesView;

        for (int i = 0; i < response.objectives.Length; i++)
        {
            objectivesViews[i].titleLabel.text          = response.objectives[i].title;
            objectivesViews[i].descriptionLabel.text    = response.objectives[i].description;
            objectivesViews[i].completionLabel.text     = response.objectives[i].currentStep + " / " + response.objectives[i].numberOfSteps;
            objectivesViews[i].rewardLabel.text         = "" + response.objectives[i].reward;
            objectivesViews[i].claimButton.interactable = response.objectives[i].currentStep == response.objectives[i].numberOfSteps && !response.objectives[i].isRewardClaimed;
            objectivesViews[i].starImage.sprite         = response.objectives[i].currentStep == response.objectives[i].numberOfSteps ? initializationScript.starOn : initializationScript.starOff;
        }
    }
Ejemplo n.º 2
0
    // MARK: Fetch

    public void doFetch(Objectives.FetchRequest request)
    {
        var response = new Objectives.FetchResponse();

        numberOfObjectives = request.numberOfObjectives;
        fetchedSet         = request.set;

        this.fetchedObjectives = ObjectivesWorker.Read(numberOfObjectives, fetchedSet);
        response.objectives    = this.fetchedObjectives;
        response.currentIndex  = ObjectivesWorker.ReadIndex(fetchedSet);

        this.presenter.presentFetch(response);
    }
Ejemplo n.º 3
0
 void IObjectivesPresenter.presentFetch(Objectives.FetchResponse response)
 {
     presentFetchCalled = true;
     lastFetchResponse  = response;
 }