示例#1
0
    public void ReceivePrize(Prize prize)
    {
        Item   item     = prize.Item;
        string name     = prize.Name;
        int    quantity = prize.Quantity;
        int    ammount  = prize.Ammount;

        if (prize.Item != null)
        {
            for (int i = 0; i < prize.Quantity; i++)
            {
                inventory.LootItem(Random.Range(1 + (currentLevel - 1) * 12, 13 + (currentLevel - 1) * 12));
                //Debug.Log("Otrzymano item");
            }
        }

        else if (prize.Name.Equals("gold"))
        {
            AddGold(ammount);
        }
        else if (prize.Name.Equals("dur"))
        {
            AddShipHealth(ammount);
        }
    }
        private void CreatePrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                Prize _prize = new Prize(
                    PlaceNamberTextBox.Text,
                    PlaceNameTextBox.Text,
                    PrizeAmountTextBox.Text,
                    PrizePercentageTextBox.Text);

                GlobalConfig.Connection.CreatePrize(_prize);

                PlaceNamberTextBox.Text     = "";
                PlaceNameTextBox.Text       = "";
                PrizeAmountTextBox.Text     = "0";
                PrizePercentageTextBox.Text = "0";

                //Call the completed method
                _callerForm.PrizeCompleted(_prize);
                this.Close();
            }
            else
            {
                MessageBox.Show("Please enter with the valid datas");
            }
        }
示例#3
0
    /// <summary>
    /// Gets the JSON prize db & puts all of the prizes from the db into a Prize object
    /// </summary>
    /// <param name="jsonstr">the serialized json string</param>
    /// <returns>The list of prize objects</returns>
    public static List <Prize> GetPrizes()
    {
        string       jsonstr = GetJsonText(prizespath);
        List <Prize> prizes  = new List <Prize>();
        // Reading JSON response
        dynamic result = JsonConvert.DeserializeObject(jsonstr);

        foreach (var prize in result)
        {
            Prize prizeitem = new Prize();
            prizeitem.id               = prize.id;
            prizeitem.name             = prize.name;
            prizeitem.currentquantity  = prize.currentquantity;
            prizeitem.originalquantity = prize.originalquantity;
            prizeitem.quantitygiven    = prize.quantitygiven;
            prizeitem.isnonprize       = prize.isnonprize;
            prizeitem.image1           = prize.image1;
            prizeitem.image2           = prize.image2;
            //prizeitem.image3 = prize.image3;
            prizeitem.tip   = prize.tip;
            prizeitem.ratio = prize.ratio;
            prizes.Add(prizeitem);
        }
        return(prizes);
    }
