Beispiel #1
0
 private void Start()
 {
     //Equal to On Join Room
     PhotonNetwork.IsMessageQueueRunning = true;
     UIRoomCanvas._inst.updateRoomInfo(PhotonNetwork.CurrentRoom);
     MatchStatistic.reset();
 }
Beispiel #2
0
        public BetDomainsViewModel()
        {
            PlaceBet = new Command <IOddVw>(OnBet);
            //Mediator.SendMessage<bool>(true, MsgTag.BlockSportFilter);
            //Mediator.SendMessage<bool>(true, MsgTag.BlockTimeFilter);
            Mediator.Register <string>(this, LanguageChosen, MsgTag.LanguageChosenHeader);
            Mediator.Register <string>(this, HeaderShowFirstView, MsgTag.RefreshStation);

            var scroller = this.GetScrollviewer();

            if (scroller != null)
            {
                scroller.ScrollToVerticalOffset(0);
            }

            ScrollChangedCommand = new Command <double>(ScrollChanged);

            if (StationRepository.IsStatisticsEnabled && MatchInfo == null && !ChangeTracker.CurrentMatch.IsLiveBet)
            {
                MatchInfo = new MatchStatistic(ChangeTracker.CurrentMatch.LineObject.BtrMatchId, ChangeTracker.CurrentMatch.TournamentView.LineObject.GroupTournament.BtrTournamentId);
            }

            if (ChangeTracker.CurrentMatch != null)
            {
                ChangeTracker.CurrentMatch.IsStartUp = true;
            }
            LineSr.SubsribeToEvent(DataCopy_DataSqlUpdateSucceeded);
            timer.Elapsed += timer_Tick;
            timer.Start();
            ChangeTracker.IsBetdomainViewOpen = true;
        }
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values == null)
            {
                return(false);
            }


            foreach (var value in values)
            {
                if (value == null)
                {
                    return(Visibility.Collapsed);
                }
                if (value is MatchStatistic)
                {
                    MatchStatistic msTemp = (MatchStatistic)value;

                    if (msTemp.Values == null)
                    {
                        return(Visibility.Collapsed);
                    }
                    if (msTemp.Values.Count == 0)
                    {
                        return(Visibility.Collapsed);
                    }
                }
            }

            return(Visibility.Visible);
        }
 public void changePlayerInfoBasedOnOtherPlayers()
 {
     foreach (var p in playerList)
     {
         p.Value.changeBasedOnOtherPlayersInfo();
         MatchStatistic.createPlayerStatistic(p.Value._photonView.Owner.NickName, p.Value._thisPlayerTeam, p.Value._photonView.Owner.ActorNumber);
     }
 }
Beispiel #5
0
 private void LanguageChosen(string lang)
 {
     if (!ChangeTracker.CurrentMatch.IsLiveBet)
     {
         MatchInfo = new MatchStatistic(ChangeTracker.CurrentMatch.LineObject.BtrMatchId, ChangeTracker.CurrentMatch.TournamentView.LineObject.GroupTournament.BtrTournamentId);
         OnPropertyChanged("MatchInfo");
     }
 }
