//====================================================================
        //
        //                           天気情報関連
        //
        //====================================================================
        #region 天気情報関連
        /// <summary>
        /// ランダムにその日の情報を取得する
        /// </summary>
        /// <returns></returns>
        public static void SetWetherSentence(List <MsgSentence> q, LiplisTone Tone, int AllocationId)
        {
            //NULLチェック
            if (LiplisStatus.Instance.InfoWether.WetherDtlList == null)
            {
                return;
            }

            if (LiplisStatus.Instance.InfoWether.WetherDtlList.Count < 1)
            {
                return;
            }

            //現在時刻取得
            DateTime dt = DateTime.Now;

            //天気コード取得
            MsgDayWether todayWether = LiplisStatus.Instance.InfoWether.GetWetherSentenceToday(dt);

            //0~12 今日 午前、午後、夜の天気
            if (dt.Hour >= 0 && dt.Hour <= 18)
            {
                CreateWetherMessage("今日の天気は", todayWether, q, Tone, AllocationId);
            }

            //19~23 明日の天気
            else if (dt.Hour >= 19 && dt.Hour <= 23)
            {
                //明日の天気も取得
                MsgDayWether tomorrowWether = LiplisStatus.Instance.InfoWether.GetWetherSentenceTommorow(dt);

                CreateWetherMessage("", todayWether, q, Tone, AllocationId);
                CreateWetherMessage("明日の天気は", tomorrowWether, q, Tone, AllocationId);
            }
        }
Exemple #2
0
        /// <summary>
        /// 今日の天気状況を取得する
        /// </summary>
        /// <returns></returns>
        public MsgDayWether GetWetherSentenceToday(DateTime dt)
        {
            MsgDayWether result = new MsgDayWether();

            //foreach (ResLpsWeatherInfoDtl60 data in WetherDtlList)
            //{
            //    if (data.timeId == "1" && data.date.Value.Day == targetDdate)
            //    {
            //        result.wether1 = data.weather;
            //        result.wether1Roughly = GetWegherRoughly(data.weather);
            //    }

            //    if (data.timeId == "2" && data.date.Value.Day == targetDdate)
            //    {
            //        result.wether2 = data.weather;
            //        result.wether2Roughly = GetWegherRoughly(data.weather);
            //    }

            //    if (data.timeId == "3" && data.date.Value.Day == targetDdate)
            //    {
            //        result.wether3 = data.weather;
            //        result.wether3Roughly = GetWegherRoughly(data.weather);
            //    }
            //}

            if (WetherDtlList.Count >= 4)
            {
                if (dt.Hour >= 0 && dt.Hour <= 11)
                {
                    result.wether1        = WetherDtlList[1].weather;
                    result.wether1Roughly = GetWegherRoughly(WetherDtlList[1].weather);
                    result.wether2        = WetherDtlList[2].weather;
                    result.wether2Roughly = GetWegherRoughly(WetherDtlList[2].weather);
                    result.wether3        = WetherDtlList[3].weather;
                    result.wether3Roughly = GetWegherRoughly(WetherDtlList[3].weather);
                }
                else if (dt.Hour >= 12 && dt.Hour <= 18)
                {
                    result.wether1        = "";
                    result.wether1Roughly = "";
                    result.wether2        = WetherDtlList[2].weather;
                    result.wether2Roughly = GetWegherRoughly(WetherDtlList[2].weather);
                    result.wether3        = WetherDtlList[3].weather;
                    result.wether3Roughly = GetWegherRoughly(WetherDtlList[3].weather);
                }
                else if (dt.Hour >= 19 && dt.Hour <= 23)
                {
                    result.wether1        = "";
                    result.wether1Roughly = "";
                    result.wether2        = "";
                    result.wether2Roughly = "";
                    result.wether3        = WetherDtlList[3].weather;
                    result.wether3Roughly = GetWegherRoughly(WetherDtlList[3].weather);
                }
            }

            return(result);
        }
Exemple #3
0
        /// <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);
            }
        }
Exemple #4
0
        public MsgDayWether GetWetherSentenceTommorow(DateTime dt)
        {
            MsgDayWether result = new MsgDayWether();


            if (WetherDtlList.Count >= 8)
            {
                result.wether1        = WetherDtlList[5].weather;
                result.wether1Roughly = GetWegherRoughly(WetherDtlList[5].weather);
                result.wether2        = WetherDtlList[6].weather;
                result.wether2Roughly = GetWegherRoughly(WetherDtlList[6].weather);
                result.wether3        = WetherDtlList[7].weather;
                result.wether3Roughly = GetWegherRoughly(WetherDtlList[7].weather);
            }

            return(result);
        }
 /// <summary>
 /// メッセージを生成する
 /// </summary>
 /// <returns></returns>
 public static void CreateWetherMessage(string dayString, MsgDayWether result, List <MsgSentence> q, LiplisTone Tone, int AllocationId)
 {
     //全入力
     if (result.wether1Roughly != "" && result.wether2Roughly != "" && result.wether3Roughly != "")
     {
         CreateWetherMessage3(dayString, result, q, Tone, AllocationId);
     }
     //2個入力
     else if (result.wether2Roughly != "" && result.wether3Roughly != "")
     {
         CreateWetherMessage2(dayString, result, q, Tone, AllocationId);
     }
     //1個入力
     else if (result.wether3Roughly != "")
     {
         CreateWetherMessage1(dayString, result, q, Tone, AllocationId);
     }
 }
        /// <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>
        /// ウェザー入力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>
        /// ウェザー入力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);
        }
Exemple #9
0
    /// <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);
        }
    }