예제 #1
0
    //=================================================================

    public override FSNSnapshot.Layer GenerateNextLayerImage(FSNSnapshot.Layer curLayer, params FSNProcessModuleCallParam[] callParams)
    {
        FSNSnapshot.Layer newLayer = curLayer.Clone();

        foreach (var callParam in callParams)
        {
            if (callParam.segment.type == FSNScriptSequence.Segment.Type.Text)                  // ** 텍스트 세그먼트 처리 **
            {
                var textSeg = callParam.segment as Segments.Text;                               // 타입 변환

                switch (textSeg.textType)                                                       // * 텍스트 종류에 따라 처리 분기
                {
                case Segments.Text.TextType.Normal:
                    AddNormalText(newLayer, textSeg, callParam.setting);
                    break;

                case Segments.Text.TextType.Clear:
                    ClearTextsToDirection(newLayer, callParam.setting.CurrentFlowDirection);
                    break;

                case Segments.Text.TextType.Options:
                    ClearTextsToDirection(newLayer, callParam.setting.CurrentFlowDirection);                                    // 선택지 텍스트는 clear를 먼저 한 뒤에 표시
                    ShowOptionTexts(newLayer, textSeg, callParam.setting);
                    break;

                case Segments.Text.TextType.LastOption:
                    AddLastOptionText(newLayer, textSeg, callParam.setting);
                    break;
                }
            }
            else if (callParam.segment.type == FSNScriptSequence.Segment.Type.Control &&
                     (callParam.segment as Segments.Control).controlType == Segments.Control.ControlType.Clear)                 // Clear 명령에 반응
            {
                ClearTextsToDirection(newLayer, callParam.setting.CurrentFlowDirection);
            }
            else if (callParam.segment.type == FSNScriptSequence.Segment.Type.HardClone)                // 레이어 Hard-Clone
            {
                newLayer.MakeAllElemsHardClone();
            }
        }

        return(newLayer);
    }
예제 #2
0
    public override FSNSnapshot.Layer GenerateNextLayerImage(FSNSnapshot.Layer curLayer, params FSNProcessModuleCallParam[] callParams)
    {
        FSNSnapshot.Layer newLayer = curLayer.Clone();
        if (curLayer.GetCustomData(c_customDataName) != null)                   // 이름 dictionary 카피
        {
            newLayer.SetCustomData(c_customDataName, new Dictionary <string, int>(curLayer.GetCustomData(c_customDataName) as Dictionary <string, int>));
        }

        foreach (var callParam in callParams)
        {
            if (callParam.segment.type == FSNScriptSequence.Segment.Type.Object)
            {
                var objSeg = callParam.segment as SegT;

                switch (objSeg.command)
                {
                case Segments.Object.CommandType.Create:
                    CreateElement(objSeg, newLayer);
                    break;

                case Segments.Object.CommandType.Remove:
                    RemoveElement(objSeg, newLayer);
                    break;

                case Segments.Object.CommandType.SetInitial:
                    SetElementInitial(objSeg, newLayer);
                    break;

                case Segments.Object.CommandType.SetFinal:
                    SetElementFinal(objSeg, newLayer);
                    break;

                case Segments.Object.CommandType.SetKey:
                    SetElement(objSeg, newLayer);
                    break;

                case Segments.Object.CommandType.Custom:
                    ProcessCustomElementCommand(objSeg, newLayer);
                    break;
                }
            }
            else if (callParam.segment.type == FSNScriptSequence.Segment.Type.Control)
            {
                var controlSeg = callParam.segment as Segments.Control;
                if (controlSeg.controlType == Segments.Control.ControlType.Clear && acceptClearCommand)                 // Clear 명령에 반응
                {
                    foreach (var rawelem in newLayer.Elements)                                                          // finalstate가 세팅되지 않은 오브젝트에 한해서 디폴트 세팅
                    {
                        var elem = rawelem as ElemT;
                        AutoSetFinalState(elem);
                    }

                    newLayer = new FSNSnapshot.Layer();                                                                                         // 완전히 새로운 레이어로 교체

                    // TODO : 힘들게 복제한 레이어를 버리는 구조임. 최적화 여지가 있음.
                }
            }
            else if (callParam.segment.type == FSNScriptSequence.Segment.Type.HardClone)                // 레이어 Hard-Clone
            {
                newLayer.MakeAllElemsHardClone();
            }
            else
            {
            }
        }

        // TODO : call 처리 이후, snapshot 마무리
        OnAfterGenerateNextLayerImage(newLayer);

        return(newLayer);
    }