void LateUpdate()
 {
     if (thingsToRemove)
     {
         Object[] objToDestroy = new Object[watToRemove.Count + foodToRemove.Count];
         int      index        = 0;
         foreach (waterPuddleScript puddle in watToRemove)
         {
             objToDestroy [index] = (Object)puddle;
             index++;
         }
         foreach (foodBundleScript bundle in foodToRemove)
         {
             objToDestroy [index] = (Object)bundle;
             index++;
         }
         for (int i = 0; i < index; i++)
         {
             resource tempResource = (resource)objToDestroy[i];
             //Debug.Log ("This "+ tempResource.name + " " + tempResource.transform.position.ToString());
             //Debug.Log ((tempResource.gameObject == null).ToString() + " <-- isNull?");
             //temp.gameObject
             tempResource.markToDie();
         }
         watToRemove.Clear();
         foodToRemove.Clear();
         thingsToRemove = false;
     }
 }
Exemple #2
0
        public DidlLite Items(uint aStartIndex, uint aCount)
        {
            iMutex.WaitOne();

            DidlLite didl = new DidlLite();

            foreach (string s in iFolders)
            {
                storageFolder folder   = new storageFolder();
                resource      resource = new resource();
                folder.Res.Add(resource);

                folder.Id          = s;
                folder.ParentId    = kRootId;
                folder.Title       = s;
                folder.WriteStatus = "PROTECTED";
                folder.Restricted  = true;
                folder.Searchable  = true;

                resource.Uri = s;

                didl.Add(folder);
            }

            iMutex.ReleaseMutex();

            return(didl);
        }
