diff --git a/scripts/Addicted/System.reds b/scripts/Addicted/System.reds index adb81e23..e2c69843 100644 --- a/scripts/Addicted/System.reds +++ b/scripts/Addicted/System.reds @@ -62,6 +62,8 @@ public class AddictedSystem extends ScriptableSystem { this.onoManager = new AudioManager(); this.onoManager.Register(this.player); + this.CreateBiomon(); + this.RefreshConfig(); } else { F(s"no player found!"); } } @@ -110,6 +112,20 @@ public class AddictedSystem extends ScriptableSystem { this.onoManager.Register(this.player); } + private func CreateBiomon() -> Void { + let system = GameInstance.GetInkSystem(); + let hud = system.GetLayer(n"inkHUDLayer").GetVirtualWindow(); + let biomon = new BiomonitorComponent(); + let widget = hud + .GetGameController() + .SpawnFromExternal( + biomon, + r"addicted\\gameplay\\gui\\widgets\\biomonitor\\biomonitor_overlay.inkwidget", + n"Root:BiomonitorController" + ); + biomon.Reparent(hud); + } + public func RefreshConfig() -> Void { E(s"refresh config"); this.config = new AddictedConfig(); diff --git a/scripts/Addicted/ui/Component.reds b/scripts/Addicted/ui/Component.reds new file mode 100644 index 00000000..ae1262e1 --- /dev/null +++ b/scripts/Addicted/ui/Component.reds @@ -0,0 +1,223 @@ +public class BiomonitorComponent extends inkComponent { + + private let booting: ref; + private let firstname: ref; + private let lastname: ref; + private let age: ref; + private let blood: ref; + private let insurance: ref; + private let chemicals: array>; + private let vitals: array>>; + + private let hydroxyzine: ref; + private let hydroxyzineValue: ref; + private let tramadol: ref; + private let tramadolValue: ref; + private let desvenlafaxine: ref; + private let desvenlafaxineValue: ref; + private let amoxapine: ref; + private let amoxapineValue: ref; + private let lactobacillius: ref; + private let lactobacilliusValue: ref; + private let acetaminofen: ref; + private let acetaminofenValue: ref; + private let bupropion: ref; + private let bupropionValue: ref; + + protected cb func OnCreate() -> ref { + let container = new inkCanvas(); + container.SetName(n"Addicted_Biomon_Canvas"); + container.SetAnchor(inkEAnchor.Fill); + container.SetVisible(false); + + return container; + } + + // Called when component is attached to the widget tree + protected cb func OnInitialize() {this.booting = this.root.GetWidget(n"main_canvas/Booting_Info_Critica_Mask_Canvas/Booting_Info_Critical_Canvas/Booting_Screen/BOOTING_Text") as inkText; + let infos = this.root.GetWidget(n"main_canvas/Booting_Info_Critica_Mask_Canvas/Booting_Info_Critical_Canvas/Info_Screen/Info_MainScreen_Mask_Canvas/Info_MainScreen_Canvas") as inkCompoundWidget; + // E(s"\(ToString(infos))"); + this.firstname = infos.GetWidget(n"SANDRA_HPanel/Info_SANDRA_Text") as inkText; + this.lastname = infos.GetWidget(n"DORSET_HPanel/Info_DORSETT_Text") as inkText; + this.age = infos.GetWidget(n"AGE_HPanel/Info_29_Text") as inkText; + this.blood = infos.GetWidget(n"BLOOD_HPanel/Info_ABRHD_Text") as inkText; + this.insurance = (infos.GetWidgetByIndex(5) as inkHorizontalPanel).GetWidget(n"Info_NC570442_Text") as inkText; + + let chemicals = infos.GetWidget(n"Info_Chemical_Information_Canvas") as inkCanvas; + let topLine = chemicals.GetWidget(n"Info_Chemical_Info_Vertical/Info_Chemical_Info_H_Line1") as inkHorizontalPanel; + let middleLine = chemicals.GetWidget(n"Info_Chemical_Info_Vertical/Info_Chemical_Info_H_Line2") as inkHorizontalPanel; + let bottomLine = chemicals.GetWidget(n"Info_Chemical_Info_Vertical/Info_Chemical_Info_H_Line3") as inkHorizontalPanel; + + // defined individually because widgets path are kind of a mess + this.hydroxyzine = topLine.GetWidget(n"Info_N_HYDROXYZINE_text") as inkText; + this.hydroxyzineValue = topLine.GetWidget(n"inkHorizontalPanelWidget2/170/Info_170_text") as inkText; + this.tramadol = topLine.GetWidget(n"Info_TR2_TRAMADOL_Text") as inkText; + this.tramadolValue = topLine.GetWidget(n"inkHorizontalPanelWidget3/720/Info_TR2_TRAMADOL_Text") as inkText; + this.desvenlafaxine = topLine.GetWidget(n"Info_DESVENLAFAXINE_Text") as inkText; + this.desvenlafaxineValue = topLine.GetWidget(n"inkHorizontalPanelWidget4/300/Info_DESVENLAFAXINE_Text") as inkText; + this.amoxapine = middleLine.GetWidget(n"Info_AMOXAPINE_Text") as inkText; + this.amoxapineValue = middleLine.GetWidget(n"inkHorizontalPanelWidget5/220/Info_AMOXAPINE_Text") as inkText; + this.lactobacillius = middleLine.GetWidget(n"Info_R7_LACTOBACILLIUS_Text") as inkText; + this.lactobacilliusValue = middleLine.GetWidget(n"inkHorizontalPanelWidget6/400/Info_R7_LACTOBACILLIUS_Text") as inkText; + this.acetaminofen = middleLine.GetWidget(n"Info_ACETAMINOFEN_Text") as inkText; + this.acetaminofenValue = middleLine.GetWidget(n"inkHorizontalPanelWidget7/250/Info_ACETAMINOFEN_Text") as inkText; + this.bupropion = bottomLine.GetWidget(n"Info_BUPROPION_Text") as inkText; + this.bupropionValue = bottomLine.GetWidget(n"inkHorizontalPanelWidget5/Info_BUPROPION_Text") as inkText; + + this.chemicals = []; + ArrayPush(this.chemicals, this.hydroxyzine); + ArrayPush(this.chemicals, this.hydroxyzineValue); + ArrayPush(this.chemicals, this.tramadol); + ArrayPush(this.chemicals, this.tramadolValue); + ArrayPush(this.chemicals, this.desvenlafaxine); + ArrayPush(this.chemicals, this.desvenlafaxineValue); + ArrayPush(this.chemicals, this.amoxapine); + ArrayPush(this.chemicals, this.amoxapineValue); + ArrayPush(this.chemicals, this.lactobacillius); + ArrayPush(this.chemicals, this.lactobacilliusValue); + ArrayPush(this.chemicals, this.acetaminofen); + ArrayPush(this.chemicals, this.acetaminofenValue); + ArrayPush(this.chemicals, this.bupropion); + ArrayPush(this.chemicals, this.bupropionValue); + + let row: array>; + + let summary = infos.GetWidget(n"Critical_Screen_Text_Canvas/inkVerticalPanelWidget7/inkHorizontalPanelWidget2") as inkHorizontalPanel; + let leftmost = summary.GetWidget(n"Critical_Vertical") as inkVerticalPanel; + let center = summary.GetWidget(n"Critical_Vertical2") as inkVerticalPanel; + let rightmost = summary.GetWidget(n"Critical_Vertical_Warning") as inkVerticalPanel; + + + // E(s"summary: \(ToString(summary))"); + // E(s"leftmost: \(ToString(leftmost))"); + // E(s"center: \(ToString(center))"); + // E(s"rightmost: \(ToString(rightmost))"); + + // let size = center.GetNumChildren(); + // let j = 0; + // let child: ref; + // while j < size { + // child = center.GetWidgetByIndex(j); + // E(s"name: \(child.GetName()), type: \(ToString(child))"); + // j += 1; + // } + + ArrayResize(row, 3); + ArrayInsert(row, 0, leftmost.GetWidget(n"Critical_BLOOD_PRESSURE_text")); + ArrayInsert(row, 1, center.GetWidgetByIndex(0)); + ArrayInsert(row, 2, rightmost.GetWidgetByIndex(0)); + ArrayPush(this.vitals, row); + + ArrayClear(row); + ArrayInsert(row, 0, leftmost.GetWidget(n"Critical_LEVEL_AO_text")); + ArrayInsert(row, 1, center.GetWidgetByIndex(1)); + ArrayInsert(row, 2, rightmost.GetWidgetByIndex(1)); + ArrayPush(this.vitals, row); + + ArrayClear(row); + ArrayInsert(row, 0, leftmost.GetWidget(n"Critical_ALBU_GLOBU_text")); + ArrayInsert(row, 1, center.GetWidgetByIndex(2)); + ArrayInsert(row, 2, rightmost.GetWidgetByIndex(2)); + ArrayPush(this.vitals, row); + + ArrayClear(row); + ArrayInsert(row, 0, leftmost.GetWidget(n"Critical_ESR_text")); + ArrayInsert(row, 1, center.GetWidget(n"Critical_CRITICAL_text")); + ArrayInsert(row, 2, rightmost.GetWidgetByIndex(3)); + ArrayPush(this.vitals, row); + + ArrayClear(row); + ArrayInsert(row, 0, leftmost.GetWidget(n"Critical_RESPIRATORY_text")); + ArrayInsert(row, 1, center.GetWidget(n"Critical_AT_RISK_text")); + ArrayInsert(row, 2, rightmost.GetWidgetByIndex(4)); + ArrayPush(this.vitals, row); + + ArrayClear(row); + ArrayInsert(row, 0, leftmost.GetWidget(n"Critical_IMMUNE_text")); + ArrayInsert(row, 1, center.GetWidget(n"Critical_AT_RISK2_text")); + ArrayInsert(row, 2, rightmost.GetWidgetByIndex(5)); + ArrayPush(this.vitals, row); + + ArrayClear(row); + ArrayInsert(row, 0, leftmost.GetWidget(n"Critical_CNS_text")); + ArrayInsert(row, 1, center.GetWidget(n"Critical_AT_RISK3_text")); + ArrayInsert(row, 2, rightmost.GetWidgetByIndex(6)); + ArrayPush(this.vitals, row); + + ArrayClear(row); + ArrayInsert(row, 0, leftmost.GetWidget(n"Critical_PNS_text")); + ArrayInsert(row, 1, center.GetWidget(n"Critical_CRITICAL2_text")); + ArrayInsert(row, 2, rightmost.GetWidgetByIndex(7)); + ArrayPush(this.vitals, row); + + this.booting.SetLocalizedText(n"Mod-Addicted-Biomonitor-Booting"); + } + + // Called when component is no longer used anywhere + protected cb func OnUninitialize() {} + + public func SetCustomer(evt: ref) -> Void { + this.firstname.SetText(evt.Customer.FirstName); + this.lastname.SetText(evt.Customer.LastName); + this.age.SetText(evt.Customer.Age); + this.blood.SetText(evt.Customer.BloodGroup); + this.insurance.SetText(evt.Customer.Insurance); + + let chemicals = evt.Chemicals; + let chemical: ref; + + let found: Int32 = ArraySize(chemicals); + let current: Int32 = 0; + + let substance: ref; + let value: ref; + let controller: ref; + + while current < 7 { + substance = this.chemicals[current*2]; + value = this.chemicals[current*2+1]; + controller = value.GetController() as inkTextValueProgressController; + + if current < found { + chemical = chemicals[current]; + substance.SetLocalizationKey(chemical.Key); + controller.SetBaseValue(chemical.From); + controller.SetTargetValue(chemical.To); + } else { + substance.SetLocalizationKey(n"Mod-Addicted-Chemical-Irrelevant"); + controller.SetBaseValue(0.0); + controller.SetTargetValue(0.0); + } + + current += 1; + } + + let i = 0; + let total = ArraySize(this.vitals); + let symptom: ref; + let symptoms: array> = evt.Symptoms; + let size = ArraySize(symptoms); + while i < total { + if i < size { + symptom = symptoms[i]; + E(s"\(ToString(this.vitals[i][0])): \(symptom.Title)"); + E(s"\(ToString(this.vitals[i][1])): \(symptom.Status)"); + E(s"\(ToString(this.vitals[i][2])): show"); + (this.vitals[i][0] as inkText).SetText(symptom.Title); + (this.vitals[i][1] as inkText).SetText(symptom.Status); + this.vitals[i][0].SetVisible(true); + this.vitals[i][1].SetVisible(true); + this.vitals[i][2].SetVisible(true); + } else { + E(s"\(ToString(this.vitals[i][0])): empty"); + E(s"\(ToString(this.vitals[i][1])): empty"); + E(s"\(ToString(this.vitals[i][2])): hide"); + this.vitals[i][0].SetVisible(false); + this.vitals[i][1].SetVisible(false); + this.vitals[i][2].SetVisible(false); + } + i += 1; + } + E(s""); + } +} \ No newline at end of file diff --git a/scripts/Addicted/ui/BiomonitorController.reds b/scripts/Addicted/ui/Controller.reds similarity index 66% rename from scripts/Addicted/ui/BiomonitorController.reds rename to scripts/Addicted/ui/Controller.reds index 32e14d63..8bc57f20 100644 --- a/scripts/Addicted/ui/BiomonitorController.reds +++ b/scripts/Addicted/ui/Controller.reds @@ -8,127 +8,12 @@ import Addicted.Helper import Addicted.Threshold import Addicted.Mood -@addField(NameplateVisualsLogicController) -private let biomonitorWidget: wref; - -@wrapMethod(NameplateVisualsLogicController) -protected cb func OnInitialize() -> Bool { - wrappedMethod(); - let root = this.GetRootCompoundWidget().parentWidget.parentWidget.parentWidget as inkCompoundWidget; - let container = new inkCanvas(); - container.SetName(n"Addicted_Biomon_Canvas"); - container.SetAnchor(inkEAnchor.Fill); - container.SetVisible(false); - root.AddChildWidget(container); - this.biomonitorWidget = this.SpawnFromExternal(container, r"addicted\\gameplay\\gui\\widgets\\biomonitor\\biomonitor_overlay.inkwidget", n"Root:BiomonitorController"); -} - -enum BiomonitorState { - Idle = 0, - Booting = 1, - Analyzing = 2, - Summarizing = 3, - Closing = 4, - Dismissing = 5, -} - -enum BloodGroup { - Unknown = 0, - A = 1, - B = 2, - O = 3, - AB = 4, -} - -public class Chemical { - public let Key: CName; - public let From: Float; - public let To: Float; -} - -public class Symptom { - public let Title: String; - public let Status: String; -} - -public class Customer { - public let FirstName: String; - public let LastName: String; - public let Age: String; - public let BloodGroup: String; - public let Insurance: String; -} - -public class CrossThresholdEvent extends Event { - public let Customer: ref; - public let Symptoms: array>; - public let Chemicals: array>; - public let Dismissable: Bool; - public let boot: Bool; -} - -public class DismissBiomonitorEvent extends Event {} - -public class InteractionHubEvent extends Event { - public let Show: Bool; -} - -public class SkipTimeEvent extends Event {} - -public class CrossThresholdCallback extends DelayCallback { - private let controller: wref; - private let event: ref; - public func Call() -> Void { - E(s"attempt at warning again"); - this.controller.OnCrossThresholdEvent(this.event); - } -} - -public class ClosingBeepCallback extends DelayCallback { - private let controller: wref; - public func Call() -> Void { - E(s"beep on close"); - this.controller.Beep(); - } -} - -enum BiomonitorRestrictions { - InMenu = 1, - InRadialWheel = 2, - InQuickHackPanel = 3, - InPhotoMode = 4, -} - public class BiomonitorController extends inkGameController { private let animation: ref; private let root: ref; private let state: BiomonitorState; private let waiting: Bool; - private let booting: ref; - private let firstname: ref; - private let lastname: ref; - private let age: ref; - private let blood: ref; - private let insurance: ref; - private let chemicals: array>; - private let vitals: array>>; - - private let hydroxyzine: ref; - private let hydroxyzineValue: ref; - private let tramadol: ref; - private let tramadolValue: ref; - private let desvenlafaxine: ref; - private let desvenlafaxineValue: ref; - private let amoxapine: ref; - private let amoxapineValue: ref; - private let lactobacillius: ref; - private let lactobacilliusValue: ref; - private let acetaminofen: ref; - private let acetaminofenValue: ref; - private let bupropion: ref; - private let bupropionValue: ref; - private let postpone: DelayID; private let beep: DelayID; private let flags: Uint32; @@ -154,124 +39,6 @@ public class BiomonitorController extends inkGameController { this.root = this.GetRootWidget() as inkCompoundWidget; this.root.parentWidget.SetVisible(false); this.waiting = false; - - this.booting = this.root.GetWidget(n"main_canvas/Booting_Info_Critica_Mask_Canvas/Booting_Info_Critical_Canvas/Booting_Screen/BOOTING_Text") as inkText; - let infos = this.root.GetWidget(n"main_canvas/Booting_Info_Critica_Mask_Canvas/Booting_Info_Critical_Canvas/Info_Screen/Info_MainScreen_Mask_Canvas/Info_MainScreen_Canvas") as inkCompoundWidget; - // E(s"\(ToString(infos))"); - this.firstname = infos.GetWidget(n"SANDRA_HPanel/Info_SANDRA_Text") as inkText; - this.lastname = infos.GetWidget(n"DORSET_HPanel/Info_DORSETT_Text") as inkText; - this.age = infos.GetWidget(n"AGE_HPanel/Info_29_Text") as inkText; - this.blood = infos.GetWidget(n"BLOOD_HPanel/Info_ABRHD_Text") as inkText; - this.insurance = (infos.GetWidgetByIndex(5) as inkHorizontalPanel).GetWidget(n"Info_NC570442_Text") as inkText; - - let chemicals = infos.GetWidget(n"Info_Chemical_Information_Canvas") as inkCanvas; - let topLine = chemicals.GetWidget(n"Info_Chemical_Info_Vertical/Info_Chemical_Info_H_Line1") as inkHorizontalPanel; - let middleLine = chemicals.GetWidget(n"Info_Chemical_Info_Vertical/Info_Chemical_Info_H_Line2") as inkHorizontalPanel; - let bottomLine = chemicals.GetWidget(n"Info_Chemical_Info_Vertical/Info_Chemical_Info_H_Line3") as inkHorizontalPanel; - - // defined individually because widgets path are kind of a mess - this.hydroxyzine = topLine.GetWidget(n"Info_N_HYDROXYZINE_text") as inkText; - this.hydroxyzineValue = topLine.GetWidget(n"inkHorizontalPanelWidget2/170/Info_170_text") as inkText; - this.tramadol = topLine.GetWidget(n"Info_TR2_TRAMADOL_Text") as inkText; - this.tramadolValue = topLine.GetWidget(n"inkHorizontalPanelWidget3/720/Info_TR2_TRAMADOL_Text") as inkText; - this.desvenlafaxine = topLine.GetWidget(n"Info_DESVENLAFAXINE_Text") as inkText; - this.desvenlafaxineValue = topLine.GetWidget(n"inkHorizontalPanelWidget4/300/Info_DESVENLAFAXINE_Text") as inkText; - this.amoxapine = middleLine.GetWidget(n"Info_AMOXAPINE_Text") as inkText; - this.amoxapineValue = middleLine.GetWidget(n"inkHorizontalPanelWidget5/220/Info_AMOXAPINE_Text") as inkText; - this.lactobacillius = middleLine.GetWidget(n"Info_R7_LACTOBACILLIUS_Text") as inkText; - this.lactobacilliusValue = middleLine.GetWidget(n"inkHorizontalPanelWidget6/400/Info_R7_LACTOBACILLIUS_Text") as inkText; - this.acetaminofen = middleLine.GetWidget(n"Info_ACETAMINOFEN_Text") as inkText; - this.acetaminofenValue = middleLine.GetWidget(n"inkHorizontalPanelWidget7/250/Info_ACETAMINOFEN_Text") as inkText; - this.bupropion = bottomLine.GetWidget(n"Info_BUPROPION_Text") as inkText; - this.bupropionValue = bottomLine.GetWidget(n"inkHorizontalPanelWidget5/Info_BUPROPION_Text") as inkText; - - this.chemicals = []; - ArrayPush(this.chemicals, this.hydroxyzine); - ArrayPush(this.chemicals, this.hydroxyzineValue); - ArrayPush(this.chemicals, this.tramadol); - ArrayPush(this.chemicals, this.tramadolValue); - ArrayPush(this.chemicals, this.desvenlafaxine); - ArrayPush(this.chemicals, this.desvenlafaxineValue); - ArrayPush(this.chemicals, this.amoxapine); - ArrayPush(this.chemicals, this.amoxapineValue); - ArrayPush(this.chemicals, this.lactobacillius); - ArrayPush(this.chemicals, this.lactobacilliusValue); - ArrayPush(this.chemicals, this.acetaminofen); - ArrayPush(this.chemicals, this.acetaminofenValue); - ArrayPush(this.chemicals, this.bupropion); - ArrayPush(this.chemicals, this.bupropionValue); - - let row: array>; - - let summary = infos.GetWidget(n"Critical_Screen_Text_Canvas/inkVerticalPanelWidget7/inkHorizontalPanelWidget2") as inkHorizontalPanel; - let leftmost = summary.GetWidget(n"Critical_Vertical") as inkVerticalPanel; - let center = summary.GetWidget(n"Critical_Vertical2") as inkVerticalPanel; - let rightmost = summary.GetWidget(n"Critical_Vertical_Warning") as inkVerticalPanel; - - - // E(s"summary: \(ToString(summary))"); - // E(s"leftmost: \(ToString(leftmost))"); - // E(s"center: \(ToString(center))"); - // E(s"rightmost: \(ToString(rightmost))"); - - // let size = center.GetNumChildren(); - // let j = 0; - // let child: ref; - // while j < size { - // child = center.GetWidgetByIndex(j); - // E(s"name: \(child.GetName()), type: \(ToString(child))"); - // j += 1; - // } - - row = []; - ArrayPush(row, leftmost.GetWidget(n"Critical_BLOOD_PRESSURE_text")); - ArrayPush(row, center.GetWidgetByIndex(0)); - ArrayPush(row, rightmost.GetWidgetByIndex(0)); - ArrayPush(this.vitals, row); - - row = []; - ArrayPush(row, leftmost.GetWidget(n"Critical_LEVEL_AO_text")); - ArrayPush(row, center.GetWidgetByIndex(1)); - ArrayPush(row, rightmost.GetWidgetByIndex(1)); - ArrayPush(this.vitals, row); - - row = []; - ArrayPush(row, leftmost.GetWidget(n"Critical_ALBU_GLOBU_text")); - ArrayPush(row, center.GetWidgetByIndex(2)); - ArrayPush(row, rightmost.GetWidgetByIndex(2)); - ArrayPush(this.vitals, row); - - row = []; - ArrayPush(row, leftmost.GetWidget(n"Critical_ESR_text")); - ArrayPush(row, center.GetWidget(n"Critical_CRITICAL_text")); - ArrayPush(row, rightmost.GetWidgetByIndex(3)); - ArrayPush(this.vitals, row); - - row = []; - ArrayPush(row, leftmost.GetWidget(n"Critical_RESPIRATORY_text")); - ArrayPush(row, center.GetWidget(n"Critical_AT_RISK_text")); - ArrayPush(row, rightmost.GetWidgetByIndex(4)); - ArrayPush(this.vitals, row); - - row = []; - ArrayPush(row, leftmost.GetWidget(n"Critical_IMMUNE_text")); - ArrayPush(row, center.GetWidget(n"Critical_AT_RISK2_text")); - ArrayPush(row, rightmost.GetWidgetByIndex(5)); - ArrayPush(this.vitals, row); - - row = []; - ArrayPush(row, leftmost.GetWidget(n"Critical_CNS_text")); - ArrayPush(row, center.GetWidget(n"Critical_AT_RISK3_text")); - ArrayPush(row, rightmost.GetWidgetByIndex(6)); - ArrayPush(this.vitals, row); - - row = []; - ArrayPush(row, leftmost.GetWidget(n"Critical_PNS_text")); - ArrayPush(row, center.GetWidget(n"Critical_CRITICAL2_text")); - ArrayPush(row, rightmost.GetWidgetByIndex(7)); - ArrayPush(this.vitals, row); - - this.booting.SetLocalizedText(n"Mod-Addicted-Biomonitor-Booting"); } protected cb func OnUninitialize() { @@ -395,68 +162,7 @@ public class BiomonitorController extends inkGameController { } } - this.firstname.SetText(evt.Customer.FirstName); - this.lastname.SetText(evt.Customer.LastName); - this.age.SetText(evt.Customer.Age); - this.blood.SetText(evt.Customer.BloodGroup); - this.insurance.SetText(evt.Customer.Insurance); - - let chemicals = evt.Chemicals; - let chemical: ref; - - let found: Int32 = ArraySize(chemicals); - let current: Int32 = 0; - - let substance: ref; - let value: ref; - let controller: ref; - - while current < 7 { - substance = this.chemicals[current*2]; - value = this.chemicals[current*2+1]; - controller = value.GetController() as inkTextValueProgressController; - - if current < found { - chemical = chemicals[current]; - substance.SetLocalizationKey(chemical.Key); - controller.SetBaseValue(chemical.From); - controller.SetTargetValue(chemical.To); - } else { - substance.SetLocalizationKey(n"Mod-Addicted-Chemical-Irrelevant"); - controller.SetBaseValue(0.0); - controller.SetTargetValue(0.0); - } - - current += 1; - } - - let i = 0; - let total = ArraySize(this.vitals); - let symptom: ref; - let symptoms: array> = evt.Symptoms; - let size = ArraySize(symptoms); - while i < total { - if i < size { - symptom = symptoms[i]; - E(s"\(ToString(this.vitals[i][0])): \(symptom.Title)"); - E(s"\(ToString(this.vitals[i][1])): \(symptom.Status)"); - E(s"\(ToString(this.vitals[i][2])): show"); - (this.vitals[i][0] as inkText).SetText(symptom.Title); - (this.vitals[i][1] as inkText).SetText(symptom.Status); - this.vitals[i][0].SetVisible(true); - this.vitals[i][1].SetVisible(true); - this.vitals[i][2].SetVisible(true); - } else { - E(s"\(ToString(this.vitals[i][0])): empty"); - E(s"\(ToString(this.vitals[i][1])): empty"); - E(s"\(ToString(this.vitals[i][2])): hide"); - this.vitals[i][0].SetVisible(false); - this.vitals[i][1].SetVisible(false); - this.vitals[i][2].SetVisible(false); - } - i += 1; - } - E(s""); + this.root.SetCustomer(evt); if evt.Dismissable { E(s"set hub as dismissable"); diff --git a/scripts/Addicted/ui/Definitions.reds b/scripts/Addicted/ui/Definitions.reds new file mode 100644 index 00000000..258128c1 --- /dev/null +++ b/scripts/Addicted/ui/Definitions.reds @@ -0,0 +1,75 @@ +enum BiomonitorState { + Idle = 0, + Booting = 1, + Analyzing = 2, + Summarizing = 3, + Closing = 4, + Dismissing = 5, +} + +enum BloodGroup { + Unknown = 0, + A = 1, + B = 2, + O = 3, + AB = 4, +} + +public class Chemical { + public let Key: CName; + public let From: Float; + public let To: Float; +} + +public class Symptom { + public let Title: String; + public let Status: String; +} + +public class Customer { + public let FirstName: String; + public let LastName: String; + public let Age: String; + public let BloodGroup: String; + public let Insurance: String; +} + +public class CrossThresholdEvent extends Event { + public let Customer: ref; + public let Symptoms: array>; + public let Chemicals: array>; + public let Dismissable: Bool; + public let boot: Bool; +} + +public class DismissBiomonitorEvent extends Event {} + +public class InteractionHubEvent extends Event { + public let Show: Bool; +} + +public class SkipTimeEvent extends Event {} + +public class CrossThresholdCallback extends DelayCallback { + private let controller: wref; + private let event: ref; + public func Call() -> Void { + E(s"attempt at warning again"); + this.controller.OnCrossThresholdEvent(this.event); + } +} + +public class ClosingBeepCallback extends DelayCallback { + private let controller: wref; + public func Call() -> Void { + E(s"beep on close"); + this.controller.Beep(); + } +} + +enum BiomonitorRestrictions { + InMenu = 1, + InRadialWheel = 2, + InQuickHackPanel = 3, + InPhotoMode = 4, +} \ No newline at end of file