52 lines
1.3 KiB
C#
52 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class EnterValutaNameState : IState
|
|
{
|
|
TextInput textInput;
|
|
GameManager gm;
|
|
IState prevState;
|
|
|
|
public EnterValutaNameState(IState prevState)
|
|
{
|
|
this.prevState = prevState;
|
|
}
|
|
|
|
//private string name;
|
|
public void enter()
|
|
{
|
|
gm = GameManager.instance;
|
|
|
|
textInput = gm.ValutaNameInput;
|
|
textInput.gameObject.SetActive(true);
|
|
textInput.Initialize();
|
|
}
|
|
|
|
public void exit() => textInput.gameObject.SetActive(false);
|
|
|
|
public void update()
|
|
{
|
|
int discreteDir = 0;
|
|
if (In.GetButtonDown(ButtonPinMapping.left1)) discreteDir -= 1;
|
|
if (In.GetButtonDown(ButtonPinMapping.right1)) discreteDir += 1;
|
|
|
|
int continiousDir = 0;
|
|
if (In.GetButton(ButtonPinMapping.left2)) continiousDir -= 1;
|
|
if (In.GetButton(ButtonPinMapping.right2)) continiousDir += 1;
|
|
|
|
textInput.SwitchSlot(discreteDir);
|
|
textInput.SwitchLetter(continiousDir);
|
|
|
|
if (In.GetButtonDownAnyPlayer(PlayerAction.down))
|
|
{
|
|
PlayerPrefs.SetString("Price", textInput.AcceptAndClose());
|
|
|
|
//переход
|
|
//gm.stateMachine.ChangeState(new SettingsState());
|
|
gm.stateMachine.ChangeState(prevState);
|
|
}
|
|
|
|
}
|
|
}
|