Ejemplo n.º 1
0
	public override void Setup(GameObject player) {
		this.player = player;
		playerControl = player.GetComponent<PlayerControl> ();
		originalJump = playerControl.jumpSpeed;
		originalMoveSpeed = playerControl.airControl;
		activationStatus = player.GetComponent<PlayerNotification> ();
	}
Ejemplo n.º 2
0
 public void NotifyAllUsers(PlayerNotification notifications)
 {
     foreach (IObserver <PlayerNotification> player in _observers)
     {
         player.OnNext(notifications);
     }
 }
Ejemplo n.º 3
0
        public void ChallengePlayer(Guid fromPlayer, Guid toPlayer)
        {
            var n = new PlayerNotification {
                Id = Guid.NewGuid(), PlayerId = toPlayer, OtherPlayer = fromPlayer, NotificationType = NotificationTypes.ChallengePlayer
            };

            CloudWarsData.AddNotification(n);
        }
Ejemplo n.º 4
0
 public override void Setup(GameObject player)
 {
     this.player       = player;
     playerControl     = player.GetComponent <PlayerControl> ();
     originalJump      = playerControl.jumpSpeed;
     originalMoveSpeed = playerControl.airControl;
     activationStatus  = player.GetComponent <PlayerNotification> ();
 }
Ejemplo n.º 5
0
        public void ShotMissed(Guid matchId, Guid player1, Guid player2, Common.Other.Position coordinates)
        {
            var n = new PlayerNotification {
                Id = Guid.NewGuid(), MatchId = matchId, PlayerId = player1, OtherPlayer = player2, Row = coordinates.Row, Col = coordinates.Column, NotificationType = NotificationTypes.ShotMissed
            };

            CloudWarsData.AddNotification(n);
        }
Ejemplo n.º 6
0
        public void ShotMade(Guid matchId, Guid player1, Guid player2, int healthAfterAttack, Guid unitId, Common.Other.Position coordinates)
        {
            var n = new PlayerNotification {
                Id = Guid.NewGuid(), MatchId = matchId, PlayerId = player1, OtherPlayer = player2, Row = coordinates.Row, Col = coordinates.Column, NotificationType = NotificationTypes.ShotMade
            };

            CloudWarsData.AddNotification(n);
        }
Ejemplo n.º 7
0
        public void StartMatch(Guid matchId, Guid player1, Guid player2)
        {
            var n = new PlayerNotification {
                Id = Guid.NewGuid(), MatchId = matchId, PlayerId = player1, OtherPlayer = player2, NotificationType = NotificationTypes.StartMatch
            };

            CloudWarsData.AddNotification(n);
        }
Ejemplo n.º 8
0
        public void ChallengeAccepted(Guid matchId, Guid fromPlayer, Guid toPlayer)
        {
            var n = new PlayerNotification {
                Id = Guid.NewGuid(), MatchId = matchId, PlayerId = toPlayer, OtherPlayer = fromPlayer, NotificationType = NotificationTypes.ChallengeAccepted
            };

            CloudWarsData.AddNotification(n);
        }
