public ViewModelWindowLaunchpad(IStaticWorldObject worldObject) { this.worldObject = worldObject; this.protoObjectLaunchpad = (ProtoObjectLaunchpad)worldObject.ProtoGameObject; this.privateState = worldObject.GetPrivateState <ObjectLaunchpadPrivateState>(); this.publicState = worldObject.GetPublicState <ObjectLaunchpadPublicState>(); this.publicState.ClientSubscribe(_ => _.LaunchServerFrameTime, _ => this.NotifyPropertyChanged(nameof(this.IsLaunched)), this); this.publicState.ClientSubscribe(_ => _.LaunchedByPlayerName, _ => this.NotifyPropertyChanged(nameof(this.LaunchedByPlayerName)), this); this.Tasks = this.protoObjectLaunchpad .TasksList .Select((task, taskIndex) => new ViewModelLaunchpadTask(worldObject, task, taskIndex, this.privateState)) .ToArray(); this.privateState.ClientSubscribe(_ => _.TaskCompletionState, _ => this.NotifyPropertyChanged(nameof(this.IsUpgradeAvailable)), this); if (this.protoObjectLaunchpad.ConfigUpgrade.Entries.Count > 0) { this.ViewModelStructureUpgrade = new ViewModelStructureUpgrade(this.protoObjectLaunchpad.ConfigUpgrade.Entries[0]); } }
public ViewModelLaunchpadTask( IStaticWorldObject worldObject, ProtoObjectLaunchpad.LaunchpadTask task, int index, ObjectLaunchpadPrivateState privateState) { this.worldObject = worldObject; this.task = task; this.index = index; this.privateState = privateState; privateState.ClientSubscribe(_ => _.TaskCompletionState, _ => this.NotifyPropertyChanged(nameof(this.IsCompleted)), this); }