示例#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);
        }
    }
示例#2
0
    private void showTaskPrompt(NodeEditorFramework.Standard.StartTaskNode node, Entity speaker) //TODO: reward part image
    {
        if (window)
        {
            endDialogue(0, false);
        }
        CreateWindow(taskDialogueBoxPrefab, node.dialogueText, 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;

        background.transform.Find("Credit Reward Text").GetComponent <Text>().text =
            "Credit reward: " + node.creditReward;

        background.transform.Find("Reputation Reward Text").GetComponent <Text>().text =
            "Reputation reward: " + node.reputationReward;
        // Part reward
        if (node.partReward)
        {
            // Part image:
            PartBlueprint blueprint = ResourceManager.GetAsset <PartBlueprint>(node.partID);
            if (!blueprint)
            {
                Debug.LogWarning("Part reward of Start Task node not found!");
            }
            var partImage = background.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 (node.partAbilityID > 0)
            {
                var backgroudBox   = background.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(node.partAbilityID, node.partSecondaryData);
                if (node.partTier >= 1)
                {
                    tierIcon.sprite = ResourceManager.GetAsset <Sprite>("AbilityTier" + Mathf.Clamp(node.partTier, 1, 3));
                }
                else
                {
                    tierIcon.enabled = false;
                }
                type.text = AbilityUtilities.GetAbilityNameByID(node.partAbilityID, null) + (node.partTier > 0 ? " " + node.partTier : "");
                string description = "";
                description += AbilityUtilities.GetAbilityNameByID(node.partAbilityID, null) + (node.partTier > 0 ? " " + node.partTier : "") + "\n";
                description += AbilityUtilities.GetDescriptionByID(node.partAbilityID, node.partTier, null);
                abilityTooltip.abilityInfo = description;
            }
            else
            {
                background.transform.Find("backgroundbox").gameObject.SetActive(false);
            }
        }
        else
        {
            background.transform.Find("Part").GetComponent <Image>().enabled = false;
            background.transform.Find("backgroundbox").gameObject.SetActive(false);
        }

        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);
        }
    }
示例#3
0
 public static void ShowTaskPrompt(NodeEditorFramework.Standard.StartTaskNode node, Entity speaker = null)
 {
     Instance.showTaskPrompt(node, speaker);
 }