Beispiel #1
0
 public void Stop()
 {
     try
     {
         if (CaptureSource != null && CaptureSource.State == CaptureState.Started)
         {
             CaptureSource.Stop();
             ClientLogger.Debug("Local captureSource stopped");
         }
         else
         {
             ClientLogger.Debug("Local captureSource already stopped: {0}", CaptureSource == null ? "captureSource is null" : CaptureSource.State.ToString());
         }
         CaptureSource = null;
     }
     catch (Exception ex)
     {
         ClientLogger.Error(ex.ToString());
     }
 }
Beispiel #2
0
        private void InitBtnObject()
        {
            Dictionary <int, AreaInfo> dictionary = ModelManager.Instance.Get_AreaList_X();

            if (dictionary.Count == 0)
            {
                ClientLogger.Error("没收到服务器数据");
                CtrlManager.ShowMsgBox("错误", "无法获得服务器列表,请稍后再试", new Action(this.ExitGameCall), PopViewType.PopOneButton, "确定", "取消", null);
            }
            this.mBtnGridControllers.Clear();
            foreach (KeyValuePair <int, AreaInfo> current in dictionary)
            {
                GameObject gameObject = NGUITools.AddChild(this.mServerListGrid.gameObject, this.mBtnCache);
                gameObject.SetActive(true);
                AreaButtonCtrl component = gameObject.GetComponent <AreaButtonCtrl>();
                component.BindingAreaInfo(current.Value);
                this.mBtnGridControllers.Add(component);
            }
            this.mServerListGrid.Reposition();
        }
        public bool CheckAccessToRGI2(string systemName)
        {
            bool          allowed       = false;
            string        jsonResult    = string.Empty;
            UserServiceDO userServiceDO = new UserServiceDO();

            string URL = string.Format("{0}CheckAccessToRGI2/{1}", userServiceAddress, systemName);

            try
            {
                WebClient serviceRequest = new WebClient();
                jsonResult = serviceRequest.DownloadString(new Uri(URL));
                jsonResult = ConnectorHelper.ChangeArrayParentheses(jsonResult);
            }
            catch (Exception ex) { ClientLogger.WriteError(ex, "Error getting access for user\nMethod: UserConnector.CheckAccessToRGI2", systemName); }

            userServiceDO = JsonConvert.DeserializeObject <UserServiceDO>(jsonResult);
            allowed       = userServiceDO.CheckAccessToRGI2Result;
            return(allowed);
        }
        public User GetUser(string systemName)
        {
            User          currentUser   = new User();
            string        jsonResult    = string.Empty;
            UserServiceDO userServiceDO = new UserServiceDO();

            string URL = string.Format("{0}GetUser/{1}", userServiceAddress, systemName);

            try
            {
                WebClient serviceRequest = new WebClient();
                jsonResult = serviceRequest.DownloadString(new Uri(URL));
                jsonResult = ConnectorHelper.ChangeArrayParentheses(jsonResult);
            }
            catch (Exception ex) { ClientLogger.WriteError(ex, "Error getting user\nMethod: UserConnector.GetUser", systemName); }

            userServiceDO = JsonConvert.DeserializeObject <UserServiceDO>(jsonResult);
            currentUser   = userServiceDO.GetUserResult;
            return(currentUser);
        }
