internal void Build(SectionBuilder sectionBuilder) { var tableBuilder = CreateTable(sectionBuilder, 3); AddTitle(tableBuilder, "Section B - Cancellation/Curtailment/Postponement"); tableBuilder .AddRow() .AddCell() .SetColSpan(3) .SetPadding(0, 2, 0, 5) .AddParagraphToCell("Documents required for Section B\n• documents from " + "carrier/travel agent and any relevant documents to support your claim"); CreateRow(tableBuilder, new Dictionary <string, int>() { { "When and where was the trip booked?", 1 }, { "Intended Departure Date", 1 }, { "Date of cancellation ", 1 } }); CreateRow(tableBuilder, new Dictionary <string, int>() { { "Why was the trip cancelled?", 3 } }); CreateRow(tableBuilder, new Dictionary <string, int>() { { "Amount paid by you", 1 }, { "Amount recovered from other sources", 1 }, { "Amount Claimed", 1 } }); }
private void AddWhatsNext(SectionBuilder sectionBuilder) { var paragraphBuilder = sectionBuilder.AddParagraph("What's next?"); paragraphBuilder.SetMarginTop(42).SetFont(FNT11B); sectionBuilder.AddLine(PageWidth, 2, Stroke.Solid); var tableBuilder = sectionBuilder.AddTable(); tableBuilder .SetWidth(XUnit.FromPercent(100)) .SetBorder(Stroke.None) .AddColumnPercentToTable("", 50) .AddColumnPercent("", 50); int halfSize = WhatsNextData.Count - WhatsNextData.Count / 2; var rowBuilder = tableBuilder.AddRow(); var cellBuilder = rowBuilder.AddCell(); cellBuilder.SetPadding(0, 6, 4, 0).SetFont(FNT8); FillWhatNextHalf(0, halfSize, cellBuilder); cellBuilder = rowBuilder.AddCell(); cellBuilder.SetPadding(4, 6, 0, 0).SetFont(FNT8); FillWhatNextHalf(halfSize, WhatsNextData.Count, cellBuilder); paragraphBuilder = sectionBuilder.AddParagraph("Have a good flight!"); paragraphBuilder .SetAlignment(HorizontalAlignment.Center) .SetMarginTop(20) .SetMarginBottom(30) .SetFont(FNT17); sectionBuilder .AddLine(PageWidth, 0.5f, Stroke.Dashed).SetMarginBottom(24); }
public static Dictionary <string, HashSet <string> > Parse(IEnumerable <string> lines) { SectionBuilder builder = new SectionBuilder(); int lineNumber = 0; foreach (string t in lines) { lineNumber++; string currentLine = t.Trim(); if (string.IsNullOrEmpty(currentLine)) { continue; // ignore empty lines } if (currentLine.StartsWith("#")) { continue; // ignore comments } if (currentLine.StartsWith("[") && currentLine.EndsWith("]")) { string sectionName = currentLine.Substring(1, currentLine.Length - 2); ThrowIfContainsInvalidCharacters(sectionName, lineNumber); builder.BeginSection(sectionName); } else { builder.Add(currentLine, lineNumber); } } return(builder.Sections); }
public static Dictionary<string, HashSet<string>> Parse(IEnumerable<string> lines) { SectionBuilder builder = new SectionBuilder(); int lineNumber = 0; foreach (string t in lines) { lineNumber++; string currentLine = t.Trim(); if (string.IsNullOrEmpty(currentLine)) continue; // ignore empty lines if (currentLine.StartsWith("#")) continue; // ignore comments if (currentLine.StartsWith("[") && currentLine.EndsWith("]")) { string sectionName = currentLine.Substring(1, currentLine.Length - 2); ThrowIfContainsInvalidCharacters(sectionName, lineNumber); builder.BeginSection(sectionName); } else { builder.Add(currentLine, lineNumber); } } return builder.Sections; }
internal static SectionBuilder AddLastFooter(this SectionBuilder s) { s.AddFooterToBothPages(45) .AddParagraph() .AddPageNumber(); return(s); }
private void BuildRouteInfo(SectionBuilder sectionBuilder) { sectionBuilder.AddParagraph("Route") .SetFont(FNT11_B).SetMarginTop(22); sectionBuilder.AddLine(PageWidth, 2f, Stroke.Solid); FillRouteInfoTable(sectionBuilder.AddTable()); }
public static IniSection[] Parse(string[] lines) { SectionBuilder builder = new SectionBuilder(); for (int i = 0; i < lines.Length; i++) { if (string.IsNullOrEmpty(lines[i])) { continue; } // ignore empty lines string currentLine = lines[i].Trim(); if (currentLine.StartsWith("#")) { continue; // ignore comments } else if (currentLine.StartsWith("[") && currentLine.EndsWith("]")) { builder.AddSection(currentLine.Substring(1, currentLine.Length - 2)); } else { builder.Add(lines[i]); } } builder.Pop(); builder.sections.Sort(); return(builder.sections.ToArray()); }
private void AddAccountBalanceCalculationWorksheet(SectionBuilder sectionBuilder) { float repAreaWidth = PageWidth * 0.5f - 1; sectionBuilder.AddRptAreaLeftToBothPages(repAreaWidth, AddInstructions); sectionBuilder.AddRptAreaRightToBothPages(repAreaWidth, AddBalanceCalc); }
private void AddBlockTitle(SectionBuilder sectionBuilder, string title) { var paragraphBuilder = sectionBuilder.AddParagraph(); paragraphBuilder .SetMarginTop(12).SetMarginBottom(4).SetFont(FNT12B).AddText(title); }
public void addConcertTable(SectionBuilder section) { var concertTable = section.AddTable() .SetContentRowStyleBorder(borderBuilder => borderBuilder.SetStroke(Stroke.None)); concertTable .SetWidth(XUnit.FromPercent(100)) .AddColumnPercentToTable("", 20) .AddColumnPercentToTable("", 30) .AddColumnPercentToTable("", 20) .AddColumnPercentToTable("", 30); var row1Builder = concertTable.AddRow(); AddLogoImage(row1Builder.AddCell("", 0, 2)); AddConcertData(row1Builder.AddCell("", 3, 0) .SetPadding(32, 0, 0, 0)); var row2Builder = concertTable.AddRow(); row2Builder.AddCell(); No(row2Builder.AddCell("").SetFont(FNT10) .SetPadding(32, 0, 0, 0)); FillTicketData(row2Builder.AddCell()); FillPersonalInfo(row2Builder.AddCell()); }
public async Task Builder_BuildsSections_WhenUseExists() { //ARRANGE var user = new User { Email = "*****@*****.**", UserName = "******" }; string userId = Guid.NewGuid().ToString(); var characters = await fixture.Context.Characters.ToListAsync(); var characterDtos = new List <BaseCharacterDto> { mapper.Map <BaseCharacterDto>(characters[1]) }; var builder = new SectionBuilder(characters[0], characterDtos, userId); //ACT builder.BuildMainTagSection(); builder.BuildTierSection(); builder.BuildTipsSection(); builder.BuildSimilarInGameSection(); builder.BuildSimilarInGenreSection(); builder.BuildCounteredBySection(); builder.BuildStrongAgainstSection(); builder.BuildSynergizesWithSection(); var result = builder.GetResult(); //ASSERT Assert.NotNull(result); Assert.True(result.Count == 7); }
public void addInfoTable(SectionBuilder section) { var infoTable = section.AddTable() .SetContentRowStyleBorder(borderBuilder => borderBuilder.SetStroke(Stroke.None)); infoTable .SetMarginTop(9f) .SetWidth(XUnit.FromPercent(100)) .AddColumnPercentToTable("", 50) .AddColumnPercentToTable("", 25) .AddColumnPercentToTable("", 25); var row3Builder = infoTable.AddRow(); FillRuleA(start: 0, end: 10, row3Builder.AddCell("").SetFont(FNT10)); FillRuleP(row3Builder.AddCell("", 2, 0).SetFont(FNT10)); var row4Builder = infoTable.AddRow(); FillBandlist(row4Builder.AddCell("").SetFont(FNT12)); row4Builder.AddCell("") .AddImage(Path.Combine("images", "CT_Location.png")).SetHeight(400) .SetMarginTop(9); AddContactInfo(row4Builder.AddCell("").SetFont(FNT12)); }
private static SectionBuilder AddReceiptTitle(this SectionBuilder s) { s.AddImage(ImageUrl).SetScale(ScalingMode.OriginalSize).SetAlignment(HorizontalAlignment.Center); s.AddParagraph("Receipt").SetMargins(0, 20, 0, 10).SetFont(TitleFont).SetAlignment(HorizontalAlignment.Center); s.AddLine().SetColor(Color.FromRgba(106.0 / 255.0, 85.0 / 255.9, 189.0 / 255.0)).SetStroke(Stroke.Solid).SetWidth(2); return(s); }
// Start is called before the first frame update void Start() { //setup map configurations tileMapGenerators = new List <TileMapGenerator>(); setupMapConfigurations(new List <string>() { "simpleTest2" }); tiles = new Dictionary <int, Tile>() { { 1, dirtTile }, { 2, grassTile } }; sections = new List <Section>(); sectionBuilder = SectionBuilderFactory.getSectionBuilder("STANDARD"); tileMapAlteration = TileMapAlterationFactory.getSectionBuilder("TOP_LAYER"); planetTileMappings = SaveLoadManager.loadTileMappings(); //eventually array will be generated from a starting section and surrounding positions generateSectionsInView(0); SaveLoadManager.saveTileMappings(planetTileMappings); }
private void AddTransactionHistory(SectionBuilder sectionBuilder, float bottomMargin) { AddStatementsHeadLine(sectionBuilder); AddStatementsTable(sectionBuilder); AddEndingDayBalanceComment(sectionBuilder, bottomMargin); }
public async void SchemaCreationTest() { // initialize schema and json var schema = await SectionBuilder.CreateSchema(); var schemaString = schema.ToJson(); string json = builder.Serialize(); // write files to disk for later examination string jsonPath = ResDir; using (var writer = new StreamWriter(jsonPath + @"\" + SchemaName)) { writer.Write(schemaString); } using (var writer = new StreamWriter(jsonPath + @"\" + JsonName)) { writer.Write(json); } string tsPath = ResDir; await SectionBuilder.CreateTypescriptClass(await SectionBuilder.CreateSchema(), tsPath + @"\" + TsName); Assert.True(SectionBuilder.Validate(json, schema)); }
private void InitializeBluePrint() { Segments.Add(Assembly.DosHeader); Segments.Add(Assembly.NtHeaders); Segments.Add(_sectionsTableBuilder); _textSectionBuilder = _sectionsTableBuilder.GetSectionBuilder(".text"); _textSectionBuilder.Header.Attributes = ImageSectionAttributes.MemoryExecute | ImageSectionAttributes.MemoryRead | ImageSectionAttributes.ContentCode; _textSectionBuilder.Segments.Add(TextBuilder = new NetTextBuilder(Assembly.NetDirectory)); if (Assembly.RootResourceDirectory != null) { _rsrcSectionBuilder = _sectionsTableBuilder.GetSectionBuilder(".rsrc"); _rsrcSectionBuilder.Header.Attributes = ImageSectionAttributes.MemoryRead | ImageSectionAttributes.ContentInitializedData; } if (Assembly.RelocationDirectory != null) { _relocSectionBuilder = _sectionsTableBuilder.GetSectionBuilder(".reloc"); _relocSectionBuilder.Header.Attributes = ImageSectionAttributes.MemoryRead | ImageSectionAttributes.MemoryDiscardable | ImageSectionAttributes.ContentInitializedData; } }
public async Task Builder_BuildsSections_WhenUserDoesntExist() { //ARRANGE var user = await fixture.Context.Users.FirstAsync(); var characters = await fixture.Context.Characters.ToListAsync(); var characterDtos = new List <BaseCharacterDto> { mapper.Map <BaseCharacterDto>(characters[1]) }; var builder = new SectionBuilder(characters[0], characterDtos, user.Id); //ACT builder.BuildMainTagSection(); builder.BuildTierSection(); builder.BuildTipsSection(); builder.BuildSimilarInGameSection(); builder.BuildSimilarInGenreSection(); builder.BuildCounteredBySection(); builder.BuildStrongAgainstSection(); builder.BuildSynergizesWithSection(); var result = builder.GetResult(); //ASSERT Assert.NotNull(result); Assert.True(result.Count == 7); }
private void BuildSignatures(SectionBuilder sectionBuilder, Sign[] data) { for (int i = 0, l = data.Length; i < l; i++) { Sign sign = data[i]; var paragraphBuilder = sectionBuilder.AddParagraph(); if (i == 0) { paragraphBuilder.SetMarginTop(SIGNATURES_TOP_MARGIN); } if (i < 2) { paragraphBuilder .SetFont(HEADER_FONT) .AddTextToParagraph( i == 0 ? "LANDLORD(S) SIGNATURE" : "TENANT(S) SIGNATURE" ) .SetMarginBottom(SIGNATURE_BOTTOM_MARGIN); paragraphBuilder = sectionBuilder.AddParagraph(); } paragraphBuilder .AddTextToParagraph(sign.name + " ", HEADER_FONT, true) .AddTabulation(380, TabulationType.Left, TabulationLeading.BottomLine); if (sign.value != null) { paragraphBuilder = sectionBuilder.AddParagraph() .AddTextToParagraph(sign.value); } paragraphBuilder.SetMarginBottom(SIGNATURE_BOTTOM_MARGIN); } }
internal static SectionBuilder AddContractText(this SectionBuilder s) { foreach (var paragraph in ContractContent) { s.AddParagraph(paragraph).SetFont(DocumentFont).SetJustifyAlignment(true); } return(s); }
internal static SectionBuilder AddSeparationArea(this SectionBuilder s) { s.AddRptAreaRightToBothPages(20f) .AddLine(length: 0.5f, width: s.PageSize.Height - s.Margins.Vertical) .SetMarginLeft(9f) .SetColor(Color.Gray); return(s); }
public RobotsTxtOptionsBuilder AddSection(Func <SectionBuilder, SectionBuilder> builder) { var sectionBuilder = new SectionBuilder(); sectionBuilder = builder(sectionBuilder); _options.Sections.Add(sectionBuilder.Section); return(this); }
private void AddTransactionFeeSummary(SectionBuilder sectionBuilder) { AddTransactionFeeSummaryParagrpaph(sectionBuilder); AddTransactionFeeSummaryTable(sectionBuilder); sectionBuilder .AddLine(PageWidth, 0.5f, Stroke.Solid); AddYourFeedBack(sectionBuilder); }
internal static SectionBuilder AddContractTitle(this SectionBuilder s) { s.AddParagraph("House Rental Contract") .SetAlignment(HorizontalAlignment.Center) .SetMargins(0, 0, 0, 20) .SetFont(TitleFont); return(s); }
internal void Build(SectionBuilder sectionBuilder) { var tableBuilder = CreateTable(sectionBuilder, 3); AddTitle(tableBuilder, "Section A - Personal Accident/Illness – " + "Medical And Additional Expenses"); tableBuilder .AddRow() .AddCell() .SetColSpan(3) .SetPadding(0, 2, 0, 5) .AddParagraphToCell("Documents required for Section A\n• original " + "medical receipts and copy of discharge summary or available " + "medical report") .ToTable() .AddRow() .SetBorderWidth(0, 0, 0, 0.5f) .SetBorderStroke(Stroke.Solid) .AddCell() .SetPadding(1, 1, 0, 10) .AddParagraph("Have you suffered this illness or injury or a similar " + "condition or a recurrence of a previous illness or injury? ") .ToRow() .AddCell() .SetPadding(1, 10, 0, 0) .AddParagraph() .AddInlineImage(CheckboxPath) .SetSize(16, 16) .ToParagraph() .AddText(" Yes", addTabulationSymbol: true) .SetFont(FNT12) .ToParagraph() .AddTabulationInPercent(50, TabulationType.Left) .AddInlineImage(CheckboxPath) .SetSize(16, 16) .ToParagraph() .AddText(" No") .SetFont(FNT12) .ToRow() .AddCell() .SetPadding(1, 1, 0, 10) .AddParagraph("If yes, please specify:") .ToTable() .AddRow() .SetBorderWidth(0, 0, 0, 0.5f) .SetBorderStroke(Stroke.Solid) .AddCell() .SetPadding(1, 1, 0, 0) .AddParagraphToCell("State amount claimed:") .AddParagraph("$") .SetFont(FNT12) .ToRow() .AddCell() .SetColSpan(2) .SetPadding(1, 1, 0, 17) .AddParagraph("Give name and address of your usual attending Doctor"); }
internal void Build(SectionBuilder sectionBuilder) { var tableBuilder = CreateTable(sectionBuilder, 2, 0); AddTitle(tableBuilder, "Section C - Luggage & Personal Effects", 2); tableBuilder .AddRow() .AddCell() .SetColSpan(2) .SetPadding(0, 7) .AddParagraphToCell("Documents required for Section C\n• Police Report " + "and original purchase receipts and/or warranty cards") .ToTable() .AddRow() .SetBorderWidth(0, 0, 0, 0.5f) .SetBorderStroke(Stroke.Solid) .AddCell() .SetPadding(1, 1, 0, 17) .AddParagraph() .AddText("Item", addTabulationSymbol: true) .ToParagraph() .AddTabulationInPercent(30, TabulationType.Left) .AddText("Description") .ToRow() .AddCell() .SetPadding(1, 1, 0, 10) .AddParagraph() .AddText("When and where", addTabulationSymbol: true) .ToParagraph() .AddTabulationInPercent(25, TabulationType.Left) .AddText("Original purchased", addTabulationSymbol: true) .ToParagraph() .AddTabulationInPercent(50, TabulationType.Left) .AddText("Depreciation of wear", addTabulationSymbol: true) .ToParagraph() .AddTabulationInPercent(75, TabulationType.Left) .AddText("Amount Claimed") .ToCell() .AddParagraph() .AddText("purchased", addTabulationSymbol: true) .ToParagraph() .AddTabulationInPercent(25, TabulationType.Left) .AddText("price", addTabulationSymbol: true) .ToParagraph() .AddTabulationInPercent(50, TabulationType.Left) .AddText("and tear"); CreateRow(tableBuilder, new Dictionary <string, int>() { { "", 2 } }, 10); CreateRow(tableBuilder, new Dictionary <string, int>() { { "", 2 } }, 10); }
private void BuildHead(SectionBuilder sectionBuilder) { var tableBuilder = sectionBuilder.AddTable(); tableBuilder .SetContentRowStyleFont(FNT9) .SetBorder(Stroke.None) .SetWidth(XUnit.FromPercent(100)) .AddColumnPercentToTable("", 33) .AddColumnPercentToTable("", 33) .AddColumnPercentToTable("", 17) .AddColumnPercent("", 17); var rowBuilder = tableBuilder.AddRow(); var cellBuilder = rowBuilder.AddCell(); cellBuilder.SetPadding(0, 0, 4, 0); var paragraphBuilder = cellBuilder.AddParagraph(); paragraphBuilder .AddInlineImage(Path.Combine(ps.ImageDir, "MB_Logo_2x.png")); cellBuilder = rowBuilder.AddCell(); cellBuilder.SetPadding(4, 0, 4, 0); paragraphBuilder = cellBuilder.AddParagraph(); paragraphBuilder .AddInlineImage(Path.Combine(ps.ImageDir, "Clinicare_2x.png")) .SetAlignment(HorizontalAlignment.Center); cellBuilder = rowBuilder.AddCell(); cellBuilder.SetColSpan(2).SetPadding(4, 0, 0, 0); paragraphBuilder = cellBuilder.AddParagraph(); paragraphBuilder .AddInlineImage(Path.Combine(ps.ImageDir, "Healthcare_2x.png")) .SetAlignment(HorizontalAlignment.Right); rowBuilder = tableBuilder.AddRow(); cellBuilder = rowBuilder.AddCell(); cellBuilder .SetPadding(4) .AddParagraphToCell(ps.CenterName + "\n" + ps.CenterAddress); cellBuilder = rowBuilder.AddCell(); cellBuilder .SetPadding(4) .AddParagraphToCell("To Contact Us Call: " + ps.CenterPhone + "\n\nPhone representatives are available:\n8am to 8pm Monday - Thursday\nand 8am to 4:30pm Friday"); cellBuilder = rowBuilder.AddCell(); cellBuilder .SetPadding(4) .AddParagraphToCell("Guarantor Number:\nGuarantor Name:\nStatement Date:\nDue Date:"); cellBuilder = rowBuilder.AddCell(); cellBuilder .SetPadding(4) .AddParagraphToCell( ps.GuarantorNumber + "\n" + ps.GuarantorName + "\n" + ps.StatementDate + "\nUpon Receipt") .SetHorizontalAlignment(HorizontalAlignment.Right); }
public ConfigSourceBuilder AddCryptoSettings() { CryptoSectionBuilder builder = new SectionBuilder().CryptoSection(); builder.AddHashProvider<MD5CryptoServiceProvider>().Named("md5").AsDefault .AddHashProvider<SHA512CryptoServiceProvider>().Named("sha512") .AddTo(configSource); return this; }
static int ShowObjectSelect(SectionBuilder builder, int select) { string[] names = new string[builder.transform.childCount]; for (int i = 0; i < names.Length; i++) { names[i] = builder.transform.GetChild(i).name; } return EditorGUILayout.Popup("Section Object Select", select, names); }
private void AddInfoTitle(SectionBuilder sectionBuilder) { var paragraphBuilder = sectionBuilder.AddParagraph(); paragraphBuilder .SetMarginTop(17) .SetFont(FNT9) .AddTextToParagraph("If any of this following has changed since your last statement, please indicate…"); }
private void BuildAboutTrip(SectionBuilder sectionBuilder) { sectionBuilder.AddParagraph("About your trip") .SetFont(FNT11_B).SetMarginTop(14); var lineBuilder = sectionBuilder.AddLine(PageWidth, 2f, Stroke.Solid); lineBuilder.SetMarginBottom(10); BuildAboutList(sectionBuilder); }
public ConfigSourceBuilder AddPolicyInjectionSettings() { PiabSectionBuilder builder = new SectionBuilder().PiabSection(); builder .AddPolicy(PolicyName) .AddTo(configSource); return this; }
public static void AddParagraph(SectionBuilder sectionBuilder, string text, FontBuilder paragrpaphFont, float bottomMagin = 0.0f) { var paragraphBuilder = sectionBuilder.AddParagraph(); paragraphBuilder.AddTextToParagraph(text) .SetMarginBottom(bottomMagin) .SetFont(paragrpaphFont); }
static int ShowObjectSelect(SectionBuilder builder, int select) { string[] names = new string[builder.transform.childCount]; for (int i = 0; i < names.Length; i++) { names[i] = builder.transform.GetChild(i).name; } return(EditorGUILayout.Popup("Section Object Select", select, names)); }
public ConfigSourceBuilder AddExceptionHandlingSettings() { ExceptionSectionBuilder builder = new SectionBuilder().ExceptionSection(); builder .AddPolicy(DefaultExceptionPolicyName) .AddException<Exception>().Named("all").NotifyRethrow .AddWrapHandler().Named("wrap").WithMessage("New message").WrapWith<ArgumentException>() .AddTo(configSource); return this; }
static void ShowSectionObject(SectionBuilder builder, Transform obj) { GUILayout.BeginHorizontal(); GUI.enabled = Selection.activeTransform != null && !Selection.activeTransform.Equals(obj); if (GUILayout.Button("Select Section Object")) { Selection.activeTransform = obj; } GUI.enabled = true; GUILayout.EndHorizontal(); }
public ConfigSourceBuilder AddConnectionStringSettings() { ConnectionStringsSectionBuilder builder = new SectionBuilder().ConnectionStringsSection(); builder .AddConnection() .Named("northwind") .WithString(NorthwindConnectionString) .WithProvider(DbProviderMapping.DefaultSqlProviderName) .AsDefault .AddTo(configSource); return this; }
public static IniSection[] Parse(string[] lines) { SectionBuilder builder = new SectionBuilder(); for (int i = 0; i < lines.Length; i++) { if(string.IsNullOrEmpty(lines[i])){ continue; } // ignore empty lines string currentLine = lines[i].Trim(); if (currentLine.StartsWith("#")) { continue; // ignore comments }else if (currentLine.StartsWith("[") && currentLine.EndsWith("]")) { builder.AddSection(currentLine.Substring(1, currentLine.Length - 2)); } else { builder.Add(lines[i]); } } builder.Pop(); builder.sections.Sort(); return builder.sections.ToArray(); }
public static void Show(SectionBuilder builder, SectionBuilderData data) { UpdateSectionObjects(builder); GUILayout.Label("Section Builder",EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUI.enabled = builder.PlayerPointObject!=null; EditorGUILayout.ObjectField("Player Point",builder.PlayerPointObject==null ? null : builder.PlayerPointObject.transform,typeof(Transform),true); if (GUILayout.Button("Select",EditorStyles.miniButton,GUILayout.Width(50))) { Selection.activeTransform = builder.PlayerPointObject.transform; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save", EditorStyles.miniButton, new GUILayoutOption[] { GUILayout.Width(50) })) { builder.BuildPrefab(); } GUI.enabled = builder.IsValid(); builder.prefabPath = EditorGUILayout.TextField(builder.prefabPath); GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Load", EditorStyles.miniButton, new GUILayoutOption[] { GUILayout.Width(50) })) { builder.LoadSection(data.prefab.gameObject); } data.prefab = (Transform)EditorGUILayout.ObjectField(data.prefab, typeof(Transform), true, new GUILayoutOption[] { }); GUILayout.EndHorizontal(); GUILayout.Label("Section Object", EditorStyles.boldLabel); if (builder.transform.childCount != 0) { selectedObject = ShowObjectSelect(builder, selectedObject); if (selectedObject >= builder.transform.childCount) { selectedObject = 0; } Transform transform = builder.transform.GetChild(selectedObject); ShowSectionObject(builder, transform); } }
static void UpdateSectionObjects(SectionBuilder builder) { for(int i = 0; i < builder.transform.childCount;i++) { Transform child = builder.transform.GetChild(i); if (childObjects.Contains(child)) { } else { builder.AddSectionObject(child); } } }
protected IConfigurationSource GetConfig() { SectionBuilder builder = new SectionBuilder(); builder.LocatorSection() .AddProvider<MockRegistrationProvider>() .WithProviderName("MockRegistrationProvider") .AddTo(updatableConfigSource); return updatableConfigSource; }
public void Start() { if (!customSeed) { DateTime epochStart = new System.DateTime(1970, 1, 1, 8, 0, 0, System.DateTimeKind.Utc); seed = (int) (System.DateTime.UtcNow - epochStart).TotalSeconds; } UnityEngine.Random.seed = seed; //A grid of sections int[,][,] master = new int[sectionsX,sectionsY][,]; //build each section SectionBuilder lastSection = null; for (int width = 0; width < master.GetLength(0); width++) { for (int height = 0; height < master.GetLength(1); height++) { EntrancePositions entrances; if (lastSection == null) { entrances = new EntrancePositions(new EntrancePosition(UnityEngine.Random.Range(1,(int) (levelSize.y/sectionsY)),2),new EntrancePosition(),new EntrancePosition(),new EntrancePosition()); } else { entrances = new EntrancePositions(lastSection.finalEntrancePositions.eastEntrance, new EntrancePosition(), new EntrancePosition(), new EntrancePosition()); } Vector2 scaleNewSection = new Vector2(levelSize.x/sectionsX, levelSize.y/sectionsY); SBParams sbParams = new SBParams(); sbParams.size = scaleNewSection; sbParams.entrancePositions = entrances; sbParams.Pittiness = 0.09f; sbParams.Hilliness = .09f; SectionBuilder newSection = new SectionBuilder(this, sbParams); int[,] section = newSection.Build(); //Store each section in master master[width, height] = section; lastSection = newSection; } } //merge random sections //for each section border shared with another section roll a number //each section border will be compared only once by going through each section and checking their top and right edges for (int width = 0; width < master.GetLength(0)-1; width++) { for (int height = 0; height < master.GetLength(1); height++) { //Determine if you want to merge right if (UnityEngine.Random.Range(0,100) < MergeChance) { //Merge to the right for (int j = 0; j < master[width,height].GetLength(1); j++) { //Don't overwrite entrances if (master[width,height][1,j] != (int) AssetTypeKey.Entrance) { //overwrite right most tiles with second to leftmost tiles in next section master[width,height][master[width,height].GetLength(0)-1,j] = master[width+1,height][1,j]; //overwrite the tiles in the first section now master[width+1,height][0,j] = master[width,height][master[width,height].GetLength(0)-2,j]; } } } } } //generate the sections using the representative arrays for (int width = 0; width < master.GetLength(0); width++) { for (int height = 0; height < master.GetLength(1); height++) { for (int i = 0; i < master[width,height].GetLength(0); i++) { for (int j = 0; j < master[width,height].GetLength(1); j++) { if (master[width,height][i,j] == (int) AssetTypeKey.GroundBlock) { float centerX = groundBlock.sprite.bounds.extents.x * 2 * i + ( groundBlock.sprite.bounds.extents.y * 2 * master[width,height].GetLength(0)* width); float centerY = groundBlock.sprite.bounds.extents.y * 2 * j + ( groundBlock.sprite.bounds.extents.y * 2 * master[width,height].GetLength(1) * height); Instantiate(groundBlock, new Vector3(centerX,centerY,0), new Quaternion()); } } } } } }
public void Given() { var configSource = new DictionaryConfigurationSource(); var mockEventSourceProvider = new Mock<IContainerReconfiguringEventSource>(); var section = new MockSection(); configSource.Add(SectionName, section); var builder = new SectionBuilder(); builder.LocatorSection() .AddConfigSection(SectionName).WithProviderName("MockSectionProvider") .AddTo(configSource); var eventArgs = new Mock<ContainerReconfiguringEventArgs>(configSource, new[] { SectionName }); var provider = TypeRegistrationsProvider.CreateDefaultProvider(configSource, mockEventSourceProvider.Object); MockSection.UpdatedRegistrationsWasCalled = false; mockEventSourceProvider.Raise(e => e.ContainerReconfiguring += null, eventArgs.Object); }