//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution command
    // @Param : pManager    => Charageki manager
    public override void Exec(KrCharagekiManager pManager)
    {
        uint   uCharaId     = 0;
        string pPositionKey = "";

        for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++)
        {
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // CHARA ID
            if (m_pOptions[sIndex].m_pKey == "chara")
            {
                bool bIsSuccess = uint.TryParse(m_pOptions[sIndex].m_pValue, out uCharaId);
                KrDebug.Assert(bIsSuccess, "Parsing failed to type unsigned int = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandCharacterAction));
            }
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // ACTION ID
            else if (m_pOptions[sIndex].m_pKey == "position")
            {
                pPositionKey = m_pOptions[sIndex].m_pValue;
            }
        }

        KrDebug.Assert(uCharaId > 0, "there is no chara id!!", typeof(KrCharagekiCommandSetCharacterPosition));
        KrDebug.Assert(!string.IsNullOrEmpty(pPositionKey), "there is no position!!", typeof(KrCharagekiCommandSetCharacterPosition));
        KrCharagekiUIController pUIController = pManager.GetUIController();

        KrDebug.Log("Chara action : chara = " + uCharaId + ", position = " + pPositionKey, typeof(KrCharagekiCommandSetCharacterPosition));

        KrDebug.Assert(KrCharagekiDef.s_pPOSITION_DIC.ContainsKey(pPositionKey), "Key not found from KrCharagekiDef.s_pPOSITION_DIC. key = " + pPositionKey, typeof(KrCharagekiCommandSetCharacterPosition));
        Vector3 vPosition = KrCharagekiDef.s_pPOSITION_DIC[pPositionKey];

        pUIController.SetPosition(uCharaId, vPosition);
    }