Exemple #3
0
        //protected void HideColumns()
        //{
        //    MakeThisColumnVisible(new string[] {
        //            "resources_name"
        //        });
        //}

        protected override void Insert(DataGridViewRow row)
        {
            try
            {
                using (var ctx = new OutpostDataContext())
                {
                    string new_resources_name = ((string)row.Cells[MyHelper.strResourceName].Value).RmvExtrSpaces();

                    if (ctx.resources.AsEnumerable().FirstOrDefault(res => res.resources_name.ToLower() == new_resources_name.ToLower()) != null)
                    {
                        string eo = $"Ресурс {new_resources_name} уже существует!";
                        MessageBox.Show(eo);
                        row.ErrorText = MyHelper.strBadRow + " " + eo;
                        return;
                    }

                    var new_res = new resource();
                    new_res.resources_name = new_resources_name;
                    ctx.resources.Add(new_res);
                    ctx.SaveChanges();
                    row.Cells[MyHelper.strSource].Value     = new_res;
                    row.Cells[MyHelper.strResourceId].Value = new_res.resources_id;
                    _resourcesDataTableHandler.Add(new_res.resources_id, new_res.resources_name);
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
                row.ErrorText = MyHelper.strError + err.Message;
            }
        }
        // POST: odata/resources
        public async Task <IHttpActionResult> Post(resource resource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.resource.Add(resource);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (resourceExists(resource.id_resource))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(Created(resource));
        }
Exemple #5
0
    private float getResourceThreshold(resource r)
    {
        switch (r)
        {
        case resource.BERRIES:
            return(0.40f);

        case resource.TREE:
            return(0.45f);

        case resource.STONE:
            return(1.0f);

        case resource.MEAT:
            return(0.10f);

        case resource.IRON:
            return(0.48f);

        case resource.GOLD:
            return(0.44f);

        case resource.DIAMOND:
            return(0.35f);

        case resource.COAL:
            return(0.46f);

        case resource.FISH:
            return(0.10f);

        default:
            return(1.0f);
        }
    }
Exemple #6
0
        public DidlLite Items(uint aStartIndex, uint aCount)
        {
            DidlLite didl = new DidlLite();

            SortedList <string, string> playlists = iPlaylists.GetPlaylists(aStartIndex, aCount);

            foreach (KeyValuePair <string, string> s in playlists)
            {
                playlistContainer playlist = new playlistContainer();
                resource          resource = new resource();
                playlist.Res.Add(resource);

                playlist.Id          = s.Key;
                playlist.ParentId    = iMetadata.Id;
                playlist.Title       = s.Value;
                playlist.WriteStatus = "PROTECTED";
                playlist.Restricted  = false;
                playlist.Searchable  = true;

                resource.Uri = s.Key;

                didl.Add(playlist);
            }

            return(didl);
        }
        public ActionResult Create(HttpPostedFileBase file, resource res)
        {
            string filename  = Path.GetFileName(file.FileName);
            string _filename = DateTime.Now.ToString("yymmssff") + filename;

            string extension = Path.GetExtension(file.FileName);
            string path      = Path.Combine(Server.MapPath("~/User_Images/"), _filename);

            res.images = "~/User_Images/" + _filename;

            if (extension.ToLower() == ".jpg" || extension.ToLower() == ".png" || extension.ToLower() == ".jpeg")
            {
                db.resources.Add(res);
                if (db.SaveChanges() > 0)
                {
                    file.SaveAs(path);
                    ViewBag.msg = "Resource Added Successfully";
                    ModelState.Clear();
                }
            }
            else
            {
                ViewBag.msg = "Invalid file type";
            }
            return(View());
        }
Exemple #8
0
        public static storageFolder Create(DirectoryInfo aInfo, string aArtworkUri)
        {
            storageFolder folder   = new storageFolderLocal(aInfo);
            resource      resource = new resource();

            folder.Res.Add(resource);

            folder.Id          = aInfo.FullName;
            folder.Title       = aInfo.Name;
            folder.WriteStatus = "PROTECTED";
            folder.Restricted  = true;
            folder.Searchable  = true;

            folder.StorageUsed = -1;

            resource.ProtocolInfo = "internal:127.0.0.1:*:local-folder";
            resource.Uri          = aInfo.FullName;

            if (!string.IsNullOrEmpty(aArtworkUri))
            {
                folder.AlbumArtUri.Add(aArtworkUri);
            }

            return(folder);
        }
Exemple #9
0
        internal PodcastEpisode(string aId, string aName, string aDate, string aAlbumArtUri, string aAudioUri, string aDuration)
        {
            iId          = aId;
            iName        = aName;
            iAlbumArtUri = aAlbumArtUri;
            iAudioUri    = aAudioUri;

            DateTime date;

            try
            {
                date  = DateTime.Parse(aDate);
                iDate = date;
            }
            catch (FormatException) { }

            iMetadata       = new audioItem();
            iMetadata.Id    = iId;
            iMetadata.Title = iName;
            iMetadata.AlbumArtUri.Add(iAlbumArtUri);

            resource res = new resource();

            res.Uri          = iAudioUri;
            res.ProtocolInfo = "http-get:*:audio/x-mpeg:*";
            if (aDuration != null)
            {
                res.Duration = new Time(aDuration).ToString();
            }

            iMetadata.Res.Add(res);
        }
    void UpdateProduction(resource _resource, int slot)
    {
        switch (_resource)
        {
        case resource.Lumber:
            lumberProduction[slot] = FieldProductionAtLevel(lumberLevel[slot]);
            lumberProductionTotal  = lumberProduction.Sum();
            break;

        case resource.Clay:
            clayProduction[slot] = FieldProductionAtLevel(clayLevel[slot]);
            clayProductionTotal  = clayProduction.Sum();
            break;

        case resource.Iron:
            ironProduction[slot] = FieldProductionAtLevel(ironLevel[slot]);
            ironProductionTotal  = ironProduction.Sum();
            break;

        case resource.Crop:
            cropProduction[slot] = FieldProductionAtLevel(cropLevel[slot]);
            cropProductionTotal  = cropProduction.Sum();
            break;
        }
    }
Exemple #11
0
        public List <resource> ParseResource(string logContent)
        {
            List <resource> resources = new List <resource>();
            //var ma = Regex.Match(logContent, @"Resource entries\n=+\n.+\n-+\n(?<RES>.+\n)+");
            var ma = Regex.Match(logContent, @"Name.+RVA.+Size.+Lang.+Sublang.+Type\r\n-+\r\n(?<RES>.+\r\n)+");

            foreach (var resource in ma.Groups["RES"].Captures)
            {
                //var val = Regex.Match(resource.ToString(), @"((?<VAL>[^\s]+)\s+)+");
                var val      = Regex.Match(resource.ToString(), @"((?<VAL>[^\s]+)\s+){1,5}(?<UVAL>.+)\r");
                var captures = val.Groups["VAL"].Captures;
                if (captures.Count == 5)
                {
                    resource res = new resource();
                    res.name     = captures[0].Value;
                    res.size     = captures[2].Value;
                    res.language = captures[3].Value;
                    if (val.Groups["UVAL"].Success)
                    {
                        res.resource_type = new resource_type()
                        {
                            name = val.Groups["UVAL"].Value
                        }
                    }
                    ;
                    //res.type = captures[5].Value;
                    resources.Add(res);
                }
            }
            return(resources);
        }
        private uint PlaylistInsert(int aIndex, DidlLite aDidlLite)
        {
            uint count = 0;

            try
            {
                Lock();

                int index = 0;
                foreach (upnpObject item in aDidlLite)
                {
                    resource resource = BestSupportedResource(item);
                    if (resource != null)
                    {
                        string   uri  = resource.Uri;
                        DidlLite didl = new DidlLite();
                        didl.Add(item);
                        iPlaylist.Insert(aIndex + index, new MrItem(++iTrackId, uri, didl));
                        ++count;
                        ++index;
                    }
                }
            }
            finally
            {
                Unlock();
            }

            if (EventPlaylistChanged != null)
            {
                EventPlaylistChanged(this, EventArgs.Empty);
            }

            return(count);
        }
Exemple #13
0
        public void saveResources(List <Dictionary <string, object> > resources)
        {
            foreach (var resource in resources)
            {
                resource res = new resource();

                if (resource.ContainsKey("id") && resource["id"] != null)
                {
                    res = databaseEntities.resources.Find(Convert.ToInt32(resource["id"]));
                    databaseEntities.Entry(res).State = System.Data.Entity.EntityState.Modified;

                    databaseEntities.resource_eav.RemoveRange(res.resource_eav);
                }
                else
                {
                    databaseEntities.Entry(res).State = System.Data.Entity.EntityState.Added;
                }

                res.name        = resource["name"].ToString();
                res.description = resource["description"].ToString();
                res.fullpath    = resource["imagePath"].ToString();
                res.is_deleted  = false;
                res.created_at  = (DateTime)resource["createdAt"];

                List <resource_eav> resourceEavCollection = SaveEavAttributes(res, resource["properties"]);

                res.resource_eav = resourceEavCollection;
            }

            databaseEntities.SaveChanges();
        }
Exemple #14
0
        public static resource Add(string stName, byte byExtension, string stDescription, byte[] byaValue, string stExternalUrlName)
        {
            try
            {
                using (straad_generaldesktopapplication_pcpcpcpc_001Entities objContext = new straad_generaldesktopapplication_pcpcpcpc_001Entities())
                {
                    Guid objGuid;
                    do
                    {
                        objGuid = Guid.NewGuid();
                    } while (FindByUUID(objGuid) != null);

                    resource objResource;

                    objResource = new resource()
                    {
                        reso_uuid__uniqueidentifier      = objGuid,
                        reso_name__nvarchar              = stName,
                        reso_extension__tinyint          = byExtension,
                        reso_description__nvarchar       = stDescription,
                        reso_value__varbinary            = byaValue,
                        reso_externalurlorname__nvarchar = stExternalUrlName,
                    };

                    objContext.resources.Add(objResource);

                    objContext.SaveChanges();

                    return(objContext.resources.Where(r => r.reso_uuid__uniqueidentifier == objResource.reso_uuid__uniqueidentifier).FirstOrDefault());
                }
            }
            catch { }

            return(null);
        }
Exemple #15
0
        public ActionResult Edit(resource r)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:18080");

            ResourceViewModels res = new ResourceViewModels();

            res.userId        = r.userId;
            res.nom           = r.nom;
            res.prenom        = r.prenom;
            res.email         = r.email;
            res.dateNaissance = r.dateNaissance;
            res.password      = r.password;
            res.competance    = r.competance;
            res.resourceType  = r.resourceType;
            res.seniority     = r.seniority;
            res.resourceState = "Available";
            res.role          = "Ressource";
            Adresse adresse = new Adresse();

            adresse.codePostal = "2222";
            adresse.pays       = "Tunis";
            adresse.rue        = "aa";
            adresse.ville      = "aa";
            res.adresse        = adresse;

            client.PutAsJsonAsync <ResourceViewModels>("http://localhost:18080/MapLevio-web/rest/Resource/" + res.userId.ToString(), res).Result.EnsureSuccessStatusCode();


            return(RedirectToAction("ListeResource"));
        }
