Exemplo n.º 1
0
    public void generate()
    {
        arr         = System.Array.ConvertAll(coef.text.ToString().Split(','), new System.Converter <string, int>(int.Parse));
        BoxScript.a = System.Array.ConvertAll(x.text.ToString().Split(','), new System.Converter <string, int>(int.Parse));

        for (int i = 1; i < arr.Length + 1; i++)
        {
            if (i == arr.Length)
            {
                var obsjs = Instantiate(boxf, new Vector2(i * 300, 400), Quaternion.identity, GameObject.FindGameObjectWithTag("Finish").transform);
                list.Add(obsjs);

                log.AddEvent("Created Process : P" + (i - 1).ToString());
            }
            else
            {
                var obsj = Instantiate(box, new Vector2(i * 300, 400), Quaternion.identity, GameObject.FindGameObjectWithTag("Finish").transform);
                list.Add(obsj);

                log.AddEvent("Created Process : P" + (i - 1).ToString());
            }
        }

        // instantiate the X's queue
        var q = Instantiate(p, new Vector2(120, 300), Quaternion.identity, GameObject.FindGameObjectWithTag("Finish").transform);

        list1.Add(q);
        Text txt;

        txt = list1[0].GetComponentInChildren <Text>();

        char[] charArray = x.text.ToCharArray();
        Array.Reverse(charArray);
        string b = new string(charArray);

        txt.text = " " + b.ToString();

        //print formula
        genFromula();

        // writing into boxes the process number
        for (int i = 0; i < list.Capacity; i++)
        {
            Text[] first;
            first         = list[i].GetComponentsInChildren <Text>();
            first[2].text = arr[i].ToString();
            first[1].text = "P" + i.ToString();
        }
    }
Exemplo n.º 2
0
 void Start()
 {
     log  = GetComponent <LogScript>();
     _out = GetComponent <OutputScript>();
     log.AddEvent("====================== Progress Log =======================");
     _out.AddEvent("======================= Output Log ========================");
 }
Exemplo n.º 3
0
    void queue()
    {
        Text[] p;
        p = InitiateScript.list[0].GetComponentsInChildren <Text>();

        Text txt;

        txt = InitiateScript.list1[0].GetComponentInChildren <Text>();

        string lastelem = (a[h]).ToString();

        log.AddEvent("Sending " + lastelem + " to P0" + " with the exit result: " + p[3].text);

        txt.text = txt.text.Remove(txt.text.Length - 2);
    }