using UniRx; using UnityEngine; public class FirePump { /// ///ID /// public string Id{get;set;} /// ///类型 /// public string Type{get;set;} /// ///型号 /// public string Mode{get;set;} /// ///功率 /// public string Power{get;set;} /// ///扬程 /// public string Lift{get;set;} /// ///流量 /// public string Flow{get;set;} /// ///压力 /// public string Pressure{get;set;} } public class FirePumpReactive:ISetData { /// ///Data /// private FirePump Data{get;set;}= new FirePump(); /// ///ID /// public ReactiveProperty Id{get;set;}= new ReactiveProperty(); /// ///类型 /// public ReactiveProperty Type{get;set;}= new ReactiveProperty(); /// ///型号 /// public ReactiveProperty Mode{get;set;}= new ReactiveProperty(); /// ///功率 /// public ReactiveProperty Power{get;set;}= new ReactiveProperty(); /// ///扬程 /// public ReactiveProperty Lift{get;set;}= new ReactiveProperty(); /// ///流量 /// public ReactiveProperty Flow{get;set;}= new ReactiveProperty(); /// ///压力 /// public ReactiveProperty Pressure{get;set;}= new ReactiveProperty(); public FirePumpReactive() { Id.Subscribe(value => Data.Id= value); Type.Subscribe(value => Data.Type= value); Mode.Subscribe(value => Data.Mode= value); Power.Subscribe(value => Data.Power= value); Lift.Subscribe(value => Data.Lift= value); Flow.Subscribe(value => Data.Flow= value); Pressure.Subscribe(value => Data.Pressure= value); } public void SetData(FirePump data) { Data = data; Id.Value = data.Id; Type.Value = data.Type; Mode.Value = data.Mode; Power.Value = data.Power; Lift.Value = data.Lift; Flow.Value = data.Flow; Pressure.Value = data.Pressure; } public FirePump GetData() { return Data; } }