Ejemplo n.º 1
0
        static void PlayMovie()
        {
            var movieFile = "";
            var movieName = "";
            var movieId   = 0;

            DbService.GetTopMovie(AppSettings.RoomId, out movieId, out movieName, out movieFile);
            DoPlayMovie(movieFile);

            DbService.CreateMoviePlayHistory(AppSettings.RoomId, movieId);
            DbService.SetCurrentMovie(AppSettings.RoomId, movieName);
            Obs.SetCurrentMovie(movieName);
            DbService.UpdateMoviePlaytime(AppSettings.RoomId, movieName);
            DbService.ClearMovieScore(AppSettings.RoomId, movieName);
            WaitPlayingFinish();
        }
Ejemplo n.º 2
0
        public void StartProcess()
        {
            // 初始化房间
            Obs.Initialize(RoomId);

            // 开始处理
            _stopProcess = false;
            IsProcessing = true;
            while (!_stopProcess)
            {
                try {
                    // 获取消息
                    var messages = ChatMessage.GetMessages(RoomId);
                    if (messages.Length == 0)
                    {
                        MyApplication.Delay(1000);
                        continue;
                    }

                    // 处理消息
                    foreach (var message in messages)
                    {
                        if (message is ChatMessage)
                        {
                            ProcessChatMessage(message as ChatMessage);
                        }
                        else if (message is GiftMessage)
                        {
                            ProcessGiftMessage(message as GiftMessage);
                        }
                        else if (message is ChouqinMessage)
                        {
                            ProcessChouqinMessage(message as ChouqinMessage);
                        }
                    }
                } catch (Exception ex) {
                    LogService.Error("处理弹幕消息发生异常!", ex);
                }
            }
            IsProcessing = false;
        }