Exemple #16
0
        public ActionResult Edit(int id)
        {
            resource resource = null;

            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:18080");

            HttpResponseMessage response = client.GetAsync("http://localhost:18080/MapLevio-web/rest/Resource/" + id.ToString()).Result;

            if (response.IsSuccessStatusCode)
            {
                resource = response.Content.ReadAsAsync <resource>().Result;
            }
            List <String> competance = (new List <string> {
                "Android", "JEE", "JAVA", "IOS", "PHP", "SYMFONY"
            });

            ViewBag.list = competance;
            List <String> resourceType = (new List <string> {
                "Employee", "Freelancer"
            });

            ViewBag.list1 = resourceType;
            return(View(resource));
        }
Exemple #17
0
        public async Task <IActionResult> Edit(int id, [Bind("resource_ID,resource_type,resource_name,resource_description,resource_datebought,resource_datecreated,resource_datelastmodified,resource_conditionstatus,resource_availabilitystatus,resource_bookedfordate")] resource resource)
        {
            if (id != resource.resource_ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(resource);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!resourceExists(resource.resource_ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(resource));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            resource resource = db.resources.Find(id);

            db.resources.Remove(resource);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public resource Insert_resource_select(int ID)
 {
     resource = resource.Select(ID);
     Insert_Location_ID_txt.Text = Convert.ToString(resource.Location_ID);
     Insert_Resource_Type_txt.Text = Convert.ToString(resource.Resource_Type);
     Insert_Date_Requested_txt.Text = Convert.ToString(resource.Date_Requested);
     return resource;
 }
Exemple #20
0
 public resource Insert_resource_select(int ID)
 {
     resource = resource.Select(ID);
     Insert_Location_ID_txt.Text    = Convert.ToString(resource.Location_ID);
     Insert_Resource_Type_txt.Text  = Convert.ToString(resource.Resource_Type);
     Insert_Date_Requested_txt.Text = Convert.ToString(resource.Date_Requested);
     return(resource);
 }
 public resource Delete_resource_select(int ID)
 {
     resource = resource.Select(ID);
     Delete_Resource_ID_txt_lbl.Text = Convert.ToString(resource.Resource_ID);
     Delete_Location_ID_txt_lbl.Text = Convert.ToString(resource.Location_ID);
     Delete_Resource_Type_txt_lbl.Text = Convert.ToString(resource.Resource_Type);
     Delete_Date_Requested_txt_lbl.Text = Convert.ToString(resource.Date_Requested);
     return resource;
 }
Exemple #22
0
 public resource Delete_resource_select(int ID)
 {
     resource = resource.Select(ID);
     Delete_Resource_ID_txt_lbl.Text    = Convert.ToString(resource.Resource_ID);
     Delete_Location_ID_txt_lbl.Text    = Convert.ToString(resource.Location_ID);
     Delete_Resource_Type_txt_lbl.Text  = Convert.ToString(resource.Resource_Type);
     Delete_Date_Requested_txt_lbl.Text = Convert.ToString(resource.Date_Requested);
     return(resource);
 }
Exemple #23
0
            public static resource Parse(XElement element)
            {
                resource result = new resource();

                result.resourceCode = element.Element("resourceCode").Value;
                result.resourceName = element.Element("resourceName").Value;
                result.resourceType = element.Element("resourceType").Value;
                return(result);
            }
Exemple #24
0
            public static resource Parse(DataRow element)
            {
                resource result = new resource();

                result.resourceCode = element["RESOURCE_CODE"].ToString();
                result.resourceName = element["RESOURCE_NAME"].ToString();
                result.resourceType = element["LOOKUP_NAME"].ToString();
                return(result);
            }
 public ActionResult Edit([Bind(Include = "resourceId,Name,Role,phone,email,address,reponsibilities,GEO,Team")] resource resource)
 {
     if (ModelState.IsValid)
     {
         db.Entry(resource).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(resource));
 }
Exemple #26
0
 public resource resource_insert()
 {
     resource.Location_ID    = Convert.ToInt32(Insert_Location_ID_txt.Text);
     resource.Resource_Type  = Insert_Resource_Type_txt.Text;
     resource.Date_Requested = Convert.ToDateTime(Insert_Date_Requested_txt.Text);
     resource = resource.Insert(resource);
     Insert_resource_GridView.DataBind();
     Update_resource_GridView.DataBind();
     Delete_resource_GridView.DataBind();
     return(resource);
 }
 public resource resource_insert()
 {
     resource.Location_ID = Convert.ToInt32(Insert_Location_ID_txt.Text);
     resource.Resource_Type = Insert_Resource_Type_txt.Text;
     resource.Date_Requested = Convert.ToDateTime(Insert_Date_Requested_txt.Text);
     resource = resource.Insert(resource);
     Insert_resource_GridView.DataBind();
     Update_resource_GridView.DataBind();
     Delete_resource_GridView.DataBind();
     return resource;
 }
Exemple #28
0
        public async Task <IActionResult> Create([Bind("resource_ID,resource_type,resource_name,resource_description,resource_datebought,resource_datecreated,resource_datelastmodified,resource_conditionstatus,resource_availabilitystatus,resource_bookedfordate")] resource resource)
        {
            if (ModelState.IsValid)
            {
                _context.Add(resource);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(resource));
        }
        public ActionResult Create([Bind(Include = "resourceId,Name,Role,phone,email,address,reponsibilities,GEO,Team")] resource resource)
        {
            if (ModelState.IsValid)
            {
                db.resources.Add(resource);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(resource));
        }
Exemple #30
0
this.span = new SpanSdk(
    name,
    context,
    parentSpanId,
    kind,
    startTimestamp,
    attributes,
    events, links,
    resource,
    status,
    endTimestamp,
    DefaultConfiguration);
Exemple #31
0
 public resource resource_update(int ID)
 {
     resource                = resource.Select(ID);
     resource.Resource_ID    = Convert.ToInt32(Update_Resource_ID_txt.Text);
     resource.Location_ID    = Convert.ToInt32(Update_Location_ID_txt.Text);
     resource.Resource_Type  = Update_Resource_Type_txt.Text;
     resource.Date_Requested = Convert.ToDateTime(Update_Date_Requested_txt.Text);
     resource.Update(resource);
     Insert_resource_GridView.DataBind();
     Update_resource_GridView.DataBind();
     Delete_resource_GridView.DataBind();
     return(resource);
 }
        // GET: resources/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            resource resource = db.resources.Find(id);

            if (resource == null)
            {
                return(HttpNotFound());
            }
            return(View(resource));
        }
        // DELETE: odata/resources(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] long key)
        {
            resource resource = await db.resource.FindAsync(key);

            if (resource == null)
            {
                return(NotFound());
            }

            db.resource.Remove(resource);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
			// verify
			assertEquals(resource, result);
 protected void INSERT(object sender, EventArgs e)
 {
     resource = resource_insert();
 }
Exemple #36
0
        public bool contains(resource.resourceTypes res, int quantity)
        {
            foreach (inventoryItem item in items)
            {
                if (item.type == res && item.quantity >= quantity)
                {
                    return true;
                }
            }

            return false;
        }
 protected void Insert_Select_Record(object sender, EventArgs e)
 {
     resource = Insert_resource_select(Convert.ToInt32(Insert_resource_GridView.SelectedValue));
 }
 protected void UPDATE(object sender, EventArgs e)
 {
     resource = resource_update(Convert.ToInt32(Update_resource_GridView.SelectedValue));
 }
 protected void Update_Select_Record(object sender, EventArgs e)
 {
     resource = Update_resource_select(Convert.ToInt32(Update_resource_GridView.SelectedValue));
 }
Exemple #40
0
        public void increaseResource(resource.resourceTypes res, int quantity)
        {
            int selectedItemPos = 0;

            for (int i = 0; i <= items.Count() - 1; i++)
            {
                if (items[i].type == res)
                {
                    selectedItemPos = i;
                    break;
                }
            }

            inventoryItem tmp = items[selectedItemPos];
            tmp.increaseQuantity(quantity);
            items[selectedItemPos] = tmp;
        }
 private Texture2D getSpriteForType(resource.resourceTypes type)
 {
     switch (type)
     {
         case resource.resourceTypes.Spike:
             return Spike;
         case resource.resourceTypes.SpikePit:
             return SpikePit;
         case resource.resourceTypes.Tree:
             return Tree;
     }
     return null;
 }
 public resource resource_update(int ID)
 {
     resource = resource.Select(ID);
     resource.Resource_ID = Convert.ToInt32(Update_Resource_ID_txt.Text);
     resource.Location_ID = Convert.ToInt32(Update_Location_ID_txt.Text);
     resource.Resource_Type = Update_Resource_Type_txt.Text;
     resource.Date_Requested = Convert.ToDateTime(Update_Date_Requested_txt.Text);
     resource.Update(resource);
     Insert_resource_GridView.DataBind();
     Update_resource_GridView.DataBind();
     Delete_resource_GridView.DataBind();
     return resource;
 }
Exemple #43
0
        //this method works but its putting stuff in the wrong way (as in it adds in verticle columns rather than horizontal which was unintended).
        //TODO: fixme
        public void addToInventory(resource.resourceTypes type, int quantity)
        {
            if(contains(type, 0))
            {
                increaseResource(type, quantity);
            }
            else
            {
                Texture2D itemTexture = getTextureForType(type);

                int colSlotsNeeded = itemTexture.Width / 20;
                int rowSlotsNeeded = itemTexture.Height / 20;

                for (int col = 0; col < 10; col++)
                {
                    for (int row = 0; row < 10; row++)
                    {
                        if (occupiedSlots[col, row] == 'F')
                        {
                            //make sure theres enough slots to do the checks
                            if (col + colSlotsNeeded <= 10 && row + rowSlotsNeeded <= 10)
                            {
                                bool columnsMatch = true;
                                bool rowsMatch = true;

                                for (int colSizeCheck = 0; colSizeCheck < colSlotsNeeded; colSizeCheck += 1)
                                {
                                    if (occupiedSlots[col + colSizeCheck, row] != 'F')
                                    {
                                        columnsMatch = false;
                                    }
                                }

                                if (columnsMatch)
                                {
                                    for (int rowSizeCheck = 0; rowSizeCheck < rowSlotsNeeded; rowSizeCheck += 1)
                                    {
                                        if (occupiedSlots[col, row + rowSizeCheck] != 'F')
                                        {
                                            rowsMatch = false;
                                        }
                                    }
                                }

                                if (rowsMatch && columnsMatch)
                                {
                                    //set the rows to used
                                    for (int colSizeCheck = 0; colSizeCheck < colSlotsNeeded; colSizeCheck += 1)
                                    {
                                        occupiedSlots[col + colSizeCheck, row] = 'T';
                                    }

                                    for (int rowSizeCheck = 0; rowSizeCheck < rowSlotsNeeded; rowSizeCheck += 1)
                                    {
                                        occupiedSlots[col, row + rowSizeCheck] = 'T';
                                    }
                                    if (items.Count == 0)
                                    {
                                        items.Add(new inventoryItem(type, quantity, new Tuple<int, int>(col, row), new Tuple<int, int>(col + (colSlotsNeeded -1), row + (rowSlotsNeeded - 1)), true));
                                    }
                                    else
                                    {
                                        items.Add(new inventoryItem(type, quantity, new Tuple<int, int>(col, row), new Tuple<int, int>(col + (colSlotsNeeded - 1), row + (rowSlotsNeeded - 1))));
                                    }
                                    return;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #44
0
 public inventoryItem(resource.resourceTypes itemType, int itemQuantity, Tuple<int,int> pos, Tuple<int, int> lowerPos, bool selected=false)
 {
     type = itemType;
     quantity = itemQuantity;
     topLeftInventoryPos = pos;
     bottomRightInventoryPos = lowerPos;
     itemSelected = selected;
 }
Exemple #45
0
        private Texture2D getTextureForType(resource.resourceTypes type)
        {
            switch (type)
            {
                case resource.resourceTypes.Wood:
                    return wood;
                case resource.resourceTypes.Hatchet:
                    return hatchet;
                case resource.resourceTypes.Acorn:
                    return acorn;
                case resource.resourceTypes.Spike:
                    return spike;
            }

            return null;
        }
Exemple #46
0
        private string getTextForItemType(resource.resourceTypes itemType)
        {
            switch (itemType)
            {
                case resource.resourceTypes.Hatchet:
                    return "Hatchet";
                case resource.resourceTypes.Wood:
                    return "Wood";
                case resource.resourceTypes.Acorn:
                    return "Acorn";
                case resource.resourceTypes.Spike:
                    return "Spike";
            };

            return "";
        }
 public string lookupNameForType(resource.resourceTypes typeToLookup)
 {
     switch (typeToLookup)
     {
         case resource.resourceTypes.Spike:
             return "Wooden Spike";
         case resource.resourceTypes.SpikePit:
             return "Wooden Spike Pit";
         case resource.resourceTypes.Tree:
             return "Tree";
     }
     return "";
 }
            public constructionItem(resource.resourceTypes itemType, List<Tuple<resource.resourceTypes, int>> itemCost, bool itemAppearsInInventory, bool itemAppearsOnMap, bool itemIsSelected = false)
            {
                type = itemType;
                cost = itemCost;
                appearsInInventory = itemAppearsInInventory;
                appearsOnMap = itemAppearsOnMap;
                name = "";
                selected = itemIsSelected;

                name = lookupNameForType(itemType);
            }