mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-18 22:36:27 +01:00
Moodlight update
This commit is contained in:
parent
50499e6d21
commit
88e304227a
@ -1,64 +1,8 @@
|
||||
export class MoodlightFromServer
|
||||
{
|
||||
private readonly _id: number = 0;
|
||||
private _type: number = 0;
|
||||
private _color: number = 0;
|
||||
private _intensity: number = 0;
|
||||
private _isParsed: boolean = false;
|
||||
private _htmlColor: string = null;
|
||||
|
||||
constructor(k: number)
|
||||
{
|
||||
this._id = k;
|
||||
}
|
||||
|
||||
public parsed(): void
|
||||
{
|
||||
this._isParsed = true;
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
{
|
||||
return this._type;
|
||||
}
|
||||
|
||||
public set type(k: number)
|
||||
{
|
||||
if(!this._isParsed) this._type = k;
|
||||
}
|
||||
|
||||
public get color(): number
|
||||
{
|
||||
return this._color;
|
||||
}
|
||||
|
||||
public set color(k: number)
|
||||
{
|
||||
if(!this._isParsed) this._color = k;
|
||||
}
|
||||
|
||||
public get intensity(): number
|
||||
{
|
||||
return this._intensity;
|
||||
}
|
||||
|
||||
public set intensity(k: number)
|
||||
{
|
||||
if(!this._isParsed) this._intensity = k;
|
||||
}
|
||||
|
||||
public set htmlColor(color: string)
|
||||
{
|
||||
this._htmlColor = color;
|
||||
}
|
||||
|
||||
public get htmlColor(): string
|
||||
{
|
||||
return this._htmlColor;
|
||||
}
|
||||
constructor(public id: number,
|
||||
public bgOnly: boolean,
|
||||
public color: string,
|
||||
public brightness: number)
|
||||
{}
|
||||
}
|
||||
|
@ -35,33 +35,20 @@ export class RoomDimmerPresetsMessageParser implements IMessageParser
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(k: IMessageDataWrapper): boolean
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
const totalPresets = k.readInt();
|
||||
const totalPresets = wrapper.readInt();
|
||||
|
||||
this._selectedPresetId = k.readInt();
|
||||
this._selectedPresetId = wrapper.readInt();
|
||||
|
||||
let _local_3 = 0;
|
||||
|
||||
while(_local_3 < totalPresets)
|
||||
for(let i = 0; i < totalPresets; i++)
|
||||
{
|
||||
const presetId = k.readInt();
|
||||
const isBackGroundOnly = k.readInt(); // Background only? 2: 1
|
||||
const color = k.readString();
|
||||
const colorForSWF = parseInt(color.substr(1), 16);
|
||||
const intensity = k.readInt();
|
||||
const presetId = wrapper.readInt();
|
||||
const bgOnly = wrapper.readInt() === 2;
|
||||
const color = wrapper.readString();
|
||||
const brightness = wrapper.readInt();
|
||||
|
||||
const _local_9 = new MoodlightFromServer(presetId);
|
||||
|
||||
_local_9.type = isBackGroundOnly;
|
||||
_local_9.color = colorForSWF;
|
||||
_local_9.intensity = intensity;
|
||||
|
||||
_local_9.parsed();
|
||||
_local_9.htmlColor = color;
|
||||
this._presets.push(_local_9);
|
||||
|
||||
_local_3++;
|
||||
this._presets.push(new MoodlightFromServer(presetId, bgOnly, color, brightness));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -31,10 +31,10 @@ export class RoomSessionDimmerPresetsEvent extends RoomSessionEvent
|
||||
this._selectedPresetId = k;
|
||||
}
|
||||
|
||||
public storePreset(k: number, _arg_2: number, _arg_3: number, _arg_4: number): void
|
||||
public storePreset(id: number, bgOnly: boolean, color: string, brightness: number): void
|
||||
{
|
||||
const _local_5:RoomSessionDimmerPresetsEventPresetItem = new RoomSessionDimmerPresetsEventPresetItem(k, _arg_2, _arg_3, _arg_4);
|
||||
this._presets[(k - 1)] = _local_5;
|
||||
const _local_5:RoomSessionDimmerPresetsEventPresetItem = new RoomSessionDimmerPresetsEventPresetItem(id, bgOnly, color, brightness);
|
||||
this._presets[(id - 1)] = _local_5;
|
||||
}
|
||||
|
||||
public getPreset(k: number):RoomSessionDimmerPresetsEventPresetItem
|
||||
|
@ -1,16 +1,16 @@
|
||||
export class RoomSessionDimmerPresetsEventPresetItem
|
||||
{
|
||||
private _id: number;
|
||||
private _type: number;
|
||||
private _color: number;
|
||||
private _light: number;
|
||||
private _bgOnly: boolean;
|
||||
private _color: string;
|
||||
private _brightness: number;
|
||||
|
||||
constructor(k: number, _arg_2: number, _arg_3: number, _arg_4: number)
|
||||
constructor(id: number, bgOnly: boolean, color: string, brightness: number)
|
||||
{
|
||||
this._id = k;
|
||||
this._type = _arg_2;
|
||||
this._color = _arg_3;
|
||||
this._light = _arg_4;
|
||||
this._id = id;
|
||||
this._bgOnly = bgOnly;
|
||||
this._color = color;
|
||||
this._brightness = brightness;
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
@ -18,18 +18,18 @@
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get type(): number
|
||||
public get bgOnly(): boolean
|
||||
{
|
||||
return this._type;
|
||||
return this._bgOnly;
|
||||
}
|
||||
|
||||
public get color(): number
|
||||
public get color(): string
|
||||
{
|
||||
return this._color;
|
||||
}
|
||||
|
||||
public get light(): number
|
||||
public get brightness(): number
|
||||
{
|
||||
return this._light;
|
||||
return this._brightness;
|
||||
}
|
||||
}
|
||||
|
@ -29,18 +29,11 @@ export class RoomDimmerPresetsHandler extends BaseHandler
|
||||
|
||||
event.selectedPresetId = parser.selectedPresetId;
|
||||
|
||||
let i = 0;
|
||||
|
||||
while(i < parser.presetCount)
|
||||
for(let i = 0; i < parser.presetCount; i++)
|
||||
{
|
||||
const preset = parser.getPreset(i);
|
||||
|
||||
if(preset)
|
||||
{
|
||||
event.storePreset(preset.id, preset.type, preset.color, preset.intensity);
|
||||
}
|
||||
|
||||
i++;
|
||||
if(preset) event.storePreset(preset.id, preset.bgOnly, preset.color, preset.brightness);
|
||||
}
|
||||
|
||||
this.listener && this.listener.events.dispatchEvent(event);
|
||||
|
Loading…
Reference in New Issue
Block a user