コード例 #1
0
        public bool openLottery()
        {
            if (mode != LotteryBasketMode.Closed)
            {
                return(false);
            }

            award = given = 0;

            mode = LotteryBasketMode.Open;

            return(true);
        }
コード例 #2
0
        public bool closeLottery()
        {
            if (mode != LotteryBasketMode.Open)
            {
                return(false);
            }

            mode = LotteryBasketMode.Closed;

            if (board != null && !board.Deleted)
            {
                board.Name = "Drawing is in progress.";
            }
            else
            {
                board = null;
            }

            return(true);
        }
コード例 #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
                drawing = reader.ReadUInt();

                for (uint i = 0; i < jackpot.Length; i++)
                {
                    jackpot[i] = reader.ReadULong();
                }

                for (uint i = 0; i < awards.Length; i++)
                {
                    awards[i] = reader.ReadULong();
                }

                award     = reader.ReadULong();
                given     = reader.ReadULong();
                destroyed = reader.ReadULong();
                mode      = (LotteryBasketMode)reader.ReadInt();

                if (reader.ReadBool())
                {
                    outcome = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                    {
                        outcome[p] = reader.ReadUInt();
                    }
                }

                uint count = reader.ReadUInt();
                for (uint i = 0; i < count; i++)
                {
                    int    id   = reader.ReadInt();
                    uint[] data = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                    {
                        data[p] = reader.ReadUInt();
                    }
                    RegisteredTicket rt = new RegisteredTicket(id, data);
                    rt.Class    = reader.ReadInt();
                    tickets[id] = rt;
                }

                count = reader.ReadUInt();
                for (uint i = 0; i < count; i++)
                {
                    int    id   = reader.ReadInt();
                    uint[] data = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                    {
                        data[p] = reader.ReadUInt();
                    }
                    incoming[id] = new RegisteredTicket(id, data);
                }

                board     = reader.ReadItem();
                itemPrize = reader.ReadBool();
                break;

            case 1:
                drawing = reader.ReadUInt();

                for (uint i = 0; i < drawingCount.Length; i++)
                {
                    drawingCount[i] = reader.ReadUInt();
                }

                for (uint i = 0; i < jackpot.Length; i++)
                {
                    jackpot[i] = reader.ReadULong();
                }

                for (uint i = 0; i < awards.Length; i++)
                {
                    awards[i] = reader.ReadULong();
                }

                for (uint i = 0; i < winners.Length; i++)
                {
                    winners[i] = reader.ReadInt();
                }

                oldParticipants = reader.ReadUInt();

                award     = reader.ReadULong();
                given     = reader.ReadULong();
                destroyed = reader.ReadULong();
                mode      = (LotteryBasketMode)reader.ReadInt();

                if (reader.ReadBool())
                {
                    outcome = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                    {
                        outcome[p] = reader.ReadUInt();
                    }
                }

                count = reader.ReadUInt();
                for (uint i = 0; i < count; i++)
                {
                    int    id   = reader.ReadInt();
                    uint[] data = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                    {
                        data[p] = reader.ReadUInt();
                    }
                    RegisteredTicket rt = new RegisteredTicket(id, data);
                    rt.Class    = reader.ReadInt();
                    tickets[id] = rt;
                }

                count = reader.ReadUInt();
                for (uint i = 0; i < count; i++)
                {
                    int    id   = reader.ReadInt();
                    uint[] data = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                    {
                        data[p] = reader.ReadUInt();
                    }
                    incoming[id] = new RegisteredTicket(id, data);
                }

                board     = reader.ReadItem();
                itemPrize = reader.ReadBool();
                break;
            }
        }
コード例 #4
0
        public bool openLottery() {
            if (mode != LotteryBasketMode.Closed)
                return false;

            award = given = 0;

            mode = LotteryBasketMode.Open;

            return true;
        }
コード例 #5
0
        public bool closeLottery() {
            if (mode != LotteryBasketMode.Open)
                return false;

            mode = LotteryBasketMode.Closed;

	    if ( board != null && !board.Deleted )
	      board.Name="Drawing is in progress.";
	    else
	      board = null;

            return true;
        }
コード例 #6
0
        public override void Deserialize(GenericReader reader) {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch ( version ) {
            case 0:
                drawing = reader.ReadUInt();

                for (uint i = 0; i < jackpot.Length; i++)
                    jackpot[i] = reader.ReadULong();

                for (uint i = 0; i < awards.Length; i++)
                    awards[i] = reader.ReadULong();

                award = reader.ReadULong();
                given = reader.ReadULong();
                destroyed = reader.ReadULong();
                mode = (LotteryBasketMode)reader.ReadInt();

                if (reader.ReadBool()) {
                    outcome = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                        outcome[p] = reader.ReadUInt();
                }

                uint count = reader.ReadUInt();
                for (uint i = 0; i < count; i++) {
                    int id = reader.ReadInt();
                    uint[] data = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                        data[p] = reader.ReadUInt();
                    RegisteredTicket rt = new RegisteredTicket(id, data);
                    rt.Class = reader.ReadInt();
                    tickets[id] = rt;
                }

                count = reader.ReadUInt();
                for (uint i = 0; i < count; i++) {
                    int id = reader.ReadInt();
                    uint[] data = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                        data[p] = reader.ReadUInt();
                    incoming[id] = new RegisteredTicket(id, data);
                }

		board = reader.ReadItem();
		itemPrize = reader.ReadBool();
                break;

	    case 1:
	        drawing = reader.ReadUInt();

                for (uint i = 0; i < drawingCount.Length; i++)
                    drawingCount[i] = reader.ReadUInt();

                for (uint i = 0; i < jackpot.Length; i++)
                    jackpot[i] = reader.ReadULong();

                for (uint i = 0; i < awards.Length; i++)
                    awards[i] = reader.ReadULong();

		for (uint i = 0; i < winners.Length; i++)
                    winners[i] = reader.ReadInt();

		oldParticipants = reader.ReadUInt();

		award = reader.ReadULong();
                given = reader.ReadULong();
                destroyed = reader.ReadULong();
                mode = (LotteryBasketMode)reader.ReadInt();

                if (reader.ReadBool()) {
                    outcome = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                        outcome[p] = reader.ReadUInt();
                }

                count = reader.ReadUInt();
                for (uint i = 0; i < count; i++) {
                    int id = reader.ReadInt();
                    uint[] data = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
                        data[p] = reader.ReadUInt();
                    RegisteredTicket rt = new RegisteredTicket(id, data);
                    rt.Class = reader.ReadInt();
                    tickets[id] = rt;
                }

                count = reader.ReadUInt();
                for (uint i = 0; i < count; i++) {
                    int id = reader.ReadInt();
                    uint[] data = new uint[LotteryConstants.Picks];
                    for (uint p = 0; p < LotteryConstants.Picks; p++)
		        data[p] = reader.ReadUInt();
                    incoming[id] = new RegisteredTicket(id, data);
                }

		board = reader.ReadItem();
		itemPrize = reader.ReadBool();
	      break;
            }
        }