コード例 #1
0
    //開始タグ適用(未対応のタグの場合はfalseを返す)
    private bool applyStartTag(TagReader.StartTag aTag)
    {
        switch (aTag.mTagName)
        {
        case "clear":    //表示削除
            clear();
            return(true);

        case "stop":    //停止
            mWritingState = WritingState.stop;
            return(true);

        case "next":    //停止、再開時に表示削除
            mWritingState = WritingState.waiteNext;
            return(true);

        case "waite":    //指定秒数停止
            mWritingState = WritingState.waite;
            this.setTimeout(float.Parse(aTag.mArguments[0]), () => {
                if (mWritingState == WritingState.waite)
                {
                    mWritingState = WritingState.writing;
                }
            });
            return(true);

        default:
            return(false);
        }
    }
コード例 #2
0
    /// <summary>再生成</summary>
    public void regenerate()
    {
        mCurrentFontHeight       = _DefaultFontHeight;
        mCurrentFontColor        = mDefaultFontColor;
        mCurrentUnderLine        = null;
        mCurrentAnimate          = null;
        mCurrentColliderArgument = "";

        mWriting?.delete();
        mWriting = this.createChild <MyBehaviour>("writing");
        mLines.Clear();
        createNewLine();

        string tText = _Text;

        _Text = "";
        addLast(tText);
    }
コード例 #3
0
    //colorタグからColorインスタンスを生成
    private Color readColor(TagReader.StartTag aTag)
    {
        switch (aTag.mArguments.Length)
        {
        case 0:    //引数なし
            return(new Color(0, 0, 0, 1));

        case 1:
        case 2:
            //キーワード指定
            switch (aTag.mArguments[0])
            {
            case "red": return(new Color(1, 0, 0));

            case "green": return(new Color(0, 1, 0));

            case "blue": return(new Color(0, 0, 1));

            case "black": return(new Color(0, 0, 0));

            case "white": return(new Color(1, 1, 1));

            case "yellow": return(new Color(1, 1, 0));
            }
            //rgb一括設定
            float rgb = float.Parse(aTag.mArguments[0]);
            return(new Color(rgb, rgb, rgb));

        case 3:    //rgb設定
            return(new Color(float.Parse(aTag.mArguments[0]), float.Parse(aTag.mArguments[1]), float.Parse(aTag.mArguments[2])));

        case 4:    //rgba設定
            return(new Color(float.Parse(aTag.mArguments[0]), float.Parse(aTag.mArguments[1]),
                             float.Parse(aTag.mArguments[2]), float.Parse(aTag.mArguments[3])));

        default:
            return(new Color(float.Parse(aTag.mArguments[0]), float.Parse(aTag.mArguments[1]),
                             float.Parse(aTag.mArguments[2]), float.Parse(aTag.mArguments[3])));
        }
    }
コード例 #4
0
    //開始タグ適用
    private void applyStartTag(TagReader.StartTag aTag)
    {
        switch (aTag.mTagName)
        {
        case "size":    //文字サイズ
            mCustomFontSize.Add(float.Parse(aTag.mArguments[0]));
            return;

        case "color":    //文字色
            mCustomFontColor.Add(readColor(aTag));
            return;

        case "br":    //改行
            createNewLine();
            return;

        case "rotate":    //回転
            addTextProduction((obj) => {
                obj.rotateForever(float.Parse(aTag.mArguments[0]));
            }, "rotate");
            return;

        case "tremble":    //震える
            addTextProduction((obj) => {
                Vector2 tInitialPosition = obj.position2D;
                Action tTremble          = () => { };
                tTremble = () => {
                    obj.moveTo(tInitialPosition + VectorCalculator.randomVector() * float.Parse(aTag.mArguments[0]), 0.5f, tTremble);
                };
                tTremble();
            }, "tremble");
            return;

        default:
            Debug.LogWarning("MyTextBoard : 不明な開始タグ「" + aTag.mTagName + "」");
            return;
        }
    }
コード例 #5
0
    /// <summary>終了タグ適用</summary>
    private void applyEndTag(TagReader.EndTag aTag)
    {
        switch (aTag.mTagName)
        {
        case "size":
            mCurrentFontHeight = mDefaultFontHeight;
            break;

        case "color":
            mCurrentFontColor = mDefaultFontColor;
            break;

        case "u":
            mCurrentUnderLine = null;
            break;

        case "collider":
            mCurrentColliderArgument = "";
            break;

        case "highlight":
            mCurrentFontColor        = mDefaultFontColor;
            mCurrentColliderArgument = "";
            break;

        case "link":
            mCurrentFontColor        = mDefaultFontColor;
            mCurrentUnderLine        = null;
            mCurrentColliderArgument = "";
            break;

        case "animation":
            mCurrentAnimate = null;
            break;
        }
    }
コード例 #6
0
    /// <summary>開始タグ適用</summary>
    private void applyStartTag(TagReader.StartTag aTag)
    {
        switch (aTag.mTagName)
        {
        case "size":
            mCurrentFontHeight = float.Parse(aTag.mArguments[0]);
            break;

        case "color":
            mCurrentFontColor = makeColor(aTag.mArguments);
            break;

        case "br":
            createNewLine();
            break;

        case "u":
            if (aTag.mArguments.Length == 0)
            {
                createUnderline(0.1f);
            }
            else
            {
                createUnderline(float.Parse(aTag.mArguments[0]));
            }
            break;

        case "image":
            ImageElement tImageElement = ImageElement.create(aTag.mArguments[0], this);
            addLast(tImageElement);
            break;

        case "reading":
        case "collider":
            mCurrentColliderArgument = aTag.mArguments[0];
            break;

        case "highlight":
            //触れた時の引数
            mCurrentColliderArgument = aTag.mArguments[0];
            //色
            string[] tCp = new string[aTag.mArguments.Length - 1];
            Array.Copy(aTag.mArguments, tCp, aTag.mArguments.Length - 1);
            mCurrentFontColor = makeColor(tCp);
            break;

        case "link":
            //触れた時の引数
            mCurrentColliderArgument = aTag.mArguments[0];
            //色
            string[] tCp2 = new string[aTag.mArguments.Length - 1];
            Array.Copy(aTag.mArguments, tCp2, aTag.mArguments.Length - 1);
            mCurrentFontColor = makeColor(tCp2);
            //アンダーライン
            if (aTag.mArguments.Length < 6)
            {
                createUnderline(0.1f);
            }
            else
            {
                createUnderline(float.Parse(aTag.mArguments[0]));
            }
            break;

        case "animation":
            mCurrentAnimate = aTag;
            break;
        }
    }