public ContestDefault(IContestSentence startSentece, Func <ContestDefault, bool> haveWin)
 {
     this.corrects = new List <bool>();
     this.onEnd    = _ => {};
     this.start    = startSentece;
     this.haveWin  = haveWin;
 }
Esempio n. 2
0
 public ContestDef(Action <ContestDef, IContestDisplay> onShowIn,
                   Func <ContestDef, IContestDisplay, IContestSentence> onGoNext,
                   IContestSentence next = null)
 {
     this.next     = next;
     this.onShowIn = onShowIn;
     this.onGoNext = onGoNext;
 }
Esempio n. 3
0
    public static Sentence CreateDialog(string[] sentences, IContestSentence nextSentence = null)
    {
        IContestSentence next = nextSentence;

        for (int i = sentences.Length - 1; i >= 0; i--)
        {
            Sentence s = new Sentence(sentences[i], next);
            next = s;
        }
        return((Sentence)next);
    }
Esempio n. 4
0
    public void SetNext(IContestSentence next)
    {
        if (nexts == null)
        {
            this.nexts = new IContestSentence[3];
        }

        this.nexts[0] = next;
        this.nexts[1] = next;
        this.nexts[2] = next;
    }
 public void MoveNext()
 {
     currentSentence = currentSentence.GoToNextSentence(this);
     if (currentSentence == null)
     {
         FinishGame();
         SwitchScenes.Get().ActiveMainScene();
     }
     else
     {
         currentSentence.ShowIn(this);
     }
 }
    public ContestData(string question, string[] answers, string[][] corrections,
                       bool[] correct, string[] sentences = null, string[] finalSentences = null)
    {
        IContestSentence[] correctionsSentences = new IContestSentence[numberOfAnswers];
        IContestSentence   final = finalSentences == null? null : SentenceListWithEffects(finalSentences);

        for (int i = 0; i < numberOfAnswers; i++)
        {
            correctionsSentences[i] = SentenceListWithEffects(corrections[i], final);
        }

        ContestQuestion q = new ContestQuestion(this, question, answers, correct, correctionsSentences);

        start = SentenceListWithEffects(sentences, q);
    }
    public void StartContest(IContestData contest, GameObject guy,
                             Quaternion rotation, Vector3 scale,
                             Vector3 offset)
    {
        onContest      = true;
        currentContest = contest;
        currentContest.Restart();
        currentSentence = contest.Begin();
        lastAnswer      = -1;

        contestGuy = Instantiate(guy, guyPosition.position + offset, rotation);
        Destroy(contestGuy.GetComponent <ContestInitiator>());
        contestGuy.transform.localScale = scale;
        realGuy = guy;

        currentSentence.ShowIn(this);
    }
    public static IContestSentence SentenceListWithEffects(string[] sentences, IContestSentence nextSentence = null)
    {
        IContestSentence next = nextSentence;

        for (int i = sentences.Length - 1; i >= 0; i--)
        {
            IContestSentence s;
            if (sentences[i].Length == 0 || sentences[i][0] != '#')
            {
                s = new Sentence(sentences[i], next);
            }
            else
            {
                s = new EffectSentence(sentences[i].Substring(1), next);
            }
            next = s;
        }
        return(next);
    }
 public void SetSentences(IContestSentence start)
 {
     this.start = start;
 }
 public ContestDefault(IContestSentence startSentece = null)
     : this(startSentece, _ => true)
 {
 }
Esempio n. 11
0
 public Sentence(string sentence, IContestSentence next = null)
 {
     this.sentence = sentence;
     this.next     = next;
 }
Esempio n. 12
0
 public void SetNext(IContestSentence next)
 {
     this.next = next;
 }
Esempio n. 13
0
 public ContestHideButtons(IContestSentence next = null)
 {
     this.next = next;
 }
 public EffectSentence(string name, IContestSentence next = null)
 {
     this.effectName = name;
     this.next       = next;
 }