private void ExecuteWinQuerry(string querry)
 {
     dbconn.Open();
     dbcmd             = dbconn.CreateCommand();
     dbcmd.CommandText = querry;
     reader            = dbcmd.ExecuteReader();
     while (reader.Read())
     {
         if (Random.Range(1, 100) < reader.GetInt16(0))
         {
             tempQuantItem = Random.Range(1, reader.GetInt16(1));
             if (tempQuantItem != 0)
             {
                 partsTxt.text += reader.GetString(2) + " " + tempQuantItem + " ,";
                 int    newQuantItem = reader.GetInt16(4) + tempQuantItem;
                 reward tempReward   = new reward();
                 tempReward.ResID       = reader.GetInt16(3);
                 tempReward.ResQuantity = newQuantItem;
                 endGameSalvage.Add(tempReward);
             }
         }
         tempQuantItem = 0;
         //tempQuantItem = reader.GetInt16(0);
     }
     dbconn.Close();
 }
 // Use this for initialization
 public void init(reward reward)
 {
     currentReward = reward;
     foreach (RoleRecord role in reward.roles)
     {
         GameObject head = Instantiate(roleHead, mainPanel.transform);
         head.GetComponent <roleInPanel>().init(role, roleInfPanel);
     }
     foreach (int no in reward.itemNos)
     {
         GameObject item = Instantiate(itemHead, mainPanel.transform);
         item.GetComponent <itemInMarket>().init(no, itemList.main.objects[no], itemInfPanel);
     }
     goldNum.text       = "" + reward.bonus;
     trans.beforeTrans += extractReward;
 }
Exemple #3
0
        public ActionResult AddReward([Bind(Include = "points,progress,job_id")] reward reward)
        {
            if (reward == null)
            {
                return(HttpNotFound());
            }

            job job = _jobService.GetById((int)reward.job_id);

            if (job == null)
            {
                return(HttpNotFound());
            }

            job.rewards.Add(reward);

            _jobService.Update(job);
            _jobService.commit();

            return(RedirectToAction("Index"));
        }
 void Awake()
 {
     Reward = GameObject.Find("Event").GetComponent <reward>();
     Player = GetComponent <player>();
 }
Exemple #5
0
    void Start()
    {
        Items = GetComponent <item>();
        Items.Load();
        DateTime d = GetNistTime();

        switch (d.DayOfWeek)
        {
        case DayOfWeek.Monday:
            indexDay = 1;
            break;

        case DayOfWeek.Tuesday:
            indexDay = 2;
            break;

        case DayOfWeek.Wednesday:
            indexDay = 3;
            break;

        case DayOfWeek.Thursday:
            indexDay = 4;
            break;

        case DayOfWeek.Friday:
            indexDay = 5;
            break;

        case DayOfWeek.Saturday:
            indexDay = 6;
            break;

        case DayOfWeek.Sunday:
            indexDay = 7;
            break;
        }
        //
        Reward = GetComponent <reward>();
        //
        Reward.Load();
        //
        if (indexDay == 1)
        {
            if (Reward.Reward.RewardDbList[0].Status == 0)
            {
                for (int i = 0; i < Reward.Reward.RewardDbList.Length; i++)
                {
                    Reward.Reward.RewardDbList[i].Status = 0;
                }
                Reward.Save();
            }
        }
        //
        foreach (var item in Reward.Reward.RewardDbList)
        {
            var e       = Instantiate(ItemReward, ContentView);
            var RewardS = e.GetComponent <ItemRewardControll>();
            RewardS.Reward      = item;
            RewardS.IsGetReward = item.IdReward == indexDay;
            foreach (var itemItem in Items.Player.ItemDbList)
            {
                if (item.IdItem == itemItem.IdItem)
                {
                    RewardS.Item = itemItem;
                    break;
                }
            }
        }
    }