Example #1
0
        private void DoQuitPlay(QuitReason reason)
        {
            LogInfo(() => FormatLogMessage("JUMP.DoQuitPlay, reason: {0}", reason));

            QuitGameReason = reason;

            // quit client and destroy it
            GameClient.Quit(reason);
            DestroyGameClient();

            if (IsOfflinePlayMode || PhotonNetwork.isMasterClient)
            {
                // quit server and destroy it
                GameServer.Quit(reason);
                DestroyGameServer();
            }

            // leave the room if we are still in there
            if (!IsOfflinePlayMode && PhotonNetwork.inRoom)
            {
                LogDebug(() => FormatLogMessage("Quit play invoked, leaving the room."));
                quittingPlay = true;
                PhotonNetwork.LeaveRoom();
            }

            if (IsOfflinePlayMode)
            {
                IsOfflinePlayMode = false;
                RaiseOnPlayDisconnected();
            }
        }
        private void HandleClientQuit(Client client, QuitReason reason)
        {
            var packet = PlayerPacketFactory.CreateQuitPacket(client.Player, reason);

            this.server.BroadcastPacket(packet);

            client.Player.Destroy();
        }
        private QuitReason ShouldQuit(QuitReason quitReason)
        {
            QuitReason AgeCheck() => hero.age >= 60 ? QuitReason.Age : QuitReason.DontQuit;

            if (quitReason == QuitReason.DontQuit)
            {
                quitReason = AgeCheck();
            }
            return(quitReason);
        }
Example #4
0
        private QuitReason ShouldQuit(QuitReason quitReason)
        {
            QuitReason AgeCheck() => Trader.age >= 70 ? QuitReason.Age : QuitReason.DontQuit;
            QuitReason MoneyCheck() => Trader.money < 0 ? QuitReason.OutOfMoney : QuitReason.DontQuit;


            if (quitReason == QuitReason.DontQuit)
            {
                quitReason = AgeCheck();
            }

            if (quitReason == QuitReason.DontQuit)
            {
                quitReason = MoneyCheck();
            }

            return(quitReason);
        }
        public static void ClosingMessage(QuitReason quitReason)
        {
            switch (quitReason)
            {
            case QuitReason.UserQuit:
                Console.WriteLine("Sorry to see you go...\n\n");
                break;

            case QuitReason.Age:
                Console.WriteLine("You're 60 years old...\n\n");
                break;

            case QuitReason.OutofMoney:
                Console.WriteLine("Your last penny spent...\n\n");
                break;

            case QuitReason.DontQuit:
                throw new NotImplementedException("Shouldn't be quitting with DontQuit reason");
            }
        }
Example #6
0
        //Ask player for a name and save it


        public static void ClosingMessage(QuitReason quitReason)
        {
            Console.Clear();

            switch (quitReason)
            {
            case QuitReason.UserQuit:
                Console.WriteLine("Sorry to see you go...\n\n");
                break;

            case QuitReason.Age:
                Console.WriteLine("You're 70 years old...The time has come for you to retire.\n\n");
                break;

            case QuitReason.OutOfMoney:
                Console.WriteLine("Your last penny is spent, a debtor's prison colony awaits");
                break;
                throw new NotImplementedException("Shouldnt be quitting with DontQuit reason");
            }
        }
Example #7
0
        //public static void Run()
        //{
        //    //bool quit;

        //    //do
        //    {
        //        startGame();
        //        leaveChoice();
        //        planetChoiceA();



        //    }
        //    //while (!quit);


        //    Console.WriteLine(); // Ensures "press any key to quit..." is on its own line
        //}
        public static void closingMessage(QuitReason quitReason)
        {
            Console.Clear();
            switch (quitReason)
            {
            case QuitReason.UserQuit:
                Console.WriteLine("See you later.... \n\n");
                break;

            case QuitReason.Age:
                Console.WriteLine("You are too old \n\n");
                break;

            case QuitReason.OutOfMoney:
                Console.WriteLine("Youre broke $ 0.00  \n\n");
                break;

            case QuitReason.DontQuit:
                throw new NotImplementedException("No quitting");
                break;
            }
        }
Example #8
0
        public static void EndMessage(QuitReason quitReason)
        {
            Console.Clear();

            switch (quitReason)
            {
            case QuitReason.UserQuit:
                Console.WriteLine("Sorry to see you go...\n\n");
                break;

            case QuitReason.Age:
                Console.WriteLine("You're 70 years old... you awaken in an old folks home.\n\n");
                break;

            case QuitReason.OutOfMoney:
                Console.WriteLine("You have ran out of money. GAME OVER!");
                break;

            case QuitReason.DontQuit:
                throw new NotImplementedException("Shouldn't be quitting with DontQuit reason");
            }
        }
Example #9
0
 public static PlayerQuitPacket CreateQuitPacket(Player player, QuitReason reason = QuitReason.Quit)
 {
     return(new PlayerQuitPacket(player.Id, (byte)reason));
 }
Example #10
0
 public PlayerQuitEventArgs(QuitReason reason)
 {
     this.Reason = reason;
 }
Example #11
0
 internal void Enable(QuitReason reason)
 {
     m_timeToEnableYes = TCODSystem.getElapsedSeconds() + 1;
     m_enabled = true;
     m_quitReason = reason;
 }
