public ReadingsGroupViewLogic(BatteryElement battery, ReadingDescriptorGrouping group) { Contract.Requires(battery, "battery").NotToBeNull(); Contract.Requires(group, "group").NotToBeNull(); this.Battery = battery; this.Group = group; this.Readings = this.Group.Descriptors.Select(x => new BatteryReadingProvider(this.Battery, x)).ToList(); }
private void SceneManagerOnActiveSceneChanged(Scene oldScene, Scene newScene) { if (newScene.name == "GameCore") { if (SpawnController == null) SpawnController = Resources.FindObjectsOfTypeAll<BeatmapObjectSpawnController>().FirstOrDefault(); if (SpawnController == null) return; if (PluginConfig.Instance.BattteryShow && Plugin.Control.IsAToyActive()) { BatteryElement = new GameObject("BatteryElement").AddComponent<BatteryElement>(); } } }
public static T GetValue <T>(BatteryElement element, EntryKey key, T defaultValue = default(T)) { T result = defaultValue; IReadingValue readingValue; if (element.CustomData.TryGetValue(key, out readingValue)) { if (readingValue.IsDefined) { result = readingValue.Get <T>(); } } return(result); }
protected override Element CreateChildForParameter(Parameter parameter) { if (IsBip) { switch (parameter.Id) { case 1: Bluetooth = new BluetoothElement(parameter, this); return(Bluetooth); case 2: Alarm = new AlarmElement(parameter, this); return(Alarm); case 3: Unlocked = new UnlockedElement(parameter, this); return(Unlocked); case 4: DoNotDisturb = new DoNotDisturbElement(parameter, this); return(DoNotDisturb); } } else { switch (parameter.Id) { case 1: DoNotDisturb = new DoNotDisturbElement(parameter, this); return(DoNotDisturb); case 2: Unlocked = new UnlockedElement(parameter, this); return(Unlocked); case 3: Bluetooth = new BluetoothElement(parameter, this); return(Bluetooth); case 4: Battery = new BatteryElement(parameter, this); return(Battery); } } return(base.CreateChildForParameter(parameter)); }
public BatteryReadingProvider(BatteryElement batteryElement, ReadingDescriptor descriptor) { Contract.Requires(batteryElement, "batteryElement").NotToBeNull(); Contract.Requires(descriptor, "descriptor").NotToBeNull(); this.BatteryElement = batteryElement; this.Descriptor = descriptor; this.m_sourceKeys = this.Descriptor.SourceKeys .GroupBy(x => x.Key(this.BatteryElement)) .ToDictionary(x => x.Key, x => x.Select(y => y.Value).ToList()); var sourceElements = m_sourceKeys.Keys .Distinct() .ToArray(); foreach (var element in sourceElements) { element.ValueChanged += this.OnValueChanged; } }
public static SMBusDataWrapper SMBusData(this BatteryElement batteryElement) { return(new SMBusDataWrapper(batteryElement.CustomData)); }
public static LtDataWrapper LtData(this BatteryElement batteryElement) { return(new LtDataWrapper(batteryElement.CustomData)); }
protected virtual void OnItemChanged(BatteryElement oldValue, BatteryElement newValue) { this.ViewLogic.Battery = newValue; }