示例#4
0
        /// <summary>
        /// This method launches when user clicks the create prize button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            //Check if user has given valid prize data.
            if (isFormValid())
            {
                //Create the prize and pass in the info
                Prize prize = new Prize(
                    placeNumberValue.Text,
                    placeNameValue.Text,
                    amountValue.Text,
                    percentageValue.Text);

                //Upload the prize info to the database
                DataConfig.connection.CreatePrize(prize);
                MessageBox.Show("Prize Created SuccessFully!!");

                //Alert the requestor that prize has been created (In this app prize is saved in the relevant tournament which requested the prize)
                prizeRequester.prizeCreated(prize);
                this.Close();
            }

            //If prize fields are not valid, then show an error box.
            else
            {
                MessageBox.Show("The Form has Invalid Information. Please Check All The Fields", "Prize Form", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#5
0
        public Prize CreatePrize(Prize model)
        {
            // Load the text file
            // Convert the text to a List<Prize>
            List <Prize> prizes = PrizesFile.FullFilePath().LoadFile().ConvertToPrizeModels();

            // Find the max ID
            int currentId = 1;

            if (prizes.Count > 0)
            {
                currentId = prizes.OrderByDescending(x => x.Id).First().Id + 1;
            }

            model.Id = currentId;

            // Add new record with new ID (max + 1)
            prizes.Add(model);

            // Convert the prizes to a list<string>
            // Save the list<string> to the text file
            prizes.SaveToPrizeFile(PrizesFile);

            return(model);
        }
示例#6
0
        public PrizeManager()
        {
            P = new Dictionary<String, Prize>();

            if (File.Exists("Media\\Profiles\\Prizes.xml"))
            {
                XmlDocument File1 = new XmlDocument();
                File1.Load("Media\\Profiles\\Prizes.xml");
                XmlElement root = File1.DocumentElement;
                XmlNodeList Items = root.SelectNodes("//prizes//prize");

                foreach (XmlNode item in Items)
                {
                    Prize newChar = new Prize();

                    newChar.PrizeID = item["PrizeID"].InnerText;
                    newChar.AmountExp = int.Parse(item["Exp"].InnerText);
                    newChar.AmountGold = int.Parse(item["Gold"].InnerText);

                    XmlNodeList Itemy = item["items"].ChildNodes;

                    foreach (XmlNode it in Itemy)
                    {
                        newChar.ItemsList.Add((Gra.Items.I[it["idstring"].InnerText]));
                    }

                    P.Add(newChar.PrizeID, newChar);
                }
            }
        }
示例#7
0
        public static Prize[] GeneratePrizeList(Prize[] prizes)
        {
            int count = 0;

            prizes = new Prize[14];
            String       tempPrizeName  = "";
            int          tempQuantity   = 0;
            int          tempLowerBound = 0;
            int          tempUpperBound = 0;
            StreamReader sr             = new StreamReader("../prizes.txt");

            while (count < 14)
            {
                tempPrizeName            = sr.ReadLine();
                tempQuantity             = Convert.ToInt32(sr.ReadLine());
                tempLowerBound           = tempUpperBound + 1;
                tempUpperBound           = Convert.ToInt32(sr.ReadLine());
                prizes[count].prizeName  = tempPrizeName;
                prizes[count].quantity   = tempQuantity;
                prizes[count].lowerBound = tempLowerBound;
                prizes[count].upperBound = tempUpperBound;
                count++;
            }


            sr.Close();
            return(prizes);
        }
        public ActionResult AddPrize(int?id)
        {
            PrizeViewModel model = new PrizeViewModel();

            if (id.HasValue)
            {
                Prize prize = _db.GetPrizeById(id.Value);

                model.PrizeId      = prize.ID;
                model.Milestone    = prize.Milestone;
                model.UserType     = prize.UserType;
                model.isActive     = prize.isActive;
                model.MaxNumPrizes = prize.MaxNumPrizes;
                model.StartDate    = prize.StartDate;
                model.EndDate      = prize.EndDate;
                model.FamilyId     = prize.FamilyID;
                model.Title        = prize.Title;
            }

            //need to add method to call allPrizes
            model.PrizeList = _db.GetPrizes(((User)Session["User"]).FamilyID);
            if (TempData.ContainsKey("AddSuccessState"))
            {
                model.AddSuccessState = (PrizeViewModel.SuccessState)TempData["AddSuccessState"];
            }
            else
            {
                model.AddSuccessState = PrizeViewModel.SuccessState.None;
            }
            return(View("AddPrize", model));
        }
示例#9
0
        // POST: AppUserPrizes/Create
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        public async Task <IActionResult> CreatePrizeUser(int prize, string user)
        {
            Prize   newPrize = _appUserPrizes.SearchForPrize(prize);
            AppUser newUser  = await _userManager.FindByIdAsync(user);

            if (newUser.Points >= newPrize.Price)
            {
                newUser.Points -= newPrize.Price;
                await _userManager.UpdateAsync(newUser);

                AppUserPrize appUserPrize = new AppUserPrize()
                {
                    Prize = newPrize,
                    User  = newUser
                };
                if (ModelState.IsValid)
                {
                    await _registry.CreateRegistryAsync("Buy", newPrize.Price, newUser);

                    await _appUserPrizes.CreateAppUserPrizeAsync(appUserPrize);

                    return(RedirectToAction(nameof(Index)));
                }
                return(View(appUserPrize));
            }
            return(RedirectToAction(nameof(Index)));
        }
示例#10
0
        public static void Create(PrizeDTO prizeDTO)
        {
            Prize prize = MapperTransform <Prize, PrizeDTO> .ToEntity(prizeDTO);

            Database.Prizes.Create(prize);
            Database.Save();
        }
示例#11
0
        public void LotteryProcess(UserLottery ul, Prize winprize)
        {
            _context.LotteryRecords.Add(new LotteryRecord
            {
                LotteryID = ul.LotteryID,
                UserID    = ul.UserID,
                Prize     = winprize
            });

            if (winprize.Type == 0 && winprize.Points > 0)
            {
                dynamic extdata = new ExpandoObject();

                extdata.Points    = winprize.Points;
                extdata.ShortMark = winprize.Lottery.Name + "奖励";//"抽奖";

                var res = IntegralProcess(ul.User.UserIntegral, null, extdata);
            }
            else
            {
                if (winprize.Type == 1 && winprize.Coupon != null)
                {
                    var uc = new UserCoupon();

                    uc.Coupon      = winprize.Coupon;
                    uc.User        = ul.User;
                    uc.ExpiredTime = winprize.Coupon.ExpiredTime ?? DateTime.Now.AddDays(winprize.Coupon.ValidDays ?? 30);

                    uc = _context.UserCoupons.Add(uc);
                }
            }
        }
示例#12
0
        /// <summary>
        ///     更新奖品
        /// </summary>
        /// <param name="member">奖品信息</param>
        /// <returns>业务操作结果</returns>
        public OperationResult Update(PrizeView pvmodel, bool savePhoto = false)
        {
            PublicHelper.CheckArgument(pvmodel, "pvmodel");
            try
            {
                Prize dbmodel = PrizeContract.Prizes.SingleOrDefault(m => m.Id.Equals(pvmodel.Id));
                if (dbmodel == null)
                {
                    return(new OperationResult(OperationResultType.Error, string.Format("不存在要更新的Id为{0}的奖品", pvmodel.Id)));
                }

                dbmodel.Name        = pvmodel.Name;
                dbmodel.Description = pvmodel.Description;
                if (savePhoto)
                {
                    dbmodel.Photo = pvmodel.Photo;
                }
                dbmodel.UpdateDate = DateTime.Now;
                return(PrizeContract.Update(dbmodel));
            }
            catch (Exception ex)
            {
                return(new OperationResult(OperationResultType.Error, ex.Message));
            }
        }
示例#13
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.name == "Shell" && invincibleTime <= 0)
     {
         Shell shell = collision.GetComponent <Shell>();
         if (shell.shooter > 0)
         {
             if (hasPrize)
             {
                 hasPrize = false;
                 GameObject prizeInstance = ObjectPool.GetInstance().GetObject("Prize");
                 Prize      prize         = prizeInstance.GetComponent <Prize>();
             }
             Health -= shell.damage;
             // If the current health is at or below zero and it has not yet been registered, call OnDeath.
             if (Health <= 0 && !m_Dead)
             {
                 StartCoroutine(OnDeath(shell.shooter));
             }
         }
     }
     else
     {
         Vector2 position = rigidbody2d.position;
         position.x = Mathf.RoundToInt(position.x / smallestGrid) * smallestGrid;
         position.y = Mathf.RoundToInt(position.y / smallestGrid) * smallestGrid;
         rigidbody2d.MovePosition(position);
     }
 }
