public static RESULTCODE FormatLine(FRAMES frame, List <hgMesh.CD> list, ref int index, ALIGN align, out List <hgMesh.CD> newList, out Vector3 leftBase)
 {
     if (index == 0 && list[index].isHR)
     {
         return(FormatLine_NORMAL(frame, list, ref index, align, out newList, out leftBase));
     }
     else
     {
         return(FormatLine_NORMAL(frame, list, ref index, align, out newList, out leftBase));
     }
 }
    public void update()
    {
        switch (mState)
        {
        case FRAMES.LOADING:
            if (frameCount == 1)
            {
                this.SetElementByName(mPepperFrames[(int)FRAMES.LOADING]);
                this.container.RemoveChild(mPowSprite);
            }
            else if (frameCount >= 30)
            {
                frameCount = 0;
                mState     = FRAMES.FIRE;
            }
            break;

        case FRAMES.FIRE:
            if (frameCount == 1)
            {
                this.SetElementByName(mPepperFrames[(int)FRAMES.FIRE]);
                this.container.AddChild(mPowSprite);
                mFireDelegate();
            }
            else if (frameCount >= 30)
            {
                frameCount = 0;
                mState     = FRAMES.LOADING;
            }

            break;

        case FRAMES.HAPPY:
            this.SetElementByName(mPepperFrames[(int)FRAMES.HAPPY]);
            this.container.RemoveChild(mPowSprite);

            break;
        }

        frameCount++;
    }
 public void happyAnimation()
 {
     mState = FRAMES.HAPPY;
 }
 public void fireAnimation()
 {
     mState = FRAMES.LOADING;
 }
    private static RESULTCODE FormatLine_2(FRAMES frame, List <hgMesh.CD> list, ref int index, ALIGN align, out List <hgMesh.CD> newList, out Vector3 leftBase)
    {
        leftBase = Vector3.zero;
        newList  = null;
        float left, right, width, top;

        {
            float[] space = frame.GetSpace();
            if (space == null)
            {
                return(RESULTCODE.ERROR);
            }
            left  = space[0];
            right = space[1];
            width = space[1] - space[0];
            top   = frame.yPos;
        }

        leftBase = new Vector3(left, top, 0);
        int startIndex = index;

        for (int loop = 0; loop < 100; loop++)
        {
            index   = startIndex;
            newList = new List <hgMesh.CD>();
            while (index < list.Count)
            {
                var cd = list[index];
                if (cd.isCR)
                {
                    if (index == 0)
                    {
                        newList.Add(cd);
                    }
                    index++;
                    goto _ALIGN;
                }
                else if (cd is hgMesh.CD_IMAGE)
                {
                    var cdimg = (hgMesh.CD_IMAGE)cd;
                    if (cdimg.align == hgMesh.CD_IMAGE.ALIGN.LEFT)
                    {
                        SetImageLeft(list, index, left, top);
                        return(RESULTCODE.FOUND_FIX_IMAGE);
                    }
                    else if (cdimg.align == hgMesh.CD_IMAGE.ALIGN.RIGHT)
                    {
                        SetImageRight(list, index, right, top);
                        return(RESULTCODE.FOUND_FIX_IMAGE);
                    }
                }

                var r      = hgMesh.CD.CalcRectwScan(newList, cd, leftBase);
                var vspace = hgMesh.CD.GetVSpace(newList, cd);
                if (r._topY + vspace > top)
                {
                    var y = leftBase.y - ((r._topY + vspace) - top);
                    leftBase = new Vector3(leftBase.x, y, leftBase.z);
                    goto _LOOP1;
                }
                if (r._rightX > right)
                {
                    goto _ALIGN;
                }
                newList.Add(cd);
                index++;
            }
            goto _ALIGN;


            _LOOP1 :;
        }
        return(RESULTCODE.ERROR);

_ALIGN:
        {
            if (align == ALIGN.CENTER)
            {
                var r        = hgMesh.CD.CalcRectwScan(newList, null, newList[0].leftBase);
                var center_X = frame.backFrame.center.x;
                var r_c      = r.MoveCenter(center_X);
                if (r_c._leftX < left)
                {
                    var v = left - r_c._leftX;
                    r_c.MoveX(v);
                }
                else if (r_c._rightX > right)
                {
                    var v = right - r_c._rightX;
                    r_c.MoveX(v);
                }

                leftBase = new Vector3(r_c._leftX, leftBase.y, leftBase.z);
            }
            else if (align == ALIGN.RIGHT)
            {
                var r = hgMesh.CD.CalcRectwScan(newList, null, newList[0].leftBase);
                var v = right - r._rightX;
                r.MoveX(v);
                leftBase = new Vector3(r._leftX, leftBase.y, leftBase.z);
            }
        }

        return(RESULTCODE.SUCCESS);
    }
    public void update()
    {
        switch(mState)
        {
        case FRAMES.LOADING:
            if(frameCount == 1)
            {
                this.SetElementByName(mPepperFrames[(int)FRAMES.LOADING]);
                this.container.RemoveChild(mPowSprite);
            }
            else if(frameCount >= 30)
            {
                frameCount = 0;
                mState = FRAMES.FIRE;
            }
            break;
        case FRAMES.FIRE:
            if(frameCount == 1)
            {
                this.SetElementByName(mPepperFrames[(int)FRAMES.FIRE]);
                this.container.AddChild(mPowSprite);
                mFireDelegate();
            }
            else if(frameCount >= 30)
            {
                frameCount = 0;
                mState = FRAMES.LOADING;
            }

            break;

        case FRAMES.HAPPY:
            this.SetElementByName(mPepperFrames[(int)FRAMES.HAPPY]);
            this.container.RemoveChild(mPowSprite);

            break;
        }

        frameCount++;
    }
 public void happyAnimation()
 {
     mState = FRAMES.HAPPY;
 }
 public void fireAnimation()
 {
     mState = FRAMES.LOADING;
 }