/* * Handles user input to control the function menu */ public void FunctionMenuControls() { if (uiController.hasTutorial) { Tutorial tut = uiController.tutorial.GetComponent <Tutorial>(); TutorialProperties tutProp = tut.tutorials[tut.index].GetComponent <TutorialProperties>(); if (!(!uiController.tutorial.activeSelf || (uiController.tutorial.activeSelf && tutProp.AllowInventoryControls))) { return; } } if (!uiController.YAxisAccessed) { if (Input.GetAxis("Left Stick Y Axis") <= -0.5) { uiController.YAxisAccessed = true; ChangeHighlightedFunction(-1); UpdateHighlightedFunction(); } else if (Input.GetAxis("Left Stick Y Axis") >= 0.5) { uiController.YAxisAccessed = true; ChangeHighlightedFunction(1); UpdateHighlightedFunction(); } } if (Input.GetButtonDown("B_Button")) { uiController.activeLineManager.functions[activeFunction].GetComponent <Image>().sprite = previousFunctionSprite; uiController.functionMenuInteraction = false; } if (Input.GetButtonDown("A_Button") && previousFunctionSprite != null) { string newText = uiController.activeLineManager.functions[activeFunction].GetComponent <Function>().tag; Line line = uiController.activeLineManager.lines[uiController.ReturnActiveLine()].GetComponent <Line>(); line.AddToText(newText); Function function = uiController.activeLineManager.functions[activeFunction].GetComponent <Function>(); function.line = line; function.parent.CallFunction(newText); uiController.activeLineManager.functions[activeFunction].GetComponent <Image>().sprite = previousFunctionSprite; uiController.functionMenuInteraction = false; } }
/* * Handles userinput to control the selection and general controls for the line manager. */ public void LineControls() { if (uiController.hasTutorial) { Tutorial tut = uiController.tutorial.GetComponent <Tutorial>(); TutorialProperties tutProp = tut.tutorials[tut.index].GetComponent <TutorialProperties>(); /*if (!(!uiController.tutorial.activeSelf || (uiController.tutorial.activeSelf && tutProp.AllowInventoryControls))) * { * return; * }*/ if (uiController.tutorial.activeSelf && !tutProp.AllowInventoryControls) { return; } } if (!uiController.YAxisAccessed) { if (Input.GetAxis("Left Stick Y Axis") <= -0.5 || Input.GetAxis("DPad Y Axis") >= 0.5) { uiController.YAxisAccessed = true; ChangeHighlightedLine(-1); UpdateHighlightedLine(); } else if (Input.GetAxis("Left Stick Y Axis") >= 0.5 || Input.GetAxis("DPad Y Axis") <= -0.5) { uiController.YAxisAccessed = true; ChangeHighlightedLine(1); UpdateHighlightedLine(); } } if (Input.GetButtonDown("A_Button")) { lineCode = activeLineObject.GetComponent <Line>(); if (lineCode.subObject != null) { lineCode.subObject.GetComponent <Text>().color = Color.yellow; uiController.subObjectInteraction = true; //// = 1; } else if (uiController.FunctionExists()) { //function menu //TODO: Change this print(lineCode.GetText().Trim().Length); if (lineCode.GetText().Trim().Length <= 2) { uiController.functionMenuInteraction = true; uiController.UpdateHighlightedFunction(); } } } if (Input.GetButtonDown("B_Button")) { Image lineImage = uiController.activeLineManager.lines[activeLine].GetComponent <Image>(); lineImage.sprite = previousLineSprite; uiController.activeInterface.SetActive(false); uiController.HackingUIParent.SetActive(false); uiController.activeInventory = false; if (uiController.tutorial.GetComponent <Tutorial>().disableAtEnd) { uiController.tutorial.SetActive(false); } activeLine = 0; lineImage = uiController.activeLineManager.lines[activeLine].GetComponent <Image>(); lineImage.sprite = previousLineSprite; } }