Exemple #1
0
    private void showTaskPrompt(NodeEditorFramework.Standard.StartTaskNode node, Entity speaker)
    {
        if (window)
        {
            endDialogue(0, false);
        }

        CreateWindow(taskDialogueBoxPrefab, node.dialogueText, node.useEntityColor && speaker ? FactionManager.GetFactionColor(speaker.faction) : node.dialogueColor, speaker);
        DialogueViewTransitionIn(speaker);
        AudioManager.PlayClipByID("clip_select", true); // task button cannot create a noise because it launches endDialogue()
        // so cover for its noise here

        // Objective list
        var objectiveList = background.transform.Find("ObjectiveList").GetComponent <Text>();

        objectiveList.text = node.objectiveList;

        var wrapper = new RewardWrapper();

        wrapper.creditReward      = node.creditReward;
        wrapper.partAbilityID     = node.partAbilityID;
        wrapper.partReward        = node.partReward;
        wrapper.partSecondaryData = node.partSecondaryData;
        wrapper.partTier          = node.partTier;
        wrapper.reputationReward  = node.reputationReward;
        wrapper.shardReward       = node.shardReward;
        wrapper.partID            = node.partID;

        SetupRewards(background.gameObject, wrapper);

        string[] answers =
        {
            node.declineResponse,
            node.acceptResponse
        };

        // create buttons
        buttons = new GameObject[answers.Length];

        for (int i = 0; i < answers.Length; i++)
        {
            //TODO: createButton()
            int index = i;
            buttons[i] = CreateButton(answers[i], () =>
            {
                if (index == 1)
                {
                    DialogueViewTransitionOut();
                    SectorManager.instance.player.alerter.showMessage("New Task", "clip_victory");
                    endDialogue(index, false);
                }
                else
                {
                    endDialogue(index, true);
                }
            }, 24 + 24 * i);
        }
    }
Exemple #2
0
    private void SetupRewards(GameObject gameObject, RewardWrapper wrapper)
    {
        gameObject.transform.Find("Credit Reward Text").GetComponent <Text>().text =
            "Credit reward: " + wrapper.creditReward;

        gameObject.transform.Find("Reputation Reward Text").GetComponent <Text>().text =
            "Reputation reward: " + wrapper.reputationReward;
        // Part reward
        if (wrapper.partReward)
        {
            // Part image:
            PartBlueprint blueprint = ResourceManager.GetAsset <PartBlueprint>(wrapper.partID);
            if (!blueprint)
            {
                Debug.LogWarning("Part reward of Start Task wrapper not found!");
            }

            var partImage = gameObject.transform.Find("Part").GetComponent <Image>();
            partImage.sprite = ResourceManager.GetAsset <Sprite>(blueprint.spriteID);
            partImage.rectTransform.sizeDelta = partImage.sprite.bounds.size * 45;
            partImage.color = Color.green;

            // Ability image:
            if (wrapper.partAbilityID > 0)
            {
                var backgroudBox   = gameObject.transform.Find("backgroundbox");
                var abilityIcon    = backgroudBox.Find("Ability").GetComponent <Image>();
                var tierIcon       = backgroudBox.Find("Tier").GetComponent <Image>();
                var type           = backgroudBox.Find("Type").GetComponent <Text>();
                var abilityTooltip = backgroudBox.GetComponent <AbilityButtonScript>();

                abilityIcon.sprite = AbilityUtilities.GetAbilityImageByID(wrapper.partAbilityID, wrapper.partSecondaryData);
                if (wrapper.partTier >= 1)
                {
                    tierIcon.sprite = ResourceManager.GetAsset <Sprite>("AbilityTier" + Mathf.Clamp(wrapper.partTier, 1, 3));
                }
                else
                {
                    tierIcon.enabled = false;
                }

                type.text = AbilityUtilities.GetAbilityNameByID(wrapper.partAbilityID, null) + (wrapper.partTier > 0 ? " " + wrapper.partTier : "");
                string description = "";
                description += AbilityUtilities.GetAbilityNameByID(wrapper.partAbilityID, null) + (wrapper.partTier > 0 ? " " + wrapper.partTier : "") + "\n";
                description += AbilityUtilities.GetDescriptionByID(wrapper.partAbilityID, wrapper.partTier, null);
                abilityTooltip.abilityInfo = description;
            }
            else
            {
                gameObject.transform.Find("backgroundbox").gameObject.SetActive(false);
            }
        }
        else
        {
            gameObject.transform.Find("Part").GetComponent <Image>().enabled = false;
            gameObject.transform.Find("backgroundbox").gameObject.SetActive(false);
        }
    }
Exemple #3
0
    private void showReward(RewardWrapper wrapper)
    {
        if (window)
        {
            endDialogue(0, false);
        }

        //create window
        window = Instantiate(rewardBoxPrefab).GetComponentInChildren <GUIWindowScripts>();
        window.Activate();
        window.transform.SetSiblingIndex(0);

        SetupRewards(window.gameObject, wrapper);
    }
Exemple #4
0
 public static void ShowReward(RewardWrapper wrapper)
 {
     Instance.showReward(wrapper);
 }