import { Entity } from '../../core/Entity' ; import { Dialog } from '../controls/Dialog' ; import { Preview } from './components/Preview' ; import { Recipe } from './components/Recipe' ; import { Modules } from './components/Modules' ; import { Filters } from './components/Filters' ; /** Editor */ export abstract class Editor extends Dialog { /** Blueprint Editor Entity reference */ protected readonly m_Entity : Entity ; /** Reference to preview container */ protected readonly m_Preview : Preview ; param width param height param entity public constructor ( width , height , entity ) { super ( width , height , entity . entityData . localised_name ) ; this . m_Entity = entity ; this . m_Preview = new Preview ( this . m_Entity , 114 ) ; this . m_Preview . position . set ( 12 , 45 ) ; this . addChild ( this . m_Preview ) ; this . m_Entity . once ( 'destroy' , ( ) => this . close ( ) ) ; } description param x param y protected addRecipe ( x = 208 , y = 45 ) { const recipe = new Recipe ( this . m_Entity ) ; recipe . position . set ( x , y ) ; this . addChild ( recipe ) ; return recipe ; } description param x param y protected addModules ( x = 208 , y = 83 ) { const modules = new Modules ( this . m_Entity ) ; modules . position . set ( x , y ) ; this . addChild ( modules ) ; return modules ; } description param x param y param counts protected addFilters ( x = 208 , y = 83 , amount = false ) { const filters = new Filters ( this . m_Entity , amount ) ; filters . position . set ( x , y ) ; this . addChild ( filters ) ; return filters ; } protected onEntityChange ( event , fn ) { this . m_Entity . on ( event , fn ) ; this . once ( 'destroy' , ( ) => this . m_Entity . off ( event , fn ) ) ; } public destroy ( ) { this . emit ( 'destroy' ) ; super . destroy ( ) ; } }