示例#1
0
    public void Reset()
    {
        if (hands != null)
        {
            for (int i = 0; i < hands.GetLength(0); i++)
            {
                if (hands[i].last != null)
                {
                    Line_Ctrl LC_select = hands[i].last;
                    while (LC_select.Prev != null)
                    {
                        LC_select = LC_select.Prev;
                        LC_select.Prev.prep_Destroy();
                    }
                    LC_select.prep_Destroy();
                }

                if (hands[i].Posledni != null)
                {
                    hands[i].vybrany = hands[i].Posledni;
                    while (hands[i].vybrany.Prev != null)
                    {
                        hands[i].vybrany = hands[i].vybrany.Prev;
                        Destroy(hands[i].vybrany.Next.gameObject);
                    }
                    Destroy(hands[i].vybrany.gameObject);
                }
            }
        }
    }
示例#2
0
    public void Reset(int[] data)
    {
        Select_hand(0);
        predznamenani = 0;
        takt          = 16;

        if (hands != null)
        {
            for (int i = 0; i < hands.GetLength(0); i++)
            {
                if (hands[i].last != null)
                {
                    Line_Ctrl LC_select = hands[i].last;
                    while (LC_select.Prev != null)
                    {
                        LC_select = LC_select.Prev;
                        LC_select.Prev.prep_Destroy();
                    }
                    LC_select.prep_Destroy();
                }

                if (hands[i].Posledni != null)
                {
                    hands[i].vybrany = hands[i].Posledni;
                    while (hands[i].vybrany.Prev != null)
                    {
                        hands[i].vybrany = hands[i].vybrany.Prev;
                        Destroy(hands[i].vybrany.Next.gameObject);
                    }
                    Destroy(hands[i].vybrany.gameObject);
                }
            }
        }
        Create(data);
    }
示例#3
0
    public Line_Ctrl Add_line(Holder hold)
    {
        GameObject novy = Instantiate(proto_linka, paper.transform, false);

        novy.gameObject.name = "linka " + hold.linek + " " + hold.id;
        GameObject klic = Instantiate(proto_klic, paper.transform, false);

        klic.gameObject.name = "klic " + hold.linek + " " + hold.id;
        GameObject end = Instantiate(proto_end, paper.transform, false);

        end.gameObject.name = "end " + hold.linek + " " + hold.id;
        GameObject pred;

        if (hold.klic == 1)
        {
            pred = Instantiate(proto_pred_h, paper.transform, false);
        }
        else
        {
            pred = Instantiate(proto_pred_b, paper.transform, false);
        }
        pred.GetComponent <Predznamenani>().Activate(predznamenani);
        pred.gameObject.name = "pred " + hold.linek + " " + hold.id;
        int mod = hold.linek;

        if (hands.GetLength(0) > 1)
        {
            mod = hold.id + hold.linek * 2;
        }
        novy.transform.position = novy.transform.position + new Vector3(0, mod * vyska_linek, 0);
        klic.transform.position = klic.transform.position + new Vector3(0, mod * vyska_linek, 0);
        end.transform.position  = end.transform.position + new Vector3(0, mod * vyska_linek, 0);
        pred.transform.position = pred.transform.position + new Vector3(0, mod * vyska_linek, 0);
        Line_Ctrl target = hold.last;
        Line_Ctrl LC     = novy.GetComponent <Line_Ctrl>();

        LC.master = hold;
        LC.id     = hold.linek;
        LC.klic   = klic;
        LC.end    = end;
        LC.pred   = pred;
        LC.SetActive(true);
        if (target != null)
        {
            target.Next = LC;
            LC.Prev     = target;
            hold.last   = LC;
        }
        else
        {
            hold.last     = LC;
            hold.first    = LC;
            hold.selected = LC;
        }
        hold.linek++;
        return(LC);
    }
示例#4
0
    public virtual void Adjust_HUD(Znak target)
    {
        Vector3 master_scale = gameObject.transform.parent.position;
        Vector3 ref_point    = new Vector3(master_scale.x + modx, master_scale.y * 2 + mody);
        int     mod          = 0;

        if (target.Hand_id > 0)
        {
            mod = target.Hand_id - 1 + target.Pos_y;
        }
        if (select)
        {
            gameObject.transform.position = ref_point + new Vector3(target.Pos_x * CTRL.get_linka(target.master, posy).nota_lenght, (mod + target.Pos_y) * Hand_Ctrl.vyska_linek, 0);
            for (int i = 0; i < toggle_able.GetLength(0); i++)
            {
                toggle_able[i].SetActive(target.is_nota());
            }
            for (int i = 0; i < auth_able.GetLength(0); i++)
            {
                auth_able[i].SetActive(auth);
            }
        }
        else
        {
            posy = target.Pos_y;
            if (last == null)
            {
                last = CTRL.get_linka(target.master, posy);
            }
            float posx = target.Pos_x;
            if (target.Delka == 4)
            {
                posx = posx + 1.5f;
            }
            else
            {
                posx++;
            }
            if (CTRL.get_linka(target.master, posy).full)
            {
                posy++;
                last.hud = false;
                last     = CTRL.get_linka(target.master, posy, true);
                posx     = 0;
            }
            gameObject.transform.position = ref_point + new Vector3(posx * CTRL.get_linka(target.master, posy).nota_lenght, (mod + posy) * Hand_Ctrl.vyska_linek, 0);
        }
    }
示例#5
0
    public Line_Ctrl get_linka(Holder hold, int input, bool hud = true)
    {
        Line_Ctrl selected = hold.first;

        while (selected != null)
        {
            if (selected.id == input)
            {
                return(selected);
            }
            else
            {
                selected = selected.Next;
            }
        }
        Add_line(hold).hud = hud;
        return(Add_line(hold));
    }