void SetValues(AppConfig config) { MHUrhoApp.InvokeOnMainSafe(SetValuesImpl); void SetValuesImpl() { UnitDrawDistance.Value = config.UnitDrawDistance; ProjectileDrawDistance.Value = config.ProjectileDrawDistance; TerrainDrawDistance.Value = config.TerrainDrawDistance; Resolutions.Selection = (uint)Game.Config.SupportedResolutions.IndexOf(Game.Config.Resolution); WindowTypes.Selection = (uint)FullscreenAndBorderlessToWindowType(config.Fullscreen, config.Borderless); HighDPI.Checked = config.HighDPI; TripleBuffer.Checked = config.TripleBuffer; VSync.Checked = config.VSync; DebugHUD.Checked = config.DebugHUD; MultiSample.Text = config.Multisample.ToString(); RefreshRate.Text = config.RefreshRateCap.ToString(); CameraScroll.Value = config.CameraScrollSensitivity; CameraRotation.Value = config.CameraRotationSensitivity; MouseCamRotation.Value = config.MouseRotationSensitivity; ZoomSpeed.Value = config.ZoomSensitivity; BorderMovement.Checked = config.MouseBorderCameraMovement; PathFindingVisualization.Selection = (uint)Game.Config.SupportedPathFindingVisualizations.IndexOf(Game.Config.PathFindingVisualization); } }
void OnTextUpdate(string newText) { //Update UI text, must be called from main thread MHUrhoApp.InvokeOnMainSafe(() => { text.Value = newText;; }); }
void OnLoadingFailed(IProgressNotifier failed, string message) { //Update UI text, must be called from main thread MHUrhoApp.InvokeOnMainSafe(() => { text.Value = "Loading failed"; }); }
void OnLoadingFinished(IProgressNotifier finished) { //Update UI text, must be called from main thread MHUrhoApp.InvokeOnMainSafe(() => { text.Value = "Loading finished"; }); }
public Material GetMaterialFromImage(string image, string normals) { return(MHUrhoApp.InvokeOnMainSafe(() => Material.FromImage(image, normals))); }
public Material GetMaterialFromImage(Image image) { return(MHUrhoApp.InvokeOnMainSafe(() => Material.FromImage(image))); }
public XmlFile GetXmlFile(string name, bool throwOnFailure = false) { var resource = MHUrhoApp.InvokeOnMainSafe(() => resourceCache.GetXmlFile(name)); return(!throwOnFailure ? resource : resource ?? throw new ResourceLoadingException(name)); }
public ParticleEffect2D GetParticleEffect2D(string name, bool throwOnFailure = false) { var resource = MHUrhoApp.InvokeOnMainSafe(() => resourceCache.GetParticleEffect2D(name)); return(!throwOnFailure ? resource : resource ?? throw new ResourceLoadingException(name)); }
public bool Exists(string name) { return(MHUrhoApp.InvokeOnMainSafe(() => resourceCache.Exists(name))); }
public override void Send(SendOrPostCallback d, object state) { MHUrhoApp.InvokeOnMainSafe(() => d(state)); }