Ejemplo n.º 1
0
        private Note FindNote(LilypondToken currentToken)
        {
            string text = currentToken.Value;
            Regex  re   = new Regex(@"^([a-g])([eis]*)([,']*)(\d+)([.]*)$");

            Match result = re.Match(text);

            noteBuilder.SetPitch(result.Groups[1].Value);
            noteBuilder.SetSemitone(pitchModifiers[result.Groups[2].Value]);
            noteBuilder.ModifyOctave(FindOctaveModifier(result.Groups[3].Value) + RelativeOctaveModifier(result.Groups[1].Value));
            noteBuilder.SetDuriation(int.Parse(result.Groups[4].Value));
            noteBuilder.SetDotted(result.Groups[5].Value.Length);
            return(noteBuilder.BuildNote());
        }
        private ReplayerHudPanel CreateHudPanel(ReplayerViewModel viewModel, int zeroBasedSeatNumber)
        {
            var player = viewModel.PlayersCollection[zeroBasedSeatNumber];

            player.Parent = new HudElementViewModel {
                Seat = zeroBasedSeatNumber
            };

            var panel = new ReplayerHudPanel
            {
                DataContext = player
            };

            panel.Height = double.NaN;
            panel.Width  = double.NaN;

            var playerNotes = dataService.GetPlayerNotes(player.Name, viewModel.CurrentHand.PokersiteId);

            player.NoteToolTip = NoteBuilder.BuildNote(playerNotes);
            player.Parent.IsXRayNoteVisible = playerNotes.Any(x => x.IsAutoNote);

            var contextMenu = CreateContextMenu(viewModel.CurrentHand.PokersiteId, player.Name, player);

            contextMenu.EventName = "MouseRightButtonUp";

            RadContextMenu.SetContextMenu(panel, contextMenu);

            return(panel);
        }
Ejemplo n.º 3
0
        private void createNewNote(MidiEvent midiEvent)
        {
            var channelMessage = midiEvent.MidiMessage as ChannelMessage;

            setNotePitch(channelMessage.Data1);
            Note note = noteBuilder.BuildNote();

            checkRest(midiEvent);

            if (!openNotes.ContainsKey(channelMessage.Data1))
            {
                openNotes.Add(channelMessage.Data1, new Tuple <MidiEvent, Note>(midiEvent, note));
            }
            else
            {
                return;
            }

            connectToLastNote(note);
        }