예제 #2
0
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PROTECTED FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution with option
    // @Param : uId        => Character id
    //        : pManager   => Charageki manager
    protected override void Exec(uint uId, KrCharagekiManager pManager)
    {
        KrDebug.Log("Load character : id = " + uId, typeof(KrCharagekiCommandLoadCharacter));
        KrCharagekiUIController pUIController = pManager.GetUIController();

        pUIController.LoadCharacter(uId);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PROTECTED FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution with option
    // @Param : sId         => Character id
    //        : pManager    => Charageki manager
    protected override void Exec(uint sId, KrCharagekiManager pManager)
    {
        KrCharagekiUIController pUIController = pManager.GetUIController();

        KrDebug.Log("Show character : id = " + sId, typeof(KrCharagekiCommandShowCharacter));
        pUIController.ShowCharacter(sId);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution command
    // @Param : pManager    => Charageki manager
    public override void Exec(KrCharagekiManager pManager)
    {
        uint uCharaId  = 0;
        uint uActionId = 0;

        for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++)
        {
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // CHARA ID
            if (m_pOptions[sIndex].m_pKey == "chara")
            {
                bool bIsSuccess = uint.TryParse(m_pOptions[sIndex].m_pValue, out uCharaId);
                KrDebug.Assert(bIsSuccess, "Parsing failed to type unsigned int = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandCharacterAction));
            }
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // ACTION ID
            else if (m_pOptions[sIndex].m_pKey == "action")
            {
                bool bIsSuccess = uint.TryParse(m_pOptions[sIndex].m_pValue, out uActionId);
                KrDebug.Assert(bIsSuccess, "Parsing failed to type unsigned int = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandCharacterAction));
            }
        }

        KrDebug.Assert(uCharaId > 0, "there is no chara id!!", typeof(KrCharagekiCommandSetText));
        KrDebug.Assert(uActionId > 0, "there is no action id!!", typeof(KrCharagekiCommandSetText));
        KrCharagekiUIController pUIController = pManager.GetUIController();

        KrDebug.Log("chara action : chara = " + uCharaId + ", action = " + uActionId, typeof(KrCharagekiCommandCharacterAction));
        pUIController.SetAction(uCharaId, uActionId);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PROTECTED FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution with option
    // @Param : uId         => Background id
    //        : pManager    => Charageki manager
    protected override void Exec(uint uId, KrCharagekiManager pManager)
    {
        KrDebug.Log("Set bg : sId = " + uId, typeof(KrCharagekiCommandSetSpriteBg));
        KrCharagekiUIController pUIController = pManager.GetUIController();

        pUIController.SetBg(uId);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution command
    // @Param : pManager    => Charageki manager
    public override void Exec(KrCharagekiManager pManager)
    {
        KrDebug.Log("Fade in : ", typeof(KrCharagekiCommandFadeIn));
        KrCharagekiUIController pUIController = pManager.GetUIController();

        // MEMO : Non option
        pUIController.FadeIn();
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution command
    // @Param : pManager    => Charageki manager
    public override void Exec(KrCharagekiManager pManager)
    {
        KrDebug.Log("Show text : ", typeof(KrCharagekiCommandShowText));
        KrCharagekiUIController pUIController = pManager.GetUIController();

        // MEMO : Non option
        pUIController.ShowText();
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution command
    // @Param : pManager    => Charageki manager
    public override void Exec(KrCharagekiManager pManager)
    {
        KrDebug.Log("Show title : ", typeof(KrCharagekiCommandSetSpriteBg));
        KrCharagekiUIController pUIController = pManager.GetUIController();

        // MEMO : Non option
        pUIController.ShowTitle();
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution command
    // @Param : pManager    => Charageki manager
    public override void Exec(KrCharagekiManager pManager)
    {
        float fWaitTime = 0.0f;

        for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++)
        {
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // KEY
            if (m_pOptions[sIndex].m_pKey == "time")
            {
                bool bIsSuccess = float.TryParse(m_pOptions[sIndex].m_pValue, out fWaitTime);
                KrDebug.Assert(bIsSuccess, "Parsing failed to type float = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandWaitTime));
            }
        }

        KrCharagekiUIController pUIController = pManager.GetUIController();

        KrDebug.Log("Set wait time = " + fWaitTime, typeof(KrCharagekiCommandWaitTime));
        pUIController.SetWaitTime(fWaitTime);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution command
    // @Param : pManager    => Charageki manager
    public override void Exec(KrCharagekiManager pManager)
    {
        bool bWait = false;

        for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++)
        {
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // KEY
            if (m_pOptions[sIndex].m_pKey == "wait")
            {
                bool bIsSuccess = bool.TryParse(m_pOptions[sIndex].m_pValue, out bWait);
                KrDebug.Assert(bIsSuccess, "Parsing failed to type bool = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandWaitInput));
            }
        }

        KrCharagekiUIController pUIController = pManager.GetUIController();

        KrDebug.Log("Set wait input = " + bWait, typeof(KrCharagekiCommandWaitInput));
        pUIController.SetWaitInput(bWait);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PROTECTED FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution with option
    // @Param : uId         => Value of "No" column of csv
    //        : pManager    => Charageki manager
    protected override void Exec(uint uId, KrCharagekiManager pManager)
    {
        KrCharagekiScenarioContainer pScenarioContainer = pManager.GetScenarioContainer();
        // Get row data of csv
        KrCsvDataRow pCsvDataRow = pScenarioContainer.GetScenario(uId.ToString(), "No");

        uint uCharaId   = 0;
        bool bIsSuccess = uint.TryParse(pCsvDataRow.GetValue("CharaId"), out uCharaId);

        KrDebug.Assert(bIsSuccess, "Parsing failed to type int = " + pCsvDataRow.GetValue("CharaId"), typeof(KrCharagekiCommandSetText));

        KrDebug.Assert(KrCharagekiDef.s_pCHARA_DIC.ContainsKey(uCharaId), "Invalid KrCharagekiDef.s_CHARA_NAME key = " + uCharaId, typeof(KrCharagekiCommandSetText));
        string pCharaName = KrCharagekiDef.s_pCHARA_DIC[uCharaId].GetCharacterName();
        string pComment   = pCsvDataRow.GetValue("Comment");

        KrDebug.Log("Play Text : " + "CharaId" + " = " + pCharaName + ", " + "Comment" + " = " + pComment, typeof(KrCharagekiCommandSetText));
        KrCharagekiUIController pUIController = pManager.GetUIController();
        // Set text
        float fReadingTime = pUIController.SetText(pCharaName, pComment);

        // Play voice
        string pVoiceName = pCsvDataRow.GetValue("VoiceId");

        KrDebug.Log("Play Voice: " + "CharaId" + " = " + pCharaName + ", " + "VoiceId" + " = " + pVoiceName, typeof(KrCharagekiCommandSetText));
        KrAudioSource pAudioSource = pUIController.PlayVoice(uCharaId, pVoiceName, pManager);

        if (pAudioSource == null)
        {
            // If there is no voice data, set the lip sync time from the length of the text
            pUIController.PlayLipSync(uCharaId, fReadingTime, pComment);
        }

        // Set log
        KrCharagekiLog          pLog          = new KrCharagekiLog(pCharaName, pComment);
        KrCharagekiLogContainer pLogContainer = pManager.GetLogContainer();

        pLogContainer.AddLog(pLog);
    }
예제 #12
0
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Initialize
    // @Param : pParam  => Arguments for initialize
    public override void Initialize(KrUIArgumentParameter pParam)
    {
        KrCharagekiManager      pManager      = KrCharagekiManager.Create(transform, scriptPaths, charaParent, charagekiMode, 1.0f);
        KrCharagekiUIController pUIController = pManager.GetUIController();

        // AddListener tap screen
        tapScreen.onClick.AddListener(() =>
        {
            pManager.TapScreen();
        });

        // Register fade process
        pUIController.RegisterFade(KrValueAnimator.eEASE.NONE, 1.0f, 1.0f, fadeImage.gameObject, (float fFadeValue) =>
        {
            Color pColor    = fadeImage.color;
            pColor.a        = fFadeValue;
            fadeImage.color = pColor;
        });

        // Register title process
        pUIController.RegisterTitle((string pStr) =>
        {
            V_TITLE_TEXT.text = pStr;
        },
                                    () => { V_TITLE_TEXT.gameObject.SetActive(true); },
                                    () => { V_TITLE_TEXT.gameObject.SetActive(false); });

        // Register background process
        pUIController.RegisterBackground((Sprite pBackground) =>
        {
            backgroundImage.sprite = pBackground;
            backgroundImage.SetNativeSize();
        },
                                         () => { backgroundImage.gameObject.SetActive(true); },
                                         () => { backgroundImage.gameObject.SetActive(false); });

        // Register text area process
        pUIController.RegisterTextArea(0.1f, (string pCharaName) =>
        {
            V_CHARA_NAME.text = pCharaName;
        },
                                       (string pComment) =>
        {
            V_COMMENT.text = pComment;
        },
                                       () => { commentObject.gameObject.SetActive(true); },
                                       () => { commentObject.gameObject.SetActive(false); });

        // AddListener switch menu
        menu.onClick.AddListener(cbSwitchMenu);
        // AddListener skip
        skip.onClick.AddListener(() =>
        {
            pUIController.ResetAutoMode();
        });
        // AddListener auto mode
        auto.onClick.AddListener(() =>
        {
            pUIController.ToggleAutoMode();
        });
    }