public ViewModelWindowObjectLight( IStaticWorldObject worldObject, ObjectLightPrivateState privateState, ObjectLightPublicState publicState) { this.worldObject = worldObject; this.protoObjectLight = (IProtoObjectLight)worldObject.ProtoStaticWorldObject; this.FuelCapacity = this.protoObjectLight.FuelCapacity; this.privateState = privateState; this.publicState = publicState; this.ContainerInput = (IClientItemsContainer)privateState.ContainerInput; var character = ClientCurrentCharacterHelper.Character; ClientContainersExchangeManager.Register(this, this.ContainerInput, allowedTargets: new[] { character.SharedGetPlayerContainerInventory(), character.SharedGetPlayerContainerHotbar() }); var(icon, color) = this.protoObjectLight.FuelItemsContainerPrototype.ClientGetFuelIconAndColor(); this.FuelIcon = Client.UI.GetTextureBrush(icon); this.FuelColor = color; this.privateState.ClientSubscribe( _ => _.FuelAmount, _ => this.RefreshFuelAmount(), this); this.privateState.ClientSubscribe( _ => _.Mode, _ => this.RefreshMode(), this); publicState.ClientSubscribe( _ => _.IsLightActive, _ => this.RefreshIsLightActive(), this); this.RefreshFuelAmount(); this.RefreshMode(); this.RefreshIsLightActive(); }
public ProtoObjectLightViewModel([NotNull] IProtoObjectLight light) : base(light) { }