示例#1
0
        private void Load(String CharacterFile)
        {
            try {
                int nReqID;
                // If the first parameter is null, then COM object gets VT_EMPTY variant, which means "default character"
                m_AgentSrv.Srv.Load(CharacterFile, out m_nCharID, out nReqID);
                m_AgentSrv.Srv.GetCharacterEx(m_nCharID, out m_CharacterEx);
                //m_CharacterEx.SetLanguageID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));

                // Show the character.  The first parameter tells Microsoft
                // Agent to show the character by playing an animation.
                Show(false);

                // Make the character speak
                //m_CharacterEx.Speak("Hello!", null, out nReqID);
                // If it is desired to wait until Agent finish talking, the following two lines would do that:
                // EventsMgr.AddEvent(nReqID);
                // EventsMgr.WaitAndRemove(nReqID);

                EnumerateAnimations();
            } catch (Exception e) {
                //e.Source = "Agent Server failed to load Agent Character file";
                AgentCharacterLoadingException ex = new AgentCharacterLoadingException("Agent Server failed to load Agent Character file", e);
                //Console.WriteLine(ex);
                throw ex;
            }
        }
示例#2
0
        private void Load(String CharacterFile)
        {
            try {
                int nReqID;
                // If the first parameter is null, then COM object gets VT_EMPTY variant, which means "default character"
                m_AgentSrv.Srv.Load(CharacterFile, out m_nCharID, out nReqID);
                m_AgentSrv.Srv.GetCharacterEx(m_nCharID, out m_CharacterEx);
                //m_CharacterEx.SetLanguageID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));

                // Show the character.  The first parameter tells Microsoft
                // Agent to show the character by playing an animation.
                Show(false);

                // Make the character speak
                //m_CharacterEx.Speak("Hello!", null, out nReqID);
                // If it is desired to wait until Agent finish talking, the following two lines would do that:
                // EventsMgr.AddEvent(nReqID);
                // EventsMgr.WaitAndRemove(nReqID);

                EnumerateAnimations();
            } catch (Exception e) {
                //e.Source = "Agent Server failed to load Agent Character file";
                AgentCharacterLoadingException ex = new AgentCharacterLoadingException("Agent Server failed to load Agent Character file", e);
                //Console.WriteLine(ex);
                throw ex;
            }
        }