Beispiel #5
0
        /// <summary>
        /// The idea here is to select a format which is closest to the format we actually want,
        /// and allows us to do the simplest possible downsampling (or none at all).
        /// </summary>
        /// <param name="device">The selected audio capture device</param>
        public static void SelectBestAudioFormat(AudioCaptureDevice device)
        {
            if (device != null && device.SupportedFormats.Count > 0)
            {
                // Some devices return a "SamplesPerSecond" of 0 at this stage. Damn Microsoft.
                var possibleAudioFormats = device.SupportedFormats.Where(format =>
                                                                         format.BitsPerSample == AudioConstants.BitsPerSample &&
                                                                         format.WaveFormat == WaveFormatType.Pcm).ToList();

                var formats = new StringBuilder();
                foreach (var format in device.SupportedFormats)
                {
                    formats.AppendFormat("BitsPerSample={0}, Channels={1}, SamplesPerSecond={2}\r\n", format.BitsPerSample, format.Channels, format.SamplesPerSecond);
                }
                ClientLogger.Debug("Possible audio formats: " + formats);

                // This will select any format that is an exact match of the desired format.
                var bestAudioFormat = possibleAudioFormats
                                      .FirstOrDefault(format => format.SamplesPerSecond == AudioConstants.WidebandSamplesPerSecond &&
                                                      format.Channels == AudioConstants.Channels &&
                                                      format.BitsPerSample == AudioConstants.BitsPerSample);

                // This will prefer formats that are exact multiples of the desired format, and which have the same number of channels.
                if (bestAudioFormat == null)
                {
                    bestAudioFormat = possibleAudioFormats
                                      .OrderBy(format =>
                                               (format.SamplesPerSecond != 0)
                                                        ? (format.SamplesPerSecond % AudioConstants.WidebandSamplesPerSecond) + format.Channels - AudioConstants.Channels
                                                        : int.MaxValue)
                                      .FirstOrDefault();
                }
                Debug.Assert(bestAudioFormat != null, "No appropriate audio format was found; possible formats = \r\n" + formats);
                ClientLogger.Debug("Selected audio format: BitsPerSample={0}, Channels={1}, SamplesPerSecond={2}", bestAudioFormat.BitsPerSample, bestAudioFormat.Channels, bestAudioFormat.SamplesPerSecond);
                device.DesiredFormat = bestAudioFormat;
            }
            else
            {
                ClientLogger.Debug("No audio capture device was found.");
            }
        }
        protected override void OnSamples(long sampleTime, long sampleDuration, byte[] sampleData)
        {
            try
            {
                // Raise an event if we managed to successfully capture real audio.
                if (!_dataReceived && HasRealAudio(sampleData))
                {
                    ClientLogger.Debug("The AudioSinkAdapter has detected that there's real audio coming in.");
                    _dataReceived = true;
                    if (CaptureSuccessful != null)
                    {
                        CaptureSuccessful(this, new EventArgs());
                    }
                }

                if (_audioContextFactory != null && AudioController != null && AudioController.IsConnected)
                {
                    var ctx = _audioContextFactory.GetAudioContext();
                    if (ctx != _lastAudioContext)
                    {
                        ClientLogger.Debug("Changed audio context: \r\nFrom: {0}\r\nTo: {1}", _lastAudioContext == null ? "" : _lastAudioContext.ToString(), ctx.ToString());
                        _lastAudioContext = ctx;
                    }
                    ctx.Resampler.Write(sampleData);
                    _logger.LogRawFrame(sampleTime, sampleDuration, sampleData);

                    bool moreFrames;
                    do
                    {
                        if (ctx.Resampler.Read(ctx.ResampleBuffer, out moreFrames))
                        {
                            SubmitFrame(ctx, ctx.ResampleBuffer);
                        }
                    } while (moreFrames);
                }
            }
            catch (Exception ex)
            {
                ClientLogger.Debug(ex.Message);
            }
        }
Beispiel #7
0
 protected override bool doAction()
 {
     if (this.casterUnit == null)
     {
         return(false);
     }
     if (this.data == null)
     {
         ClientLogger.Error("Ч��û�ҵ�:" + this.performId);
         return(false);
     }
     if (base.unit == null)
     {
         return(false);
     }
     if ((int)this.data.effectParam1 == 1)
     {
         if (this.casterUnit != null)
         {
             List <Units> list = new List <Units>();
             list.Add(this.casterUnit);
             this.AddAction(ActionManager.Link(this.skillKey, this.performId, base.unit, list, null, this.casterUnit));
         }
     }
     else if ((int)this.data.effectParam1 == 0)
     {
         if (this.data.effectParam2 == 0f)
         {
             this.AddAction(ActionManager.PlayEffect(this.performId, base.unit, null, null, true, string.Empty, this.casterUnit));
         }
         else
         {
             this.AddAction(ActionManager.PlayLookAtEffect(this.performId, base.unit, this.casterUnit.trans.forward, true, this.casterUnit));
         }
     }
     else if ((int)this.data.effectParam1 == 2)
     {
         this.AddAction(ActionManager.AbsorbMissile(this.skillKey, this.performId, base.unit, this.casterUnit));
     }
     return(true);
 }
