public void SetData(PlayerPreferencesManager playerPreferencesManager, BattleSceneData data)
    {
        sceneData        = data;
        Title.text       = data.SceneTitle;
        Thumbnail.sprite = data.SceneThumbnail;

        int objectivesAmount = data.Objectives.Count;
        int questsAmount     = data.Quests.Count;

        ObjectivesLabel.text = LanguageManager.Instance.GetTextValue(_objectivesLabelLocId);

        ProgressData progressData = playerPreferencesManager.LoadProgressData();

        for (int i = 0; i < objectivesAmount; i++)
        {
            GameObject objective = GameObject.Instantiate(ObjectivePrefab);
            objective.transform.SetParent(ObjectivesContainer);
            objective.transform.localScale = Vector3.one;
            objective.transform.SetSiblingIndex(i + 1);
            objective.GetComponent <HUDBattleSceneObjective>().Label.text = data.GetObjectiveById(i).Name;
            objective.GetComponent <HUDBattleSceneObjective>().SetToggle(progressData.GetLevelDataById(data.TargetSceneName).GetObjectiveById(i).Completed);
        }

        QuestsLabel.text = LanguageManager.Instance.GetTextValue(_questsLabelLocId);

        for (int i = 0; i < questsAmount; i++)
        {
            GameObject quest = GameObject.Instantiate(ObjectivePrefab);
            quest.transform.SetParent(ObjectivesContainer);
            quest.transform.localScale = Vector3.one;
            quest.transform.SetSiblingIndex(i + objectivesAmount + 2);
            quest.GetComponent <HUDBattleSceneObjective>().Label.text = data.GetQuestById(i).Name;
            quest.GetComponent <HUDBattleSceneObjective>().SetToggle(progressData.GetLevelDataById(data.TargetSceneName).GetQuestById(i).Completed);
        }

        AcceptButtonLabel.text = LanguageManager.Instance.GetTextValue(_acceptButtonLabelLocId);
        CancelButtonLabel.text = LanguageManager.Instance.GetTextValue(_cancelButtonLabelLocId);

        //AcceptButtonLabel.GetComponentInParent<UIButton>().OnClick.AddListener(OnAcceptClicked);
        //CancelButtonLabel.GetComponentInParent<UIButton>().OnClick.AddListener(OnCancelClicked);

        //if (data.MapConversation != null)
        //    Card._Common._ConversationsManager.StartConversation(data.MapConversation);
    }
Example #2
0
 private void Start()
 {
     _progressData = _playerPreferencesManager.LoadProgressData();
 }