Beispiel #1
0
    private void Shift_next(Znak target = null)
    {
        if (target == null)
        {
            target = hands[selected_hand].vybrany;
        }
        Znak swap = target.Next;

        if (swap != null)
        {
            swap.Prev   = target.Prev;
            target.Prev = swap;
            target.Next = swap.Next;
            swap.Next   = target;
            if (target.Next != null)
            {
                target.Next.Prev = target;
            }
            else
            {
                target.master.Posledni = target;
            }
            if (swap.Prev != null)
            {
                swap.Prev.Next = swap;
            }
            else
            {
                target.master.Prvni = swap;
            }
            target.Swap_Pos(swap);
        }
        Select_HUD.Adjust_HUD(target);
        End_HUD.Adjust_HUD(target.master.Posledni);
    }
Beispiel #2
0
    public int[] Copy(Znak target)
    {
        int output = 0;

        int[] inputs = target.Copy();
        if (inputs[0] > 1)//ACORD SWAP do something about this
        {
            nota = true;
        }
        else
        {
            nota = false;
        }
        delka = inputs[1];
        if (inputs[0] > 0)
        {
            postfix = inputs[2];
            if (nota)
            {
                output = 1;
                prefix = inputs[3];
                topfix = inputs[4];
                vyska  = inputs[5];
            }
        }

        carky    = new GameObject[1];
        carky[0] = Instantiate(carka_licha, gameObject.transform);
        carky[0].SetActive(false);

        Update_gfx();
        return(new int[3] {
            vyska, delka, output
        });
    }
Beispiel #3
0
    public void Select_note(GameObject input)
    {
        Znak select = input.GetComponent <Znak>();

        select.master.vybrany = select;
        Select_hand(select.master);
        Select_HUD.Adjust_HUD(select);
    }
Beispiel #4
0
        private void Count()
        {
            int pocet = 0;

            if (!string.IsNullOrEmpty(Retezec) && !string.IsNullOrEmpty(Znak))
            {
                char znak = Znak.First();
                pocet = Retezec.Count(z => z == znak);
            }

            Pocet = pocet;
        }
Beispiel #5
0
 /// <summary>
 /// Vytváří instanci třídy TypografickýPrvek.
 /// </summary>
 /// <param name="Text">Text, který reprezentuje daný prvek.</param>
 /// <param name="PoradiRazeni">Uživatelsky definované pořadí řazení prvku v rámci skupiny.</param>
 public TypografickyPrvek(string Text, int PoradiRazeni)
 {
     strText  = Text;
     intPocet = 1;
     znkZnaky = new Znak[strText.Length - 1];
     char[] pole = strText.ToCharArray();
     for (int i = 0; i < pole.Length; i++)
     {
         znkZnaky[i] = new Znak(pole[i]);
     }
     //znkZnaky[] = strText.ToCharArray();
     intPoradiRazeni = PoradiRazeni;
 }
Beispiel #6
0
 /// <summary>
 /// Vytváří instanci třídy TypografickýPrvek.
 /// </summary>
 /// <param name="Text">Text, který reprezentuje daný prvek.</param>
 public TypografickyPrvek(string Text)
 {
     strText  = Text;
     intPocet = 1;
     znkZnaky = new Znak[strText.Length];
     char[] pole = strText.ToCharArray();
     for (int i = 0; i < pole.Length; i++)
     {
         znkZnaky[i] = new Znak(pole[i]);
     }
     intPoradiRazeni =
         -1; //= (int) Thread.CurrentThread.CurrentCulture.CompareInfo.GetSortKey(strText).ToString() ;
 }
Beispiel #7
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);
        }
    }
Beispiel #8
0
    private void Change(Znak target = null)
    {
        if (target == null)
        {
            target = hands[selected_hand].vybrany;
        }
        Znak made;

        if (target.is_nota())
        {
            made = target.gameObject.AddComponent <Pomlka>();
        }
        else
        {
            made = target.gameObject.AddComponent <Nota>();
        }
        made.Load(target);
        Destroy(target);
    }
Beispiel #9
0
 public void Recalc(Znak from, Znak to = null)
 {
     if (from != null)
     {
         Holder hold = from.master;
         while (from != to)
         {
             from.Bump_pos();
             from.Update_delka();
             if (from.Next == null && to != null)
             {
                 Recalc(to, from);
                 return;
             }
             from = from.Next;
         }
         Select_HUD.Adjust_HUD(hold.Posledni);
         End_HUD.Adjust_HUD(hold.Posledni);
     }
 }