示例#14
0
        public ActionResult EditPrize(Prize model)
        {
            if (model.Id != 0)
            {
                var prize = _db.Prizes.Find(model.Id);

                if (prize != null)
                {
                    prize.Name    = model.Name;
                    prize.Detail  = model.Detail;
                    prize.Count   = model.Count;
                    prize.Percent = model.Percent;
                    prize.Angle   = model.Angle;
                }
            }
            else
            {
                model.State = true;

                _db.Prizes.Add(model);
            }
            _db.SaveChanges();

            var pList = _db.Prizes.Where(x => x.State).ToList();

            return(PartialView("_DrawRoulette", pList));
        }
示例#15
0
        /// <summary>
        /// 获取用户所有的刮刮卡
        /// </summary>
        /// <returns></returns>
        public List <ScratchCardResult> Get_AllScratchCardList()
        {
            using (DbRepository entities = new DbRepository())
            {
                var query      = entities.ScratchCard.AsQueryable().Where(x => (x.Flag & (long)GlobalFlag.Removed) == 0 && x.PersonId.Equals(Client.LoginUser.UNID));
                var prizeDic   = entities.Prize.ToDictionary(x => x.TargetID);
                var list       = new List <ScratchCardResult>();
                var prizeModel = new Prize();
                query.OrderByDescending(x => x.CreatedTime).ToList().ForEach(x =>
                {
                    if (x != null)
                    {
                        prizeDic.TryGetValue(x.UNID, out prizeModel);
                        ScratchCardResult model = new ScratchCardResult()
                        {
                            ScratchCard = x.AutoMap <ScratchCard, ApiScratchCardModel>(),
                            Prize       = prizeModel.AutoMap <Prize, ApiPrizeModel>()
                        };
                        model.ScratchCard.OngoingImage    = UrlHelper.GetFullPath(model.ScratchCard.OngoingImage);
                        model.ScratchCard.PreheatingImage = UrlHelper.GetFullPath(model.ScratchCard.PreheatingImage);
                        model.ScratchCard.OverImage       = UrlHelper.GetFullPath(model.ScratchCard.OverImage);
                        list.Add(model);
                    }
                });

                return(list);
            }
        }