Example #12
0
        public static void ClosingMessage(QuitReason quitReason)
        {
            Console.Clear();

            switch (quitReason)
            {
            case QuitReason.UserQuit:
                Console.BackgroundColor = ConsoleColor.DarkRed;
                Console.ForegroundColor = ConsoleColor.Black;
                Console.WriteLine(@"Bye! Felicia...
          _.----.                          
       .-'       \-.                       
      /           ; \                      
     :           /:  \                     
     ;         .'  ;  ;                    
     ;      .-'    :  :                    
    :   _.+(   .-- :  :                    
    ;  ;   ' :  :                    
    ;  :           ;  ;                    
    :   ;    -    :  :                     
     )  '   .-.   '  :                     
    (    '. `'' .'   ;                     
     '-._.:`---':-'-.'+'                   
          ;     ;    '                     
   _..__.-. -. (:                          
 ,'   .:(o);     '-._                      
 :    _: 0 ;        \`.                    
 ;  .'/.\-/-.        `:                    
:  : :  -U--:'-.  \    ;                   
;  ; :  ----;   '-.L.-' \                  
'. '  \ ---(      ;O:    ;                 
  \ '. '-;-'      :-:    :                 
   `. ""/         ; :    ;                 
     ""T      .-':  :`. /                  
       :  --""   :   ; Y                   
        ;        ;   : :                   
        :       :     ; ;                  
         ;      :   ; : :                  
         :      ;   :  ; \                 
          ;    :    ;  :  \_               
          :    :        \  \'-.            
          ;    ;         \  `. '-.         
         :    :     c     \   `./'-._      
         ;    :            \    \    '-.   
        :     ;             `.    -.  -.`. 
        :    :       __..--"" \     `.\.`.\
        ;    :_..--"";  ;  _.-'\      ')))T
       :     ;      _L.-'""     ;      '-='
");
                Console.ReadLine();
                break;

            case QuitReason.Age:
                Console.BackgroundColor = ConsoleColor.DarkMagenta;
                Console.ForegroundColor = ConsoleColor.Black;
                Console.WriteLine(@"YOU ATE ALL MY TWINKIES!!!.                                
                    dS$$S$S$S$S$S$S$$Sb                    
                   :$$S^S$S$S$S$S$S^S$$;                   
                   SSP   `^$S$S$^'   TSS                   
                   $$       `''       $$                   
                  _SS ,-           -  SS_                  
                 :-.|  _    - .-   _  |.-;                 
                 :\(; ' '-._.'._.-' ` |)/;                 
                  \`|  , o       o .  |'/                  
                   ':     -'   `-     ;'                   
                     ;.              :                     
                     : `    ._.    ' ;                     
                   .sSb   ._____.   dSs.                   
                _.d8dSSb.   ._.   .SSbT8b._                
            _.oOPd88SSSS T.     .P SSSS888OOo.             
        _.mMMOOPd888SSSSb TSqqqSP dSSSS88OMOOOMm._         
     .oOMMMOMOOM8O8OSSSSSb TSSSP dSSSSS8OOMMOOMMOOOo._     
   .OOMMOOOMMOOMOOOO  '^SSSTSSP dSSS^'OOOOMMOOMMMOOMMMb.   
  dOOOMMMOMMOOOMOOOO      '^SSSS^'   :OOO8MMMOOMMOOMMOMMb  
 :MMMOOMMOMMOOMMO8OS         `P      8O8OPdMMOOMMOMMOMMMM; 
 MMMMOOMMMMMOOMbTO8S;               :8888MMMMMOMMOMMOMMMMM 
 OMMMMOOMMMMOOOMMOOOS        S     :O8OPdMOMMMOMOMMOOMMMMO 
:OMMMMOOMMOMMOOMbTObTb.     :S;   .PdOPdMOOMMMMMOMMOMMMMMO;
MOOMMMMOMMOMMOOMMMOObTSSg._.SSS._.PdOPdMOOMMMMOMMMMOMMMMOOM
MMOMMMMOMMMOMMOOMMbT8bTSSSSSSSSSPd8OPdOOOMMMMOOMMMMOMMMOOMM
MMOMMMOMMMMMOMMOOMMMbT8bTSSSSSPd88PdOOOOMMMMOOMMMMMMMMOOMMM
");
                Console.ReadLine();
                break;

            case QuitReason.OutOfMoney:
                Console.BackgroundColor = ConsoleColor.DarkYellow;
                Console.ForegroundColor = ConsoleColor.Black;
                Console.WriteLine(@"You're broke, have fun dying in space.     
  ___  _____                        
 .'/,-Y'     '~-.                  
 l.Y             ^.                  
 /\               _\_      'Doh!'    
i            ___/'   '\              
|          /'   '\   o !             
l         ]     o !__./            
 \ _  _    \.___./    '~\            
  X \/ \            ___./           
 ( \ ___.   _..--~~'   ~`-.                
  ` Z,--   /               \                        
    \__.  (   /       ______)                
      \   l  /-----~~' /                     
       Y   \          /                
       |    'x______.^                
       |           \                 
       j            Y                 

");
                Console.ReadLine();
                break;

            case QuitReason.DontQuit:
                throw new NotImplementedException("Shouldn't be quitting with DontQuit reason");
            }
        }
Example #13
0
 public EnableQuitDialog(QuitReason reason)
 {
     m_reason = reason;
 }