private void button_GenerateFixedAI_Clicked(object sender, RoutedEventArgs e) { if (listBox_AICarList.SelectedIndex == -1) { MessageBox.Show("Select a car first.", "No car selected", MessageBoxButton.OK, MessageBoxImage.Warning); return; } if (CurrentEvent.GetFreeCarSlotsLeft() <= 0) { MessageBox.Show($"Fixed entry count exceeds the amount of allowed 'Max Cars' specified ({_fixedEntries.Count} fixed entries + Player >= {CurrentEvent.RaceParameters.RacersMax}).", "No car selected", MessageBoxButton.OK, MessageBoxImage.Warning); return; } RaceEntry raceEntry = GenerateEntry(); _fixedEntries.Add(raceEntry); CurrentEvent.Entries.AI.Add(raceEntry); listBox_AIFixedEntries.Items.Add($"{raceEntry.DriverName} [{raceEntry.DriverRegion}]: {raceEntry.ActualCarName}"); button_EditFixedAI.IsEnabled = true; button_RemoveFixedAI.IsEnabled = true; UpdateEntryControls(); }
public void StartRequest(Socket sender, byte[] data) { if (CurrentEvent == null) { int rawCommand = (data[0x15] << 8 | data[0x14]); if (Enum.IsDefined(typeof(Command), rawCommand)) { Command command = (Command)rawCommand; switch (command) { case Command.Teleport: //command teleport CurrentEvent = new EventMenuTeleport(); break; default: CurrentEvent = new Event(); break; } } else { Log.Instance.Error("Unknown command 0x" + rawCommand.ToString("X2")); } } CurrentEvent.StartRequest(sender, data); }
private void Start() { currentEvent = FindObjectOfType <CurrentEvent>(); loadFromSo = FindObjectOfType <LoadFromSO>(); eventToLoad = FindObjectOfType <EventToLoad>(); LoadRandom(); }
public void Action(ResetSheetInput message) { var newEvent = EventService.Create(); CurrentEvent.Map(newEvent); CalculateOutcome(); Brief(); }
override public void Cancel() { base.Cancel(); if (null != CurrentEvent) { CurrentEvent.Use(); } }
/// <summary> /// 解除事件监听 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="callback"></param> public void UnrigistEvent <T>(Action <T> callback) where T : CurrentEventHead { CurrentEvent current = new CurrentEvent(); current.m_Type = typeof(T); current.CallBack = callback; base.UnregistEvent(current); //解除注册 }
/// <summary> /// 添加事件监听 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="callback"></param> /// <returns></returns> public CurrentEvent RigistEvent <T>(Action <T> callback) where T : CurrentEventHead { CurrentEvent current = new CurrentEvent(); current.m_Type = typeof(T); current.CallBack = callback; base.RigistEvent(current); //注册 return(current); }
internal static bool TryUnpack(string data, out CurrentEvent current) { current = null; if (string.IsNullOrEmpty(data)) { return(false); } var values = data.Split("~"); var mask = Convert.ToInt32(values[^ 1], 16);
protected override string GetUserName(object user) { var cat = CurrentEvent.GetEventCategory(); if (cat == SysEventCategory.User) { var u = (AppUser)CurrentEvent.Data; return(u.UserName); } return(base.GetUserName(user)); }
public TAggregateRoot Load <TAggregateRoot>(string aggregateRootId) where TAggregateRoot : class { if (CurrentEvent == null) { throw new InvalidOperationException( string.Format( "Attempted to load aggregate root {0} with ID {1} in snapshot at the time of the current event, but there was no current event on the context!", typeof(TAggregateRoot), aggregateRootId)); } return(Load <TAggregateRoot>(aggregateRootId, CurrentEvent.GetGlobalSequenceNumber())); }
protected override string GetUserId(object user) { var cat = CurrentEvent.GetEventCategory(); if (cat == SysEventCategory.Issue) { var iss = (Issue)CurrentEvent.Data; return(iss?.UserId); } if (cat == SysEventCategory.User) { var u = (AppUser)CurrentEvent.Data; return(u.Id); } return(base.GetUserId(user)); }
private void EventCompletePbx_Click(object sender, EventArgs e) { if (CurrentEvent.Participants.Contains(Server.CurrentSession.Info)) { if (CurrentEvent.Status == EventStatus.Pending) { CurrentEvent.MarkAsFinished(); EventCompletePbx.Image = Properties.Resources.undo_favicon; } else if (CurrentEvent.Status == EventStatus.Finished) { Event.MarkEvent(CurrentEvent.Id, false); EventCompletePbx.Image = Properties.Resources.kisspng_check_mark_symbol_icon_black_checkmark_5a76d35a732948_8416047115177367944717; } } }
private void DoPlan(long dotime) { #region ObjectLock if (planDoTime == -1) { lock (planObjectLock) { if (planDoTime == -1) { planDoTime = dotime; } } } #endregion if (planDoTime == dotime) { try { GetData(); // 当前订单不在缓存中 robotSession.CheckLostOrders(currentOrder); //遍历缓存订单对比当前订单,处理成交订单 if (filledOrders.Count != 0) { UpdateFilledSessionOrders(); robotSession.FilledSessionOrders(FilledSessionOrders, currentOrder); } if (CheckLittleTrade(info.ResetTimes, info.ShockTimes)) { CurrentEvent?.Invoke(null, new CurrentEventArgs(CurrentEventType.LittleTrade, null, null)); } LimitFilledSessionOrders(); } #region catch finally catch (Exception e) { ////DbHelper.CreateInstance().AddErrInfo("DoPlan", e); Log4NetUtility.Error("DoPlan", Utils.Exception2String(e)); DbHelper.CreateInstance().AddError("DoPlan", e); } finally { planDoTime = -1; } #endregion } }
public void UpdateEntryControls() { int slotsLeft = CurrentEvent.GetFreeCarSlotsLeft(); sl_EntryCount.Maximum = slotsLeft; if (CurrentEvent.Entries.AIsToPickFromPool > slotsLeft) { CurrentEvent.Entries.AIsToPickFromPool = slotsLeft; } sl_EntryCount.Value = CurrentEvent.Entries.AIsToPickFromPool; sl_EntryPlayerPos.Maximum = CurrentEvent.RaceParameters.RacersMax; sl_EntryPlayerPos.Value = CurrentEvent.Entries.PlayerPos; label_EntryCount.Content = CurrentEvent.Entries.AIsToPickFromPool.ToString(); label_PlayerPos.Content = $"#{CurrentEvent.Entries.PlayerPos}"; }
/// <summary> /// Search the evaluation for a candidate /// </summary> /// <param name="candidate">Candidate, the candidate for who we want the evaluation</param> /// <returns>Evaluation, the evaluation for the candidate</returns> private Evaluation FindEvaluation(Candidate candidate) { int idCandidate = candidate.Id; Evaluation evaluation = null; evaluation = CurrentEvent.GetEvaluationForCandidate(idCandidate); evaluation.IdEvent = CurrentEvent.Id; if (File.Exists(Path.Combine(ApplicationConstants.jsonDataDirectory, idCandidate + "-" + LoggedUser.Id + "-" + CurrentEvent.Id + "-evaluation.json"))) { String jsonString = JsonParser.ReadJsonFromInternalMemeory(idCandidate, LoggedUser.Id, CurrentEvent.Id); Evaluation localevaluation = JsonParser.DeserializeJsonEvaluation(jsonString); if (localevaluation.LastUpdatedDate != null && evaluation.LastUpdatedDate != null && localevaluation.LastUpdatedDate > evaluation.LastUpdatedDate) { evaluation = localevaluation; } } foreach (Criteria cEvent in CurrentEvent.Criterias) { if (evaluation.Criterias.Count == 0) { evaluation.Criterias.Add(cEvent.Clone() as Criteria); } else { foreach (Criteria cEval in evaluation.Criterias) { if (cEval.Id == cEvent.Id) { break; } if (evaluation.Criterias.IndexOf(cEval) == evaluation.Criterias.Count - 1) { evaluation.Criterias.Add(cEvent.Clone() as Criteria); } } } } return(evaluation); }
private IEnumerator PlayFromMarker() { CameraEffects.Instance.ShowRewind(); PlayerController.Instance.Reset(); SkipToStartOfEvent(RangeStartIndex); bool survived = true; currentPositionIndex = RangeStartIndex; #if UNITY_EDITOR if (debugStartMarker > 0 && !TutorialProgress.victory) { currentPositionIndex = debugStartMarker; SkipToStartOfEvent(debugStartMarker); } #endif while (survived && !EndOfTimeline) { float moveTime = CameraController.Instance.MoveToPoint(CurrentEvent.transform.position.x, immediate: currentPositionIndex == RangeStartIndex); yield return(new WaitForSeconds(moveTime)); yield return(CurrentEvent.PlayEvent()); survived = CurrentEvent.Survived; if (survived) { currentPositionIndex++; if (EndOfTimeline) { // END AnimationPauser.Instance.SetPaused(true); break; } else if (currentPositionIndex >= RangeEndIndex) { yield return(ExpandActiveRange()); break; } } } }
private void Start() { currEvent = FindObjectOfType <CurrentEvent>(); if (currEvent.CurrentEventSO.EventType == EventType.City) { bgImage.sprite = city; } else if (currEvent.CurrentEventSO.EventType == EventType.Forest) { bgImage.sprite = forest; } else if (currEvent.CurrentEventSO.EventType == EventType.Factories) { bgImage.sprite = industry; } else if (currEvent.CurrentEventSO.EventType == EventType.Reaserch) { bgImage.sprite = reaserch; } }
public void Next() { CurrentEvent.Close(); if (!Unlocked) { ConversationView.currentConversation.CloseConversation(); return; } currentEvent += 1; if (currentEvent >= events.Length) { currentEvent = events.Length; ConversationView.currentConversation.FinishState(); return; } CurrentEvent.Open(); }
public override void Update() { base.Update(); if (RunEvents) { if (CurrentEvent == null) { NextEvent(); } while (CurrentEvent != null) { if (isFreshEvent) { isFreshEvent = false; CurrentEvent.EventProcessor = this; CurrentEvent.Start(); CurrentEvent.Begin(); } CurrentEvent.Update(); CurrentEvent.Timer += Entity.Game.DeltaTime; if (CurrentEvent.IsFinished) { isFreshEvent = true; CurrentEvent.End(); CurrentEvent.EventProcessor = null; Events.Remove(CurrentEvent); NextEvent(); } else { break; } } } }
private void AddParticipantBtn_Click(object sender, EventArgs e) { int userID = 0; List <User> users = User.Enumerate(); List <User> participants = CurrentEvent.Participants; List <User> result = users.Except(participants).ToList(); foreach (User user in result) { if (ParticipantsCmb.SelectedIndex == -1) { continue; } string selected = ParticipantsCmb.SelectedItem.ToString(); if (user.FirstName == selected) { userID = user.Id; CurrentEvent.AddParticipant(userID, this.Session); ReloadParticipants(); } } }
private async Task initializeInternal() { if (initialized) { return; } initialized = true; // モデルの初期化 try { await model.Initialize(); await BasicSettingControlViewModel.Initialize(); //await ChatPostControlViewModel.Initialize(); } catch (Exception e) { AlertRequest.Raise(new Notification { Title = "TVTCommentエラー", Content = $"初期化で予期しないエラーが発生しました\n{e.ToString()}" }); CloseApplication(); return; } if (model.State != Model.TVTCommentState.Working) { AlertRequest.Raise(new Notification { Title = "TVTCommentエラー", Content = "Viewer側(TVTestプラグイン側)と接続できませんでした" }); CloseApplication(); return; } // 表示関係の設定復元 Model.Serialization.WindowPositionEntity rect = model.Settings.View.MainWindowPosition; this.WindowPosition.X = rect.X; this.WindowPosition.Y = rect.Y; this.WindowPosition.Width = rect.Width; this.WindowPosition.Height = rect.Height; ChatListColumnInfos = model.Settings.View.ChatListViewColumns?.Select( x => new Views.AttachedProperties.GridViewColumnSettingsBinder.ColumnInfo(x.Id, x.Width) ).ToArray(); this.SelectedTab.Value = model.Settings.View.MainWindowTab; // ウィンドウの位置を復元したら最小化を解除 Window window = Application.Current.MainWindow; window.WindowState = WindowState.Normal; // モデルのイベントハンドラを登録 model.ChatCollectServiceModule.ErrorOccurredInChatCollecting += model_ErrorOccurredInChatCollecting; model.ChatCollectServiceModule.ErrorOccurredInChatPosting += model_ErrorOccurredInChatPosting; model.ChatCollectServiceModule.ErrorOccurredInServiceCreation += model_ErrorOccurredAtChatCollectServiceCreation; // モデルのプロパティを結びつける CurrentPlayTime = model.ChannelInformationModule.CurrentTime; CurrentChannel = model.ChannelInformationModule.CurrentChannel; CurrentEvent = model.ChannelInformationModule.CurrentEvent; disposables.Add(CurrentPlayTime.Subscribe(_ => updateWindowTitle())); disposables.Add(CurrentChannel.Subscribe(_ => updateWindowTitle())); disposables.Add(CurrentEvent.Subscribe(_ => updateWindowTitle())); // 旧ニコニコ実況が廃止されたので現状常にnull // 今後対応するときのためにとって置いてる forceValueData = new ReadOnlyObservableValue <Model.IForceValueData>(Observable.Return <Model.IForceValueData>(null)); UseDefaultChatCollectService = model.DefaultChatCollectServiceModule.IsEnabled; model.CommandModule.ShowWindowCommandInvoked += commandModule_ShowWindowCommandInvoked; // コマンド生成 ChangeChannelCommand = new DelegateCommand <Model.ChannelInfo>(channel => { if (channel != null) { model.ChannelInformationModule.SetCurrentChannel(channel); } }); AddChatCollectServiceCommand = new DelegateCommand <ShellContents.ChatCollectServiceAddListItemViewModel>( async x => { if (x != null) { await addChatCollectService(x); } }, _ => !UseDefaultChatCollectService.Value ); RemoveChatCollectServiceCommand = new DelegateCommand <Model.ChatCollectService.IChatCollectService>( service => { if (service != null) { model.ChatCollectServiceModule.RemoveService(service); } }, _ => !UseDefaultChatCollectService.Value ); UseDefaultChatCollectService.Subscribe(x => { AddChatCollectServiceCommand.RaiseCanExecuteChanged(); RemoveChatCollectServiceCommand.RaiseCanExecuteChanged(); }); ClearChatsCommand = new DelegateCommand(() => model.ChatModule.ClearChats()); AddWordNgCommand = new DelegateCommand <Model.Chat>(chat => { if (chat == null) { return; } model.ChatModule.AddChatModRule(new Model.ChatModRules.WordNgChatModRule(model.ChatServices.SelectMany(x => x.ChatCollectServiceEntries), chat.Text)); }); AddUserNgCommand = new DelegateCommand <Model.Chat>(chat => { if (chat == null) { return; } model.ChatModule.AddChatModRule(new Model.ChatModRules.UserNgChatModRule(chat.SourceService.Owner.ChatCollectServiceEntries, chat.UserId)); }); CopyCommentCommand = new DelegateCommand <Model.Chat>(chat => { if (chat == null) { return; } Clipboard.SetText(chat.Text); }); CopyUserCommand = new DelegateCommand <Model.Chat>(chat => { if (chat == null) { return; } Clipboard.SetText(chat.UserId); }); OnPropertyChanged(null); }
public void Process() { if (Ship.Alive) { if (ActionList != null && ActionList.Count > 0) { ActionListFinished = false; if (!ActionsPaused) { if (CurrentAction == null) { CurrentAction = ActionList[0]; } if (CurrentAction.Completed) { ActionList.Remove(CurrentAction); if (ActionList.Count > 0) { CurrentAction = ActionList[0]; } else { CurrentAction = null; } } if (CurrentAction != null) { CurrentAction.Execute(Ship); } } } else if (!ActionListFinished) { ActionListFinished = true; if (Ship != null && Ship.Commander != null) { Ship.Commander.ExecuteRun(); } } if (EventList != null && EventList.Count > 0) { EventListFinished = false; if (CurrentEvent == null) { CurrentEvent = EventList[0]; } if (CurrentEvent.Completed) { if (CurrentEvent is StopAction) { ActionsPaused = false; } EventList.Remove(CurrentEvent); if (EventList.Count > 0) { CurrentEvent = EventList[0]; } else { CurrentEvent = null; } } if (CurrentEvent != null) { if (CurrentEvent is StopAction) { ActionsPaused = true; } CurrentEvent.Execute(Ship); } } else if (!EventListFinished) { EventListFinished = true; } } }
protected virtual void OnCurrentEvent(string current) { CurrentEvent?.Invoke(this, current); }
public void Update() { CurrentEvent.Update(); }
public void Open() { currentEvent = 0; CurrentEvent.Open(); }
public void End() { CurrentEvent.Close(); }
public void EventResult(Socket sender, byte[] data) { CurrentEvent.EventResult(sender, data); }
public override void MakeFixedMenu() { EditorUtility.DisplayPopupMenu(MenuRect, "GameObject/Yu/LegoUI/MetaInfo/Component", null); CurrentEvent.Use(); }
/// <summary> /// 事件广播回调 /// </summary> /// <param name="varhead"></param> /// <param name="varevent"></param> protected override void CallEventDelegate(CurrentEventHead varhead, CurrentEvent varevent) { varevent.CallBack.DynamicInvoke(varhead); }
public void PopulateEntries() { sl_EntryCount.Maximum = CurrentEvent.GetFreeCarSlotsLeft(); if (CurrentEvent.Entries.AIsToPickFromPool > CurrentEvent.RaceParameters.RacersMax - 1) { CurrentEvent.Entries.AIsToPickFromPool = CurrentEvent.RaceParameters.RacersMax - 1; } sl_EntryCount.Value = CurrentEvent.Entries.AIsToPickFromPool; sl_EntryPlayerPos.Maximum = CurrentEvent.RaceParameters.RacersMax; if (CurrentEvent.Entries.PlayerPos > CurrentEvent.RaceParameters.RacersMax) { CurrentEvent.Entries.PlayerPos = CurrentEvent.RaceParameters.RacersMax; } sl_EntryPlayerPos.Value = CurrentEvent.Entries.PlayerPos; label_EntryCount.Content = CurrentEvent.Entries.AIsToPickFromPool.ToString(); label_PlayerPos.Content = $"#{CurrentEvent.Entries.PlayerPos}"; if (!CurrentEvent.Entries.NeedsPopulating) { return; } PopulateComboBoxesIfNeeded(); _AIPoolEntries.Clear(); _fixedEntries.Clear(); listBox_AIEntries.Items.Clear(); listBox_AIFixedEntries.Items.Clear(); foreach (var entry in CurrentEvent.Entries.AIBases) { if (string.IsNullOrEmpty(entry.ActualCarName)) { entry.ActualCarName = GameDatabase.GetCarNameByLabel(entry.CarLabel); } listBox_AIEntries.Items.Add($"{entry.DriverName} [{entry.DriverRegion}]: {entry.ActualCarName}"); _AIPoolEntries.Add(entry); } foreach (var entry in CurrentEvent.Entries.AI) { if (string.IsNullOrEmpty(entry.ActualCarName)) { entry.ActualCarName = GameDatabase.GetCarNameByLabel(entry.CarLabel); } listBox_AIFixedEntries.Items.Add($"{entry.DriverName} [{entry.DriverRegion}]: {entry.ActualCarName}"); _fixedEntries.Add(entry); } if (_fixedEntries.Count != 0) { button_EditFixedAI.IsEnabled = true; button_RemoveFixedAI.IsEnabled = true; } if (_AIPoolEntries.Count != 0) { button_EditAI.IsEnabled = true; button_RemoveAI.IsEnabled = true; } if (CurrentEvent.Entries.Player != null) { CurrentEvent.Entries.Player.ActualCarName = GameDatabase.GetCarNameByLabel(CurrentEvent.Entries.Player.CarLabel); label_PlayerRentedCar.Content = $"Player has rented car: {CurrentEvent.Entries.Player.ActualCarName}"; button_SetCarAsPlayer.IsEnabled = false; button_EditPlayerEntry.IsEnabled = true; button_RemovePlayerEntry.IsEnabled = true; } else { label_PlayerRentedCar.Content = "No custom player entry set - Player will not use a rented Car"; button_SetCarAsPlayer.IsEnabled = true; button_EditPlayerEntry.IsEnabled = false; button_RemovePlayerEntry.IsEnabled = false; } UpdateEntryControls(); CurrentEvent.Entries.NeedsPopulating = false; }