示例#16
0
        public PrizeModel SavePrizeModel(PrizeModel model)
        {
            model.ValidateModel();
            PrizeModel result    = null;
            Prize      dataModel = null;

            using (var db = new CFLSuiteDB())
            {
                if (model.PrizeID > 0)
                {
                    dataModel = db.Prizes.First(x => x.PrizeID == model.PrizeID);
                    dataModel.LosingParticipantID  = model.LosingParticipantID;
                    dataModel.WinningParticipantID = model.WinningParticipantID;
                    dataModel.PrizeDescription     = model.PrizeDescription;
                }
                else
                {
                    dataModel = new Prize
                    {
                        LosingParticipantID  = model.LosingParticipantID,
                        WinningParticipantID = model.WinningParticipantID,
                        PrizeDescription     = model.PrizeDescription
                    };
                    db.Prizes.Add(dataModel);
                }
                db.SaveChanges();
                result = db.Prizes.Where(x => x.PrizeID == dataModel.PrizeID).ToPrizeModel().First();
            }

            return(result);
        }
        /// <summary>
        /// Loads prizes from the file (if any) and adds a new prize to it.
        /// </summary>
        /// <param name="prize">Prize to be added.</param>
        /// <returns>Prize with its unique ID.</returns>
        public Prize CreatePrize(Prize prize)
        {
            //Loads the file containing data of prizes and convert them to prizes and store them in a list.
            //Note: Extension Methods from TextProcessor class are used here.
            List <Prize> prizesList = prizeFile.getFilePath().LoadFile().convertToPrize();

            //Find the maximum id of the prizes in list  and assign it to the prize.
            //If there is no prize in file then first id will be 1
            int currentID = 1;

            //If file contains prizes.
            if (prizesList.Count > 0)
            {
                currentID = prizesList.OrderByDescending(x => x.id).First().id + 1;
            }
            prize.id = currentID;

            //Add the prize into the prizes with its id
            prizesList.Add(prize);

            //Save all the prizes into the file
            prizesList.SavePrizes(prizeFile);

            return(prize);
        }