Beispiel #8
0
    private void RefreshUI_heroIcon()
    {
        ReadyPlayerSampleInfo memInfo      = this.MemInfo;
        SysHeroMainVo         heroMainData = BaseDataMgr.instance.GetHeroMainData(memInfo.GetHeroId());

        if (heroMainData == null)
        {
            ClientLogger.Error("找不到heroMain表信息,heroID=" + memInfo.GetHeroId());
            return;
        }
        string text = string.Empty;

        if (memInfo.heroSkinId != "0" && memInfo.heroSkinId != string.Empty)
        {
            Dictionary <string, object> dicByType = BaseDataMgr.instance.GetDicByType <SysHeroSkinVo>();
            if (dicByType != null && dicByType.ContainsKey(memInfo.heroSkinId))
            {
                SysHeroSkinVo sysHeroSkinVo = dicByType[memInfo.heroSkinId] as SysHeroSkinVo;
                if (sysHeroSkinVo != null)
                {
                    text = sysHeroSkinVo.avatar_icon;
                }
                else
                {
                    ClientLogger.Error("找不到SysHeroSkinVo表信息,skinID=" + memInfo.heroSkinId);
                }
            }
            else
            {
                ClientLogger.Error("找不到SysHeroSkinVo表信息2,skinID=" + memInfo.heroSkinId);
            }
        }
        else
        {
            text = heroMainData.avatar_icon;
        }
        if (!string.IsNullOrEmpty(text))
        {
            this.sp_heroIcon.mainTexture = ResourceManager.Load <Texture>(text, true, true, null, 0, false);
        }
    }
 public static void ExecuteMsg(MobaMessage msg)
 {
     if (msg.MessageType < (MobaMessageType)MobaMessageManager.mMessageFuncList.Length)
     {
         if (msg.MessageType == MobaMessageType.PvpCode)
         {
         }
         Dictionary <int, MobaMessageFunc> dictionary = MobaMessageManager.mMessageFuncList[(int)msg.MessageType];
         MobaMessageFunc mobaMessageFunc;
         if (dictionary != null && dictionary.TryGetValue(msg.ID, out mobaMessageFunc))
         {
             if (mobaMessageFunc == null)
             {
                 return;
             }
             if (msg.MessageType == MobaMessageType.PvpCode)
             {
             }
             try
             {
                 Stopwatch stopwatch = new Stopwatch();
                 if (msg.MessageType == MobaMessageType.PvpCode)
                 {
                     stopwatch.Start();
                 }
                 mobaMessageFunc(msg);
                 if (msg.MessageType == MobaMessageType.PvpCode)
                 {
                     stopwatch.Stop();
                 }
             }
             catch (Exception e)
             {
                 ClientLogger.LogException(e);
             }
             if (msg.MessageType == MobaMessageType.PvpCode)
             {
             }
         }
     }
 }
