// Static setup methods /// <summary> Creates a new ItemDescription that can be used by the game. </summary> public static ItemDescription CreateItemDescription(string sName, string sDesc, string sDisplayImage, ContentManager xContent, string sShadow = "") { string sEntry = sName.Replace(" ", ""); ItemDescription xDesc = new ItemDescription() { sFullName = sName, sDescription = sDesc, sNameLibraryHandle = sEntry + "_Name", sDescriptionLibraryHandle = sEntry + "_Description", sCategory = "", iInternalLevel = 1, iValue = 1, enType = ModLibrary.ItemTypesNext }; ItemCodex.denxLoadedDescriptions[xDesc.enType] = xDesc; ModLibrary.ItemDetails.Add(xDesc.enType, new ModItemData(xDesc.enType)); Ui.AddMiscText("Items", xDesc.sNameLibraryHandle, sName, MiscTextTypes.GenericItemName); Ui.AddMiscText("Items", xDesc.sDescriptionLibraryHandle, sDesc, MiscTextTypes.GenericItemDescription); xDesc.SetTextures(sDisplayImage, xContent, sShadow); return(xDesc); }
/// <summary> /// Initializes a new instance of the <see cref="Item"/> class. /// </summary> /// <param name="game">The game.</param> /// <param name="itemDescription">The item description.</param> public Item(ICanyonShooterGame game, string itemDescription) : base(game, itemDescription) { this.game = game; // Load Weapon Description desc = game.Content.Load <ItemDescription>("Content\\Items\\" + itemDescription); switch (desc.NameValue) { case "HEALTH": SetModel("item_health"); break; case "SHIELD": SetModel("item_shield"); break; default: SetModel("item_health"); break; } LocalScale = new Vector3(20, 20, 20); ConnectedToXpa = true; ContactGroup = ContactGroup.Items; InfluencedByGravity = false; TimeLiving = 0; if (game.Graphics.ShadowMappingSupported) { game.World.Sky.Sunlight.ShadowMapLow.Scene.AddDrawable(this); game.World.Sky.Sunlight.ShadowMapHigh.Scene.AddDrawable(this); } }
public void FirstTimeFieldIsAutomaticallyEventTime() { var ms = new MemoryStream(); var fio = new FileIO(ms); var fw = new FormattedWriter(fio); var wc = new WriteContext(fw); wc.Description = new TeaFileDescription(); wc.Description.ItemDescription = ItemDescription.FromAnalysis <C2>(); wc.Description.Timescale = Time.Scale; ISectionFormatter f = new TimeSectionFormatter(); f.Write(wc); ms.Position = 0; var fr = new FormattedReader(fio); var rc = new ReadContext(fr); rc.Description.Should().Not.Be.Null(); rc.Description.ItemDescription = ItemDescription.FromAnalysis <C2>(); f.Read(rc); var fields = rc.Description.ItemDescription.Fields; fields[0].IsEventTime.Should().Be.True(); fields[1].IsEventTime.Should().Be.False(); }
public void TimeSectionRoundTrip() { var ms = new MemoryStream(); var fio = new FileIO(ms); var fw = new FormattedWriter(fio); var wc = new WriteContext(fw); wc.Description = new TeaFileDescription(); wc.Description.ItemDescription = ItemDescription.FromAnalysis <Event <C> >(); wc.Description.Timescale = Time.Scale; ISectionFormatter f = new TimeSectionFormatter(); f.Write(wc); ms.Position = 0; ms.Length.Should().Be(24); // epoch(8) ticksperday(8) fieldcount(4) + timefieldoffset(4) = 24 var fr = new FormattedReader(fio); var rc = new ReadContext(fr); rc.Description.Should().Not.Be.Null(); rc.Description.ItemDescription = wc.Description.ItemDescription; // this makes the test a bit weaker, but we need some item description here f.Read(rc); rc.Description.Should().Not.Be.Null(); rc.Description.Timescale.HasValue.Should().Be.True(); }
public void EventTimeAttributeRoundTrip() { Time.Scale = Timescale.Net; var ms = new MemoryStream(); var fio = new FileIO(ms); var fw = new FormattedWriter(fio); var wc = new WriteContext(fw); wc.Description = new TeaFileDescription(); wc.Description.ItemDescription = ItemDescription.FromAnalysis <Event <C> >(); wc.Description.Timescale = Time.Scale; ISectionFormatter f = new TimeSectionFormatter(); f.Write(wc); ms.Position = 0; var fr = new FormattedReader(fio); var rc = new ReadContext(fr); rc.Description.Should().Not.Be.Null(); rc.Description.ItemDescription = wc.Description.ItemDescription; rc.Description.ItemDescription.Fields.ForEach(ff => ff.IsEventTime = ff.IsTime = false); // reset flags f.Read(rc); rc.Description.ItemDescription.Fields.Count(ff => ff.IsTime).Should().Be(1); rc.Description.ItemDescription.Fields.Count(ff => ff.IsEventTime).Should().Be(1); rc.Description.Timescale.Value.Epoch.Should().Be(0); rc.Description.Timescale.Value.TicksPerDay.Should().Be(TimeSpan.TicksPerDay); }
public void TimeSectionValuesRoundTrip() { var ms = new MemoryStream(); var fio = new FileIO(ms); var fw = new FormattedWriter(fio); var wc = new WriteContext(fw); wc.Description = new TeaFileDescription(); wc.Description.ItemDescription = ItemDescription.FromAnalysis <Event <C> >(); Time.Scale = Timescale.FromEpoch(33, 77); wc.Description.Timescale = Time.Scale; ISectionFormatter f = new TimeSectionFormatter(); f.Write(wc); ms.Position = 0; var fr = new FormattedReader(fio); var rc = new ReadContext(fr); rc.Description.Should().Not.Be.Null(); rc.Description.ItemDescription = wc.Description.ItemDescription; f.Read(rc); rc.Description.Timescale.Value.Epoch.Should().Be(33); rc.Description.Timescale.Value.TicksPerDay.Should().Be(77); Executing.This(() => f.Read(rc)).Should().Throw <EndOfStreamException>(); }
public override void OnCLick() { if (ThisItem) { PlayerManager player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerManager>(); Debug.Log(player.Coins); if (player.Coins - ThisItem.price >= 0) { player.Coins -= ThisItem.price; UpdateCoins.Raise(); AddItem(); UpdateInventory.Raise(); ItemDescription.GetComponent <TextMeshProUGUI>().text = ""; if (ThisItem.Unique) { Destroy(this.gameObject); for (int i = 0; i < Shop.MyInventory.Count; i++) { if (ThisItem.name == Shop.MyInventory[i].name) { Shop.MyInventory.Remove(Shop.MyInventory[i]); } } } } } }
private void OnPointerEnter() { Debug.Log("Enter !"); itemDescription = PrefabLoader.LoadPrefab(PrefabLoader.cPrefabDir, "ItemDescription"); transform.root.gameObject.AddChild(itemDescription); RectTransform rt = itemDescription.GetComponent <RectTransform>(); rt.pivot = new Vector2(0, 1); itemDescription.transform.position = new Vector3( GetComponent <RectTransform>().position.x + (GetComponent <RectTransform>().rect.width / 2), GetComponent <RectTransform>().position.y + (GetComponent <RectTransform>().rect.height / 2), itemDescription.transform.position.z ); itemDescription.transform.localScale = new Vector3( (rt.localScale.x * transform.root.localScale.x) * 0.7f, (rt.localScale.y * transform.root.localScale.y) * 0.7f, (rt.localScale.z * transform.root.localScale.z) * 0.7f ); ItemDescription description = itemDescription.GetComponent <ItemDescription>(); description.descriptions[(int)ItemDescription.Description.Name].text = item.nameString; description.descriptions[(int)ItemDescription.Description.DungeonLevel].text = item.dungeonLevelString; description.descriptions[(int)ItemDescription.Description.Wearable].text = item.wearableString; description.descriptions[(int)ItemDescription.Description.WearingLocation].text = item.locationString; description.descriptions[(int)ItemDescription.Description.Stat].text = item.statString; description.descriptions[(int)ItemDescription.Description.Classes].text = item.classesString; description.descriptions[(int)ItemDescription.Description.RequiredLevel].text = item.requireLevelString; description.descriptions[(int)ItemDescription.Description.Price].text = item.priceString; }
public void ItemSectionRoundTrip() { var ms = new MemoryStream(); var fio = new FileIO(ms); var fw = new FormattedWriter(fio); var wc = new WriteContext(fw); wc.Description = new TeaFileDescription(); var writeID = wc.Description.ItemDescription = ItemDescription.FromAnalysis <Event <OHLCV> >(); ISectionFormatter f = new ItemSectionFormatter(); f.Write(wc); ms.Position = 0; var fr = new FormattedReader(fio); var rc = new ReadContext(fr); rc.Description.Should().Not.Be.Null(); f.Read(rc); rc.Description.Should().Not.Be.Null(); var id = rc.Description.ItemDescription; id.ItemTypeName.Should().Be(typeof(Event <OHLCV>).GetLanguageName()); id.ItemSize.Should().Be(wc.Description.ItemDescription.ItemSize); id.Fields.Select(ff => ff.Name).Should().Have.SameValuesAs("Time", "Open", "High", "Low", "Close", "Volume"); id.Fields.Select(ff => ff.Index).Should().Have.SameValuesAs(0, 1, 2, 3, 4, 5); id.Fields.Select(ff => ff.FieldType).Should().Have.SameValuesAs(FieldType.Int64, FieldType.Double, FieldType.Double, FieldType.Double, FieldType.Double); id.Fields.Select(ff => ff.Offset).Should().Have.SameValuesAs(writeID.Fields.Select(ff => ff.Offset)); ms.Position.Should().Be(ms.Length); // very important, all bytes must have been read }
// // Harmony Library Patches - For Get- methods // /// <summary> Patches GetItemInstance so that SoG can create item instances with a correct shadow texture. </summary> private static bool GetItemInstance_PrefixPatch(ref Item __result, ItemCodex.ItemTypes enType) { if (!enType.IsModItem()) { return(true); // Executes original method } ItemDescription xDesc = ItemCodex.denxLoadedDescriptions[enType]; __result = new Item() { enType = enType, sFullName = xDesc.sFullName, bGiveToServer = xDesc.lenCategory.Contains(ItemCodex.ItemCategories.GrantToServer) }; __result.xRenderComponent.txTexture = xDesc.txDisplayImage; __result.xCollisionComponent.xMovementCollider = new SphereCollider(10f, Vector2.Zero, __result.xTransform, 1f, __result) { bCollideWithFlat = true }; __result.xRenderComponent.txShadowTexture = ModLibrary.ItemDetails[enType].txItemShadow ?? Utils.GetTheGame().xLevelMaster.contRegionContent.Load <Texture2D>("Items/DropAppearance/hartass02"); return(false); // Skips original method }
public ItemLine(int id, ItemDescription item, int amount, int amountExtra) { itemLineID = id; this.item = item; this.amount = amount; isCompleted = amountExtra; // TEMP FIX: Amount Extra is the amount done! }
public static void CreateItemDescriptionNode(ItemDescriptionWrapper objWrap) { Logger.WriteToLogFile(DBInteractor.Common.Utilities.GetCurrentMethod()); Logger.WriteObjectToLogFile <ItemDescription>(objWrap.objItem); ItemDescription objItem = objWrap.objItem; Brand objBrand = objWrap.objBrand; var result = Neo4jController.m_graphClient.Cypher .Match("(A:" + objBrand.getLabel() + " { id: { brandid }})") .Create("(B:" + objItem.getLabel() + "{ objItem })") .Merge("(A)-[:" + Rel_Brand.brand_item + "]->(B)") .WithParams(new { brandid = objBrand.id, objItem = objItem }) .Return((B) => new { NodeCount = B.Count() }) .Results .Single(); if (result.NodeCount == 1) { Logger.WriteToLogFile("Successfully created Item"); } else { Logger.WriteToLogFile("unable to create Item"); } }
private void Awake() { brewUI = transform.parent.GetComponent <BrewUI>(); Empty = true; Item = null; UnlockItem(); }
/// <summary> /// Notifies the instance that a line was handled in order to keep the statistics up-to-date. /// </summary> /// <param name="oStation">The corresponding station.</param> /// <param name="item">The item that was picked.</param> /// <param name="lineCount">The number of items that have been picked for the line.</param> internal void NotifyLineHandled(OutputStation oStation, ItemDescription item, int lineCount) { // Store the number of handled lines StatOverallLinesHandled++; // Raise the event LinePicked?.Invoke(oStation, item, lineCount); }
public StringModel ToStringModel <BLModel, StringModel>() { Mapper.CreateMap <OrderExport, StringOrderExport>() .ForAllMembers(item => item.ToString().CutDownTo(50)); var stringModel = Mapper.Map <OrderExport, StringOrderExport>(this); stringModel.UnitCost = UnitCost.DecimalToString(2); stringModel.ExportDate = ExportDate.DateTimeToString(); stringModel.ItemDescription = ItemDescription.CutDownTo(50); stringModel.LeadTime = LeadTime.DecimalToString(2); stringModel.EstimateOfDemand = EstimateOfDemand.DecimalToString(2); stringModel.Returnable = Returnable.CutDownTo(1); stringModel.Stocked = Stocked.CutDownTo(1); stringModel.Hazardous = Hazardous.CutDownTo(1); stringModel.DueDate = DueDate.DateTimeToString(); Mapper.CreateMap <StringOrderExport, StringModel>(); var stringModelRet = Mapper.Map <StringOrderExport, StringModel>(stringModel); return(stringModelRet); }
public override int GetHashCode() { int hashCode = IdVer.GetHashCode() + IdSubVer.GetHashCode() + Timestamp.GetHashCode() + (IdPrototype == null ? 0 : IdPrototype.GetHashCode()) + (IdItemBcn == null ? 0 : IdItemBcn.GetHashCode()) + (IdMatTypeL1 == null ? 0 : IdMatTypeL1.GetHashCode()) + (IdMatTypeL2 == null ? 0 : IdMatTypeL2.GetHashCode()) + (IdMatTypeL3 == null ? 0 : IdMatTypeL3.GetHashCode()) + (IdDefaultSupplier == null ? 0 : IdDefaultSupplier.GetHashCode()) + (IdModel == null ? 0 : IdModel.GetHashCode()) + (IdFamilyHK == null ? 0 : IdFamilyHK.GetHashCode()) + (IdColor1 == null ? 0 : IdColor1.GetHashCode()) + (IdColor2 == null ? 0 : IdColor2.GetHashCode()) + (IdItemHK == null ? 0 : IdItemHK.GetHashCode()) + (ItemDescription == null ? 0 : ItemDescription.GetHashCode()) + (Comments == null ? 0 : Comments.GetHashCode()) + (LaunchDate == null ? 0 : LaunchDate.GetHashCode()) + (RemovalDate == null ? 0 : RemovalDate.GetHashCode()) + IdStatusCial.GetHashCode() + IdStatusProd.GetHashCode() + (IdUserAttri1 == null ? 0 : IdUserAttri1.GetHashCode()) + (IdUserAttri2 == null ? 0 : IdUserAttri2.GetHashCode()) + (IdUserAttri3 == null ? 0 : IdUserAttri3.GetHashCode()) + (Unit == null ? 0 : Unit.GetHashCode()) + (DocsLink == null ? 0 : DocsLink.GetHashCode()) + CreateDate.GetHashCode() + (PhotoUrl == null ? 0 : PhotoUrl.GetHashCode()) + (User == null ? 0 : User.GetHashCode()); return(hashCode); }
/// <summary> /// Notifies the instance that an item was extracted. /// </summary> /// <param name="pod">The pod the item was stored in.</param> /// <param name="item">The item that was extracted.</param> internal void NotifyItemExtracted(Pod pod, ItemDescription item) { // Update inventory fill level StorageUsage -= item.Weight; // Raise the event ItemExtracted(pod, item); }
public static Item GetItem(Store objStore, ItemDescription objItemDesc) { Logger.WriteToLogFile(Utilities.GetCurrentMethod()); Item objItem = new Item(); var results = Neo4jController.m_graphClient.Cypher .Match("(A: " + objStore.getLabel() + "{ id : { storeid }})") .Match("(B: " + objItemDesc.getLabel() + "{ id : { itemdescid}})") .Match("(A)-[: " + Rel_Store.store_item + "]->(C:" + objItem.getLabel() + ")") .Match("(C)-[:" + Rel_Item.item_itemDescription + "]->(B)") .WithParams(new { storeid = objStore.id, itemdescid = objItemDesc.id }) .Return(C => C.As <Item>()) .Results; if (results.Count() == 0) { return(null); } else { return(results.First()); } }
private void Awake() { //set singleton if (instance != null) { Destroy(gameObject); } else { instance = this; } //get objectnya inventoryView = transform.GetChild(0).Find("InventoryView").gameObject; inventoryViewPort = inventoryView.transform.Find("InventoryViewPort").gameObject; inventoryItemDescription = inventoryView.transform.Find("InventoryItemDescription").GetComponent <ItemDescription>(); inventoryAndSaveButton = inventoryView.transform.Find("InventoryAndSaveButton").gameObject; inventoryAndInventoryBoxButton = inventoryView.transform.Find("InventoryAndInventoryBoxButton").gameObject; //hitung ada berapa indicator pada viewport int h = inventoryViewPort.transform.childCount; inventoryIndicator = new InventoryIndicator[h]; for (int i = 0; i < h; i++) { inventoryIndicator[i] = inventoryViewPort.transform.GetChild(i).GetComponent <InventoryIndicator>(); } }
void ReleaseDesignerOutlets() { if (AvailableQuantity != null) { AvailableQuantity.Dispose(); AvailableQuantity = null; } if (ItemDescription != null) { ItemDescription.Dispose(); ItemDescription = null; } if (ItemImage != null) { ItemImage.Dispose(); ItemImage = null; } if (ItemTitle != null) { ItemTitle.Dispose(); ItemTitle = null; } if (UpdateButton != null) { UpdateButton.Dispose(); UpdateButton = null; } }
/// <summary> /// event is based on previous methods. if update will update description and or cost based on itemCode. if new will add new item with auto /// generated itemCode, inputed descritpion and cost. If delete will delete based on ItemCode /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnAdd_Click(object sender, RoutedEventArgs e) { _item.ItemDesc = textBoxDescription.Text; _item.ItemCode = _logic.GetId(); if (textBoxDescription.Text == string.Empty) { _item.ItemDesc = "NULL"; } if (radioButtonAdd.IsChecked == true && ValidateAdd()) { _logic.AddItem(_item); _items.Add(_item); } if (radioButtonDelete.IsChecked == true && ValidateDelete()) { _logic.DeleteItem(_item); _items.Remove(_items.FirstOrDefault(x => x.ItemCode == int.Parse(textBoxCode.Text))); } if (radioButtonUpdate.IsChecked == true && ValidateUpdate()) { _logic.UpdateItem(_item); _items = _logic.GetItems(); } _item = new ItemDescription(); UpdateTable(); }
private void AddInstrument(TestStationInstrumentData testStationInstrumentData, Color bgColor) { if (testStationInstrumentData != null) { TestStationDescriptionInstrument testStationInstrument = testStationInstrumentData.TestStationInstrument; InstrumentDescription instrument = testStationInstrumentData.InstrumentDescription; ItemDescription itemDescription = testStationInstrumentData.ItemDescription; string testStationName = testStationInstrumentData.TestStation.name; var itm = new ListViewItem(testStationName); var modelName = ""; if (instrument != null) { modelName = instrument.name; if (instrument.Identification != null && instrument.Identification.ModelName != null) { modelName = instrument.Identification.ModelName; } } else if (itemDescription != null) { modelName = itemDescription.name; if (itemDescription.Identification != null && itemDescription.Identification.ModelName != null) { modelName = itemDescription.Identification.ModelName; } } itm.SubItems.Add(modelName); itm.SubItems.Add(testStationInstrument.ID); itm.BackColor = bgColor; itm.Tag = testStationInstrumentData; lvInstruments.Items.Add(itm); } }
public bool Equals(DestinyDerivedItemDefinition input) { if (input == null) { return(false); } return (( ItemHash == input.ItemHash || (ItemHash.Equals(input.ItemHash)) ) && ( ItemName == input.ItemName || (ItemName != null && ItemName.Equals(input.ItemName)) ) && ( ItemDetail == input.ItemDetail || (ItemDetail != null && ItemDetail.Equals(input.ItemDetail)) ) && ( ItemDescription == input.ItemDescription || (ItemDescription != null && ItemDescription.Equals(input.ItemDescription)) ) && ( IconPath == input.IconPath || (IconPath != null && IconPath.Equals(input.IconPath)) ) && ( VendorItemIndex == input.VendorItemIndex || (VendorItemIndex.Equals(input.VendorItemIndex)) )); }
public static void RemoveCategories(this ItemDescription xDesc, params ItemCodex.ItemCategories[] p_enCategories) { foreach (var enCat in p_enCategories) { xDesc.lenCategory.Remove(enCat); } }
/*<h4 id="_c_specification_327">C Specification</h4> * <div class="paragraph"> * <p>Acceleration structures are an opaque structure that is built by the * implementation to more efficiently perform spatial queries on the provided * geometric data. * For this extension, an acceleration structure is either a top-level * acceleration structure containing a set of bottom-level acceleration * structures or a bottom-level acceleration structure containing either a set * of axis-aligned bounding boxes for custom geometry or a set of triangles.</p>*/ private static void TraverseDescriptions(XElement node, List <ItemDescription> list, ref bool inside) { if (node.Name == "h4") { if (node.Value == "C Specification") { inside = true; var comment = new ItemDescription(); list.Add(comment); } else if (node.Value == "Description") { inside = false; } } else if (node.Name == "p") { if (inside) { ItemDescription comment = list[list.Count - 1]; string text = node.ToString(); text = text.Substring("<p>".Length, text.Length - "<p></p>".Length); text = text.Trim(); comment.lstComment.Add(text); } } foreach (XElement item in node.Elements()) { TraverseDescriptions(item, list, ref inside); } }
public static ItemDescription GetItemDescription(Brand objBrand, String ModelNumber) { Logger.WriteToLogFile(Utilities.GetCurrentMethod()); ItemDescription objItemDescr = new ItemDescription(); if (String.IsNullOrEmpty(ModelNumber)) { throw new Exception("Model Number is null"); } var results = Neo4jController.m_graphClient.Cypher .Match("(A:" + objBrand.getLabel() + "{id : { Brandid}})") .Match("(A)-[R:" + Rel_Brand.brand_item + "]->(B: " + objItemDescr.getLabel() + "{ Model_Name : { modelNumber}})") .WithParams(new { Brandid = objBrand.id, modelNumber = ModelNumber }) .Return(B => B.As <ItemDescription>()) .Results; if (results.Count() == 0) { return(null); } else { return(results.First()); } }
private void Awake() { instance = this; background = transform.Find("Background").GetComponent <RectTransform>(); text = transform.Find("Description").GetComponent <TextMeshProUGUI>(); HideDecription_Static(); }
/// <summary> /// Добавление класса /// </summary> /// <param name="item"> /// The item. /// </param> public void AddItem(ItemDescription item) { if (!Items.ContainsKey(item.Code)) { Items.Add(item.Code, item); } }
/// <summary> /// Creates an abstract item description for an item of the specified type. /// </summary> /// <param name="id">The ID of the item description.</param> /// <param name="itemType">The type of the item.</param> /// <returns>An abstract item description.</returns> public ItemDescription CreateItemDescription(int id, ItemType itemType) { ItemDescription item = null; switch (itemType) { case ItemType.Letter: { item = new ColoredLetterDescription(this); } break; case ItemType.SimpleItem: { item = new SimpleItemDescription(this); } break; default: throw new ArgumentException("Unknown item type: " + itemType.ToString()); } item.ID = id; item.Instance = this; ItemDescriptions.Add(item); // Determine volatile ID int volatileID = 0; while (_volatileItemDescriptionIDs.Contains(volatileID)) { volatileID++; } item.VolatileID = volatileID; _volatileItemDescriptionIDs.Add(item.VolatileID); // Maintain actual ID if (_idToItemDescription.ContainsKey(item.ID)) { throw new ArgumentException("Already have an item with this ID: " + id); } _idToItemDescription[item.ID] = item; return(item); }
public TestStationInstrumentData(TestStationDescription11 testStation, TestStationDescriptionInstrument testStationInstrument) { _testStation = testStation; _testStationInstrument = testStationInstrument; _instrumentDescription = GetInstrumentDescription(testStationInstrument); _itemDescription = GetItemDescription(testStationInstrument); }
public void OnPointerEnter(PointerEventData eventData) { Vector2 offSet = new Vector2(50, 0); Vector2 pos = (Vector2)this.gameObject.transform.position + offSet; string description = PowerUpManager.Instance.powerUps[itemNumber].description; ItemDescription.ShowDecription_Static(pos, description); }
public void AddTaskItems(int id, ItemDescription item, int amount, int amountExtra) { foreach (TaskDescription Item in tasks) { if (Item.GetId() == id) { Item.AddItems(id, item, amount, amountExtra); } } }
public CollectionWriterTestDescriptor(Settings settings, string collectionName, ItemDescription[] itemDescriptions, IEdmModel model) { this.TestDescriptorSettings = settings; this.collectionName = collectionName; this.payloadItems = itemDescriptions.Select(i => i.Item).ToArray(); bool errorOnly; this.invocations = CreateInvocations(payloadItems, out errorOnly); this.expectedResultCallback = CollectionWriterUtils.CreateExpectedResultCallback(collectionName, itemDescriptions, errorOnly, this.TestDescriptorSettings.ExpectedResultSettings); this.Model = model; }
protected void Button1_Click(object sender, EventArgs e) { // instantiate an Item object // populate the Item object from the text boxes // instantiate an ItemManager object // call the ItemManager's Insert method and pass the Item Item myItem = new Item(); myItem.itemName = this.TextBox1.Text; myItem.itemType = this.DropDownList1.SelectedValue; myItem.firstMentionBook = this.DropDownList2.SelectedIndex; myItem.firstMentionChapter = this.DropDownList3.SelectedIndex; // To be added in later weeks // NOTE: exception handling and/or database modification needed to prevent duplicate Items //ItemMgr itemManager = new ItemMgr(); //itemManager.Insert(myItem); // Temporary code in order to test UI readerDB01Entities dbCntxt = new readerDB01Entities(); dbCntxt.Items.Add(myItem); dbCntxt.SaveChanges(); // Now the Item has been added, but we have to find its itemID in order to add the ItemDescription // NOTE: exception handling to be added in later weeks Item addedItem = (from rcrd in dbCntxt.Items where rcrd.itemName == myItem.itemName select rcrd).Single(); // instantiate an ItemDescription object // populate the ItemDescription object from the text boxes // instantiate an ItemDescMgr object // call the ItemDescMgr's Insert method and pass the item description ItemDescription myItemDescription = new ItemDescription(); myItemDescription.bookNumber = this.DropDownList4.SelectedIndex; myItemDescription.description = this.TextBox3.Text; myItemDescription.itemID = addedItem.itemID; // To be added in later weeks //ItemDescMgr itemDescManager = new ItemDescMgr(); //itemDescMgr.Insert(myItemDescription); // Temporary code in order to test UI dbCntxt.ItemDescriptions.Add(myItemDescription); dbCntxt.SaveChanges(); System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('" + "Item added" + "')", true); }
public void Read(ReadContext c) { var id = new ItemDescription(DescriptionSource.File); var r = c.Reader; id.ItemSize = r.ReadInt32(); id.ItemTypeName = r.ReadText(); var fieldCount = r.ReadInt32(); fieldCount.Times(() => { var f = id.NewField(); f.FieldType = (FieldType)r.ReadInt32(); f.Offset = r.ReadInt32(); f.Name = r.ReadText(); }); c.Description.ItemDescription = id; }
public CollectionWriterTestDescriptor(Settings settings, string collectionName, WriterInvocations[] invocations, Func<WriterTestConfiguration, ExpectedException> expectedExceptionFunc, ItemDescription collectionItem, ItemDescription errorItem, IEdmModel model) { this.TestDescriptorSettings = settings; this.collectionName = collectionName; ItemDescription[] itemDescriptions; bool errorOnly; this.payloadItems = CreatePayloadItems(invocations, collectionItem, errorItem, out itemDescriptions, out errorOnly); this.invocations = invocations; this.Model = model; if (expectedExceptionFunc == null) { this.expectedResultCallback = CollectionWriterUtils.CreateExpectedResultCallback(collectionName, itemDescriptions, errorOnly, this.TestDescriptorSettings.ExpectedResultSettings); } else { this.expectedResultCallback = CollectionWriterUtils.CreateExpectedErrorResultCallback(collectionName, expectedExceptionFunc, this.TestDescriptorSettings.ExpectedResultSettings); } }
//READ public ItemDescription FindItem(int id) { ItemDescription item = null; string findItem = "Select * from Items where ItemID = " + id; conn.Open(); SqlCommand com = new SqlCommand(findItem, conn); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { String stringItemID = reader["ItemID"].ToString(); int itemID = Convert.ToInt32(stringItemID); String itemDesc = reader["ItemlDescription"].ToString(); String stringMSRP = reader["MSRP"].ToString(); double salesPrice = Convert.ToDouble(stringMSRP); String stringPurchasePrice = reader["PurchasingPrice"].ToString(); double shopsPrice = Convert.ToDouble(stringPurchasePrice); item = new ItemDescription(itemDesc, itemID, salesPrice, shopsPrice); } conn.Close(); return item; }
public CollectionWriterTestDescriptor(Settings settings, string collectionName, WriterInvocations[] invocations, Func<WriterTestConfiguration, ExpectedException> expectedExceptionFunc, ItemDescription collectionItem) { this.TestDescriptorSettings = settings; this.collectionName = collectionName; ItemDescription[] itemDescriptions; bool errorOnly; this.payloadItems = CreatePayloadItems(invocations, collectionItem, null, out itemDescriptions, out errorOnly); this.invocations = invocations; if (expectedExceptionFunc == null ) { // skip validation of cases that do not expect an error this.expectedResultCallback = testConfig => null; } else { this.expectedResultCallback = testConfig => new WriterTestExpectedResults(this.TestDescriptorSettings.ExpectedResultSettings) { ExpectedException2 = expectedExceptionFunc(testConfig) }; } }
public void AddTaskItems(int id, ItemDescription item, int amount, int amountExtra) { tc.AddTaskItems(id,item,amount, amountExtra); }
public bool load(ulong appid,List<uint> types, SteamID steamid) { dynamic invResponse; Item tmpItemData; ItemDescription tmpDescription; loaded = false; try { for (int i = 0; i < types.Count; i++) { string response = SteamWeb.Fetch(string.Format("http://steamcommunity.com/profiles/{0}/inventory/json/{1}/{2}/?trading=1", steamid.ConvertToUInt64(),appid, types[i]), "GET", null, null, true); invResponse = JsonConvert.DeserializeObject(response); if (invResponse.success == false) { errors.Add("Fail to open backpack: " + invResponse.Error); return false; } //rgInventory = Items on Steam Inventory foreach (var item in invResponse.rgInventory) { foreach (var itemId in item) { tmpItemData = new Item(); tmpItemData.id = itemId.id; tmpItemData.classid = itemId.classid; items.Add((ulong)itemId.id, tmpItemData); break; } } // rgDescriptions = Item Schema (sort of) foreach (var description in invResponse.rgDescriptions) { foreach (var classid_instanceid in description)// classid + '_' + instenceid { tmpDescription = new ItemDescription(); tmpDescription.name = classid_instanceid.name; tmpDescription.type = classid_instanceid.type; tmpDescription.marketable = (bool) classid_instanceid.marketable; tmpDescription.tradable = (bool) classid_instanceid.marketable; tmpDescription.metadata = classid_instanceid.descriptions; descriptions.Add((ulong)classid_instanceid.classid, tmpDescription); break; } } }//end for (inventory type) }//end try catch (Exception e) { Console.WriteLine(e.Message); errors.Add("Exception: " + e.Message); return false; } loaded = true; return true; }
public unsafe void IsAccessibleDetectsStructHasNoFieldsException() { sizeof (A2).Should().Be(20); // has 2 fields, a, b sizeof (Other.A2).Should().Be(20); // an empty struct var ida = ItemDescription.FromAnalysis<A2>(); var ida2 = new ItemDescription(DescriptionSource.File); ida2.ItemSize = 20; ida2.ItemTypeName = "A2"; ida.IsAccessibleWith(ida2, ItemDescriptionElements.None); ida.IsAccessibleWith(ida2, ItemDescriptionElements.ItemName); ida.IsAccessibleWith(ida2, ItemDescriptionElements.ItemSize); Executing.This(() => ida2.IsAccessibleWith(ida, ItemDescriptionElements.FieldOffsets)) .Should().Throw<TypeMismatchException>() .Exception.Source.Should().Be("No ItemFields"); Executing.This(() => ida.IsAccessibleWith(ida2, ItemDescriptionElements.FieldOffsets)) .Should().Throw<TypeMismatchException>() .Exception.Source.Should().Be("No ItemFields Accessor"); // FieldNames checking includes FieldOffset checking, so the exception remains its Source Executing.This(() => ida2.IsAccessibleWith(ida, ItemDescriptionElements.FieldNames)) .Should().Throw<TypeMismatchException>() .Exception.Source.Should().Be("No ItemFields"); Executing.This(() => ida.IsAccessibleWith(ida2, ItemDescriptionElements.FieldNames)) .Should().Throw<TypeMismatchException>() .Exception.Source.Should().Be("No ItemFields Accessor"); // FieldTypes checking includes FieldOffset checking, so the exception remains its Source Executing.This(() => ida2.IsAccessibleWith(ida, ItemDescriptionElements.FieldTypes)) .Should().Throw<TypeMismatchException>() .Exception.Source.Should().Be("No ItemFields"); Executing.This(() => ida.IsAccessibleWith(ida2, ItemDescriptionElements.FieldTypes)) .Should().Throw<TypeMismatchException>() .Exception.Source.Should().Be("No ItemFields Accessor"); }
public void ExoticCoverage() { var id = new ItemDescription(DescriptionSource.File); Executing.This(() => id.GetFieldByName(null)).Should().Throw<ArgumentNullException>(); Executing.This(() => id.GetFieldByName("nonexistingfield")).Should().Throw<InvalidOperationException>(); }
//FIND ITEM private void numericUpDown1_ValueChanged(object sender, EventArgs e) { currentItem = cc.FindItem(Convert.ToInt32(numericUpDown1.Value)); if (currentItem != null) { richTextBox_Desc.Text = currentItem.GetDesc(); textBox_SalesPrice.Text = currentItem.GetSalesPrice().ToString(); textBox_shopsPrice.Text = currentItem.GetShopsPrice().ToString(); } else { richTextBox_Desc.Text = ""; textBox_SalesPrice.Text = ""; textBox_shopsPrice.Text = ""; } }
public void AddItems(int itemLineId, ItemDescription Item, int amount, int amountExtra) { materials.Add(new ItemLine(itemLineId, Item, amount, amountExtra)); }
private static object[] CreatePayloadItems( CollectionWriterTestDescriptor.WriterInvocations[] invocations, ItemDescription payloadItem, ItemDescription errorItem, out ItemDescription[] itemDescriptions, out bool errorOnly) { if (invocations == null || invocations.Length == 0) { itemDescriptions = null; errorOnly = false; return null; } List<object> payloadItems = new List<object>(); List<ItemDescription> descriptions = new List<ItemDescription>(); bool? onlyErrorsWritten = null; for (int i = 0; i < invocations.Length; ++i) { switch (invocations[i]) { case CollectionWriterTestDescriptor.WriterInvocations.StartCollection: break; case CollectionWriterTestDescriptor.WriterInvocations.Item: payloadItems.Add(payloadItem.Item); descriptions.Add(payloadItem); onlyErrorsWritten = false; break; case CollectionWriterTestDescriptor.WriterInvocations.Error: payloadItems.Add(errorItem.Item); descriptions.Add(errorItem); if (!onlyErrorsWritten.HasValue) { onlyErrorsWritten = true; } break; case CollectionWriterTestDescriptor.WriterInvocations.EndCollection: break; case CollectionWriterTestDescriptor.WriterInvocations.UserException: break; default: throw new NotSupportedException("Unsupported invocation kind."); } } itemDescriptions = descriptions.ToArray(); errorOnly = onlyErrorsWritten.HasValue && onlyErrorsWritten.Value; return payloadItems.ToArray(); }
public void IsAccessibleWith(ItemDescription accessorDescription, ItemDescriptionElements elements) { // without descriptions in the file we cannot check anything. No warning will be issued in such case, // the user is responsible to check that files have descriptions if desired. if (this.Description == null) return; if (this.Description.ItemDescription == null) return; var fileDescription = this.Description.ItemDescription; fileDescription.IsAccessibleWith(accessorDescription, elements); }