public EntityViewBehaviourInitializer(ISceneContext sceneContext, GameContext context, IGameConfig gameConfig, IOsnowaContextManager contextManager) { _sceneContext = sceneContext; _context = context; _gameConfig = gameConfig; _contextManager = contextManager; }
public GCodeDebugView(PrinterTabPage printerTabPage, GCodeFile gCodeFile, ISceneContext sceneContext, ThemeConfig theme) : base(theme) { this.gCodeFile = gCodeFile; this.printerTabPage = printerTabPage; this.sceneContext = sceneContext; gCodeMemoryFile = gCodeFile as GCodeMemoryFile; if (gCodeMemoryFile != null) { rawLine = this.AddSetting("G-Code Line".Localize(), ""); } startPointWidget = this.AddSetting("Start".Localize(), ""); endPointWidget = this.AddSetting("End".Localize(), ""); lengthWidget = this.AddSetting("Length".Localize(), ""); //slopeWidget = this.AddSetting("Slope".Localize(), ""); //yInterceptWidget = this.AddSetting("Y Intercept".Localize(), ""); //xInterceptWidget = this.AddSetting("X Intercept".Localize(), ""); if (gCodeMemoryFile != null) { timeToToolChange = this.AddSetting("Time to Tool Change".Localize(), ""); } // Register listeners printerTabPage.LayerFeaturesScrollbar.SecondValueChanged += this.LayerFeaturesScrollbar_SecondValueChanged; }
public InteractionLayer(ISceneContext sceneContext, ThemeConfig theme, EditorType editorType = EditorType.Part) { this.sceneContext = sceneContext; this.EditorMode = editorType; this.theme = theme; scene = sceneContext.Scene; gCodeMeshColor = new Color(theme.PrimaryAccentColor, 35); BuildVolumeColor = new ColorF(.2, .8, .3, .2).ToColor(); floorDrawable = new FloorDrawable(editorType, sceneContext, this.BuildVolumeColor, theme); if (ViewOnlyTexture == null) { // TODO: What is the ViewOnlyTexture??? UiThread.RunOnIdle(() => { ViewOnlyTexture = new ImageBuffer(32, 32, 32); var graphics2D = ViewOnlyTexture.NewGraphics2D(); graphics2D.Clear(Color.White); graphics2D.FillRectangle(0, 0, ViewOnlyTexture.Width / 2, ViewOnlyTexture.Height, Color.LightGray); // request the texture so we can set it to repeat var plugin = ImageGlPlugin.GetImageGlPlugin(ViewOnlyTexture, true, true, false); }); } iavMappings.Add(typeof(ImageObject3D), new List <InteractionVolume> { new MoveInZControl(this) }); // Register listeners sceneContext.Scene.SelectionChanged += this.Scene_SelectionChanged; }
public void LoadContent(ISceneContext sceneContext) { if (sceneContext == null) throw new ArgumentNullException("sceneContext"); SceneConfigEdit.SceneContext = sceneContext; SceneConfigEdit.LoadContent(); }
public static void Paste(this ISceneContext sceneContext) { var scene = sceneContext.Scene; if (Clipboard.Instance.ContainsImage) { // Persist string filePath = ApplicationDataStorage.Instance.GetNewLibraryFilePath(".png"); AggContext.ImageIO.SaveImageData( filePath, Clipboard.Instance.GetImage()); scene.UndoBuffer.AddAndDo( new InsertCommand( scene, new ImageObject3D() { AssetPath = filePath })); } else if (Clipboard.Instance.ContainsText) { if (Clipboard.Instance.GetText() == "!--IObjectSelection--!") { sceneContext.DuplicateItem(0, ApplicationController.ClipboardItem); // each time we put in the object offset it a bit more pasteObjectXOffset += 5; } } }
async UniTask LoadAndUnloadResources(ISceneContext nextSceneContext) { _resourceStore.ReleaseAllSceneScoped(); nextSceneContext.RetainResource(); _resourceStore.Unload(); await _resourceStore.Load(); }
public static void Build(SimulationSceneDescription scene, ISceneContext context) { for (int i = 0; i < scene.Structures.Length; i++) { scene.Structures[i].GetBuilder().Build(context); } }
public Object3DControlsLayer(ISceneContext sceneContext, ThemeConfig theme, EditorType editorType = EditorType.Part) { this.sceneContext = sceneContext; this.EditorMode = editorType; scene = sceneContext.Scene; gCodeMeshColor = new Color(theme.PrimaryAccentColor, 35); BuildVolumeColor = new ColorF(.2, .8, .3, .2).ToColor(); floorDrawable = new FloorDrawable(editorType, sceneContext, this.BuildVolumeColor, theme); if (viewOnlyTexture == null) { // TODO: What is the ViewOnlyTexture??? UiThread.RunOnIdle(() => { viewOnlyTexture = new ImageBuffer(32, 32, 32); var graphics2D = viewOnlyTexture.NewGraphics2D(); graphics2D.Clear(Color.White); graphics2D.FillRectangle(0, 0, viewOnlyTexture.Width / 2, viewOnlyTexture.Height, Color.LightGray); // request the texture so we can set it to repeat ImageGlPlugin.GetImageGlPlugin(viewOnlyTexture, true, true, false); }); } // Register listeners sceneContext.Scene.SelectionChanged += this.Scene_SelectionChanged; if (sceneContext.Printer != null) { sceneContext.Printer.Settings.SettingChanged += this.Settings_SettingChanged; } }
public virtual GameObject Build(ISceneContext context) { var obj = StructureBuilderUtils.Build(prefabPath, structure.Transform); obj.layer = LayerMaskForCollisionLayer(collisionLayer, context); return(obj); }
public ViewStyleButton(ISceneContext sceneContext, ThemeConfig theme) : base(theme) { this.sceneContext = sceneContext; this.PopupContent = ShowViewOptions; this.HAnchor = HAnchor.Fit; this.VAnchor = VAnchor.Fit; viewIcons = new Dictionary <RenderTypes, ImageBuffer>() { [RenderTypes.Shaded] = AggContext.StaticData.LoadIcon("view_shaded.png", 16, 16, theme.InvertIcons), [RenderTypes.Outlines] = AggContext.StaticData.LoadIcon("view_outlines.png", 16, 16, theme.InvertIcons), [RenderTypes.Polygons] = AggContext.StaticData.LoadIcon("view_polygons.png", 16, 16, theme.InvertIcons), [RenderTypes.NonManifold] = AggContext.StaticData.LoadIcon("view_polygons.png", 16, 16, theme.InvertIcons), [RenderTypes.Materials] = AggContext.StaticData.LoadIcon("view_materials.png", 16, 16, theme.InvertIcons), [RenderTypes.Overhang] = AggContext.StaticData.LoadIcon("view_overhang.png", 16, 16, theme.InvertIcons), }; this.AddChild(iconButton = new IconButton(viewIcons[sceneContext.ViewState.RenderType], theme) { Selectable = false }); UserSettings.Instance.SettingChanged += UserSettings_SettingChanged; }
public GCodeLayerDetailsView(GCodeFile gCodeMemoryFile, ISceneContext sceneContext, ThemeConfig theme) : base(theme) { GuiWidget layerIndex = this.AddSetting("Number".Localize(), ""); GuiWidget layerTime = this.AddSetting("Time".Localize(), ""); GuiWidget layerTimeToHere = this.AddSetting("Time From Start".Localize(), ""); GuiWidget layerTimeFromHere = this.AddSetting("Time to End".Localize(), ""); GuiWidget layerHeight = this.AddSetting("Height".Localize(), ""); GuiWidget layerWidth = this.AddSetting("Layer Top".Localize(), ""); GuiWidget layerFanSpeeds = this.AddSetting("Fan Speed".Localize(), ""); void UpdateLayerDisplay(object sender, EventArgs e) { layerIndex.Text = $"{sceneContext.ActiveLayerIndex + 1}"; layerTime.Text = gCodeMemoryFile.LayerTime(sceneContext.ActiveLayerIndex); layerTimeToHere.Text = gCodeMemoryFile.LayerTimeToHere(sceneContext.ActiveLayerIndex); layerTimeFromHere.Text = gCodeMemoryFile.LayerTimeFromeHere(sceneContext.ActiveLayerIndex); layerHeight.Text = $"{gCodeMemoryFile.GetLayerHeight(sceneContext.ActiveLayerIndex):0.###}"; layerWidth.Text = $"{gCodeMemoryFile.GetLayerTop(sceneContext.ActiveLayerIndex):0.###}"; var fanSpeed = gCodeMemoryFile.GetLayerFanSpeeds(sceneContext.ActiveLayerIndex); layerFanSpeeds.Text = string.IsNullOrWhiteSpace(fanSpeed) ? "Unchanged" : fanSpeed; } sceneContext.ActiveLayerChanged += UpdateLayerDisplay; // and do the initial setting UpdateLayerDisplay(this, null); }
private void GoToInternal(string sceneName, ISceneContext context) { if (_currentSceneName == null) { _currentSceneName = SceneManager.GetActiveScene().name; } if (_currentSceneName == sceneName) { return; } if (!_transitioning) { _transitioning = true; Instance.StartCoroutine(Instance.PerformTransition(sceneName, context)); if (_nextSceneName == sceneName) { _nextSceneName = null; _nextContext = null; } } else { _nextSceneName = sceneName; _nextContext = context; } }
public OperationIconButton(SceneOperation sceneOperation, ISceneContext sceneContext, ThemeConfig theme) : base(sceneOperation.Icon(theme), theme) { this.sceneOperation = sceneOperation; this.sceneContext = sceneContext; this.ToolTipText = sceneOperation.HelpText ?? sceneOperation.Title; }
public SelectedItemDrawable(ISceneContext sceneContext, GuiWidget guiWidget) { this.scene = sceneContext.Scene; this.guiWidget = guiWidget; // Register listeners scene.SelectionChanged += Selection_Changed; }
public GameObject Build(ISceneContext context) { var spawner = StructureBuilderUtils.AddGameObjectWithBehaviour<RollingObstacleSpawnerBehaviour>(structure.Transform); spawner.SpawnInterval = structure.SpawnInterval; spawner.ObstacleLifetime = structure.ObstacleLifetime; spawner.ForceMultiplier = structure.ForceMultiplier; spawner.Context = context; return spawner.gameObject; }
public StimulusHandler(IGameConfig gameConfig, IActivityResolver activityResolver, ISceneContext sceneContext, IFriendshipResolver friendshipResolver, IActivityInterruptor activityInterruptor) { _gameConfig = gameConfig; _activityResolver = activityResolver; _sceneContext = sceneContext; _friendshipResolver = friendshipResolver; _activityInterruptor = activityInterruptor; }
public LevelingDataDrawable(ISceneContext sceneContext) { this.sceneContext = sceneContext; if (sceneContext.Printer is PrinterConfig printer) { levelingDataMesh = LevelingMeshVisualizer.BuildMeshFromLevelingData(printer); } }
private void Scene4(ISceneContext context) { MessageWindow.Show( "以降の実装は消えてなくなりました。\n" + "これ ダークライの しわざです。\n" ); context.Quit(); }
public TileMatrixUpdater(IPositionFlagsResolver positionFlagsResolver, IGameConfig gameConfig, ITileByIdProvider tileByIdProvider, ISceneContext sceneContext, IOsnowaContextManager contextManager) { _positionFlagsResolver = positionFlagsResolver; _gameConfig = gameConfig; _tileByIdProvider = tileByIdProvider; _sceneContext = sceneContext; contextManager.ContextReplaced += newContext => _tileMatricesByteByLayer = newContext.TileMatricesByLayer; }
private void Scene3(ISceneContext context) { var selected = MessageWindow.ShowChoices( "ホントに ホェェェェェェェッ!!", new YesChoice(nextScene: Scene4), new NoChoice(message: "いいえのさばくの まもりがみ!", nextScene: Scene3) ); NextScene = selected.NextScene; }
public UnityGridInfoProvider(ISceneContext sceneContext, IOsnowaContextManager contextManager) { _sceneContext = sceneContext; contextManager.ContextReplaced += newContext => _positionFlags = newContext.PositionFlags; _sceneContext.TilemapDefiningOuterBounds.CompressBounds(); MinPosition = Position.Zero; CellSize = _sceneContext.TilemapDefiningOuterBounds.cellSize.x; }
public override GameObject Build(ISceneContext context) { var spawner = base.Build(context).GetComponent <DistanceMarkerSpawnerBehaviour>(); spawner.MarkerDistance = this.structure.MarkerDistance; spawner.DistanceAngleFactor = this.structure.DistanceAngleFactor; spawner.BestMarkerRotation = this.structure.BestMarkerRotation; spawner.Context = context; return(spawner.gameObject); }
private void Scene2(ISceneContext context) { var selected = MessageWindow.ShowChoices( "だが そんな てに ひっかかる\n" + "オレたちじゃないぜッ!", new YesChoice(nextScene: Scene3), new NoChoice(nextScene: Scene2) ); NextScene = selected.NextScene; }
public ConditionContext(IGameConfig gameConfig, ISceneContext sceneContext, IEntityDetector entityDetector, GameContext context, IFriendshipResolver friendshipResolver, IExampleContextManager contextManager) { GameConfig = gameConfig; SceneContext = sceneContext; EntityDetector = entityDetector; Context = context; FriendshipResolver = friendshipResolver; ContextManager = contextManager; }
public TilePresenter(ISceneContext sceneContext, IGameConfig gameConfig, IOsnowaContextManager contextManager, ITileByIdProvider tileByIdProvider, ITileMatrixUpdater tileMatrixUpdater) { _gameConfig = gameConfig; _sceneContext = sceneContext; _contextManager = contextManager; _tileByIdProvider = tileByIdProvider; _tileMatrixUpdater = tileMatrixUpdater; _positionsToReset = new List <Position>(400); }
public PartWorkspace(ISceneContext sceneContext) { // Create a new library context for the SaveAs view this.LibraryView = new LibraryConfig() { ActiveContainer = new WrappedLibraryContainer(ApplicationController.Instance.Library.RootLibaryContainer) }; this.SceneContext = sceneContext; Name = sceneContext.EditContext?.SourceItem?.Name ?? "Unknown"; }
public void BuildScene(SimulationSceneDescription scene, ISceneContext context) { SimulationSceneBuilder.Build(scene, context); SetupPhysics(scene.PhysicsConfiguration); var trackedCameras = FindObjectsOfType <TrackedCamera>(); foreach (var trackedCamera in trackedCameras) { trackedCamera.ControlPoints = scene.CameraControlPoints; } }
public GCodePanel(PrinterTabPage printerTabPage, PrinterConfig printer, ISceneContext sceneContext, ThemeConfig theme) : base(FlowDirection.TopToBottom) { this.sceneContext = sceneContext; this.theme = theme; this.printer = printer; this.printerTabPage = printerTabPage; SectionWidget sectionWidget; this.AddChild( sectionWidget = new SectionWidget( "Options".Localize(), new GCodeOptionsPanel(sceneContext, printer, theme), theme) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit, Padding = 0 }); sectionWidget.ContentPanel.Descendants <SettingsRow>().First().Border = 0; var scrollable = new ScrollableWidget(true) { Name = "editorPanel", HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Stretch, }; scrollable.ScrollArea.HAnchor = HAnchor.Stretch; scrollable.AddChild(loadedGCodeSection = new FlowLayoutWidget(FlowDirection.TopToBottom) { HAnchor = HAnchor.Stretch, VAnchor = VAnchor.Fit }); this.AddChild(scrollable); this.RefreshGCodeDetails(printer); this.EnsureSectionWidgetStyling(this.Children <SectionWidget>()); var firstSection = this.Children <SectionWidget>().First(); firstSection.BorderColor = Color.Transparent; // Disable top border on first item to produce a more flat, dark top edge // Register listeners printer.Bed.LoadedGCodeChanged += Bed_LoadedGCodeChanged; printer.Bed.RendererOptions.PropertyChanged += RendererOptions_PropertyChanged; }
public PartWorkspace(ISceneContext bedConfig) { var extraContainers = new List <ILibraryContainerLink>(); // Create a new library context for the SaveAs view this.LibraryView = new LibraryConfig() { ActiveContainer = new WrappedLibraryContainer(ApplicationController.Instance.Library.RootLibaryContainer) }; _sceneContext = bedConfig; Name = _sceneContext.EditContext?.SourceItem?.Name ?? "Unknown"; }
public SimulationSpawnConfig( CreatureDesign design, int batchSize, PhysicsScene physicsScene, ISceneContext context, LegacySimulationOptions legacyOptions, SimulationSceneDescription sceneDescription ) { this.Design = design; this.BatchSize = batchSize; this.PhysicsScene = physicsScene; this.SceneContext = context; this.LegacyOptions = legacyOptions; this.SceneDescription = sceneDescription; }
public FloorDrawable(Object3DControlsLayer.EditorType editorType, ISceneContext sceneContext, Color buildVolumeColor, ThemeConfig theme) { this.buildVolumeColor = buildVolumeColor; this.sceneContext = sceneContext; this.editorType = editorType; this.theme = theme; this.printer = sceneContext.Printer; this.EnsureBedTexture(selectedItem: null); // Register listeners if (printer != null) { printer.Settings.SettingChanged += this.Settings_SettingChanged; } }
public void Draw( ISceneContext context ) { _size = context.Camera.ScreenSize; using ( var whole = context.Push() ) { whole.Color = Color.Gray; whole.PointSize = 3; whole.LineWidth = 1; // X, Y ���i�����j�̕`�� context.DrawLines( gl => { gl.Vertex( 0, _pos.y ); gl.Vertex( _size.x, _pos.y ); gl.Vertex( _pos.x, 0 ); gl.Vertex( _pos.x, _size.y ); } ); // �ڐ��̊Ԋu const int P0 = 16; // �ڐ��̍ŏ��s�N�Z���� double unit = context.Camera.LengthPerPixel; double exp = Math.Log10( P0 * unit ); double delta = Math.Pow( 10, Math.Ceiling( exp ) ); if ( delta / unit > 5 * P0 ) delta /= 2; Geom.Box2d box = new Geom.Box2d( new Geom.Point2d( -_pos.x * unit, (_pos.y - _size.y) * unit ), new Geom.Point2d( (_size.x - _pos.x) * unit, _pos.y * unit ) ); // �ڐ���_��Ƃ��ĕ`�� using ( var gl = HiGL.Begin( GLPrimType.Points ) ) { for ( double x = 0.0 ; x < box.Upper.x ; x += delta ) { gl.Vertex( _pos.x + (int)(x / unit), _pos.y ); } for ( double x = 0.0 ; x > box.Lower.x ; x -= delta ) { gl.Vertex( _pos.x + (int)(x / unit), _pos.y ); } for ( double y = 0.0 ; y < box.Upper.y ; y += delta ) { gl.Vertex( _pos.x, _pos.y - (int)(y / unit) ); } for ( double y = 0.0 ; y > box.Lower.y ; y -= delta ) { gl.Vertex( _pos.x, _pos.y - (int)(y / unit) ); } } // �ڐ��̐��l��`�� for ( double x = 2 * delta ; x < box.Upper.x ; x += 2 * delta ) { DrawNumber( context, _pos.x + (int)(x / unit), _pos.y + 16, x ); } for ( double x = -2 * delta ; x > box.Lower.x ; x -= 2 * delta ) { DrawNumber( context, _pos.x + (int)(x / unit), _pos.y + 16, x ); } for ( double y = 2 * delta ; y < box.Upper.y ; y += 2 * delta ) { DrawNumber( context, _pos.x + 2, _pos.y - (int)(y / unit), y ); } for ( double y = -2 * delta ; y > box.Lower.y ; y -= 2 * delta ) { DrawNumber( context, _pos.x + 2, _pos.y - (int)(y / unit), y ); } // ���x��̕`�� double radius = 100; using ( var gl = HiGL.Begin( GLPrimType.LineStrip ) ) { for ( int deg = 0 ; deg <= 90 ; deg += 5 ) { double rad = Math.PI * deg / 180.0; double x = _pos.x + radius * Math.Cos( rad ); double y = _pos.y - radius * Math.Sin( rad ); gl.Vertex( x, y ); } } using ( var gl = HiGL.Begin( GLPrimType.Points ) ) { for ( int deg = 15 ; deg < 90 ; deg += 15 ) { double rad = Math.PI * deg / 180.0; double x = _pos.x + radius * Math.Cos( rad ); double y = _pos.y - radius * Math.Sin( rad ); gl.Vertex( x, y ); } } } }