Beispiel #6
0
    public void setResult()
    {
        var localPlayerStatistic = MatchStatistic.getLocalPlayerStatistic();
        var winnerTeam           = MatchStatistic.getWinnerTeam();

        if (winnerTeam == EnumsData.Team.Both)
        {
            //Tie
            winBack.SetActive(false);
            loseBack.SetActive(false);
            tieBack.SetActive(true);
            screenTitle.text = "Tie";
        }
        else if (winnerTeam == localPlayerStatistic.playerTeam)
        {
            //You Won
            winBack.SetActive(true);
            loseBack.SetActive(false);
            tieBack.SetActive(false);
            screenTitle.text = "You Won";
        }
        else
        {
            winBack.SetActive(false);
            loseBack.SetActive(true);
            tieBack.SetActive(false);
            screenTitle.text = "You Lose";
        }


        doctorSlayerText.text = MatchStatistic.getDoctorSlayer().playerName.ToString();
        kingInfectorText.text = MatchStatistic.getBestInfector().playerName.ToString();
        qurotineMaster.text   = MatchStatistic.getBestDoctor().playerName.ToString();



        foreach (var playerStats in MatchStatistic.getPlayerStatsOrderByKDA())
        {
            var uiPlayer = Instantiate(UIPlayerPrefab, playersContainer);
            uiPlayer.playerName.text     = playerStats.playerName;
            uiPlayer.playerKills.text    = playerStats.kills.ToString();
            uiPlayer.playerDeaths.text   = playerStats.deaths.ToString();
            uiPlayer.playerBotKills.text = playerStats.botKills.ToString();

            if (playerStats.isMe)
            {
                uiPlayer.myPlayerBackground.SetActive(true);
            }
            else
            {
                uiPlayer.otherPlayerBackground.SetActive(false);
            }
        }
    }
 /* Photon */
 public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
 {
     if (stream.IsWriting)
     {
         stream.SendNext(this.currentHealth);
         stream.SendNext(this.killsOnPlayersCount);
         stream.SendNext(this.killsOnBotCount);
         stream.SendNext(this.deathCount);
         stream.SendNext(this.isMoving);
         MatchStatistic.updatePlayerStatistic(_photonView.Owner.ActorNumber, killsOnPlayersCount, killsOnBotCount, deathCount);
     }
     else
     {
         this.currentHealth       = (int)stream.ReceiveNext();
         this.killsOnPlayersCount = (int)stream.ReceiveNext();
         this.killsOnBotCount     = (int)stream.ReceiveNext();
         this.deathCount          = (int)stream.ReceiveNext();
         this.isMoving            = (bool)stream.ReceiveNext();
         healthBar.setHealth(this.currentHealth, maxHealth);
         MatchStatistic.updatePlayerStatistic(_photonView.Owner.ActorNumber, killsOnPlayersCount, killsOnBotCount, deathCount);
     }
 }
        public object Convert(object values, Type targetType, object parameter, CultureInfo culture)
        {
            bool emptyStats;

            if (values == null)
            {
                return(false);
            }

            if (values is MatchStatistic)
            {
                MatchStatistic msTemp = (MatchStatistic)values;

                if (msTemp.Values == null)
                {
                    return(false);
                }
                if (msTemp.Values.Count == 0)
                {
                    return(false);
                }
                foreach (var value in msTemp.Values)
                {
                    if (value.Value != null && !value.Value.Equals("0") && !value.Name.Contains("BTR_SUPER_ID"))
                    {
                        return(true);
                    }
                }

                return(false);
            }

            if (values != null)
            {
                return(true);
            }
            return(false);
        }
    IEnumerator gameLoop()
    {
        while (PhotonNetwork.PlayerList.Length != onPlayerReady)
        {
            yield return(null);
        }
        NetworkPlayers._inst.initLocalPlayerInRightTeamBasedOnNetworkList();

        while (NetworkPlayers._inst.playerList.Count != PhotonNetwork.PlayerList.Length)
        {
            yield return(null);
        }
        if (PhotonNetwork.IsMasterClient)
        {
            GameStatus = 1;
        }
        NetworkPlayers._inst.changePlayerInfoBasedOnOtherPlayers();
        Tutorial._inst.showTutorial(NetworkPlayers._inst._localCPlayer._thisPlayerTeam);
        PickupSpawner._inst.startSpawning();
        yield return(new WaitForSeconds(5f));

        Tutorial._inst.hideTutorial(NetworkPlayers._inst._localCPlayer._thisPlayerTeam);
        NetworkPlayers._inst.markPlayersReady();
        if (PhotonNetwork.IsMasterClient)
        {
            GameStatus = 2;
        }


        //While InGame
        while (GameStatus != 3)
        {
            //Master
            if (PhotonNetwork.IsMasterClient)
            {
                if (GameTimer > 0f)
                {
                    GameTimer -= 1f;
                }


                int doctorTeamPoints  = 0;
                int patientTeamPoints = 0;
                foreach (var cP in NetworkPlayers._inst.playerList)
                {
                    if (cP.Value._thisPlayerTeam == EnumsData.Team.Doctors)
                    {
                        doctorTeamPoints = doctorTeamPoints + cP.Value.killsOnBotCount + cP.Value.killsOnPlayersCount;
                    }
                    else
                    {
                        patientTeamPoints = patientTeamPoints + cP.Value.killsOnBotCount + cP.Value.killsOnPlayersCount;
                    }
                }

                InfectionCount   = patientTeamPoints;
                QuarantinedCount = doctorTeamPoints;
            }

            //All Clients
            UIInGameCanvas._inst.setTime(GameTimer);
            UIInGameCanvas._inst.updateInfectionSlider(InfectionCount, QuarantinedCount);

            if (GameTimer <= 0f)
            {
                GameStatus = 3;
            }
            yield return(new WaitForSeconds(1f));
        }

        while (GameStatus == 3)
        {
            yield return(new WaitForSeconds(2f));

            MatchStatistic.calcWinner();
            UIWindow.transTo(EnumsData.WindowEnum.AnyFirstWindow, EnumsData.SceneEnum.ResultScene);
            yield return(new WaitForSeconds(5f));
        }
    }
