private void Awake() { button = GetComponent <Button>(); label = GetComponentInChildren <TextMeshProUGUI>(); input = transform.parent.GetComponent <InputScreen>(); buttonImage = GetComponent <Image>(); enabledSprite = buttonImage.sprite; Texture2D disabledTexture = UUI.LoadTextureFromFile("UI_Button_disabled.png"); disabledSprite = Sprite.Create(disabledTexture, new Rect(0, 0, disabledTexture.width, disabledTexture.height), new Vector2(0.5f, 0.5f), 100f); button.onClick.AddListener(() => { if (isBackspace) { input.Backspace(); } else if (isPaste) { input.Paste(); } else { input.SendKeyPress(key); } }); }
private void Awake() { TextMeshProUGUI text = transform.Find("label").GetComponent <TextMeshProUGUI>(); InputScreen input = CustomUI.InputScreenUI.GetComponent <InputScreen>(); Button btnConfirm = CustomUI.InputScreenUI.transform.Find("Button Confirm").GetComponent <Button>(); Button btnClose = CustomUI.InputScreenUI.transform.Find("Button Close").GetComponent <Button>(); GetComponent <Button>().onClick.AddListener(() => { MenuScreen prevScreen = CustomUI.currentScreen; input.SetTitle(title); input.Input = text.text; input.isDigitOnly = isDigitOnly; CustomUI.Open(CustomUI.InputScreenUI); input.OnOpen(); btnConfirm.onClick.RemoveAllListeners(); btnConfirm.onClick.AddListener(() => { text.text = input.Input; CustomUI.Open(prevScreen); input.OnClose(); }); btnClose.onClick.RemoveAllListeners(); btnClose.onClick.AddListener(() => { CustomUI.Open(prevScreen); input.OnClose(); }); }); }
public Level2() { Console.WriteLine("Level2"); Reset(); timebarSpace = 10.768F; this.Add(new SpriteGameObject("spr_background")); thePlayer = new Player(3, 3); door = new Door(14, 0); goal = new MainGoal(26, 3); xaxis = new Xaxis(8, "Map/spr_horizontal_art_blue"); yaxis = new Yaxis(20, "Map/spr_vertical_art_blue"); Mouse.SetPosition(GameEnvironment.Screen.X / 2, GameEnvironment.Screen.Y / 2); floors = new GameObjectList(); walls = new GameObjectList(); goals = new GameObjectList(); inputScreen = new InputScreen(GameEnvironment.Screen.X / 2 - 64 * 2, GameEnvironment.Screen.Y); inputanswer = new InputAnswer(GameEnvironment.Screen.X / 2 - 64 * 2, GameEnvironment.Screen.Y); timeGround = new SpriteGameObject("Map/time_ground"); guards = new GameObjectList(); lasers = new GameObjectList(); times = new GameObjectList(); score = new Score(12, 20, (int)time); Axis_nums = new Axis_numbers(20, 8); switchBoards = new GameObjectList(); this.Add(floors); this.Add(switchBoards); this.Add(lasers); this.Add(walls); this.Add(door); this.Add(xaxis); this.Add(yaxis); this.Add(Axis_nums); this.Add(goal); this.Add(goals); this.Add(guards); this.Add(thePlayer); this.Add(inputScreen); this.Add(timeGround); this.Add(times); this.Add(score); this.Add(inputanswer); goals.Add(new ExtraGoal(11, 9)); guards.Add(new Guard(new Vector2(3, 13), new Vector2(25, 13))); FloorSetup(); WallSetup(); TimeBarSetup(); SoundSetup(); lasers.Add(new Laser(new Vector2(11, 6), new Vector2(14, 10), Color.Red, xaxis.gridPos, yaxis.gridPos)); lasers.Add(new Laser(new Vector2(23, 10), new Vector2(28, 7), Color.Blue, xaxis.gridPos, yaxis.gridPos)); switchBoards.Add(new SwitchBoard(3, 7, Color.Blue)); switchBoards.Add(new SwitchBoard(22, 3, Color.Red)); }
/// <summary> /// Sets this. /// </summary> /// <param name="name">The name of this.</param> /// <param name="onNameChanged">The first string representing the new name and the second one the old one.</param> /// <param name="onRemove">On removing this.</param> public void Set(string name, System.Action <string, string, PlayerInterface> onNameChanged, System.Action <string> onRemove) { this.SetName(name); this.onNameChanged = onNameChanged; this.onRemove = onRemove; this.nameInputButton.onClick.AddListener(delegate { InputScreen.Create().Set("What is the Name of this Player?", 2, 14, true, OnNameChanged, lineType: InputField.LineType.SingleLine, startValue: "", contentType: InputField.ContentType.Name, promptText: "Enter Name"); }); this.removeButton.onClick.AddListener(OnRemove); }
IEnumerator HandlingInputLine(string line) { string title = line.Split('"')[1]; InputScreen.Show(title); while (InputScreen.isWaitingForUserInput) { yield return(new WaitForEndOfFrame()); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Alpha1)) { InputScreen.Show(displayTitle); } if (Input.GetKeyDown(KeyCode.Return) && InputScreen.isWaitingForUserInput) { InputScreen.instance.Accept(); print("You entered the value of " + InputScreen.currentInput); } }
public void PromptChangeQuestion(QuestionEditInterface questionEditInterface) { if (questionEditInterface == null) { Debug.LogError(this.GetType().FullName + ": Null interface."); return; } string startValue = string.Equals(questionEditInterface.Question.value, QuestionManager.emptyQuestion) ? "" : questionEditInterface.Question.value; InputScreen.Create().Set("Change question: ", 3, 140, true, (newValue) => { OnChangeQuestion(questionEditInterface, newValue); }, startValue: startValue); }
static void Main() { // Madlip in ASCII 'broadway' font MadLipOpeningScreen.MadLipDisplayinRed(); // "We need some input" in ASCII font InputScreen.InputDisplay(); // init Game MainGame mainGame = new MainGame(); mainGame.madlibRun(); // End Title EndingGameScene.EndTitle(); }
void Awake() { _Instance = this; mPressedLeft = false; mPressedRight = false; mPressedForward = false; mPressedBackward = false; mMouseClicked = false; UICamera.fallThrough = this.gameObject; #if UNITY_STANDALONE mAnchorLeft.relativeOffset = new Vector2(-1, -1); mAnchorRight.relativeOffset = new Vector2(-1, -1); #endif }
IEnumerator HandlingInputLine(string line) { string title = line.Split('"')[1]; //get the one or more commands to execute when this input is done and accepted. string[] parts = line.Split(' '); List <string> endingCommands = new List <string>(); if (parts.Length >= 3) { for (int i = 2; i < parts.Length; i++) { endingCommands.Add(parts[i]); } } //we have the title and the ending commands to execute. Now we need to bring up the input screen. InputScreen.Show(title); while (InputScreen.isShowingInputField || InputScreen.isRevealing) { //wait for the input screen to finish revealing before being able to accept input. if (Input.GetKey(KeyCode.Return) && !InputScreen.isRevealing) { //if the input is not empty, accept it. if (InputScreen.currentInput != "") { InputScreen.instance.Accept(); } } yield return(new WaitForEndOfFrame()); } //the input has been accepted, now it is time to execute the commands that follow. for (int i = 0; i < endingCommands.Count; i++) { string command = endingCommands[i]; HandleAction(command); } }
public FormEdit() { InitializeComponent(); ScreenObj = new InputScreen(SplitContainer.Panel2); }
void Awake() { instance = this; Hide(); }
public Level4() { Console.WriteLine("Level4"); Reset(); timebarSpace = 10.768F; this.Add(new SpriteGameObject("spr_background")); thePlayer = new Player(2, 2); door = new Door(1, 0); xaxis = new Xaxis(8, "Map/spr_horizontal_art_blue"); yaxis = new Yaxis(13, "Map/spr_vertical_art_blue"); goal = new MainGoal(3, 13); Mouse.SetPosition(GameEnvironment.Screen.X / 2, GameEnvironment.Screen.Y / 2); floors = new GameObjectList(); walls = new GameObjectList(); goals = new GameObjectList(); inputScreen = new InputScreen(GameEnvironment.Screen.X / 2 - 64 * 2, GameEnvironment.Screen.Y); inputanswer = new InputAnswer(GameEnvironment.Screen.X / 2 - 64 * 2, GameEnvironment.Screen.Y); timeGround = new SpriteGameObject("Map/time_ground"); guards = new GameObjectList(); lasers = new GameObjectList(); times = new GameObjectList(); score = new Score(12, 20, (int)time); Axis_nums = new Axis_numbers(13, 8); switchBoards = new GameObjectList(); this.Add(floors); this.Add(switchBoards); this.Add(lasers); this.Add(walls); this.Add(door); this.Add(xaxis); this.Add(yaxis); this.Add(Axis_nums); this.Add(goal); this.Add(goals); this.Add(guards); this.Add(thePlayer); this.Add(inputScreen); this.Add(timeGround); this.Add(times); this.Add(score); this.Add(inputanswer); goals.Add(new ExtraGoal(7, 2)); goals.Add(new ExtraGoal(12, 2)); goals.Add(new ExtraGoal(22, 2)); goals.Add(new ExtraGoal(26, 2)); goals.Add(new ExtraGoal(27, 2)); goals.Add(new ExtraGoal(26, 3)); goals.Add(new ExtraGoal(27, 3)); goals.Add(new ExtraGoal(17, 8)); goals.Add(new ExtraGoal(9, 13)); goals.Add(new ExtraGoal(26, 13)); FloorSetup(); WallSetup(); TimeBarSetup(); SoundSetup(); lasers.Add(new Laser(new Vector2(21, 9), new Vector2(28, 6), Color.Red, xaxis.gridPos, yaxis.gridPos)); lasers.Add(new Laser(new Vector2(13, 10), new Vector2(19, 4), Color.Blue, xaxis.gridPos, yaxis.gridPos)); lasers.Add(new Laser(new Vector2(14, 12), new Vector2(26, 15), Color.Yellow, xaxis.gridPos, yaxis.gridPos)); lasers.Add(new Laser(new Vector2(7, 12), new Vector2(5, 15), Color.Purple, xaxis.gridPos, yaxis.gridPos)); lasers.Add(new Laser(new Vector2(1, 9), new Vector2(5, 11), Color.Green, xaxis.gridPos, yaxis.gridPos)); lasers.Add(new Laser(new Vector2(26, 5), new Vector2(28, 5), Color.DarkGray, xaxis.gridPos, yaxis.gridPos)); lasers.Add(new Laser(new Vector2(1, 5), new Vector2(6, 10), Color.Aqua, xaxis.gridPos, yaxis.gridPos)); switchBoards.Add(new SwitchBoard(15, 10, Color.Red)); switchBoards.Add(new SwitchBoard(6, 10, Color.Blue)); switchBoards.Add(new SwitchBoard(23, 10, Color.Yellow)); switchBoards.Add(new SwitchBoard(20, 11, Color.Purple)); switchBoards.Add(new SwitchBoard(10, 11, Color.Green)); switchBoards.Add(new SwitchBoard(17, 11, Color.DarkGray)); switchBoards.Add(new SwitchBoard(4, 4, Color.Aqua)); guards.Add(new Guard(new Vector2(2, 13), new Vector2(25, 13))); guards.Add(new Guard(new Vector2(26, 13), new Vector2(27, 1))); guards.Add(new Guard(new Vector2(5, 8), new Vector2(11, 2))); }
public void ShowInputScreen(InputScreen instance) { activeScreens[2] = instance; activeScreens[2].Show(1f); }
public void Start() { Instance = this; }
private void PromptNameChange() { InputScreen.Create().Set("New Set Name?", 2, 15, true, callbackConfirm: OnSetNameChanged, lineType: InputField.LineType.SingleLine, startValue: currSet.GetDisplayName()); }
private void ClearButton_Click(object sender, EventArgs e) { InputScreen.Clear(); LexerOutput.Items.Clear(); ParserOutput.Items.Clear(); }
void Awake() { instance = this; }