Beispiel #10
0
        public void Start(String ip)
        {
            try
            {
                IPAddress  ipAddress = IPAddress.Parse(ip);
                IPEndPoint remoteEP  = new IPEndPoint(ipAddress, port);

                Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                connection = new Connection(socket);
                connection.Connect(remoteEP);

                if (connection.Open)
                {
                    connection.BeginReceive(new AsyncCallback(DataReceived));
                }
            }
            catch (Exception e)
            {
                ClientLogger.Debug("Unforeseen error when connecting: " + e.GetBaseException());
            }
        }
        protected override void OnFormatChange(wmAudioFormat audioFormat)
        {
            // We may need to do more with this.
            if (audioFormat == null ||
                audioFormat.WaveFormat != WaveFormatType.Pcm ||
                audioFormat.BitsPerSample != AudioConstants.BitsPerSample)
            {
                throw new ArgumentException("The audio format was not supported.");
            }

            // Only change the audio context factory if the raw audio format has actually changed.
            var rawAudioFormat = new AudioFormat(audioFormat.SamplesPerSecond, AudioConstants.MillisecondsPerFrame, audioFormat.Channels, audioFormat.BitsPerSample);

            if (_audioContextFactory == null || _audioContextFactory.RawAudioFormat != rawAudioFormat)
            {
                _audioContextFactory   = GetAudioContextFactory(rawAudioFormat, _playedAudioFormat, _mediaConfig, _mediaEnvironment);
                _logger.RawAudioFormat = rawAudioFormat;
                ClientLogger.Debug("The recorded audio format was changed: BitsPerSample = {0}, Channels = {1}, SamplesPerSecond = {2}",
                                   rawAudioFormat.BitsPerSample, rawAudioFormat.Channels, rawAudioFormat.SamplesPerSecond);
            }
        }
        protected virtual void RegistHandler()
        {
            Type type = base.GetType();

            foreach (ClientNet current in this.listNetMsg)
            {
                MethodInfo method = type.GetMethod(current.ToString(), BindingFlags.Instance | BindingFlags.NonPublic);
                if (method != null)
                {
                    Delegate @delegate = Delegate.CreateDelegate(typeof(MobaMessageFunc), this, method, false);
                    if (@delegate != null)
                    {
                        MobaMessageManager.RegistMessage((ClientMsg)current, (MobaMessageFunc)@delegate);
                    }
                }
                else
                {
                    ClientLogger.Error("Can't find the method infomation whose name is " + current.ToString());
                }
            }
        }
        /// <summary>
        /// Callback method called after attempting to connect to the media server's control port.
        /// </summary>
        /// <param name="connectException">Any exception raised by the connection attempt.</param>
        protected virtual void HandleControlConnect(Exception connectException)
        {
            try
            {
                if (connectException == null)
                {
                    RegisterClientOnServer();
                }
                else
                {
                    string message = _controlClient != null?String.Format(MediaStrings.FailedToConnectToControlPort, _controlClient.Port, _controlClient.Host) : "Failed to connect to the media server and controlClient is null.";

                    FinalizeConnection(new Exception(message, connectException));
                }
            }
            catch (Exception ex)
            {
                ClientLogger.ErrorException(ex, "Error on handling media server connection");
                FinalizeConnection(ex);
            }
        }
 public void Connect()
 {
     try
     {
         CurrentVisualState = VisualStates.Progress;
         _mediaDevices.Start();
         if (_mediaDevices.CaptureSource.State == CaptureState.Started)
         {
             OnCapturedStarted();
         }
     }
     catch (Exception ex)
     {
         ClientLogger.ErrorException(ex);
         _messageService.ShowErrorHint(ex.Message);
     }
     finally
     {
         UpdatePanel();
     }
 }