示例#18
0
        public async Task <IActionResult> Create(Prize model, IFormFile file)
        {
            int CreationPrice = 100;

            if (CreationPrice > Me.Money)
            {
                ModelState.AddModelError("", $"You need at least {CreationPrice} to create new prize, but you have only {Me.Money}");
            }
            else if (file == null)
            {
                ModelState.AddModelError("", "Picture can't be empty");
            }
            if (ModelState.IsValid)
            {
                Me.Money -= CreationPrice;
                model.IsCreatedByUser = true;
                model.PictureUrl      = await _fileSaver.SaveFileAsync(file);

                _context.Prizes.Add(model);
                _context.SaveChanges();
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(View());
            }
        }
示例#19
0
文件: Prizes.cs 项目: pedrovt/bd-yacm
        internal static Prize Read(int id)
        {
            Debug.Assert(id > -1, "Prize Index Invalid. Can't Load Prize");

            Prize P = new Prize();

            SqlCommand cmd = new SqlCommand("SELECT * FROM YACM.Prize WHERE id = @id", Program.db.Open());

            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@id", id);
            try
            {
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    P.ID          = Convert.ToInt32(reader["id"].ToString());
                    P.SponsorID   = Convert.ToInt32(reader["sponsorID"].ToString());
                    P.EventNumber = Convert.ToInt32(reader["eventNumber"].ToString());
                    P.ReceiverID  = Convert.ToInt32(reader["receiverID"].ToString());
                    P.Value       = Convert.ToDouble(reader["value"].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to read from database. \n Error message: \n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Program.db.Close();
            }
            return(P);
        }
示例#20
0
        private void createPrizeButton_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                Prize model = new Prize(
                    placeNumberValue.Text,
                    placeNameValue.Text,
                    prizeAmountValue.Text,
                    prizePercentageValue.Text);


                GlobalConfig.Connection.CreatePrize(model);
                callingForm.PrizeComplete(model);

                //placeNumberValue.Text = "";
                //placeNameValue.Text = "";
                //prizeAmountValue.Text = "0";
                //prizePercentageValue.Text = "0";
                Close();
            }
            else
            {
                MessageBox.Show("The form is invalid.", "Error");
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Prize prize = db.Prizes.Find(id);

            db.Prizes.Remove(prize);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#22
0
 public void SetUpPrize(string _text, ref Prize prize)
 {
     assignedPrize = prize;
     if (textField)
     {
         textField.text = _text;
     }
 }
示例#23
0
 public Prize(Prize _prize)
 {
     this.name = _prize.name;
     if (_prize.value != 0)
     {
         this.value = _prize.value;
     }
 }
 private void frmOrder_Load(object sender, System.EventArgs e)
 {
     this.Text += " - " + this.CompanyID;
     oPrize     = new Prize(this.CompanyID);
     oProduct   = new Product(this.CompanyID);
     oPack      = new Pack(this.CompanyID);
     this.txtPrizeID.Focus();
 }
示例#25
0
        public Prize getPrize()
        {
            Prize prize = this.prizes[0];

            this.prizes.RemoveAt(0);

            return(prize);
        }
示例#26
0
    private void GivePrize(Prize prize, int count)
    {
        var text = footer.GetComponent <Text>();

        text.text = prize.type.ToString() + " x " + count.ToString();

        PrizeGiver.GivePrize(prize, count);
    }
示例#27
0
        /// <summary>
        /// will get you all mystery boxes
        /// </summary>
        /// <param name="mysteryBoxes"></param>
        /// <returns></returns>
        public static bool GetAllMysteryBoxes(List <MysteryBox> mysteryBoxes)
        {
            ScrapingBrowser browser = new ScrapingBrowser
            {
                AllowAutoRedirect = true,
                AllowMetaRedirect = true
            };

            try
            {
                WebPage Main  = browser.NavigateToPage(new Uri("https://www.realmeye.com/items/mystery-boxes"));
                var     Boxes = Main.Html.CssSelect(".col-md-12").First();
                foreach (var Box in Boxes.CssSelect(".well"))
                {
                    MysteryBox box = new MysteryBox
                    {
                        Name   = Box.SelectSingleNode("h3").InnerHtml.Split('"')[0].Split('<')[0].Replace("&apos;", "'"),
                        Price  = Box.SelectSingleNode("h3/span").InnerText,
                        EndsAt = Box.SelectSingleNode("small/span").InnerText
                    };
                    foreach (var Prize in Box.CssSelect(".prize"))
                    {
                        MPrize prize = new MPrize();
                        if (Box.CssSelect(".prize.jackpot") != null)
                        {
                            prize.Jackpot = true;
                        }
                        else
                        {
                            prize.Jackpot = false;
                        }
                        foreach (var Item in Prize.CssSelect(".item"))
                        {
                            MItem item = new MItem
                            {
                                Name     = Item.ParentNode.InnerHtml.Split('"')[3],
                                Quantity = "1"
                            };
                            if (Prize.CssSelect(".item-quantity-static") != null)
                            {
                                foreach (var ItemQ in Prize.CssSelect(".item-quantity-static"))
                                {
                                    item.Quantity = ItemQ.InnerText;
                                }
                            }
                            prize.Items.Add(item);
                        }
                        box.Prizes.Add(prize);
                    }
                    mysteryBoxes.Add(box);
                }
                result = true;
            }
            catch ()
            {
            }
            return(result);
        }
示例#28
0
 public ActionResult Edit([Bind(Include = "Id,Points,Title,Description")] Prize prize)
 {
     if (ModelState.IsValid)
     {
         _pm.Update(prize);
         return(RedirectToAction("Index"));
     }
     return(View(prize));
 }
示例#29
0
        public int DeletePrize(int id)
        {
            Prize prize = db.Prize.Find(id);

            db.Prize.Remove(prize);
            int result = db.SaveChanges();

            return(result);
        }
示例#30
0
        public void Update(Prize entity)
        {
            var idx = this.prizes.IndexOf(entity);

            if (this.prizes.IndexOf(entity) != -1)
            {
                this.prizes[idx] = entity;
            }
        }
示例#31
0
        public void DeletePrize(int prizeId)
        {
            Prize targetPrize = context.Prizes.Find(prizeId);

            if (targetPrize != null)
            {
                context.Prizes.Remove(targetPrize);
            }
        }
示例#32
0
 public ActionResult Create(Prize prize)
 {
     if (ModelState.IsValid)
     {
         _prizeRepository.InsertOrUpdate(prize);
         _prizeRepository.Save();
         return RedirectToAction("Index");
     }
     ViewBag.PossibleLotteries = _lotteryRepository.All;
     return View();
 }
示例#33
0
        public Enemy(CharacterProfile profile, bool czyPojemnik, float zasiegWzr, float zasiegOgl)
        {
            Profile = profile.Clone();

            _Orientation = Quaternion.IDENTITY;

            Entity = Engine.Singleton.SceneManager.CreateEntity(Profile.MeshName);
            Node = Engine.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
            Node.AttachObject(Entity);

            Vector3 scaledSize = Entity.BoundingBox.HalfSize * Profile.BodyScaleFactor;

            ConvexCollision collision = new MogreNewt.CollisionPrimitives.ConvexHull(Engine.Singleton.NewtonWorld,
                Node,
                Quaternion.IDENTITY,
                0.1f,
                Engine.Singleton.GetUniqueBodyId());

            Vector3 inertia, offset;
            collision.CalculateInertialMatrix(out inertia, out offset);

            inertia *= Profile.BodyMass;

            Body = new Body(Engine.Singleton.NewtonWorld, collision, true);
            Body.AttachNode(Node);
            Body.SetMassMatrix(Profile.BodyMass, inertia);
            Body.AutoSleep = false;

            Body.Transformed += BodyTransformCallback;
            Body.ForceCallback += BodyForceCallback;

            Body.UserData = this;
            Body.MaterialGroupID = Engine.Singleton.MaterialManager.EnemyMaterialID;

            Joint upVector = new MogreNewt.BasicJoints.UpVector(
            Engine.Singleton.NewtonWorld, Body, Vector3.UNIT_Y);

            collision.Dispose();

            isContainer = czyPojemnik;
            isSeen = false;
            isReachable = false;
            _ZasiegWzroku = zasiegWzr;
            _ZasiegOgolny = zasiegOgl;
            _Statistics = Profile.Statistics.statistics_Clone();
            State = StateTypes.IDLE;

            //DROPPRIZE KUFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

            if (Profile.DropPrizeID == "")
                Profile.DropPrizeID = "pPusty";

            DropPrize = PrizeManager.P[Profile.DropPrizeID].prize_Clone();
            List<DescribedProfile> lista_tym = new List<DescribedProfile>();
            List<DescribedProfile> lista_tym2 = new List<DescribedProfile>(DropPrize.ItemsList);

            if (DropPrize.ItemsList.Count > 2)
            {
                for (int i = 0; i < 2; i++)
                {
                    int Los = Engine.Singleton.Random.Next(lista_tym2.Count);
                    lista_tym.Add(lista_tym2[Los]);
                    lista_tym2.RemoveAt(Los);
                    DropPrize.ItemsList = new List<DescribedProfile>(lista_tym);
                }
            }

            else
                DropPrize.ItemsList = new List<DescribedProfile>(DropPrize.ItemsList);

            DropPrize.AmountGold = Engine.Singleton.Random.Next(DropPrize.AmountGold / 2, DropPrize.AmountGold + 1);
            DropExp = DropPrize.AmountExp;

            //PO DROPPRIZIE KUFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

            walkAnim = Entity.GetAnimationState("WALK");
            idleAnim = Entity.GetAnimationState("IDLE");
            attackAnim = Entity.GetAnimationState("ATTACK");
            deadAnim = Entity.GetAnimationState("DEAD");

            //Animation("IdleLegs").Enabled = true;
            //Animation("IdleLegs").Loop = true;
            FriendlyType = Profile.FriendlyType;
            ProfName = Profile.ProfileName;
        }
示例#34
0
 public void SetPrize(Prize NewPrize)
 {
     DropPrize = NewPrize.prize_Clone();
 }
示例#35
0
文件: Box.cs 项目: hiblen/Monty-Hall
 public Box(Prize prize)
 {
     Prize = prize;
 }
示例#36
0
    public MapRoom(int weight)
    {
        m_hasBaddy = false;
        m_hasPrize = false;
        float maxWeight = (float)MapManager.shared.mapHeight + (float)MapManager.shared.mapWidth;

        float randomizedWeight = weight * (0.5f + (Random.value * 0.9f));
        if (randomizedWeight > maxWeight) randomizedWeight = maxWeight;

        float r = Random.value;
        if (r < 0.4f) {
            m_hasBaddy = true;
            m_badGuy = (int)(((float)randomizedWeight / maxWeight) * (float)BaddyType.NUM_BADDY_TYPES) % (int)BaddyType.NUM_BADDY_TYPES;
            m_monster = new Monster((BaddyType)m_badGuy);
        }
        else if (r < 0.8f) {
            m_hasPrize = true;
            m_prize = (int)(Random.value * (float)PrizeType.NUM_PRIZE_TYPES) % (int)PrizeType.NUM_PRIZE_TYPES;
            m_realPrize = new Prize((PrizeType)m_prize);
        }
        if (weight == 0) {
            m_hasBaddy = false;
            m_hasPrize = false;
        }
    }