Example #1
0
    public void TextArrangement()     //Layout종류에 따라 Text들을 정렬 ChoiceControler에 Scenario를 넣을때 호출했다.
    {
        int firstX = 0;
        int lastY  = 0;
        int count  = 0;

        if (selectText != null)
        {
            for (int i = 0; i < selectText.Count; i++)         //SelectText의 레이아웃 정렬
            {
                TextAndPosition tap = selectText[i];
                if (tap.Layout == null)
                {
                    continue;
                }
                if (tap.Layout == TextLayout.SELECT_DEFAULT)
                {
                    if (selectText.Count == 1)
                    {
                        tap[0] = 22;
                        tap[1] = 13;
                    }
                    else
                    {
                        firstX = GameManager.selectListFirststPositionX(selectText);
                        lastY  = GameManager.selectListLastPositionY(selectText);
                        tap[0] = firstX;
                        tap[1] = lastY + ++count;
                    }
                }
            }
        }
        if (selectText != null)
        {
            for (int i = 0; i < selectText.Count; i++)        //SelectText중 CROSSROADS의 레이아웃 정렬
            {
                TextAndPosition        tap        = selectText[i];
                List <TextAndPosition> crossroads = new List <TextAndPosition>();
                for (int j = 0; j < selectText.Count; j++)
                {
                    if (selectText[i][1] >= 19)
                    {
                        crossroads.Add(selectText[i]);
                    }
                }
                if (crossroads.Count != 0)
                {
                    if (tap.Layout == TextLayout.CROSSROADS_DEFAULT)
                    {
                        if (crossroads.Count == 1)
                        {
                            tap[0] = 1;
                            tap[1] = 19;
                        }
                        else if (crossroads.Count == 2)
                        {
                            firstX = 60 - (tap.text.Length + Convenience.GetKoreanCount(tap.text));
                            tap[0] = firstX;
                            tap[1] = 19;
                        }
                        else if (crossroads.Count > 2)
                        {
                            throw new Exception("이미 갈림길이 2개 있음.");
                        }
                    }
                }
            }
        }
        if (onlyShowText != null)
        {
            for (int i = 0; i < onlyShowText.Count; i++)
            {
                TextAndPosition tap = onlyShowText[i];
                if (tap.Layout == null)
                {
                    continue;
                }
                if (tap.Layout == TextLayout.ONLY_SHOW_DEFAULT)
                {
                    if (onlyShowText.Count == 1)
                    {
                        tap[0] = 15;
                        tap[1] = 8;
                    }
                    else
                    {
                        firstX = GameManager.selectListFirststPositionX(onlyShowText);
                        lastY  = GameManager.selectListLastPositionY(onlyShowText);
                        tap[0] = firstX;
                        tap[1] = lastY;
                    }
                }
            }
        }
        if (streamText != null)
        {
            for (int i = 0; i < streamText.Count; i++)
            {
                TextAndPosition tap = streamText[i];
                if (tap.Layout == null)
                {
                    continue;
                }
                if (tap.Layout == TextLayout.ONLY_SHOW_DEFAULT)
                {
                    tap[0] = 15;
                    tap[1] = 8;
                }
            }
        }
        if (returnText != null)
        {
            for (int i = 0; i < returnText.Count; i++)
            {
                TextAndPosition tap = returnText[i];
                if (tap.Layout == null)
                {
                    continue;
                }
                if (tap.Layout == TextLayout.ONLY_SHOW_DEFAULT)
                {
                    if (returnText.Count == 1)
                    {
                        tap[0] = 15;
                        tap[1] = 8;
                    }
                    else
                    {
                        firstX = GameManager.selectListFirststPositionX(returnText);
                        lastY  = GameManager.selectListLastPositionY(returnText);
                        tap[0] = firstX;
                        tap[1] = lastY;
                    }
                }
            }
        }
    }