From 40a0325e6adf66cb65d10f4a2ca7f906615cadde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=89?= <940119273@qq.com> Date: Tue, 25 Jan 2022 08:13:07 +0000 Subject: [PATCH] =?UTF-8?q?!1808=20=E4=BF=AE=E5=A4=8D:=E7=81=AF=E5=85=89?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E9=85=8D=E7=BD=AE=E4=BF=9D=E5=AD=98=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UI/Store/RightPanelStore/LightStore.ts | 170 ++++++++++----------- 1 file changed, 79 insertions(+), 91 deletions(-) diff --git a/src/UI/Store/RightPanelStore/LightStore.ts b/src/UI/Store/RightPanelStore/LightStore.ts index 1c62f9a70..630851ff2 100644 --- a/src/UI/Store/RightPanelStore/LightStore.ts +++ b/src/UI/Store/RightPanelStore/LightStore.ts @@ -295,7 +295,21 @@ export class LightStore implements IConfigStore export class PointLightStore implements IConfigStore { @observable configName = "默认"; + @observable m_Option: PointLightOption = { ...DefaultPointLightOption }; + @observable configsNames: string[] = []; + InitOption() + { + Object.assign(this.m_Option, DefaultPointLightOption); + } + InitConfigs() + { + let config: IConfigOption = {}; + config.option = toJS(this.m_Option); + let configs: { [key: string]: IConfigOption; } = {}; + configs["默认"] = config; + return configs; + } SaveConfig() { let lightStore = LightStore.GetInstance(); @@ -314,23 +328,6 @@ export class PointLightStore implements IConfigStore newConfig.option = toJS(this.m_Option); return newConfig; }; - //板数据 - m_Option: PointLightOption = { ...DefaultPointLightOption }; - @observable configsNames: string[] = []; - InitOption() - { - Object.assign(this.m_Option, DefaultPointLightOption); - } - InitConfigs() - { - let config: IConfigOption = {}; - config.option = toJS(this.m_Option); - let configs: { [key: string]: IConfigOption; } = {}; - configs["默认"] = config; - - return configs; - } - async UpdateOption(cof: IConfigOption) { Object.assign(this.m_Option, cof.option); @@ -362,15 +359,6 @@ export class PointLightStore implements IConfigStore app.Viewer.UpdateRender(); } } - - private static _SingleInstance: PointLightStore; - - static GetInstance(): PointLightStore - { - if (this._SingleInstance) return this._SingleInstance; - this._SingleInstance = new PointLightStore; - return this._SingleInstance; - } private updatePointLight(pointLight: PointLight, cof: IConfigOption) { EntityUpdateWrap(pointLight, () => @@ -386,12 +374,34 @@ export class PointLightStore implements IConfigStore pointLight.CaseShadow = cof.option.CaseShadow; }); } + private static _SingleInstance: PointLightStore; + + static GetInstance(): PointLightStore + { + if (this._SingleInstance) return this._SingleInstance; + this._SingleInstance = new PointLightStore; + return this._SingleInstance; + } } export class SpotLightStore implements IConfigStore { @observable configName = "默认"; + @observable m_Option: SpotLightOption = { ...DefaultSpotLightOption }; + @observable configsNames: string[] = []; + InitOption() + { + Object.assign(this.m_Option, DefaultSpotLightOption); + } + InitConfigs() + { + let config: IConfigOption = {}; + config.option = toJS(this.m_Option); + let configs: { [key: string]: IConfigOption; } = {}; + configs["默认"] = config; + return configs; + } SaveConfig() { let lightStore = LightStore.GetInstance(); @@ -413,22 +423,6 @@ export class SpotLightStore implements IConfigStore newConfig.option = toJS(this.m_Option); return newConfig; }; - m_Option: SpotLightOption = { ...DefaultSpotLightOption }; - @observable configsNames: string[] = []; - InitOption() - { - Object.assign(this.m_Option, DefaultSpotLightOption); - } - InitConfigs() - { - let config: IConfigOption = {}; - config.option = toJS(this.m_Option); - let configs: { [key: string]: IConfigOption; } = {}; - configs["默认"] = config; - - return configs; - } - async UpdateOption(cof: IConfigOption) { Object.assign(this.m_Option, cof.option); @@ -463,15 +457,6 @@ export class SpotLightStore implements IConfigStore app.Viewer.UpdateRender(); } } - - private static _SingleInstance: SpotLightStore; - - static GetInstance(): SpotLightStore - { - if (this._SingleInstance) return this._SingleInstance; - this._SingleInstance = new SpotLightStore; - return this._SingleInstance; - } private updateSpotLight(spotLight: SpotLight, cof: IConfigOption) { EntityUpdateWrap(spotLight, () => @@ -491,12 +476,34 @@ export class SpotLightStore implements IConfigStore spotLight.ShowHelper = cof.option.ShowHelper; }); } + private static _SingleInstance: SpotLightStore; + + static GetInstance(): SpotLightStore + { + if (this._SingleInstance) return this._SingleInstance; + this._SingleInstance = new SpotLightStore; + return this._SingleInstance; + } } export class RectAreaLightStore implements IConfigStore { @observable configName = "默认"; + @observable m_Option: RectAreaLightOption = { ...DefaultRectAreaLightOption }; + @observable configsNames: string[] = []; + InitOption() + { + Object.assign(this.m_Option, DefaultRectAreaLightOption); + } + InitConfigs() + { + let config: IConfigOption = {}; + config.option = toJS(this.m_Option); + let configs: { [key: string]: IConfigOption; } = {}; + configs["默认"] = config; + return configs; + } SaveConfig() { let lightStore = LightStore.GetInstance(); @@ -517,22 +524,6 @@ export class RectAreaLightStore implements IConfigStore newConfig.option = toJS(this.m_Option); return newConfig; }; - m_Option: RectAreaLightOption = { ...DefaultRectAreaLightOption }; - @observable configsNames: string[] = []; - InitOption() - { - Object.assign(this.m_Option, DefaultRectAreaLightOption); - } - InitConfigs() - { - let config: IConfigOption = {}; - config.option = toJS(this.m_Option); - let configs: { [key: string]: IConfigOption; } = {}; - configs["默认"] = config; - - return configs; - } - async UpdateOption(cof: IConfigOption) { Object.assign(this.m_Option, cof.option); @@ -565,14 +556,6 @@ export class RectAreaLightStore implements IConfigStore app.Viewer.UpdateRender(); } } - - private static _SingleInstance: RectAreaLightStore; - static GetInstance(): RectAreaLightStore - { - if (this._SingleInstance) return this._SingleInstance; - this._SingleInstance = new RectAreaLightStore; - return this._SingleInstance; - } private updateRectAreaLight(rectAreaLight: RectAreaLight, cof: IConfigOption) { EntityUpdateWrap(rectAreaLight, () => @@ -591,12 +574,33 @@ export class RectAreaLightStore implements IConfigStore rectAreaLight.ShowHelper = cof.option.ShowHelper; }); } + private static _SingleInstance: RectAreaLightStore; + static GetInstance(): RectAreaLightStore + { + if (this._SingleInstance) return this._SingleInstance; + this._SingleInstance = new RectAreaLightStore; + return this._SingleInstance; + } } export class RightPlaneLightStore implements IConfigStore { @observable configName = "默认"; + @observable m_Option: RightPlaneLightOption = { ...DefaultRightPlaneLightOption }; + @observable configsNames: string[] = []; + InitOption() + { + Object.assign(this.m_Option, DefaultRightPlaneLightOption); + } + InitConfigs() + { + let config: IConfigOption = {}; + config.option = toJS(this.m_Option); + let configs: { [key: string]: IConfigOption; } = {}; + configs["默认"] = config; + return configs; + } SaveConfig() { let lightStore = LightStore.GetInstance(); @@ -620,22 +624,6 @@ export class RightPlaneLightStore implements IConfigStore newConfig.option = toJS(this.m_Option); return newConfig; }; - m_Option: RightPlaneLightOption = { ...DefaultRightPlaneLightOption }; - @observable configsNames: string[] = []; - InitOption() - { - Object.assign(this.m_Option, DefaultRightPlaneLightOption); - } - InitConfigs() - { - let config: IConfigOption = {}; - config.option = toJS(this.m_Option); - let configs: { [key: string]: IConfigOption; } = {}; - configs["默认"] = config; - - return configs; - } - async UpdateOption(cof: IConfigOption) { Object.assign(this.m_Option, cof.option);