Beispiel #10
0
    private void Remove(Znak target = null)
    {
        if (target == null)
        {
            target = hands[selected_hand].vybrany;
        }
        Znak swap = target.Next;

        if (target.Prev != null)
        {
            if (target.Next != null)
            {
                target.Next.Prev = target.Prev;
                target.Prev.Next = target.Next;
                Do_Takty(target.master);
            }
            else
            {
                target.Prev.Next       = null;
                target.master.Posledni = target.Prev;
            }
        }
        else if (target.Next != null)
        {
            Do_Takty(target.master);
            target.Next.Prev    = null;
            target.master.Prvni = target.Next;
        }
        else
        {
            target.master.Prvni    = null;
            target.master.Posledni = null;
        }
        Destroy(target.gameObject);
        Select_HUD.Adjust_HUD(target.master.Posledni);
        End_HUD.Adjust_HUD(target.master.Posledni);
    }
Beispiel #11
0
    public Takt Add_takt(Holder hold, Znak targ)
    {
        Takt made;

        hold.first.count(hold.pocatek);
        if (hold.last.full)
        {
            Add_line(hold);
        }
        if (hold.nakonec == null)
        {
            made         = new Takt(Instantiate(proto_takt, hold.first.transform, false), targ, null, hold.last);
            hold.nakonec = made;
            hold.pocatek = made;
        }
        else
        {
            made         = new Takt(Instantiate(proto_takt, hold.first.transform, false), targ, hold.nakonec, hold.last);
            hold.nakonec = made;
        }
        made.cara.name = "takt " + hold.taktu;
        hold.taktu++;
        return(made);
    }
Beispiel #12
0
    public void Set_data(Znak target)
    {
        if (!swaping)
        {
            swaping     = true;
            target_note = target;
            pred.Activate(CTRL.predznamenani);
            int[] output = prototype.Copy(target);

            Vyska_txt.text = output[0].ToString();
            Delka_txt.text = Math.Pow(2, output[1]).ToString();
            if (output[2] == 1)
            {
                nota.isOn   = true;
                pomlka.isOn = false;
            }
            else
            {
                nota.isOn   = false;
                pomlka.isOn = true;
            }
            swaping = false;
        }
    }
Beispiel #13
0
 protected Card(int number, Znak suit)
 {
     Number = number;
     Suit = suit;
 }
Beispiel #14
0
 public BjCard(int number, Znak suit)
     : base(number, suit)
 {
 }
Beispiel #15
0
    public Pomlka Add_Pomlka(Holder hold, Znak target = null, int input_delka = -1, float adapt = 0)
    {
        if (hold == null)
        {
            hold = hands[0];
        }
        bool middle = true;

        if (target == null)
        {
            target = hold.Posledni;
            middle = false;
        }
        GameObject GO = Instantiate(proto_nota, paper.transform, false);

        GO.name = "note " + hold.not + " " + hold.id;
        hold.not++;
        Pomlka made = GO.AddComponent <Pomlka>();

        made.Do_data();
        made.master  = hold;
        made.Hand_id = hands.GetLength(0) - 1 + hold.id;
        if (adapt == 0)
        {
            if (input_delka == -1)
            {
                int tmp_delka = 1;
                for (int i = 4; i > -1; i--)
                {
                    if (Math.Pow(2, i) <= takt)
                    {
                        tmp_delka = i;
                        i         = -1;
                    }
                }
                made.Delka = tmp_delka;
            }
            else
            {
                made.Delka = input_delka;
            }
        }
        else
        {
            made.Adapt(adapt, false);
        }
        if (target != null)
        {
            if (middle && target.Next != null)
            {
                made.Next = target.Next;
            }
            else
            {
                hold.Posledni = made;
            }
            target.Next = made;
            made.Prev   = target;
            made.Bump_pos();
        }
        else
        {
            hold.Prvni    = made;
            hold.Posledni = made;
            made.Linka    = hold.first;
            made.Calc_Pos();
        }
        made.Update_delka();
        Do_Takty(hold);
        hold.vybrany = made;
        if (hold.nakonec != null)
        {
            hold.nakonec.add(made);
        }
        Select_HUD.Adjust_HUD(made);
        Select_hand(hold);
        return(made);
    }