Ejemplo n.º 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_LiveCreatures = reader.ReadInt();
            m_VacationLeft  = reader.ReadInt();

            m_Food  = new AquariumState();
            m_Water = new AquariumState();

            m_Food.Deserialize(reader);
            m_Water.Deserialize(reader);

            m_Events = new List <int>();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                m_Events.Add(reader.ReadInt());
            }

            m_RewardAvailable = reader.ReadBool();

            m_Timer = Timer.DelayCall(TimeSpan.FromHours(12), TimeSpan.FromHours(24), new TimerCallback(Evaluate));
        }
Ejemplo n.º 2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 2:
            {
                m_EvaluateDay = reader.ReadBool();

                goto case 1;
            }

            case 1:
            {
                DateTime next = reader.ReadDateTime();

                if (next < DateTime.Now)
                {
                    next = DateTime.Now;
                }

                m_Timer = Timer.DelayCall(next - DateTime.Now, TimeSpan.FromHours(24), new TimerCallback(Evaluate));

                goto case 0;
            }

            case 0:
            {
                m_LiveCreatures = reader.ReadInt();
                m_VacationLeft  = reader.ReadInt();

                m_Food  = new AquariumState();
                m_Water = new AquariumState();

                m_Food.Deserialize(reader);
                m_Water.Deserialize(reader);

                m_Events = new List <int>();

                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    m_Events.Add(reader.ReadInt());
                }

                m_RewardAvailable = reader.ReadBool();

                break;
            }
            }
        }
Ejemplo n.º 3
0
        private void Deserialize(IGenericReader reader, int version)
        {
            switch (version)
            {
            case 3:
            case 2:
            case 1:
            {
                var next = reader.ReadDateTime();

                if (next < Core.Now)
                {
                    next = Core.Now;
                }

                _evaluateTimer = Timer.DelayCall(next - Core.Now, EvaluationInterval, Evaluate);

                goto case 0;
            }

            case 0:
            {
                _liveCreatures = reader.ReadInt();
                _vacationLeft  = reader.ReadInt();

                _food = new AquariumState(this);
                _food.Deserialize(reader);
                _water = new AquariumState(this);
                _water.Deserialize(reader);

                _events = new List <int>();
                var count = reader.ReadInt();
                for (var i = 0; i < count; i++)
                {
                    _events.Add(reader.ReadInt());
                }

                _rewardAvailable = reader.ReadBool();
                break;
            }
            }
        }
Ejemplo n.º 4
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 3:
            case 2:
            case 1:
            {
                DateTime next = reader.ReadDateTime();

                if (next < DateTime.UtcNow)
                {
                    next = DateTime.UtcNow;
                }

                m_Timer = Timer.DelayCall(next - DateTime.UtcNow, EvaluationInterval, new TimerCallback(Evaluate));

                goto case 0;
            }

            case 0:
            {
                m_LiveCreatures = reader.ReadInt();
                m_VacationLeft  = reader.ReadInt();

                m_Food  = new AquariumState();
                m_Water = new AquariumState();

                m_Food.Deserialize(reader);
                m_Water.Deserialize(reader);

                m_Events = new List <int>();

                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    m_Events.Add(reader.ReadInt());
                }

                m_RewardAvailable = reader.ReadBool();

                break;
            }
            }

            if (version < 2)
            {
                Weight  = DefaultWeight;
                Movable = false;
            }

            if (version < 3)
            {
                ValidationQueue <Aquarium> .Add(this);
            }
        }
Ejemplo n.º 5
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();

			switch ( version )
			{
				case 3:
				case 2:
				case 1:
				{
					DateTime next = reader.ReadDateTime();

					if ( next < DateTime.Now )
						next = DateTime.Now;

					m_Timer = Timer.DelayCall( next - DateTime.Now, EvaluationInterval, new TimerCallback( Evaluate ) );

					goto case 0;
				}
				case 0:
				{
					m_LiveCreatures = reader.ReadInt();
					m_VacationLeft = reader.ReadInt();

					m_Food = new AquariumState();
					m_Water = new AquariumState();

					m_Food.Deserialize( reader );
					m_Water.Deserialize( reader );

					m_Events = new List<int>();

					int count = reader.ReadInt();

					for ( int i = 0; i < count; i ++ )
						m_Events.Add( reader.ReadInt() );

					m_RewardAvailable = reader.ReadBool();

					break;
				}
			}

			if ( version < 2 )
			{
				Weight = DefaultWeight;
				Movable = false;
			}

			if ( version < 3 )
				ValidationQueue<Aquarium>.Add( this );
		}
Ejemplo n.º 6
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			
			int version = reader.ReadInt();
			
			switch ( version )
			{
				case 1: 				
					DateTime next = reader.ReadDateTime();
					
					if ( next < DateTime.Now )
						next = DateTime.Now;												
				
					m_Timer = Timer.DelayCall( next - DateTime.Now, TimeSpan.FromHours( 24 ), new TimerCallback( Evaluate ) );				
						
					goto case 0;					
				case 0:			
					m_LiveCreatures = reader.ReadInt();
					m_VacationLeft = reader.ReadInt();
					
					m_Food = new AquariumState();
					m_Water = new AquariumState();
					
					m_Food.Deserialize( reader );
					m_Water.Deserialize( reader );
					
					m_Events = new List<int>();
					
					int count = reader.ReadInt();		
					
					for ( int i = 0; i < count; i ++ )
						m_Events.Add( reader.ReadInt() );
					
					m_RewardAvailable = reader.ReadBool();
					
					break;					
			}
		}
Ejemplo n.º 7
0
		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			
			int version = reader.ReadInt();
			
			m_LiveCreatures = reader.ReadInt();
			m_VacationLeft = reader.ReadInt();
			
			m_Food = new AquariumState();
			m_Water = new AquariumState();
			
			m_Food.Deserialize( reader );
			m_Water.Deserialize( reader );
			
			m_Events = new List<int>();
			
			int count = reader.ReadInt();		
			
			for ( int i = 0; i < count; i ++ )
				m_Events.Add( reader.ReadInt() );
			
			m_RewardAvailable = reader.ReadBool();
			
			m_Timer = Timer.DelayCall( TimeSpan.FromHours( 12 ), TimeSpan.FromHours( 24 ), new TimerCallback( Evaluate ) );
		}