Ejemplo n.º 1
0
        public override async Task <InstanceState> RemoveAsync(InstanceContext context, RemoveInstance command, CancellationToken cancellationToken)
        {
            await context.Mediator.ExecuteAsync(command, cancellationToken);

            return(context.InstanceStates.Get(InstanceStates.Idle));
        }
Ejemplo n.º 2
0
        public override async Task <InstanceState> RemoveAsync(InstanceContext context, RemoveInstance command, CancellationToken cancellationToken)
        {
            var rvalue = await VacateAsync(context, new VacateInstance(), cancellationToken);

            rvalue = await rvalue.RemoveAsync(context, new RemoveInstance(), cancellationToken);

            return(rvalue);
        }
Ejemplo n.º 3
0
        public async Task RemoveAsync(RemoveInstance command, CancellationToken cancellationToken)
        {
            _currentState = await _currentState.RemoveAsync(this, command, cancellationToken);

            await repository.SetInstanceStateAsync(_currentState.State, cancellationToken);
        }
Ejemplo n.º 4
0
    public IEnumerator ThreeQuestions()
    {
        int             type         = 0;
        int             ShittyLoop   = 0;
        List <Question> threeAnswers = new List <Question>();

        threeAnswers.Add(question);
        int AreaPlace = 0;

        for (int i = 1; i < 3; i++)
        {
            threeAnswers.Add(Questions[Random.Range(0, Questions.Length - 1)]);
            while (threeAnswers[i] == threeAnswers[0])
            {
                threeAnswers[i] = Questions[Random.Range(0, Questions.Length - 1)];
            }
        }

        GameObject Block;

        while (threeAnswers.Count > 0)
        {
            Question Allquestion = threeAnswers[Random.Range(0, threeAnswers.Count)];
            Block     = Instantiate(blockExample, Areas[AreaPlace], blockExample.transform.rotation);
            Block.tag = "Instance";
            Block.transform.SetParent(_Background.transform.parent);
            Block.transform.localScale = new Vector2(1, 1);
            Block.GetComponentInChildren <Text>().text = Allquestion.answer;

            Block.GetComponent <Date>().answer = Allquestion.answer;
            threeAnswers.Remove(Allquestion);
            print(threeAnswers.Count);
            AreaPlace++;
            yield return(null);
        }

        List <GameObject> texts = new List <GameObject>();

        foreach (GameObject t in GameObject.FindGameObjectsWithTag("Instance"))
        {
            texts.Add(t);
        }
        for (int i = 0; i < Days.Length; i++)
        {
            if (Days[i] == question.answer)
            {
                type = 1;
            }
        }

        foreach (GameObject RemoveInstance in GameObject.FindGameObjectsWithTag("Instance"))
        {
            if (RemoveInstance.GetComponent <Date>().answer != question.answer)
            {
                if (type == 0)
                {
                    RemoveInstance.GetComponentInChildren <Text>().text = Dates[Random.Range(0, Dates.Length)];
                }
                else
                {
                    RemoveInstance.GetComponentInChildren <Text>().text = Days[Random.Range(0, Days.Length)];
                }
            }
        }

        if (type == 0)
        {
            while (texts[0].GetComponentInChildren <Text>().text == texts[1].GetComponentInChildren <Text>().text ||
                   texts[0].GetComponentInChildren <Text>().text == texts[2].GetComponentInChildren <Text>().text ||
                   texts[1].GetComponentInChildren <Text>().text == texts[2].GetComponentInChildren <Text>().text)
            {
                Debug.Log("Redone");
                for (int i = 0; i < texts.Count; i++)
                {
                    if (texts[i].GetComponent <Date>().answer != question.answer)
                    {
                        texts[i].GetComponentInChildren <Text>().text = Dates[Random.Range(0, Dates.Length)];
                    }
                }
                Debug.Log(texts[0].GetComponentInChildren <Text>().text + texts[1].GetComponentInChildren <Text>().text + texts[2].GetComponentInChildren <Text>().text);

                ShittyLoop++;
                if (ShittyLoop > 100)
                {
                    break;
                }
            }
        }
        else
        {
            //threeAnswers[1].answer = Days[Random.Range(0, Days.Length)];
            //threeAnswers[2].answer = Days[Random.Range(0, Days.Length)];
            while (texts[0].GetComponentInChildren <Text>().text == texts[1].GetComponentInChildren <Text>().text ||
                   texts[0].GetComponentInChildren <Text>().text == texts[2].GetComponentInChildren <Text>().text ||
                   texts[1].GetComponentInChildren <Text>().text == texts[2].GetComponentInChildren <Text>().text)
            {
                Debug.Log("Redo");
                for (int i = 0; i < texts.Count; i++)
                {
                    if (texts[i].GetComponent <Date>().answer != question.answer)
                    {
                        texts[i].GetComponentInChildren <Text>().text = Days[Random.Range(0, Days.Length)];
                    }
                }
                Debug.Log(texts[0].GetComponentInChildren <Text>().text + texts[1].GetComponentInChildren <Text>().text + texts[2].GetComponentInChildren <Text>().text);
                ShittyLoop++;
                if (ShittyLoop > 100)
                {
                    break;
                }
            }
        }
    }
Ejemplo n.º 5
0
 public override Task <InstanceState> RemoveAsync(InstanceContext context, RemoveInstance command, CancellationToken cancellationToken) =>
 Task.FromResult <InstanceState>(this);
 public abstract Task <InstanceState> RemoveAsync(InstanceContext context, RemoveInstance command, CancellationToken cancellationToken);