Beispiel #15
0
 private void enableMicrophone_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (captureSource != null)
         {
             if (CaptureDeviceConfiguration.AllowedDeviceAccess || CaptureDeviceConfiguration.RequestDeviceAccess())
             {
                 ClientLogger.Debug("AudioTimingPage CaptureSource started.");
                 captureSource.Start();
                 mediaElement.SetSource(audioStreamSource);
                 mediaElement.Play();
                 sendPulse.IsEnabled = true;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Beispiel #16
0
 private void updatashader()
 {
     if (this.mFog != null && this.mFog.enabled)
     {
         if (!this.mFog.getenabelfog())
         {
             return;
         }
         this.mInverseMVP = (this.mCam.projectionMatrix * this.mCam.worldToCameraMatrix).inverse;
         float     num       = 1f / (float)this.mFog.worldSize;
         Transform transform = this.mFog.transform;
         float     num2      = transform.position.x - (float)this.mFog.worldSize * 0.5f;
         float     num3      = transform.position.z - (float)this.mFog.worldSize * 0.5f;
         Vector4   vector    = this.mCam.transform.position;
         if (QualitySettings.antiAliasing > 0)
         {
             RuntimePlatform platform = Application.platform;
             if (platform == RuntimePlatform.WindowsEditor || platform == RuntimePlatform.WindowsPlayer || platform == RuntimePlatform.WindowsWebPlayer)
             {
                 vector.w = 1f;
             }
         }
         if (this.mMat != null)
         {
             Vector4 vector2 = new Vector4(-num2 * num, -num3 * num, num, this.mFog.blendFactor);
             this.mMat.SetVector("_CamPos", vector);
             this.mMat.SetVector("_Params", vector2);
             this.mMat.SetMatrix("_InverseMVP", this.mInverseMVP);
             this.mMat.SetTexture("_MainTex", this.mFog.texture1);
         }
         else
         {
             ClientLogger.Warn("err mMat...");
         }
     }
     else
     {
         ClientLogger.Warn("err fog..");
     }
 }
        public void LogAudioFramePlayed()
        {
            var now = DateTime.Now;

            if (!_firstFramePlayed)
            {
                _firstFramePlayed   = true;
                _firstPlayedMessage = now;
                _lastPlayedMessage  = _firstPlayedMessage;
                _lastPlayedLog      = now;
            }

            const int interval = 2000;

            _audioFramesPlayed++;
            _audioFramesPlayedRecent++;

            var recentElapsed = now - _lastPlayedMessage;

            if (recentElapsed.TotalMilliseconds < interval)
            {
                return;
            }

            var totalElapsed = now - _firstPlayedMessage;

            AverageFramePlayedTime = recentElapsed.TotalMilliseconds / _audioFramesPlayedRecent;
            var averageTotalTime = totalElapsed.TotalMilliseconds / _audioFramesPlayed;

            _playingRateCounter.Update(AverageFramePlayedTime);
            if ((now - _lastPlayedLog).TotalSeconds > 10)
            {
                ClientLogger.Debug(
                    "MediaController: Total audio frames played={0}; recentElapsed={1}; time/entry={2:f3}; recent time/entry={3:f3}",
                    _audioFramesPlayed, recentElapsed.TotalMilliseconds, averageTotalTime, AverageFramePlayedTime);
                _lastPlayedLog = now;
            }
            _audioFramesPlayedRecent = 0;
            _lastPlayedMessage       = now;
        }
Beispiel #18
0
        public void RenderVisualization(short[] samples)
        {
            Dispatcher.BeginInvoke(() =>
            {
                try
                {
                    // Copy the samples to the appropriate buffer.
                    Buffer.BlockCopy(samples, 0, _sampleBuffer, _sampleBufferPosition * sizeof(short), samples.Length * sizeof(short));
                    _sampleBufferPosition += samples.Length;

                    // Once there's enough data in the buffer to submit something to the visualizer,
                    // loop through the buffer, pulling a frame's worth of samples at a time, until there's no more room.
                    if (_sampleBufferPosition >= AudioVisualizerConstants.TransformBufferSize)
                    {
                        for (; _sampleBufferPosition - _sampleBufferStart >= AudioVisualizerConstants.TransformBufferSize; _sampleBufferStart += AudioVisualizerConstants.TransformBufferSize)
                        {
                            var samplesToRender = new short[AudioVisualizerConstants.TransformBufferSize];
                            Buffer.BlockCopy(_sampleBuffer, _sampleBufferStart * sizeof(short), samplesToRender, 0, AudioFormat.Default.BytesPerFrame * sizeof(short));
                            lock (_visualLock)
                            {
                                if (_currentRenderVisuals != null)
                                {
                                    _currentRenderVisuals(samplesToRender);
                                }
                            }
                        }

                        // When we're all done, move the unprocessed bytes back to the beginning of the buffer.
                        _sampleBufferPosition = _sampleBufferPosition - _sampleBufferStart;
                        Array.Copy(_sampleBuffer, _sampleBufferStart, _sampleBuffer, 0, _sampleBufferPosition);
                        _sampleBufferStart = 0;
                    }
                }
                catch (Exception ex)
                {
                    ClientLogger.ErrorException(ex, "Render visualization failed");
                }
            });
        }
Beispiel #19
0
        /// <summary>
        /// Registers a media stream source listener for a given ssrcId.
        /// </summary>
        /// <param name="ssrcId">The ssrcId of the media stream source for which it should be listening.</param>
        /// <remarks>
        /// This method is called when the main client is notified (via the web service) that a new user has joined the room.
        /// This method tells the media controller to be prepared for video data tagged for the specified SsrcId
        /// to start coming down the pipe.
        /// </remarks>
        public virtual void RegisterRemoteSession(ushort ssrcId)
        {
            VideoThreadData videoThreadData;

            lock (RemoteSessions)
            {
                if (RemoteSessions.ContainsKey(ssrcId))
                {
                    ClientLogger.Debug("A remote session for ssrcId {0} already exists.", ssrcId);
                    return;
                }
                ClientLogger.Debug("Registering remote session for ssrcId {0}", ssrcId);
                videoThreadData = new VideoThreadData(ssrcId, _codecFactory.GetVideoDecoder(VideoQualityController));
                videoThreadData.Validator.Timer = new Timer(timerCheckingRemoteCameras_Tick, ssrcId, VideoConstants.RemoteCameraCheckDelay, VideoConstants.RemoteCameraTimeout);
                RemoteSessions.Add(ssrcId, videoThreadData);
                _videoEncoder.Synchronize();
                _mediaEnvironment.RemoteSessions = RemoteSessions.Count;
            }
            var decoderThread = new Thread(ProcessVideoQueue);

            decoderThread.Start(videoThreadData);
        }
        public static void DispatchChooseGameMsg()
        {
            LevelStorage?levelStorage = PvpLevelStorage.FetchLast();

            if (levelStorage.HasValue)
            {
                string battleId = levelStorage.Value.battleId;
                int    num;
                if (int.TryParse(battleId, out num))
                {
                    MobaMessageManager.DispatchMsg((ClientMsg)26002, new object[]
                    {
                        num,
                        levelStorage.Value.matchType
                    }, 0f);
                }
                else
                {
                    ClientLogger.Error("cannot parse BattleId " + battleId);
                }
            }
        }
Beispiel #21
0
 void config_Closed(object sender, EventArgs e)
 {
     try
     {
         var config = (ConfigureAudioVideo)sender;
         if (config.DialogResult.HasValue && config.DialogResult.Value)
         {
             if (_captureSource != null)
             {
                 if (_captureSource.AudioCaptureDevice != config.AudioCaptureDevice || _captureSource.VideoCaptureDevice != config.VideoCaptureDevice)
                 {
                     _captureSource.AudioCaptureDevice = config.AudioCaptureDevice;
                     CreateAudioContexts();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ClientLogger.ErrorException(ex, "Closing windows of configuration AudioVideo failed");
     }
 }
Beispiel #22
0
        private static void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            if (e.ExceptionObject is AssertFailedException)
            {
                return;
            }
            ClientLogger.Debug("Error: Unhandled exception: " + e.ExceptionObject);
            e.Handled = true;
            // If the app is running outside of the debugger then report the exception using
            // the browser's exception mechanism. On IE this will display it a yellow alert
            // icon in the status bar and Firefox will display a script error.
            //if (!System.Diagnostics.Debugger.IsAttached)
            //{

            //    // NOTE: This will allow the application to continue running after an exception has been thrown
            //    // but not handled.
            //    // For production applications this error handling should be replaced with something that will
            //    // report the error to the website and stop the application.
            //    e.Handled = true;
            //    Deployment.Current.Dispatcher.BeginInvoke(() => ReportErrorToDOM(e));
            //}
        }
Beispiel #23
0
 public CmppClient(
     CmppClientConfig config,
     BaseCmppSmsHandler smsHandler,
     ClientLoggerFactory loggerFactory)
 {
     this.loggerFactory  = loggerFactory;
     this.logger         = loggerFactory.CreateLogger <CmppClient>();
     config.ClientStatus = ClientStatus.WAITING_CONNECT;
     config.Version      = CmppVersion.CMPP20;
     Config            = config;
     smsHandler.client = this;
     this.smsHandler   = smsHandler;
     matchQueue        = new SubmitSmsMatchPool <MsgEx>(32, 60 * 1000);
     if (smsHandler != null)
     {
         matchQueue.timeOutHandle = smsHandler.SubmitTimeOutHandle;
     }
     eventExecutorGroup = new MultithreadEventLoopGroup();
     group     = new MultithreadEventLoopGroup();
     dbContext = new SqliteContext(Config.ClientId);
     InitClient();
 }
Beispiel #24
0
    public static void PromptFormat(string id, params object[] args)
    {
        SysPromptVo dataById = BaseDataMgr.instance.GetDataById <SysPromptVo>(id);

        if (dataById != null)
        {
            try
            {
                string mess = string.Format(LanguageManager.Instance.GetStringById(dataById.prompt_text), args);
                UIMessageBox.ShowMessage(mess, dataById.text_time, 0);
            }
            catch (Exception e)
            {
                ClientLogger.LogException(e);
            }
            AudioMgr.PlayUI(dataById.sound, null, false, false);
        }
        else
        {
            ClientLogger.Error("PromptHelper.Prompt: cannot found #" + id);
        }
    }
Beispiel #25
0
    private void ShowAbsent(ReadyPlayerSampleInfo data, NewHeroItem.CardType cardType = NewHeroItem.CardType.Lock, bool isSelf = false)
    {
        this._showAbsent = false;
        if (data != null && (cardType == NewHeroItem.CardType.HeroCardLeft || (cardType == NewHeroItem.CardType.HeroCardRight && !this._hideEnemy)))
        {
            this._showAbsent = !data.IsReadySelectHero;
            if (isSelf)
            {
                this._showAbsent = false;
            }
        }
        Transform transform = base.transform.Find("IsPresent");

        if (transform)
        {
            transform.gameObject.SetActive(this._showAbsent);
        }
        else
        {
            ClientLogger.Error("cannot found IsPresent");
        }
    }
Beispiel #26
0
 /// <summary>
 /// Saves the selected video capture source back to the local config file after it's successfully captured data.
 /// </summary>
 private void SaveVideoCaptureSource()
 {
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         try
         {
             if (CaptureSource != null && _mediaDeviceConfig != null)
             {
                 if (CaptureSource.VideoCaptureDevice != null)
                 {
                     _mediaDeviceConfig.VideoCaptureDeviceFriendlyName = CaptureSource.VideoCaptureDevice.FriendlyName;
                 }
                 var helper = new ConfigurationHelper <MediaDeviceConfig>();
                 helper.SaveConfigurationObject(_mediaDeviceConfig, MediaDeviceConfig.DefaultFileName);
             }
         }
         catch (Exception ex)
         {
             ClientLogger.ErrorException(ex, "Unable to save video capture source");
         }
     });
 }
Beispiel #27
0
        private void EditBook()
        {
            var win             = new View.NewBookWindow();
            NewBookViewModel vm = (NewBookViewModel)win.DataContext;

            vm.BookName        = selectedBook.BookName;
            vm.Author          = selectedBook.Author.AuthorName;
            vm.PublicationYear = selectedBook.PublicationYear.ToString();

            win.ShowDialog();

            if (Session.Current.LibraryProxy.EditBook(selectedBook.BookName, vm.BookName, vm.Author, int.Parse(vm.PublicationYear)))
            {
                ClientLogger.Log($"Book {vm.BookName} successfully edited.", Common.LogLevel.Info);
            }
            else
            {
                ClientLogger.Log($"Book {vm.BookName} could not be edited.", Common.LogLevel.Error);
            }

            RefreshList();
        }
Beispiel #28
0
 void captureTimer_Tick(object sender, EventArgs e)
 {
     // If we've gone more than five seconds since capture, give the user a chance to configure their microphone and webcam.
     if (CaptureSource == null)
     {
         return;
     }
     _captureTimer.Stop();
     if (CaptureSource.AudioCaptureDevice != null && !CapturingAudio)
     {
         PossibleAudioDevices.SetFailed(CaptureSource.AudioCaptureDevice);
         var nextAudioDevice = PossibleAudioDevices.GetNextDevice();
         if (nextAudioDevice != null && UseAutomaticSelection)
         {
             ClientLogger.Debug("No audio coming in from device {0}; trying device {1}", CaptureSource.AudioCaptureDevice.FriendlyName, nextAudioDevice.FriendlyName);
             ChangeCapturedDevices(nextAudioDevice, CaptureSource.VideoCaptureDevice);
         }
         else
         {
             ClientLogger.Debug("No audio coming in from device {0}; giving up.", CaptureSource.AudioCaptureDevice.FriendlyName);
             RaiseCaptureFailed();
         }
     }
     if (CaptureSource.VideoCaptureDevice != null && !CapturingVideo)
     {
         PossibleVideoDevices.SetFailed(CaptureSource.VideoCaptureDevice);
         var nextVideoDevice = PossibleVideoDevices.GetNextDevice();
         if (nextVideoDevice != null && UseAutomaticSelection)
         {
             ClientLogger.Debug("No video coming in from device {0}; trying device {1}", CaptureSource.VideoCaptureDevice.FriendlyName, nextVideoDevice.FriendlyName);
             ChangeCapturedDevices(CaptureSource.AudioCaptureDevice, nextVideoDevice);
         }
         else
         {
             ClientLogger.Debug("No video coming in from device {0}; giving up.", CaptureSource.VideoCaptureDevice.FriendlyName);
             RaiseCaptureFailed();
         }
     }
 }
        private void UpdateShipPosition(PositionUpdateData posUpdate)
        {
            var s = _clientShipManager.GetShip(posUpdate.TargetId);

            if (s == null)
            {
                ClientLogger.Log(Log_Type.ERROR, "RECIEVED POSITION UPDATE FOR A SHIP THAT WAS NOT IN THE SHIPLIST");
                return;
            }
#if DEBUG
            if (_clientShipManager.PlayerShip != null && s.Id == _clientShipManager.PlayerShip.Id)
            {
                ConsoleManager.WriteLine("Error: Received position update for player ship!", ConsoleMessageType.Error);
            }
#endif

            _clientShipManager.HandlePositionUpdate(posUpdate);

            s.Shields.CurrentShields = (int)posUpdate.CurrentShields;
            s.CurrentHealth          = (int)posUpdate.CurrentHealth;
            s.Thrusting = posUpdate.Thrusting;
        }
Beispiel #30
0
        private void HandleNewbieStartGame(byte[] startGameDataOrig)
        {
            NewbieStartGameData newbieStartGameData = SerializeHelper.Deserialize <NewbieStartGameData>(startGameDataOrig);
            PvpStartGameInfo    startGameInfo       = newbieStartGameData.startGameInfo;
            BattleRoomInfo      btRoomInfo          = newbieStartGameData.btRoomInfo;

            ReadyPlayerSampleInfo[] playerInfos = newbieStartGameData.playerInfos;
            if (startGameInfo != null && btRoomInfo != null && playerInfos != null)
            {
                this.NewbieSetRoomInfo(startGameInfo.newUid, playerInfos);
                NetWorkHelper.Instance.DisconnectFromGateServer(false);
                NetWorkHelper.Instance.DisconnectLobbyServer();
                Singleton <PvpManager> .Instance.LoginInfo            = startGameInfo;
                Singleton <PvpManager> .Instance.ServerBattleRoomInfo = btRoomInfo;
                NetWorkHelper.Instance.ConnectToPvpServer();
            }
            else
            {
                ClientLogger.Error("L2C_StartGame: PvpStartGameInfo is null");
                PvpStateManager.Instance.ChangeState(new PvpStateHome());
            }
        }