//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // 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);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // 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);
    }
예제 #3
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 : 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);
    }
예제 #5
0
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution command
    // @Param : pManager   => Charageki manager
    public override void Exec(KrCharagekiManager pManager)
    {
        string pKey  = "";
        string pPath = "";

        for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++)
        {
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // KEY
            if (m_pOptions[sIndex].m_pKey == "key")
            {
                // Keys for using csv
                pKey = m_pOptions[sIndex].m_pValue;
            }
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // RESOURCE PATH
            else if (m_pOptions[sIndex].m_pKey == "path")
            {
                pPath = m_pOptions[sIndex].m_pValue;
            }
        }

        KrDebug.Assert(!string.IsNullOrEmpty(pKey), "there is no key!!", typeof(KrCharagekiCommandLoad));
        KrDebug.Assert(!string.IsNullOrEmpty(pPath), "there is no path!!", typeof(KrCharagekiCommandLoad));

        Exec(pKey, pPath, pManager);
    }
    // @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);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // 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)
    {
        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();
    }
예제 #11
0
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PROTECTED FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution with key & path
    // @Param : pKey        => Key name
    //        : pPath       => Asset path of csv
    //        : pManager    => Charageki manager
    protected override void Exec(string pKey, string pPath, KrCharagekiManager pManager)
    {
        KrCharagekiScenarioContainer pScenarioContainer = pManager.GetScenarioContainer();

        KrDebug.Log("Load scenario : key = " + pKey + ", path = " + pPath, typeof(KrCharagekiCommandLoadScenario));
        // Load scenario csv data
        pScenarioContainer.LoadScenario(pKey, pPath);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief  : Create
    // @Param  : pParent        => Charageki manager parent
    //         : pScripts       => Script paths
    //         : pCharaParent   => Character parent
    //         : eViewMode      => Character display mode
    //         : fAutoTime      => Wait time after completion of processing of auto mode
    //         : pAssetBasePath => Asset base path
    //         : pServerBaseUrl => Server base url
    // @Return : KrCharagekiManager instance
    public static KrCharagekiManager Create(Transform pParent, string[] pScripts, Transform pCharaParent, KrCharagekiUICharacterContainer.eVIEW_MODE eViewMode, float fAutoTime, string pAssetBasePath = "", string pServerBaseUrl = "")
    {
        GameObject pPrefab = KrResources.LoadDataInApp <GameObject>(c_pPREFAB_PATH);
        GameObject pObj    = Instantiate <GameObject>(pPrefab, pParent);

        pObj.SetActive(true);
        KrCharagekiManager pManager = pObj.GetComponent <KrCharagekiManager>();

        pManager.Initialize(pScripts, pCharaParent, eViewMode, fAutoTime, pAssetBasePath, pServerBaseUrl);
        return(pManager);
    }
예제 #13
0
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution command
    // @Param : pManager    => Charageki manager
    public override void Exec(KrCharagekiManager pManager)
    {
        string pPath = "";

        for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++)
        {
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // PATH
            if (m_pOptions[sIndex].m_pKey == "path")
            {
                pPath = m_pOptions[sIndex].m_pValue;
            }
        }
        KrDebug.Assert(!string.IsNullOrEmpty(pPath), "there is no path!!", typeof(KrCharagekiCommandPathOption));
        Exec(pPath, pManager);
    }
예제 #14
0
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // PUBLIC FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Execution command
    // @Param : pManager    => Charageki manager
    public override void Exec(KrCharagekiManager pManager)
    {
        uint sId = 0;

        for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++)
        {
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // ID
            if (m_pOptions[sIndex].m_pKey == "id")
            {
                bool bIsSuccess = uint.TryParse(m_pOptions[sIndex].m_pValue, out sId);
                KrDebug.Assert(bIsSuccess, "Parsing failed to type unsigned int = " + m_pOptions[sIndex].m_pValue, typeof(KrCharagekiCommandSetText));
            }
        }

        KrDebug.Assert(sId > 0, "there is no id!!", typeof(KrCharagekiCommandSetText));
        Exec(sId, pManager);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // 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);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // 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)
    {
        string pKey = "";

        for (int sIndex = 0; sIndex < m_pOptions.Count; sIndex++)
        {
            //:::::::::::::::::::::::::::::::::::::::::::::::::::
            // KEY
            if (m_pOptions[sIndex].m_pKey == "key")
            {
                pKey = m_pOptions[sIndex].m_pValue;
            }
        }
        KrDebug.Assert(!string.IsNullOrEmpty(pKey), "there is no key!!", typeof(KrCharagekiCommandLoadScenario));

        KrCharagekiScenarioContainer pScenarioContainer = pManager.GetScenarioContainer();

        KrDebug.Log("Set scenario = " + pKey, typeof(KrCharagekiCommandLoadScenario));
        // set the current scenario
        pScenarioContainer.SettingScenario(pKey);
    }
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // 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);
    }
예제 #19
0
 // @Brief : Execution command
 // @Param : pManager    => Charageki manager
 public abstract void Exec(KrCharagekiManager pManager);
예제 #20
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();
        });
    }
 // @Brief  : Play voice
 // @Param  : pPath      => Asset path of audio clip
 //         : pManager   => Charageki manager
 // @Return : Audio source
 public virtual KrAudioSource PlayVoice(string pPath, KrCharagekiManager pManager)
 {
     return(pManager.PlayVoice(pPath));
 }
    // @Brief  : Play Voice
    // @Param  : uCharaId   => Character Id
    //         : pPath      => Asset path of audio clip
    //         : pManager   => Charageki manager
    // @Return : Audio source
    public KrAudioSource PlayVoice(uint uCharaId, string pPath, KrCharagekiManager pManager)
    {
        KrCharagekiUICharacter pChara = GetCharacter(uCharaId);

        return(pChara.PlayVoice(pPath, pManager));
    }
 // @Brief  : Play Voice
 // @Param  : uCharaId   => Character Id
 //         : pPath      => Asset path of audio clip
 //         : pManager   => Charageki manager
 // @Return : Audio source
 public KrAudioSource PlayVoice(uint uCharaId, string pPath, KrCharagekiManager pManager)
 {
     return(m_pCharaContainer.PlayVoice(uCharaId, pPath, pManager));
 }
예제 #24
0
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 // PROTECTED FUNCTION
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 // @Brief : Execution with key & path
 // @Param : pKey        => Key name
 //        : pPath       => Asset path
 //        : pManager    => Charageki manager
 protected abstract void Exec(string pKey, string pPath, KrCharagekiManager pManager);
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 // PROTECTED FUNCTION
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 // @Brief : Execution with option
 // @Param : pPath       => Path
 //        : pManager    => Charageki manager
 protected override void Exec(string pPath, KrCharagekiManager pManager)
 {
     KrDebug.Log("Play bgm : path = " + pPath, typeof(KrCharagekiCommandPlayBgm));
     pManager.PlayBgm(pPath);
 }
    private KrCharagekiScenarioContainer m_pScenarioContainer = null;               // scenario container

    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // UNITY FUNCTION
    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    // @Brief : Awake
    void Awake()
    {
        I = this;
    }
 // @Brief : OnDestroy
 void OnDestroy()
 {
     m_pUIController.Unload();
     I = null;
 }
예제 #28
0
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 // PROTECTED FUNCTION
 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 // @Brief : Execution with option
 // @Param : uId         => Id
 //        : pManager    => Charageki manager
 protected abstract void Exec(uint uId, KrCharagekiManager pManager);