private void SetNextSentence(MsgSentence sentence) { //トーンコンバート sentence.ToneConvert(); //ウインドウを表示する if (!sentence.FlgAddMessge) { if (sentence.TalkSentence != null) { CreateWindow(sentence.TalkSentence, sentence.AllocationId); } } else { this.NowTalkWindow.AddText(sentence.TalkSentence); } //音声再生 VoiceTalk(sentence); //表情設定 StartCoroutine(modelController.SetExpression(sentence)); //おしゃべりの開始 modelController.StartTalking(sentence); //センテンスカウントインクリメント NowSentenceCount++; }
/// <summary> /// 次の文章をセットする /// </summary> private void SetNextSentence() { try { //バカよけ if (NowLoadTopic.TalkSentenceList.Count < 1) { SetNextTopic(); return; } //設定数おしゃべりしたら次の話題 if (NowSentenceCount > LiplisSetting.Instance.Setting.GetTalkNum()) { while (NowLoadTopic.TalkSentenceList.Count > 0) { MsgSentence s = NowLoadTopic.TalkSentenceList.Dequeue(); } return; } //センテンスを1個取り出す MsgSentence sentence = NowLoadTopic.TalkSentenceList.Dequeue(); //センテンスをセットする SetNextSentence(sentence); } catch (Exception ex) { Console.WriteLine(ex); } }
/// <summary> /// 音声おしゃべり /// </summary> /// <returns></returns> public static IEnumerator GetAudioClip(MsgSentence Sentence, int ModelCount) { if (Sentence.AllocationId < 0 || Sentence.AllocationId >= ModelCount) { //何もしない } else { //ソース指定し音楽流す //音楽ファイルロード using (WWW www = new WWW(UtilVoiceByOS.GetOndemandVoiceApiUrl(), CreateRequest(Sentence))) { ////読み込み完了まで待機 //yield return www; // 画像ダウンロード完了を待機 while (www.MoveNext()) {// コルーチンの終了を待つ yield return(null); } //ダウンロードサイズが5kb以下ならエラーと判断 if (www.bytesDownloaded > 5000) { yield return(www.GetAudioClip(false, false, UtilVoiceByOS.GetVoiceFileTypeByOs())); } else { yield return(null); } } } }
/// <summary> /// 最高気温からコメントを生成する /// </summary> /// <param name="maxTemp"></param> /// <returns></returns> public void CreatChanceOfRainSentence(List <MsgSentence> q, int maxTemp) { if (maxTemp <= 0) { string msg = "雨の心配は全く無いですね!"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 1, 3, true, AllocationId); q.Add(sentence); } else if (maxTemp < 10) { string msg = "雨が降る可能性は低そうですね~。"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 3, 3, true, AllocationId); q.Add(sentence); } else if (maxTemp < 20) { string msg = "雨、降るかもしれませんね。"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 0, 0, true, AllocationId); q.Add(sentence); } else if (maxTemp < 30) { string msg = "うーん、傘は大丈夫ですかね・・・?念のため持って行きますか?"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 0, 0, true, AllocationId); q.Add(sentence); } else if (maxTemp < 50) { string msg = "雨が降るか振らないか、五分五分ですねぇ。"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 3, 3, true, AllocationId); q.Add(sentence); } else if (maxTemp < 80) { string msg = "傘を持っていったほうがいいですね!"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 1, -3, true, AllocationId); q.Add(sentence); } else { string msg = "傘を持っていったほうがいいですね!"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 1, 3, true, AllocationId); q.Add(sentence); } }
//==================================================================== // // 天気文章取得 // //==================================================================== #region 天気文章取得 /// <summary> /// あいさつ文章を取得する /// </summary> /// <returns></returns> public MsgSentence GetWetherMessage() { MsgSentence result = new MsgSentence(); return(result); }
//==================================================================== // // あいさつ取得 // //==================================================================== #region あいさつ取得 /// <summary> /// あいさつ文章を取得する /// </summary> /// <returns></returns> public MsgSentence GetGreetMessage() { MsgSentence result = new MsgSentence(); return(result); }
/// <summary> /// メインウインドウを設定する /// </summary> private void SetMainTalkWindow(MsgSentence sentence) { //名前設定 this.TextName.text = LiplisModels.Instance.GetModelName(sentence); //顔アイコン設定 this.ImgChar.gameObject.SetActive(true); this.ImgChar.sprite = LiplisModels.Instance.GetModelCharImage(sentence); }
/// <summary> /// 天気文章をセットする /// /// TODO CtrlTalk:SetWetherSentence アロケーションIDの付け方再考 /// </summary> /// <param name="topic"></param> public void SetWetherSentence(MsgTopic topic) { //NULLチェック if (LiplisStatus.Instance.InfoWether.WetherDtlList == null) { return; } if (LiplisStatus.Instance.InfoWether.WetherDtlList.Count < 1) { return; } if (topic.TalkSentenceList.Count < 1) { return; } //最終センテンス取得 MsgSentence lastSentence = topic.TalkSentenceList[topic.TalkSentenceList.Count - 1]; //現在時刻取得 DateTime dt = DateTime.Now; //天気コード取得 MsgDayWether todayWether = LiplisStatus.Instance.InfoWether.GetWetherSentenceToday(dt); //0~12 今日 午前、午後、夜の天気 if (dt.Hour >= 0 && dt.Hour <= 18) { //次モデル取得 LiplisModel model = LiplisModels.Instance.GetCharacterModelNext(lastSentence.AllocationId); //センテンス生成 LiplisWeather.CreateWetherMessage("今日の天気は", todayWether, topic.TalkSentenceList, model.Tone, model.AllocationId); } //19~23 明日の天気 else if (dt.Hour >= 19 && dt.Hour <= 23) { //明日の天気も取得 MsgDayWether tomorrowWether = LiplisStatus.Instance.InfoWether.GetWetherSentenceTommorow(dt); //次モデル取得 LiplisModel model1 = LiplisModels.Instance.GetCharacterModelNext(lastSentence.AllocationId); //1文目追加 LiplisWeather.CreateWetherMessage("", todayWether, topic.TalkSentenceList, model1.Tone, model1.AllocationId); //次モデル取得 LiplisModel model2 = LiplisModels.Instance.GetCharacterModelNext(model1.AllocationId); //2文目追加 LiplisWeather.CreateWetherMessage("明日の天気は", tomorrowWether, topic.TalkSentenceList, model2.Tone, model2.AllocationId); } }
public IEnumerator SetVoiceDataInterrupt(MsgSentence sentence) { var Async = ClalisForLiplisGetVoiceMp3Ondemand.GetAudioClip(sentence, modelController.GetModelCount()); //非同期実行 yield return(Async); //データ取得 sentence.VoiceData = (AudioClip)Async.Current; }
/// <summary> /// センテンスを生成する /// </summary> /// <param name="message"></param> /// <param name="wetherCode"></param> /// <param name="addMessage"></param> /// <returns></returns> private static MsgSentence CreateWetherSentence(string message, string wetherCode, bool addMessage, LiplisTone Tone, int AllocationId) { //エモーションをセットする MsgEmotion emotion = GetWetherEmotion(wetherCode); //インスタンス生成 MsgSentence sentence = new MsgSentence(Tone, message, message, emotion.EMOTION, emotion.POINT, false, AllocationId, addMessage); //生成したセンテンスを返す return(sentence); }
/// <summary> /// 音声おしゃべり /// </summary> private void VoiceTalk(MsgSentence sentence) { //音声おしゃべり設定がONなら、音声おしゃべりする if (LiplisSetting.Instance.Setting.FlgVoice) { if (sentence.VoiceData != null) { LiplisModels.Instance.StartVoice(sentence.AllocationId, sentence.VoiceData); } } }
/// <summary> /// キャラクターアイコンを取得する /// </summary> /// <param name="sentence"></param> /// <returns></returns> public Sprite GetModelCharImage(MsgSentence sentence) { int AllocationId = sentence.AllocationId; if (AllocationId < 0) { AllocationId = 0; } //モデルに感情をセットする return(TableModelId[sentence.AllocationId].SpriteCharIcon); }
/// <summary> /// モデル名を取得する /// </summary> /// <param name="AllocationId"></param> /// <param name="sentence"></param> public string GetModelName(MsgSentence sentence) { int AllocationId = sentence.AllocationId; if (AllocationId < 0) { AllocationId = 0; } //モデルに感情をセットする return(TableModelId[sentence.AllocationId].ModelName); }
/// <summary> /// エクスプレッションを設定する /// </summary> /// <param name="AllocationId"></param> /// <param name="sentence"></param> public IEnumerator SetExpression(MsgSentence sentence) { int AllocationId = sentence.AllocationId; if (AllocationId < 0) { AllocationId = 0; } //モデルに感情をセットする yield return(TableModelId[sentence.AllocationId].ActiveModel.SetExpression(MotionMap.GetMotion(sentence.Emotion, sentence.Point))); }
public IEnumerator SetVoiceData(MsgTopic NowLoadTopic, MsgSentence sentence) { //トーンコンバート //sentence.ToneConvert(); var Async = ClalisForLiplisGetVoiceMp3Ondemand.GetAudioClip(sentence, LiplisModels.Instance.GetModelCount()); //非同期実行 yield return(Async); //データ取得 sentence.VoiceData = (AudioClip)Async.Current; }
/// <summary> /// リクエストを生成する /// </summary> /// <param name="NowLoadTopic"></param> /// <param name="SubId"></param> /// <returns></returns> public static WWWForm CreateRequest(MsgSentence Sentence) { WWWForm ps = new WWWForm(); //レックトピック生成 string json = JsonConvert.SerializeObject(TopicUtil.CreateReqTopicVoiceOndemand(Sentence.TalkSentence, Sentence.AllocationId)); //パラメータ生成 ps.AddField("reqmsg", json); //トーンURL //結果を返す return(ps); }
/// <summary> /// アニバーサリーセンテンスをセットする。 /// </summary> /// <param name="topic"></param> public void SetAnniversarySentence(MsgTopic topic) { //データ取得 ResWhatDayIsToday DataList = LiplisStatus.Instance.InfoAnniversary.DataList; if (DataList == null) { return; } int sentenceIdx = 0; int AllocationId = 0; foreach (var data in DataList.AnniversaryDaysList) { foreach (MsgSentence talkSentence in data.TalkSentenceList) { MsgSentence sentence = talkSentence.Clone(); //キャラデータ取得 LiplisModel cahrData = LiplisModels.Instance.TableModelId[AllocationId]; if (sentenceIdx == 0) { sentence.BaseSentence = "今日は" + sentence.BaseSentence + "みたいです~♪"; sentence.ToneConvert(); //sentence.TalkSentence = sentence.BaseSentence; } else { sentence.ToneConvert(); } //アロケーションID設定 sentence.AllocationId = AllocationId; //インデックスインクリメント sentenceIdx++; AllocationId++; //アロケーションIDコントロール if (AllocationId > LiplisModels.Instance.GetMaxAllocationId()) { AllocationId = 0; } //センテンスを追加 topic.TalkSentenceList.Add(sentence); } } }
public IEnumerator SetVoiceData(MsgTopic NowLoadTopic, MsgSentence sentence) { //トーンコンバート sentence.ToneConvert(); //var Async = ClalisForLiplisGetVoiceMp3.GetAudioClip(NowLoadTopic, sentence.AllocationId, sentence.SubId); var Async = ClalisForLiplisGetVoiceMp3Ondemand.GetAudioClip(sentence, modelController.GetModelCount()); //非同期実行 yield return(Async); //データ取得 sentence.VoiceData = (AudioClip)Async.Current; }
//==================================================================== // // イベントハンドラ // //==================================================================== #region イベントハンドラ /// <summary> /// アイテム更新 /// </summary> /// <returns></returns> private IEnumerator updateItem() { if (this.dataIndex == -1) { yield break; } //センテンス取得 MsgSentence data = ScrollViewControllerTalk.sc.TalkSentenceList[this.dataIndex]; //モデル取得 LiplisModel charData = LiplisModels.Instance.TableModelId[data.AllocationId]; if (this.dataIndex % 2 == 0) { iconLeft.gameObject.SetActive(true); iconRight.gameObject.SetActive(false); nameLeft.gameObject.SetActive(true); nameRight.gameObject.SetActive(false); imageBalloonLeft.gameObject.SetActive(true); imageBalloonRight.gameObject.SetActive(false); nameLeft.text = charData.ModelName; iconLeft.sprite = charData.SpriteCharIcon; imageBalloonLeft.color = charData.GetColorFromSetting(); messageLeft.text = data.TalkSentence; } else { iconLeft.gameObject.SetActive(false); iconRight.gameObject.SetActive(true); nameLeft.gameObject.SetActive(false); nameRight.gameObject.SetActive(true); imageBalloonLeft.gameObject.SetActive(false); imageBalloonRight.gameObject.SetActive(true); nameRight.text = charData.ModelName; iconRight.sprite = charData.SpriteCharIcon; imageBalloonRight.color = charData.GetColorFromSetting(); messageRight.text = data.TalkSentence; } }
/// <summary> /// ネクストセンテンスをセットする /// </summary> /// <param name="sentence"></param> private void SetNextSentence(MsgSentence sentence) { //トーンコンバート //sentence.ToneConvert(); //ウインドウを表示する if (!sentence.FlgAddMessge) { if (sentence.TalkSentence != null) { CreateWindow(sentence.TalkSentence, sentence.AllocationId); } } else { this.NowTalkWindow.AddText(sentence.TalkSentence); } //メイントークウインドウに設定する SetMainTalkWindow(sentence); //音声再生 VoiceTalk(sentence); //表情設定 StartCoroutine(LiplisModels.Instance.SetExpression(sentence)); //おしゃべりの開始 LiplisModels.Instance.StartTalking(sentence); //ログに追記 if (this.LogLoadTopic != null) { this.LogLoadTopic.TalkSentenceList.Add(sentence); } //センテンスカウントインクリメント NowSentenceCount++; }
/// <summary> /// トークUIを生成する /// </summary> /// <param name="sentence"></param> /// <param name="rlBit"></param> /// <param name="idx"></param> public void CreateLogTalkUi(MsgSentence sentence, bool rlBit, int idx) { //ウインドウのプレハブからインスタンス生成 GameObject panel = CreateCharPanel(sentence.AllocationId, rlBit); //ウインドウ名設定 panel.name = "LiplisTalkLog" + idx; //要素取得 Text TxtMessage = panel.transform.Find("ImgText").GetComponent <Image>().transform.Find("Text").GetComponent <Text>(); //内容設定 TxtMessage.text = sentence.TalkSentence; Vector3 txtPos = panel.transform.position; panel.transform.position = new Vector3(txtPos.x, -idx * 40, txtPos.z); //親パネルにセット PanelChildList.Add(panel); panel.transform.SetParent(ContentChild.transform, false); }
/// <summary> /// ウェザー入力2つの場合の入力 /// </summary> /// <returns></returns> private static void CreateWetherMessage2(string dayString, MsgDayWether result, List <MsgSentence> q, LiplisTone Tone, int AllocationId) { //同じ if (result.wether2Roughly == result.wether3Roughly) { MsgSentence sentence1 = CreateWetherSentence(dayString + "午後から夜を通して" + GetWetherWording2(result.wether2Roughly) + "でしょう。", result.wether2Roughly, false, Tone, AllocationId); q.Add(sentence1); return; } //違う else { //1文目生成 MsgSentence sentence1 = CreateWetherSentence(dayString + "午後から夜にかけては" + GetWetherWording1(result.wether2Roughly) + "ますが、", result.wether2Roughly, false, Tone, AllocationId); q.Add(sentence1); //2文目生成 MsgSentence sentence2 = CreateWetherSentence("今夜は" + GetWetherWording2(result.wether3Roughly) + "でしょう。", result.wether2Roughly, true, Tone, AllocationId); q.Add(sentence2); return; } }
/// <summary> /// おしゃべり開始 /// </summary> public void StartTalking(MsgSentence sentence) { ////リップシンク有効 this.TableModelId[sentence.AllocationId].ActiveModel.StartTalking(); }
/// <summary> /// 天気文章をセットする /// /// TODO CtrlTalk:SetWetherSentence アロケーションIDの付け方再考 /// </summary> /// <param name="topic"></param> public void SetWetherSentence(MsgTopic topic) { //NULLチェック if (LiplisStatus.Instance.InfoWether.WetherDtlList == null) { return; } if (LiplisStatus.Instance.InfoWether.WetherDtlList.Count < 1) { return; } //最終センテンス取得 MsgSentence lastSentence = topic.TalkSentenceList[topic.TalkSentenceList.Count - 1]; //モデル LiplisModel cahrData1; LiplisModel cahrData2; LiplisModel cahrData3; //アロケーションID int AllocationId1; int AllocationId2; int AllocationId3; //アロケーションID取得 AllocationId1 = lastSentence.AllocationId + 1; if (AllocationId1 > 3) { AllocationId1 = 0; } AllocationId2 = AllocationId1 + 1; if (AllocationId2 > 3) { AllocationId2 = 0; } AllocationId3 = AllocationId2 + 1; if (AllocationId3 > 3) { AllocationId3 = 0; } //キャラクターデータ取得 cahrData1 = modelController.TableModelId[AllocationId1]; cahrData2 = modelController.TableModelId[AllocationId2]; cahrData3 = modelController.TableModelId[AllocationId3]; //現在時刻取得 DateTime dt = DateTime.Now; //天気コード取得 MsgDayWether todayWether = LiplisStatus.Instance.InfoWether.GetWetherSentenceToday(dt); //0~12 今日 午前、午後、夜の天気 if (dt.Hour >= 0 && dt.Hour <= 18) { LiplisWeather.CreateWetherMessage("今日の天気は", todayWether, topic.TalkSentenceList, cahrData1.Tone, cahrData1.AllocationId); } //19~23 明日の天気 else if (dt.Hour >= 19 && dt.Hour <= 23) { //明日の天気も取得 MsgDayWether tomorrowWether = LiplisStatus.Instance.InfoWether.GetWetherSentenceTommorow(dt); LiplisWeather.CreateWetherMessage("", todayWether, topic.TalkSentenceList, cahrData2.Tone, cahrData2.AllocationId); LiplisWeather.CreateWetherMessage("明日の天気は", tomorrowWether, topic.TalkSentenceList, cahrData3.Tone, cahrData3.AllocationId); } }
/// <summary> /// ウェザー入力1つの場合の入力 /// </summary> /// <returns></returns> private static void CreateWetherMessage1(string dayString, MsgDayWether result, List <MsgSentence> q, LiplisTone Tone, int AllocationId) { MsgSentence sentence1 = CreateWetherSentence("今夜は" + GetWetherWording2(result.wether3Roughly) + "でしょう。", result.wether3Roughly, false, Tone, AllocationId); q.Add(sentence1); }
public MsgSentence GetWetherMessage(string timeString, string wetherCode) { MsgSentence result = new MsgSentence(); switch (wetherCode) { case WETHER_CODE.SUNNY: result.BaseSentence = timeString + "の天気は" + "晴れでしょう。"; result.Emotion = EMOTION.JOY; result.Point = 3; break; case WETHER_CODE.SUNNY_THEN_CLOUDY: result.BaseSentence = timeString + "の天気は" + "晴れのち曇りでしょう。"; result.Emotion = EMOTION.NORMAL; result.Point = 0; break; case WETHER_CODE.SUNNY_THEN_RAIN: result.BaseSentence = timeString + "の天気は" + "晴れのち雨でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.SUNNY_THEN_SNOW: result.BaseSentence = timeString + "の天気は" + "晴れのち雪でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.SUNNY_WITH_OCCASIONAL_CLOUDY: result.BaseSentence = timeString + "の天気は" + "晴れ時々曇りでしょう。"; result.Emotion = EMOTION.NORMAL; result.Point = 0; break; case WETHER_CODE.SUNNY_WITH_OCCASIONAL_RAIN: result.BaseSentence = timeString + "の天気は" + "晴れ時々雨でしょう。"; result.Emotion = EMOTION.NORMAL; result.Point = 0; break; case WETHER_CODE.SUNNY_WITH_OCCASIONAL_SNOW: result.BaseSentence = timeString + "の天気は" + "晴れ時々雪でしょう。"; result.Emotion = EMOTION.NORMAL; result.Point = 0; break; case WETHER_CODE.CLOUDY: result.BaseSentence = timeString + "の天気は" + "曇りでしょう。"; result.Emotion = EMOTION.NORMAL; result.Point = 0; break; case WETHER_CODE.CLOUDY_THEN_SUNNY: result.BaseSentence = timeString + "の天気は" + "曇りのち晴れでしょう。"; result.Emotion = EMOTION.JOY; result.Point = 3; break; case WETHER_CODE.CLOUDY_THEN_RAIN: result.BaseSentence = timeString + "の天気は" + "曇りのち雨でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.CLOUDY_THEN_SNOW: result.BaseSentence = timeString + "の天気は" + "曇りのち雪でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.CLOUDY_WITH_OCCASIONAL_SUNNY: result.BaseSentence = timeString + "の天気は" + "曇り時々晴れでしょう。"; result.Emotion = EMOTION.JOY; result.Point = 3; break; case WETHER_CODE.CLOUDY_WITH_OCCASIONAL_RAIN: result.BaseSentence = timeString + "の天気は" + "曇り時々雨でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.CLOUDY_WITH_OCCASIONAL_SNOW: result.BaseSentence = timeString + "の天気は" + "曇り時々雪でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.RAIN: result.BaseSentence = timeString + "の天気は" + "雨でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.RAIN_THEN_SUNNY: result.BaseSentence = timeString + "の天気は" + "雨のち晴れでしょう。"; result.Emotion = EMOTION.JOY; result.Point = 3; break; case WETHER_CODE.RAIN_THEN_CLOUDY: result.BaseSentence = timeString + "の天気は" + "雨のち曇でしょう。"; result.Emotion = EMOTION.NORMAL; result.Point = 0; break; case WETHER_CODE.RAIN_THEN_SNOW: result.BaseSentence = timeString + "の天気は" + "雨のち雪でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.RAIN_WITH_OCCASIONAL_SUNNY: result.BaseSentence = timeString + "の天気は" + "雨時々晴れでしょう。"; result.Emotion = EMOTION.JOY; result.Point = 3; break; case WETHER_CODE.RAIN_WITH_OCCASIONAL_CLOUDY: result.BaseSentence = timeString + "の天気は" + "雨時々曇りでしょう。"; result.Emotion = EMOTION.NORMAL; result.Point = 0; break; case WETHER_CODE.RAIN_WITH_OCCASIONAL_SNOW: result.BaseSentence = timeString + "の天気は" + "雨時々雪でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.SNOW: result.BaseSentence = timeString + "の天気は" + "雪でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.SNOW_THEN_SUNNY: result.BaseSentence = timeString + "の天気は" + "雪のち晴れでしょう。"; result.Emotion = EMOTION.JOY; result.Point = 3; break; case WETHER_CODE.SNOW_THEN_CLOUDY: result.BaseSentence = timeString + "の天気は" + "雪のち曇りでしょう。"; result.Emotion = EMOTION.NORMAL; result.Point = 0; break; case WETHER_CODE.SNOW_THEN_RAIN: result.BaseSentence = timeString + "の天気は" + "雪のち雨でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.SNOW_WITH_OCCASIONAL_SUNNY: result.BaseSentence = timeString + "の天気は" + "雪時々晴れでしょう。"; result.Emotion = EMOTION.JOY; result.Point = 3; break; case WETHER_CODE.SNOW_WITH_OCCASIONAL_CLOUDY: result.BaseSentence = timeString + "の天気は" + "雪時々曇りでしょう。"; result.Emotion = EMOTION.NORMAL; result.Point = 0; break; case WETHER_CODE.SNOW_WITH_OCCASIONAL_RAIN: result.BaseSentence = timeString + "の天気は" + "雪時々雨でしょう。"; result.Emotion = EMOTION.JOY; result.Point = -3; break; case WETHER_CODE.WIND_STOM: result.BaseSentence = timeString + "の天気は" + "暴風雨でしょう。"; result.Emotion = EMOTION.AMAZEMENT; result.Point = 3; break; default: result.BaseSentence = ""; result.Emotion = 0; result.Point = 0; break; } //データセット result.TalkSentence = result.BaseSentence; return(result); }
/// <summary> /// ウェザー入力3つの場合の入力 /// </summary> /// <returns></returns> private static void CreateWetherMessage3(string dayString, MsgDayWether result, List <MsgSentence> q, LiplisTone Tone, int AllocationId) { // 同一 if (result.wether1Roughly == result.wether2Roughly && result.wether1Roughly == result.wether3Roughly) { MsgSentence sentence1 = CreateWetherSentence(dayString + "1日を通して" + GetWetherWording2(result.wether1Roughly) + "でしょう。", result.wether1Roughly, false, Tone, AllocationId); q.Add(sentence1); } // 前2つ同 else if (result.wether1Roughly == result.wether2Roughly) { //1文目生成 MsgSentence sentence1 = CreateWetherSentence(dayString + "朝から昼にかけて" + GetWetherWording1(result.wether1Roughly) + "ますが、", result.wether1Roughly, false, Tone, AllocationId); q.Add(sentence1); //2文目生成 MsgSentence sentence2 = CreateWetherSentence(GetWetherWording2(result.wether3Roughly) + "でしょう。", result.wether3Roughly, true, Tone, AllocationId); q.Add(sentence2); return; } // 後2つ同 else if (result.wether2Roughly == result.wether3Roughly) { //1文目生成 MsgSentence sentence1 = CreateWetherSentence(dayString + "朝は" + GetWetherWording1(result.wether1Roughly) + "ますが、", result.wether1Roughly, false, Tone, AllocationId); q.Add(sentence1); //2文目生成 MsgSentence sentence2 = CreateWetherSentence("昼過ぎから今夜まで" + GetWetherWording2(result.wether2Roughly) + "でしょう。", result.wether2Roughly, true, Tone, AllocationId); q.Add(sentence2); return; } // 全違 else if (result.wether1Roughly != result.wether2Roughly && result.wether1Roughly != result.wether3Roughly) { //1文目生成 MsgSentence sentence1 = CreateWetherSentence(dayString + "朝は" + GetWetherWording1(result.wether1Roughly) + "ますが、", result.wether1Roughly, false, Tone, AllocationId); q.Add(sentence1); //2文目生成 MsgSentence sentence2 = CreateWetherSentence("昼過ぎから" + GetWetherWording1(result.wether2Roughly) + "、", result.wether2Roughly, true, Tone, AllocationId); q.Add(sentence2); //2文目生成 MsgSentence sentence3 = CreateWetherSentence("今夜は" + GetWetherWording2(result.wether3Roughly) + "でしょう。", result.wether3Roughly, true, Tone, AllocationId); q.Add(sentence3); return; } // 前後同じ else if (result.wether1Roughly == result.wether3Roughly) { //1文目生成 MsgSentence sentence1 = CreateWetherSentence(dayString + "朝は" + GetWetherWording1(result.wether1Roughly) + "ますが、", result.wether1Roughly, false, Tone, AllocationId); q.Add(sentence1); //2文目生成 MsgSentence sentence2 = CreateWetherSentence("昼過ぎから" + GetWetherWording1(result.wether2Roughly) + "、", result.wether2Roughly, true, Tone, AllocationId); q.Add(sentence2); //2文目生成 MsgSentence sentence3 = CreateWetherSentence("今夜は" + GetWetherWording2(result.wether3Roughly) + "でしょう。", result.wether3Roughly, true, Tone, AllocationId); q.Add(sentence3); } else { return; } }
/// <summary> /// 最高気温からコメントを生成する /// </summary> /// <param name="maxTemp"></param> /// <returns></returns> public void CreateTemperatureSentence(List <MsgSentence> q, int maxTemp) { if (maxTemp <= 0) { string msg = "寒すぎです・・・!"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 1, -3, false, AllocationId); q.Add(sentence); } else if (maxTemp < 10) { string msg = "寒いですね~。"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 4, -3, false, AllocationId); q.Add(sentence); } else if (maxTemp < 15) { string msg = "少し寒いですね。"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 0, 0, false, AllocationId); q.Add(sentence); } else if (maxTemp < 20) { string msg = "涼しいですね。"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 0, 0, false, AllocationId); q.Add(sentence); } else if (maxTemp < 25) { string msg = "これくらいの気温が過ごしやすいですね。"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 1, 3, false, AllocationId); q.Add(sentence); } else if (maxTemp < 30) { string msg = "ちょっと暑いですね~。"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 3, -3, false, AllocationId); q.Add(sentence); } else if (maxTemp < 35) { string msg = "暑くて溶けてしまいそうです・・・"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 6, -3, false, AllocationId); q.Add(sentence); } else { string msg = "暑い、暑い、暑いぃぃぃ!"; MsgSentence sentence = new MsgSentence(Tone, msg, msg, 6, 3, false, AllocationId); q.Add(sentence); } }