コード例 #1
0
    // @Brief  : Play voice
    // @Param  : pPath      => Asset path of audio clip
    //         : pManager   => Charageki manager
    // @Return : Audio source
    public override KrAudioSource PlayVoice(string pPath, KrCharagekiManager pManager)
    {
        KrAudioSource pAudioSource = base.PlayVoice(pPath, pManager);

        m_pLive2DModel.PlayLipSync(pAudioSource);
        return(pAudioSource);
    }
コード例 #2
0
    // @Brief  : Play se
    // @Param  : pPath          => Audio asset path
    //         : bIsLoop        => Is loop mode
    //         : bFromResources => From resources file
    // @Return : Audio source
    public KrAudioSource PlaySe(string pPath, bool bIsLoop, bool bFromResources)
    {
        KrAudioSource pAudioSource = PlayAudio(pPath, bIsLoop, bFromResources);

        if (pAudioSource == null)
        {
            return(null);
        }

        m_pSeAudioSources.Add(pAudioSource);
        return(pAudioSource);
    }
コード例 #3
0
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief  : Play bgm
    // @Param  : pPath          => Audio asset path
    //         : bFromResources => From resources file
    // @Return : Audio source
    public KrAudioSource PlayBgm(string pPath, bool bFromResources)
    {
        KrAudioSource pAudioSource = PlayAudio(pPath, true, bFromResources);

        if (pAudioSource == null)
        {
            return(null);
        }

        if (m_pBgmAudioSource != null)
        {
            m_pBgmAudioSource.Destroy();
        }
        m_pBgmAudioSource = pAudioSource;
        return(m_pBgmAudioSource);
    }
コード例 #4
0
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // 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);
    }
コード例 #5
0
    // @Brief  : Play se
    // @Param  : pPath          => Audio asset path
    //         : bIsMultiVoice  => Is multi voice
    //         : bFromResources => From resources file
    // @Return : Audio source
    public KrAudioSource PlayVoice(string pPath, bool bIsMultiVoice, bool bFromResources)
    {
        KrAudioSource pAudioSource = PlayAudio(pPath, false, bFromResources);

        if (pAudioSource == null)
        {
            return(null);
        }

        if (bIsMultiVoice)
        {
            m_pVoiceAudioSources.Add(pAudioSource);
        }
        else
        {
            if (m_pVoiceAudioSource != null)
            {
                m_pVoiceAudioSource.Destroy();
            }
            m_pVoiceAudioSource = pAudioSource;
        }
        return(pAudioSource);
    }
コード例 #6
0
    private KrAudioSource m_pAudioSource = null;                    // audio source

    //:::::::::::::::::::::::::::::::::::::::::::::::::::::
    // CONSTRUCTOR
    //:::::::::::::::::::::::::::::::::::::::::::::::::::::
    public KrLive2DLipSyncAudio(KrAudioSource pAudioSource)
    {
        m_pAudioSource = pAudioSource;
    }
コード例 #7
0
 // @Brief : Play lip sync
 // @Param : pVoice  => Audio source
 public void PlayLipSync(KrAudioSource pVoice)
 {
     m_pLipSync = new KrLive2DLipSyncAudio(pVoice);
 }