Пример #1
0
        //====================================================================
        //
        //                           天気情報関連
        //
        //====================================================================
        #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);
            }
        }
Пример #2
0
 /// <summary>
 /// ベースセンテンスを設定するコンストラクター
 /// モード0:口調変換する
 /// モード1:口調変換しない
 /// </summary>
 /// <param name="BaseSentence"></param>
 public MsgSentence(LiplisTone Tone, string BaseSentence, string TalkSentence, int Emotion, int Point, bool FlgToneConvertSkip, int AllocationId, bool FlgAddMessge)
 {
     this.BaseSentence       = BaseSentence;
     this.Emotion            = Emotion;
     this.Point              = Point;
     this.FlgToneConvertSkip = FlgToneConvertSkip;
     this.FlgAddMessge       = FlgAddMessge;
     this.AllocationId       = AllocationId;
     this.Tone = Tone;
 }
Пример #3
0
        public MsgGreet(LiplisTone Tone, ChatSetting chat, int AllocationId)
        {
            try
            {
                this.message = new MsgTopic(Tone, chat.sentence, chat.sentence, chat.GetEmotion(), chat.GetEmotion(), true, AllocationId);

                //Chatに設定があれば、時間範囲を設定する
                if (chat.rangeStart != "" || chat.rangeEnd != "")
                {
                    //スタート時刻をセット
                    string[] start = chat.rangeStart.Split(':');
                    this.SrtTime = DateUtil.CreateDatetime(int.Parse(start[0]), int.Parse(start[1]), 0);

                    //終了時刻をセット
                    string[] end = chat.rangeEnd.Split(':');
                    this.EndTime = DateUtil.CreateDatetime(int.Parse(end[0]), int.Parse(end[1]), 0);
                }
            }
            catch
            {
                //エラーでも処理を継続
            }
        }
Пример #4
0
 /// <summary>
 /// コンストラクター
 /// </summary>
 public MsgTopic(LiplisTone Tone, string BaseSentence, string TalkSentence, int Emotion, int Point, bool FlgConvert, int AllocationId)
 {
     TalkSentenceList = new List <MsgSentence>();
     TalkSentenceList.Add(new MsgSentence(Tone, BaseSentence, TalkSentence, Emotion, Point, FlgConvert, AllocationId));
 }
Пример #5
0
 /// <summary>
 /// トーン設定をセットする
 /// </summary>
 /// <param name="Tone"></param>
 public void SetTone(LiplisTone Tone)
 {
     this.Tone = Tone;
     ToneConvert();
 }
Пример #6
0
        /// <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;
            }
        }
Пример #7
0
 /// <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);
     }
 }
Пример #8
0
        /// <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);
        }
Пример #9
0
        /// <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;
            }
        }
Пример #10
0
        /// <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);

            //トーンコンバート
            sentence.ToneConvert();

            //生成したセンテンスを返す
            return(sentence);
        }
Пример #11
0
 /// <summary>
 /// トーン設定をセットする
 /// </summary>
 /// <param name="Tone"></param>
 public void SetTone(LiplisTone Tone)
 {
     this.Tone = Tone;
 }