Ejemplo n.º 4
0
        private void LoadNote()
        {
            playerNoteEntities = player != null?
                                 dataService.GetPlayerNotes(player.PlayerId).ToList() :
                                     null;

            if (playerNoteEntities != null)
            {
                Note         = NoteBuilder.BuildNote(playerNoteEntities);
                initialNotes = Note;
            }
        }
        private void LoadHUD(HudDragCanvas dgCanvas, ReplayerViewModel viewModel, HudLayoutInfoV2 activeLayout)
        {
            var seats = (int)CurrentCapacity;

            var hudPanelService = ServiceLocator.Current.GetInstance <IHudPanelService>(ReplayerPokerSite.ToString());

            var nonToolLayoutStats = activeLayout
                                     .HudPlayerTypes
                                     .SelectMany(x => x.Stats)
                                     .Select(x => x.Stat)
                                     .Concat(activeLayout
                                             .HudBumperStickerTypes
                                             .SelectMany(x => x.Stats)
                                             .Select(x => x.Stat))
                                     .Concat(new[] { Stat.TotalHands })
                                     .Distinct()
                                     .ToArray();

            var hudElements = new List <HudElementViewModel>();

            var hudElementCreator = ServiceLocator.Current.GetInstance <IHudElementViewModelCreator>();

            var hudElementCreationInfo = new HudElementViewModelCreationInfo
            {
                GameType      = EnumGameType.CashHoldem,
                HudLayoutInfo = activeLayout,
                PokerSite     = ReplayerPokerSite
            };

            for (var i = 0; i < seats; i++)
            {
                var replayerPlayer = viewModel.PlayersCollection[i];

                hudElementCreationInfo.SeatNumber = i + 1;

                if ((int)activeLayout.TableType < hudElementCreationInfo.SeatNumber)
                {
                    continue;
                }

                var hudElement = hudElementCreator.Create(hudElementCreationInfo);

                if (string.IsNullOrEmpty(replayerPlayer.Name))
                {
                    if (hudElement != null)
                    {
                        EmptySeats.Add(hudElement);
                    }
                    continue;
                }

                var player = dataService.GetPlayer(replayerPlayer.Name, viewModel.CurrentHand.PokersiteId);

                if (player == null)
                {
                    if (hudElement != null)
                    {
                        EmptySeats.Add(hudElement);
                    }
                    continue;
                }

                if (hudElement == null ||
                    !playerIndicators.TryGetValue(replayerPlayer.Name, out HudIndicators playerData))
                {
                    continue;
                }

                hudElement.PlayerId   = player.PlayerId;
                hudElement.PlayerName = replayerPlayer.Name;
                hudElement.TotalHands = playerData.TotalHands;

                var playerNotes = dataService.GetPlayerNotes(player.PlayerId);
                hudElement.NoteToolTip       = NoteBuilder.BuildNote(playerNotes);
                hudElement.IsXRayNoteVisible = playerNotes.Any(x => x.IsAutoNote);

                var graphTools = hudElement.Tools.OfType <HudGraphViewModel>().ToArray();

                foreach (var graphTool in graphTools)
                {
                    graphTool.StatSessionCollection = new ReactiveList <decimal>();
                }

                var heatMapTools = hudElement.Tools.OfType <HudHeatMapViewModel>()
                                   .Concat(hudElement.Tools.OfType <HudGaugeIndicatorViewModel>()
                                           .SelectMany(x => x.GroupedStats)
                                           .SelectMany(x => x.Stats)
                                           .Where(x => x.HeatMapViewModel != null)
                                           .Select(x => x.HeatMapViewModel))
                                   .ToArray();

                heatMapTools.ForEach(x =>
                {
                    var heatMapKey = playerData.HeatMaps.Keys
                                     .ToArray()
                                     .FirstOrDefault(p => p.Stat == x.BaseStat.Stat);

                    if (heatMapKey != null)
                    {
                        x.HeatMap = playerData.HeatMaps[heatMapKey];
                    }
                });

                var gaugeIndicatorTools = hudElement.Tools.OfType <HudGaugeIndicatorViewModel>().ToArray();

                hudElement.SessionMoneyWonCollection = new ObservableCollection <decimal>();

                var activeLayoutHudStats = hudElement.ToolsStatInfoCollection
                                           .Concat(heatMapTools.Select(x => x.BaseStat))
                                           .Concat(gaugeIndicatorTools.Select(x => x.BaseStat))
                                           .ToList();

                var extraStats = (from nonToolLayoutStat in nonToolLayoutStats
                                  join activateLayoutHudStat in activeLayoutHudStats on nonToolLayoutStat equals activateLayoutHudStat.Stat into grouped
                                  from extraStat in grouped.DefaultIfEmpty()
                                  where extraStat == null
                                  select new StatInfo
                {
                    Stat = nonToolLayoutStat
                }).ToArray();

                activeLayoutHudStats.AddRange(extraStats);

                StatsProvider.UpdateStats(activeLayoutHudStats);

                foreach (var statInfo in activeLayoutHudStats)
                {
                    var propertyName = StatsProvider.GetStatProperyName(statInfo.Stat);

                    if (!string.IsNullOrEmpty(propertyName))
                    {
                        if (playerData.TotalHands < statInfo.MinSample)
                        {
                            statInfo.IsNotVisible = true;
                        }

                        statInfo.AssignStatInfoValues(playerData, propertyName);
                    }
                    else if (!(statInfo is StatInfoBreak) && statInfo.Stat != Stat.PlayerInfoIcon)
                    {
                        continue;
                    }
                }

                hudElement.StatInfoCollection = activeLayoutHudStats;

                var isNoteIconSet = false;

                foreach (var toolViewModel in hudElement.Tools.Where(x => x is IHudNonPopupToolViewModel).ToArray())
                {
                    if (!isNoteIconSet && toolViewModel is HudPlainStatBoxViewModel && !(toolViewModel is HudFourStatsBoxViewModel))
                    {
                        (toolViewModel as HudPlainStatBoxViewModel).IsNoteIconEnabled = true;
                        isNoteIconSet = true;
                    }

                    var panel = hudPanelService.Create(toolViewModel);

                    if (panel != null)
                    {
                        dgCanvas.Children.Add(panel);

                        Canvas.SetLeft(panel, toolViewModel.Position.X);
                        Canvas.SetTop(panel, toolViewModel.Position.Y);
                    }
                }

                hudElements.Add(hudElement);
            }

            hudLayoutsService.SetPlayerTypeIcon(hudElements, activeLayout);
        }