public override void Update() { button.Update(); //match the target to the button each frame line.SetTarget( button.window.rec_bkg.openedRec.X + offsetX, button.window.rec_bkg.openedRec.Y + offsetY); //insta match the line's length (bypass animation) if (displayState == DisplayState.Opened) { line.line.animLength = line.line.length; } //else we allow the lines to close line.Update(); //wait for line to complete opening before opening button if (line.displayState == DisplayState.Opened) { button.Open(); } //set display state based on instances if (button.displayState == DisplayState.Opening || line.displayState == DisplayState.Opening) { displayState = DisplayState.Opening; } else if (button.displayState == DisplayState.Opened & line.displayState == DisplayState.Opened) { displayState = DisplayState.Opened; } else if (button.displayState == DisplayState.Closing || line.displayState == DisplayState.Closing) { displayState = DisplayState.Closing; } else if (button.displayState == DisplayState.Closed & line.displayState == DisplayState.Closed) { displayState = DisplayState.Closed; } }
public Screen_Title() { aui_instances = new List <AUI_Base>(); button_screen1 = new AUI_Button( 16 * 8, 16 * 20, 16 * 5, "crown example"); button_screen1.CenterText(); aui_instances.Add(button_screen1); button_screen2 = new AUI_Button( 16 * 15, 16 * 20, 16 * 5, "stress test"); button_screen2.CenterText(); aui_instances.Add(button_screen2); button_screen3 = new AUI_Button( 16 * 22, 16 * 20, 16 * 5, "spider game"); button_screen3.CenterText(); aui_instances.Add(button_screen3); button_screen4 = new AUI_Button( 16 * 29, 16 * 20, 16 * 5, "example 4"); button_screen4.CenterText(); aui_instances.Add(button_screen4); button_screen5 = new AUI_Button( 16 * 36, 16 * 20, 16 * 5, "example 5"); button_screen5.CenterText(); aui_instances.Add(button_screen5); titleText = new AUI_Text("grak's aui lab", 16 * 8, 16 * 5, Assets.ForegroundColor); titleText.scale = 10.0f; aui_instances.Add(titleText); descText = new AUI_Text( "this monogame laboratory showcases a variety of animated ui." + "\nclick a button below to see an example.", 16 * 8, 16 * 14, Assets.ForegroundColor); descText.scale = 2.0f; aui_instances.Add(descText); AUI_LineWithRecs line0 = new AUI_LineWithRecs(); line0.MoveTo(16 * 8, 16 * 6); line0.SetTarget(16 * 41, 16 * 6); line0.line.speedOpen = 25; line0.line.speedClosed = 25; aui_instances.Add(line0); AUI_LineWithRecs line1 = new AUI_LineWithRecs(); line1.MoveTo(16 * 8, 16 * 13); line1.SetTarget(16 * 41, 16 * 13); line1.line.speedOpen = 20; line1.line.speedClosed = 25; aui_instances.Add(line1); AUI_LineWithRecs line2 = new AUI_LineWithRecs(); line2.MoveTo(16 * 8, 16 * 18); line2.SetTarget(16 * 41, 16 * 18); line2.line.speedOpen = 15; line2.line.speedClosed = 20; aui_instances.Add(line2); AUI_LineWithRecs line3 = new AUI_LineWithRecs(); line3.MoveTo(16 * 8, 16 * 23); line3.SetTarget(16 * 41, 16 * 23); line3.line.speedOpen = 10; line3.line.speedClosed = 20; aui_instances.Add(line3); }