예제 #1
0
 protected void Add(DialogTree.DlgElement data)
 {
     if (data is DialogTree.Say)
     {
         DialogTree.Say _data = (DialogTree.Say)data;
         m_Header.text = _data.m_Who;
         m_Text.text   = _data.m_What;
     }
     else if (data is DialogTree.Choice)
     {
         DialogTree.Choice _data = (DialogTree.Choice)data;
         int k_PageSize          = Bt.Length;
         int index = 0;
         for (int i = 0; i < k_PageSize; i++)
         {
             index = /*(m_Page * k_PageSize)+*/ i;
             if (index < _data.m_Choice.Length)
             {
                 Bt[i].GetComponentInChildren <Text>(true).text = _data.m_Text[index];
                 int fixedi = _data.m_Choice[index]; //if we use i instead, all delegates will be called with the last value i was assigned by the loop !
                 Bt[i].onClick.AddListener(delegate { onClick(fixedi); });
                 Bt[i].enabled = true;
                 Bt[i].gameObject.SetActive(true);
             }
             else
             {
                 Bt[i].gameObject.SetActive(false);
             }
         }
     }
 }
예제 #2
0
    public override DialogTree GetDialog()
    {
        DialogTree.Say    _Say    = new DialogTree.Say();
        DialogTree.Choice _Choice = new DialogTree.Choice();
        int _choice = dlg.GetDialogResult();

        if (_choice > 0)
        {
            m_State = _choice;
        }

        dlg.CreateDialogSetup();
        _Say.m_Who = "Trader";
        switch (m_State)
        {
        case 0:
            _Say.m_What      = "Hello my friend. Do you want to trade?";
            _Choice.m_Choice = new int[] { 20, 10 };
            _Choice.m_Text   = new string[] { "Yes", "No" };
            dlg.AddElement(_Choice);
            break;

        case 10:
            _Say.m_What = "Good by then.";
            m_State     = 11;
            break;

        case 11:
            dlg.SetDone();
            break;

        case 20:
            _Say.m_What = "Check out my wonderful wares...";
            m_State     = 30;
            break;

        case 30:
            _Say.m_What = "[TradePanel]";
            dlg.SetDone();
            ShowTradePanel();
            break;

        default:
            _Say.m_What = "Some suspicious looking persons are lurking other there?";
            m_State     = 0;
            break;
        }
        dlg.AddElement(_Say);
        return(dlg);
    }
예제 #3
0
    public override DialogTree GetDialog()
    {
        DialogTree.Say    _Say    = new DialogTree.Say();
        DialogTree.Choice _Choice = new DialogTree.Choice();
        int _choice = dlg.GetDialogResult();

        if (_choice > 0)
        {
            m_State = _choice;
        }
        if (m_State == 0)
        {
            QuestGlobals.getSingleton();    //Todo rebuild quest on Start/load
            int _GoogleQuestMile = QuestManager.getSingleton().GetQuestById((int)QuestGlobals.QuestEnum.QstWiseManGoogles).GetCurrMile().GetUId();
            if (_GoogleQuestMile >= (int)QstWiseManGoogles.MileEnum.HuntGoogleQuest1 && _GoogleQuestMile < (int)QstWiseManGoogles.MileEnum.HuntGoogleQuest2)
            {
                m_State = 10;
            }
        }
        dlg.CreateDialogSetup();
        _Say.m_Who = "Wise Man";
        switch (m_State)
        {
        case 1:
            _Say.m_What      = "You ponder your option";
            _Choice.m_Choice = new int[] { 2, 3 };
            _Choice.m_Text   = new string[] { "Who are you?", "Are you blind?" };
            dlg.AddElement(_Choice);
            break;

        case 10:
            _Say.m_What      = "Hello again. Did you find my googles?";
            _Choice.m_Choice = new int[] { 20, 30 };
            _Choice.m_Text   = new string[] { "No", "Yes" };
            dlg.AddElement(_Choice);
            break;

        case 20:
            _Say.m_What = "I cannot help you if you dont find them.";
            dlg.SetDone();
            break;

        case 2:
            _Say.m_What = "Iam old and know stuff.";
            m_State     = 1;
            break;

        case 3:
            _Say.m_What      = "I lost my googles. Please find them.";
            m_State          = 1;
            _Choice.m_Choice = new int[] { 4, 5 };
            _Choice.m_Text   = new string[] { "Sure", "Nah" };
            dlg.AddElement(_Choice);
            break;

        case 4:
            _Say.m_What = "You have got a quest.";
            m_State     = 1;
            dlg.SetDone();
            QuestManager.getSingleton().GetQuestById((int)QuestGlobals.QuestEnum.QstWiseManGoogles).ActivateMileByID(
                (int)QstWiseManGoogles.MileEnum.HuntGoogleQuest1);
            break;

        case 5:
            _Say.m_What = "Maybe later. Lets talk about other things.";
            m_State     = 1;
            break;

        default:
            _Say.m_What = "Hello my friend. How may I help you?";
            m_State     = 1;
            break;
        }
        dlg.AddElement(_Say);
        return(dlg);
    }
예제 #4
0
    public override DialogTree GetDialog()
    {
        DialogTree.Say    _Say    = new DialogTree.Say();
        DialogTree.Choice _Choice = new DialogTree.Choice();
        int _choice = dlg.GetDialogResult();

        if (_choice > 0)
        {
            m_State = _choice;
        }
        if (m_State == 0)
        {
            QuestGlobals.getSingleton();    //Todo rebuild quest on Start/load
            int _GoogleQuestMile = QuestManager.getSingleton().GetQuestById((int)QuestGlobals.QuestEnum.QstWiseManGoogles).GetCurrMile().GetUId();
            if (_GoogleQuestMile >= (int)QstWiseManGoogles.MileEnum.HuntGoogleQuest1 && _GoogleQuestMile < (int)QstWiseManGoogles.MileEnum.HuntGoogleQuest2)
            {
                m_State = 10;
            }
        }
        dlg.CreateDialogSetup();
        _Say.m_Who = "Bandits";
        switch (m_State)
        {
        case 1:
            _Say.m_What = "Better dont hassle with them.";
            m_State     = 2;
            break;

        case 2:
            dlg.SetDone();
            break;

        case 10:
            _Say.m_What      = "You still have to get those googles. How are you approaching this situation?";
            _Choice.m_Choice = new int[] { 20, 30, 40 };
            _Choice.m_Text   = new string[] { "Ask them.", "Sneak and steal", "Attack them" };
            dlg.AddElement(_Choice);
            break;

        case 20:
            _Say.m_What = "Hello sir can you please hand over the googles.";
            m_State     = 21;
            break;

        case 21:
            _Say.m_What = "Piss off";
            m_State     = 2;
            break;

        case 30:
            _Say.m_What = "You sneak around their backside and see the googles right there in a basket. You grab them.";
            QuestManager.getSingleton().GetQuestById((int)QuestGlobals.QuestEnum.QstWiseManGoogles).ActivateMileByID(
                (int)QstWiseManGoogles.MileEnum.HuntGoogleQuest2);
            m_State = 2;
            break;

        case 40:
            _Say.m_What = "You are not fit enough for this.";
            m_State     = 2;
            break;

        default:
            _Say.m_What = "Some suspicious looking persons are lurking other there?";
            m_State     = 1;
            break;
        }
        dlg.AddElement(_Say);
        return(dlg);
    }