public WindowTextInfo _BuildTextInfo(string title, Vector3 position, string message, Color tint) { position.z = 0; var windowCanvasObject = Instantiate(WindowTextInfoPrefab, Parent.transform); var windowObjectRef = windowCanvasObject.GetComponentInChildren <WindowReferencer>(); var windowObject = windowObjectRef.GameObjectWindow; var tintObject = windowCanvasObject.GetComponentInChildren <Tint>(true); tintObject.SetColor(tint); tintObject.SetActive(true); var wtc = windowObject.GetComponent <WindowTextContent>(); wtc.ContentText(message); var w = new WindowTextInfo(windowObject, position, null) { Title = title }; windowObjectRef.Window = w; windows.Add(w); return(w); }
/// <summary> /// Initialize Phiddle to run. This means creating all UI compontents and make /// the service provider ready to serve. /// </summary> public void Initialize() { lastPos = SKPoint.Empty; // Setup services InitializeServices(Services); ServiceProvider = Services.BuildServiceProvider(); screenService = ServiceProvider.GetRequiredService <IScreenService>(); logService = ServiceProvider.GetRequiredService <ILogService>(); appSettingsService = ServiceProvider.GetRequiredService <SettingsService <AppSettings> >(); appStateService = ServiceProvider.GetRequiredService <SettingsService <AppState> >(); // Actions appActions = InitializeActions(); // Screen var s = screenService.Dimensions(); // Tools appTools = new AppTools(s, appStateService.Settings, appSettingsService.Settings); helpLines = new HelpLines(s, appStateService.Settings, appSettingsService.Settings.PaintHelpLines); WindowsSizeFactor = appSettingsService.Settings.WindowSizeFactor; WindowZoomFactor = appSettingsService.Settings.WindowZoomFactor; // Windows windowApp = new Window(SKPoint.Empty, ToolWindowSize, appSettingsService.Settings.WindowApp); windowInfo = new WindowTextInfo(SKPoint.Empty, InfoWindowSize, appSettingsService.Settings.WindowInfo); windowZoom = new WindowZoom(SKPoint.Empty, ZoomWindowSize, appSettingsService.Settings.WindowZoom) { CrosshairVisible = !helpLines.Visible } ; // Calculate initial locations of windows with relative positions #if DEBUG var wm = appSettingsService.Settings.WindowMargin + windowApp.PaintBorder.StrokeWidth; #else var wm = appSettingsService.Settings.WindowMargin; #endif var zx = s.Right - windowZoom.Bounds.Width - wm * 2; var zy = s.Bottom - windowZoom.Bounds.Height - wm * 2; ZoomWindowLocation = new SKPoint(zx, zy); var ix = s.Right - windowInfo.Bounds.Width - wm * 2; var iy = s.Bottom - windowInfo.Bounds.Height - windowZoom.Bounds.Height - wm * 4; InfoWindowLocation = new SKPoint(ix, iy); // Setup refresh timer timer = new Timer(50) { AutoReset = true }; timer.Elapsed += new ElapsedEventHandler(TimerElapsed); logService.Debug("Initialize", $"Core initialized with refresh rate = {1000 / timer.Interval:0} FPS"); }
public WindowTextInfo _BuildTextInfo(string title, Vector3 position, City c) { position.z = 0; var windowCanvasObject = Instantiate(WindowTextInfoPrefab, Parent.transform); var windowObjectRef = windowCanvasObject.GetComponentInChildren <WindowReferencer>(); var windowObject = windowObjectRef.GameObjectWindow; var wtc = windowObject.GetComponent <WindowTextContent>(); wtc.ContentText(c.InfoText()); var w = new WindowTextInfo(windowObject, position, c) { Title = title }; windowObjectRef.Window = w; windows.Add(w); return(w); }