Beispiel #10
0
        public BetDomainsViewModel()
        {
            PlaceBet = new Command <IOddVw>(OnBet);
            //Mediator.SendMessage<bool>(true, MsgTag.BlockSportFilter);
            //Mediator.SendMessage<bool>(true, MsgTag.BlockTimeFilter);
            Mediator.Register <string>(this, LanguageChosen, MsgTag.LanguageChosenHeader);
            Mediator.Register <string>(this, HeaderShowFirstView, MsgTag.RefreshStation);

            var scroller = this.GetScrollviewer();

            if (scroller != null)
            {
                scroller.ScrollToVerticalOffset(0);
            }

            ScrollChangedCommand = new Command <double>(ScrollChanged);

            if (StationRepository.IsStatisticsEnabled && MatchInfo == null && !ChangeTracker.CurrentMatch.IsLiveBet)
            {
                MatchInfo = new MatchStatistic(ChangeTracker.CurrentMatch.LineObject.BtrMatchId, ChangeTracker.CurrentMatch.TournamentView.LineObject.GroupTournament.BtrTournamentId);
            }

            if (ChangeTracker.CurrentMatch != null)
            {
                ChangeTracker.CurrentMatch.IsStartUp = true;
            }

            switch (ChangeTracker.CurrentMatch.SportDescriptor)
            {
            case SportSr.SPORT_DESCRIPTOR_SOCCER:
                BackgroundBrush = new LinearGradientBrush()
                {
                    StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1)
                };
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FF3F8145"), 1));
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FF90C696"), 0));
                PicturePath    = (BitmapImage) new ResolveImagePath("LiveView/socker-ball.png").ProvideValue(null);
                BackgroundPath = (BitmapImage) new ResolveImagePath("LiveView/socker-fon.png").ProvideValue(null);
                SimpleColor    = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#008000"));
                break;

            case SportSr.SPORT_DESCRIPTOR_BASKETBALL:
                BackgroundBrush = new LinearGradientBrush()
                {
                    StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1)
                };
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#AF6828"), 1));
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#D8A362"), 0));
                PicturePath    = (BitmapImage) new ResolveImagePath("LiveView/Basket-ball.png").ProvideValue(null);
                BackgroundPath = (BitmapImage) new ResolveImagePath("LiveView/Basketball-fon.png").ProvideValue(null);
                SimpleColor    = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#AF6828"));
                break;

            case SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY:
                BackgroundBrush = new LinearGradientBrush()
                {
                    StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1)
                };
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#1A5181"), 1));
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#73B0D8"), 0));
                PicturePath    = (BitmapImage) new ResolveImagePath("LiveView/hockey-ball.png").ProvideValue(null);
                BackgroundPath = (BitmapImage) new ResolveImagePath("LiveView/Hokkey-fon.png").ProvideValue(null);
                SimpleColor    = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#1A5181"));
                break;

            case SportSr.SPORT_DESCRIPTOR_TENNIS:
                BackgroundBrush = new LinearGradientBrush()
                {
                    StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1)
                };
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#979F0D"), 1));
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#DDE04A"), 0));
                PicturePath    = (BitmapImage) new ResolveImagePath("LiveView/tennis-ball.png").ProvideValue(null);
                BackgroundPath = (BitmapImage) new ResolveImagePath("LiveView/tennis-fon.png").ProvideValue(null);
                SimpleColor    = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#DDE04A"));
                break;

            case SportSr.SPORT_DESCRIPTOR_HANDBALL:
                BackgroundBrush = new LinearGradientBrush()
                {
                    StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1)
                };
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#C8C8CA"), 1));
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F4F4F4"), 0));
                PicturePath    = (BitmapImage) new ResolveImagePath("LiveView/hand-ball.png").ProvideValue(null);
                BackgroundPath = (BitmapImage) new ResolveImagePath("LiveView/handball-fon.png").ProvideValue(null);
                SimpleColor    = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#EFEFDA"));
                break;

            case SportSr.SPORT_DESCRIPTOR_RUGBY:
                BackgroundBrush = new LinearGradientBrush()
                {
                    StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1)
                };
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#963D2D"), 1));
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#989E98"), 0));
                PicturePath    = (BitmapImage) new ResolveImagePath("LiveView/rugby-ball.png").ProvideValue(null);
                BackgroundPath = (BitmapImage) new ResolveImagePath("LiveView/rugby-fon.png").ProvideValue(null);
                SimpleColor    = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E86F25"));
                break;

            case SportSr.SPORT_DESCRIPTOR_VOLLEYBALL:
                BackgroundBrush = new LinearGradientBrush()
                {
                    StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1)
                };
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#3685D3"), 1));
                BackgroundBrush.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FDC903"), 0));
                PicturePath    = (BitmapImage) new ResolveImagePath("LiveView/volley-ball.png").ProvideValue(null);
                BackgroundPath = (BitmapImage) new ResolveImagePath("LiveView/volleyball-fon.png").ProvideValue(null);
                SimpleColor    = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#E8C425"));
                break;
            }

            LineSr.SubsribeToEvent(DataCopy_DataSqlUpdateSucceeded);
            timer.Elapsed += timer_Tick;
            timer.Start();
            ChangeTracker.IsBetdomainViewOpen = true;
        }