示例#1
0
        private void Init(IEnumerable <KanaCharacter> kana)
        {
            int x = 0;
            int y = 0;

            foreach (var k in kana)
            {
                if (k != null)
                {
                    Kana.Add(new KanaVM(this, CodePoint.FromString(k.Kana), k.Romaji, x, y));
                }
                else
                {
                    Kana.Add(new KanaVM(this, null, null, x, y));
                }

                x++;
                if (x == 5)
                {
                    x = 0;
                    y++;
                }
            }

            Width  = x == 0 ? y : y + 1;
            Height = 5;

            var contents = Kana.OrderBy(k => k.X * Width + -k.Y).ToList();

            Kana.Clear();
            Kana.AddRange(contents);
        }