コード例 #1
0
 public ConversationOptionData(string _text, int _id, CompanyValue _trait, OptionTrigger _type)
 {
     optionText = _text;
     optionDestinationStepID = _id;
     optionTrait             = _trait;
     optionType = _type;
 }
コード例 #2
0
 public ConversationOptionData(string _text, int _id)
 {
     optionText              = _text;
     optionType              = OptionTrigger.None;
     optionTrait             = CompanyValue.NULL;
     optionDestinationStepID = _id;
 }
コード例 #3
0
ファイル: UIManager.cs プロジェクト: youdevils/PixelOffice
    public void AddConversationResponse(string _responsetext, int _responseID, CompanyValue _trait, OptionTrigger _type, Quest _quest)
    {
        GameObject btn = Instantiate(conversationOptionPrefab, conversationOptionContainer) as GameObject;

        btn.GetComponentInChildren <TextMeshProUGUI>().text = _responsetext;
        btn.GetComponent <Button>().onClick.AddListener(delegate { ConversationManager.instance.NextConversationStep(_responseID); });
        if (_type == OptionTrigger.QuestAcceptance)
        {
            btn.GetComponent <Button>().onClick.AddListener(delegate { _quest.Accept(); });
        }
        else if (_type == OptionTrigger.ObtainQuestReward)
        {
            btn.GetComponent <Button>().onClick.AddListener(delegate { _quest.ClaimReward(); });
        }
        switch (_trait)
        {
        case CompanyValue.NULL:
            btn.transform.GetChild(1).GetChild(0).GetComponent <Image>().enabled = false;
            break;

        case CompanyValue.ValueOne:
            btn.transform.GetChild(1).GetChild(0).GetComponent <Image>().enabled = true;
            btn.transform.GetChild(1).GetChild(0).GetComponent <Image>().sprite  = perceptionIcon;
            btn.transform.GetChild(1).GetChild(0).GetComponent <Image>().color   = ValueOneColor;
            break;

        case CompanyValue.ValueTwo:
            btn.transform.GetChild(1).GetChild(0).GetComponent <Image>().enabled = true;
            btn.transform.GetChild(1).GetChild(0).GetComponent <Image>().sprite  = managementIcon;
            btn.transform.GetChild(1).GetChild(0).GetComponent <Image>().color   = ValueTwoColor;
            break;

        case CompanyValue.ValueThree:
            btn.transform.GetChild(1).GetChild(0).GetComponent <Image>().enabled = true;
            btn.transform.GetChild(1).GetChild(0).GetComponent <Image>().sprite  = coWorkerIcon;
            btn.transform.GetChild(1).GetChild(0).GetComponent <Image>().color   = ValueThreeColor;
            break;

        default:
            Debug.LogError("Unknown Trait Type");
            break;
        }
    }
コード例 #4
0
ファイル: Conversation.cs プロジェクト: youdevils/PixelOffice
    public void AddOption(ConversationStepData _destStep, string _text, ConversationStepData _parentStep, CompanyValue _value, OptionTrigger _trigger)
    {
        if (!conversationSteps.Contains(_parentStep))
        {
            AddStep(_parentStep);
        }

        if (!conversationSteps.Contains(_destStep))
        {
            AddStep(_destStep);
        }

        ConversationOptionData newOption;

        if (_destStep == null)
        {
            newOption = new ConversationOptionData(_text, -1, _value, _trigger);
        }
        else
        {
            newOption = new ConversationOptionData(_text, _destStep.stepID, _value, _trigger);
        }

        _parentStep.myOptions.Add(newOption);
    }