Ejemplo n.º 9
0
        public void PlayerLost(Guid playerId, Guid matchId)
        {
            var n = new PlayerNotification {
                Id = Guid.NewGuid(), MatchId = matchId, PlayerId = playerId, NotificationType = NotificationTypes.PlayerLost
            };

            CloudWarsData.AddNotification(n);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 音乐进度改变
 /// </summary>
 /// <param name="parameter"></param>
 public void MusicPositionChangedExecute(object parameter)
 {
     if (PlayerManager.State == NAudio.Wave.PlaybackState.Stopped)
     {
         return;
     }
     PlayerManager.Position = TimeSpan.FromSeconds((double)parameter);
     PlayerNotification.Start();
 }
    private static void Add(PlayerNotification notification)
    {
        notification.Created = Time.time;

        messages.AddLast(notification);
        if (messages.Count > HistorySize)
        {
            messages.RemoveFirst();
        }
    }
Ejemplo n.º 12
0
 private void TimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
 {
     _allGames = GameServer.GameCenter.Instance.GetAllActiveGames();
     if (_notifications != null)
     {
         foreach (IGame game in _allGames)
         {
             _notifications = BuildNotificationsFromGamePropoties(game);
             ((GameClient)game).UpdatePlayersFromServer(_notifications);
         }
     }
 }
Ejemplo n.º 13
0
        public override void Clear()
        {
            accountId = string.Empty;
            roleInfoLiteList.Clear();

            roleInfo.roleId    = string.Empty;
            roleInfo.roleName  = string.Empty;
            roleInfo.roleLevel = 0;
            roleInfo.serverId  = 0;

            notification = null;
        }
Ejemplo n.º 14
0
        //exmple to notifacations from game propoties
        private PlayerNotification BuildNotificationsFromGamePropoties(IGame game)
        {
            PlayerNotification data = new PlayerNotification();


            data.AddNotification("Hello From Game " + game.GetProperties().GameIdentifier);
            data.AddNotification("The Game chip policy is : " + game.GetProperties().ChipPolicy.Sum);
            data.AddNotification("the pot size is " + game.GetMainPotSize());
            data.AddNotification("The Current by in policy " + game.GetProperties().BuyInPolicy);

            return(data);
        }
Ejemplo n.º 15
0
        protected virtual void HandleDealer(IList <SecretPolynomials> shareMySecrets, Zp recvSecretShare_i)
        {
            // Should send & receive complaints on the bulletin board  1 - I'm not complaining on myself
            var myDemoComplaint = new PlayerNotification(Confirmation.Approval);

            // broadcast the complaint using BA
            //var bcaster = new SecureBroadcaster<PlayerNotification>(
            //    EntityId, myDemoComplaint, EntityIds.Except(BadPlayers).ToList().AsReadOnly(), true, Prime, Send);
            //bcaster.Run();

            //var complaintesOnMe = SecureBroadcaster.PublishAndRead(myDemoComplaint, Prime, BadPlayers);

            //// Prepare wanted polys according to players complaintes
            //var wantedPolysList = new List<SecretPolynomials>();
            //bool recvCompOnMe = CreateWantedPolynomials(wantedPolysList, complaintesOnMe, shareMySecrets);

            //if (recvCompOnMe)
            //{
            //    // Publish wanted polynomials on the bulletin board
            //    var secretBundle = new SecretPolynomialsBundle(wantedPolysList);
            //    SecureBroadcaster.Publish(secretBundle, BadPlayers);

            //    // Should send&receive complaints on the bulletin board  2 - I'm not complaining on  myself
            //    complaintesOnMe = Sendable.asPlayerNotifications(
            //        BulletinBoardProtocol.PublishAndRead(myDemoComplaint, Prime, BadPlayers));

            //    // Prepare wanted polys according to players complaintes
            //    recvCompOnMe = CreateWantedPolynomials(wantedPolysList, complaintesOnMe, shareMySecrets);

            //    if (recvCompOnMe)
            //    {
            //        // Publish wanted polynomials on the bulletin board
            //        secretBundle = new SecretPolynomialsBundle(wantedPolysList);
            //        BulletinBoardProtocol.Publish(secretBundle, BadPlayers);

            //        // Should send&receive complaints on the bulletin board  3 - I'm not complaining on  myself
            //        complaintesOnMe = Sendable.asPlayerNotifications(
            //            BulletinBoardProtocol.PublishAndRead(myDemoComplaint, Prime, BadPlayers));

            //        // Count complaints number
            //        int numOfcomplaints = GetNumberOfComplaints(complaintesOnMe);

            //        if (numOfcomplaints > PolynomialDeg)
            //        {
            //            // Take the zero polynomial as my input (Not mandatodry) and throw exception
            //            recvSecretShare_i.Value = 0;
            //            throw new Exception("Other players decided that I'm a cheater  :- (  -  taking my input as zero.");
            //        }
            //    }
            //}
        }
Ejemplo n.º 16
0
    protected void HandlePlayerNotification(MessageWrapper message)
    {
        /*
         * JSONParameters jsonParameters = new JSONParameters();
         * jsonParameters.UsingGlobalTypes = false;
         * jsonParameters.UseExtensions = false;
         */
        PlayerNotification pn = JsonUtility.FromJson <PlayerNotification>(message.message);
        LocalPlayer        lp = CurrentGame.Instance.LocalPlayer;

        lp.money             = pn.money;
        lp.legalItems        = pn.LegalItems;
        lp.illegalItems      = pn.IllegalItems;
        lp.visitedTradeposts = pn.VisitedTradeposts;


        Debug.Log(pn.IllegalItems.Count);
        Debug.Log(pn.LegalItems.Count);
    }
Ejemplo n.º 17
0
        private void NotifyClientChange(Client client)
        {
            var notification = new PlayerNotification(new Player
            {
                Id     = client.Id,
                Nick   = client.Nick,
                Status = client.Status
            });

            Client[] clientsToNotify;
            lock (_lock)
            {
                clientsToNotify = _clients
                                  .Where(c => c.Status == PlayerStatus.Joined || c.Status == PlayerStatus.OnGame)
                                  .Where(c => c != client)
                                  .ToArray();
            }

            foreach (var otherClient in clientsToNotify)
            {
                Send(otherClient, notification);
            }
        }
Ejemplo n.º 18
0
        public MainWindowViewModel()
        {
            ViewModelManager.MainWindowViewModel = this;
            var historys = new SearchHistoryManager().GetList();

            if (historys.Count <= 10)
            {
                SearchHistoryList = new ObservableCollection <SearchHistoryModel>();
                historys.ForEach(item => { SearchHistoryList.Insert(0, item); });
            }
            else
            {
                SearchHistoryList = new ObservableCollection <SearchHistoryModel>();
                historys.GetRange(historys.Count - 10, 10).ForEach(item => { SearchHistoryList.Insert(0, item); });
            }

            //Init();
            ClickMinimizedCommand            = new DelegateCommand(new Action(() => State = WindowState.Minimized));
            ClickClosedCommand               = new DelegateCommand(new Action(CloseWindow));
            ClickMaximizedCommand            = new DelegateCommand(new Action(ClickMaximizedExecute));
            ClickSearchCommand               = new DelegateCommand(new Action(ClickSearchExecute));
            ClickPlayCommand                 = new DelegateCommand(new Action(ClickPlayExecute));
            ClickPauseCommand                = new DelegateCommand(new Action(ClickPauseExecute));
            VolumeChangedCommand             = new DelegateCommand <object>(new Action <object>((parameter) => PlayerManager.Volume = Volume));
            MusicPositionChangedCommand      = new DelegateCommand <object>(new Action <object>(MusicPositionChangedExecute));
            MusicPositionBeginChangedCommand = new DelegateCommand(new Action(() => PlayerNotification.Stop()));
            DragMoveCommand           = new DelegateCommand(new Action(() => Application.Current.MainWindow.DragMove()));
            MouseMovedCoverCommand    = new DelegateCommand(new Action(MouseMovedCoverExecute));
            MouseLeftCoverCommand     = new DelegateCommand(new Action(() => HiddenCoverVisibility = Visibility.Hidden));
            CoverClickCommand         = new DelegateCommand(new Action(CoverClickExecute));
            ClickPreviousMusicCommand = new DelegateCommand(new Action(ClickPreviousMusicExecute));
            ClickNextMusicCommand     = new DelegateCommand(new Action(ClickNextMusicExecute));
            PlayModeIcon              = Application.Current.FindResource("PlaySingle") as Geometry;
            ChangePlayModeCommand     = new DelegateCommand <object>(new Action <object>(ChangePlayModeExecute));
            ClickSearchHistoryCommand = new DelegateCommand <object>(new Action <object>(ClickSearchHistoryExecute));
        }
Ejemplo n.º 19
0
 protected virtual void OnPlayerNotification(Plugin.NotificationType notification) =>
 PlayerNotification?.Invoke(this, notification);
Ejemplo n.º 20
0
 public void UpdatePlayersFromServer(PlayerNotification data)
 {
     NotifyAllUsers(data);
 }
Ejemplo n.º 21
0
 public static void AddNotification(PlayerNotification notification)
 {
     CloudWarsDB.PlayerNotifications.Insert(notification);
 }
Ejemplo n.º 22
0
 private void PlayerNotificationReceived(PlayerNotification obj)
 {
     Audio.PlaySound("PlayerNotification", 0.50f);
 }
Ejemplo n.º 23
0
 public override void Setup(GameObject player)
 {
     this.player      = player;
     activationStatus = player.GetComponent <PlayerNotification> ();
 }
Ejemplo n.º 24
0
	public override void Setup(GameObject player) {
		this.player = player;
		activationStatus = player.GetComponent<PlayerNotification> ();
	}
Ejemplo n.º 25
0
 public NotificationBuilder()
 {
     _notifications = new PlayerNotification();
 }