public override void Render(IRenderContext rc) { ActualBarRectangles = new List <OxyRect>(); if (!ValidItems.Any()) { return; } var actualMargin = GetActualMargin(); var actualBarWidth = GetActualBarWidth(); foreach (var item in ValidItems) { var categoryIndex = item.CategoryIndex; var value = item.Value; var x = actualMargin / 2 * Math.Sign(value); var topValue = x + value; var categoryValue = categoryIndex - 0.5 + Manager.GetCurrentBarOffset(categoryIndex); var rect = new OxyRect(this.Transform(x, categoryValue), this.Transform(topValue, categoryValue + actualBarWidth)); ActualBarRectangles.Add(rect); RenderItem(rc, topValue, categoryValue, actualBarWidth, item, rect); RenderLabel(rc, item, x - (Math.Sign(value) * actualBarWidth), topValue, categoryValue, categoryValue + actualBarWidth); Manager.IncreaseCurrentBarOffset(categoryIndex, actualBarWidth); } RenderSpacing(rc, actualMargin / 2, ValidItems); }
public ExtractedGame(IGameExtractor extractor) { MoveList = extractor.ExtractMoves(); Abilities = extractor.ExtractAbilities(); PokemonList = extractor.ExtractPokemon(); GiftPokemonList = extractor.ExtractGiftPokemon(); ItemList = extractor.ExtractItems(); OverworldItemList = extractor.ExtractOverworldItems(); Pokemarts = extractor.ExtractPokemarts().OrderBy(m => m.FirstItemIndex).ToArray(); TrainerPools = extractor.ExtractPools(PokemonList, MoveList); ValidMoves = MoveList.Where(m => m.MoveIndex != 0 && m.MoveIndex != 355).ToArray(); ValidPokemon = PokemonList.Where(p => !RandomizerConstants.SpecialPokemon.Contains(p.Index)).ToArray(); ValidItems = ItemList.Where(i => !RandomizerConstants.InvalidItemList.Contains(i.Index)).ToArray(); NonKeyItems = ValidItems.Where(i => i.BagSlot != BagSlots.KeyItems && i.BagSlot != BagSlots.None).ToArray(); TMs = ItemList.Where(i => i is TM).Select(i => i as TM).ToArray(); if (extractor is XDExtractor xd) { isXD = true; TutorMoves = xd.ExtractTutorMoves(); } else { isXD = false; TutorMoves = Array.Empty <TutorMove>(); } }
internal ProjectCompilation Update(Dictionary <int, int> projRefs, List <MetadataReference> references, List <SyntaxTree> sources) { Contract.Ensures(Contract.Result <ProjectCompilation>().IsValid); ValidItems valid = _valid; var compilation = _compilation; if (references != null) { compilation = compilation.RemoveAllReferences() .AddReferences(references); valid |= ValidItems.References; } if (sources != null) { compilation = compilation.RemoveAllSyntaxTrees() .AddSyntaxTrees(sources); valid |= ValidItems.Sources | ValidItems.Configuration; } return(new ProjectCompilation( compilation, _id, (projRefs ?? new Dictionary <int, int>()).ToImmutableDictionary(), valid, _version + 1)); }
public override global::System.Data.DataSet Clone() { ValidItems cln = ((ValidItems)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
private ProjectCompilation(CSharpCompilation compilation, int id, ImmutableDictionary<int, int> projectReferences, ValidItems valid, int version) { Contract.Requires(projectReferences != null); _compilation = compilation; _valid = valid; _version = version; _id = id; _projectReferences = projectReferences; }
private ProjectCompilation(CSharpCompilation compilation, int id, ImmutableDictionary <int, int> projectReferences, ValidItems valid, int version) { Contract.Requires(projectReferences != null); _compilation = compilation; _valid = valid; _version = version; _id = id; _projectReferences = projectReferences; }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { ValidItems ds = new ValidItems(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
private void Callback() { if (EnergyHandler.Energy < EnergyPerItem) return; int slot = Handler.GetFirstInput(); if (slot != -1) { Item item = Handler.GetItemInSlot(slot); if (ValidItems.Contains(item.type)) { (int type, int amount) = ExtractinatorUse(item.type); if (Handler.OutputSlots.Any((i, _) => i.IsAir || i.type == type && i.stack + amount <= i.maxStack)) { for (int i = 0; i < Handler.Slots; i++) { if (Handler.Modes[i] != SlotMode.Output) continue; if (Handler.Items[i].type == type && Handler.Items[i].stack + amount <= Handler.Items[i].maxStack) { Handler.Items[i].stack += amount; break; } if (Handler.Items[i].IsAir) { Handler.Items[i].SetDefaults(type); break; } } Handler.Shrink(slot, 1); EnergyHandler.ExtractEnergy(EnergyPerItem); } } } }
public AutoExtractinator() { timer = new BaseLibrary.Timer(60, Callback); Handler = new ItemHandler(11) { Modes = { [1] = SlotMode.Input, [2] = SlotMode.Output, [3] = SlotMode.Output, [4] = SlotMode.Output, [5] = SlotMode.Output, [6] = SlotMode.Output, [7] = SlotMode.Output, [8] = SlotMode.Output, [9] = SlotMode.Output, [10] = SlotMode.Output } }; Handler.IsItemValid += (slot, item) => { switch (slot) { case 0: return item.modItem is BaseContainmentUnit; case 1: return ValidItems.Contains(item.type); default: return false; } }; EnergyHandler = new EnergyHandler(10000, 1000); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); ValidItems ds = new ValidItems(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "ValidDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }