C# 交互式游戏:以下代码中出现错误,意外符号为“)”,应为“;”或“}”

C# 交互式游戏:以下代码中出现错误,意外符号为“)”,应为“;”或“}”,c#,unity3d,C#,Unity3d,需要帮助:我想比较两个输入字段:1显示一个数字,1用户可以输入一个字母表与显示器进行比较,然后显示字段将在正确输入时颜色更改为绿色,在错误输入时颜色更改为红色。numEnemies显示一个意外的符号,并使用I 终于工作了 }问题是什么?unity向我展示了意想不到的符号'expecting;'或者`}@TehminaAslam将该细节添加到问题中,包括在错误复制和粘贴上抛出错误是代码问题所在的那一行&应该是@Programmer你忘了;,OP必须替换 public void InputCheki

需要帮助:我想比较两个输入字段:1显示一个数字,1用户可以输入一个字母表与显示器进行比较,然后显示字段将在正确输入时颜色更改为绿色,在错误输入时颜色更改为红色。numEnemies显示一个意外的符号,并使用I 终于工作了


}

问题是什么?unity向我展示了意想不到的符号'expecting;'或者`}@TehminaAslam将该细节添加到问题中,包括在错误复制和粘贴上抛出错误是代码问题所在的那一行&应该是@Programmer你忘了;,OP必须替换
public void InputCheking()
{
    UserInput = inp2.text;  // input field to get input from the user
    for(int i = 0; i < numEnemies; i++)
    {
        switch (UserInput) 
        {
        case "H":
            CheckingForEight();
            break;
        case "U":
            CheckingForTwentyOne();
            break;
        default:
            Debug.Log("Default execute");
            inp2.text = "";
            break;
        }
        Debug.Log("Creating enemy number: " + i);
    }
}

public void CheckingForEight()
{
    //========================Taking Static
    Debug.Log(inp1.text); // inp1 is an input field showing a perticular number gainst Alphabet such as 1 for A, 2 for B, and so on and so forth 
    if (UserInput == "H")
    {
        Debug.Log ("1st Phase");
        inp1.text = "H";
        inp1.image.color = Color.green; 
        inp2.text = "";
    }
    else
    {
        inp1.text = "8";
        Debug.Log("2nd Phase");
        inp1.image.color = Color.red;
    }

}
public void CheckingForTwentyOne()
{
    //========================Taking Static
    Debug.Log(inp1.text);
    UserInput = inp2.text;
    if (UserInput == "U")
    {
        inp21.text = "U";// another input field that shows 21 against alphabet U
        inp21.image.color = Color.green; 

    }
    else
    {
        inp21.text = "21";
        Debug.Log("Input In 2nd Phase");
        inp21.image.color = Color.red;
    }
}
using UnityEngine;
using UnityEngine.UI;




public class Level_1 : MonoBehaviour {

string word = null;
int wordIndex = 0;
string alpha;
public InputField textBox = null;
[SerializeField] private float mainTimer;
public Text timerText; 
public static float timer = 20f;
public Text resultText;

private bool canCounter = true;
private bool doOnce = false;

public InputField display8;
public InputField display21;
public InputField display12;
public InputField display11;
public InputField userInputField;

public string userEntry;




public void keyboardFunction(string alphabet){

    wordIndex++;
    word = word + alphabet;
    textBox.text = word; 
}

public void Okay()
{
    InputCheking ();
}
public void ValueChangeCheck()
{
    Debug.Log("Value Changed");
}
void Start () {
    timer = mainTimer; 

    //numStart = (int)KeyCode.Alpha0;
}

// Update is called once per frame
public void Update () {
    if (timer >= 0.0f && canCounter) {
        timer -= Time.deltaTime;
        timerText.text = timer.ToString("F");
    }
    else if (timer <= 0.0f && !doOnce){

        canCounter = false;
        doOnce = true;
        timerText.text = "0.00";
        timer = 0.0f; 
        SceneManager.LoadScene ("ResultScreen", LoadSceneMode.Single);
    }
    //  Debug.Log ("Scene Lodaing after TimeUp!");




}
public void InputCheking()
{
    userEntry = userInputField.text;
    switch (userEntry) 
    {
    case "H":
        Debug.Log ("User put H");
        display8.image.color = Color.green;
        display8.text = "H";
        userInputField.image.color = Color.white;
        display8.DeactivateInputField ();
        userInputField.text = "";
        break;
    case "U":
        Debug.Log ("User put U");
        display21.text = "U";
        display21.image.color = Color.green;
        userInputField.image.color = Color.white;
        userInputField.text = "";
        break;
    case "L":
        Debug.Log ("User put L");
        display12.text = "L";
        display12.image.color = Color.green;
        userInputField.image.color = Color.white;
        userInputField.text = "";
        break;
    case "K":
        display11.image.color = Color.green;
        display11.text = "K";
        userInputField.image.color = Color.white;
        userInputField.text = "";
        Result ();
        Debug.Log ("User put K");
        break;
    default:

        Debug.Log ("Please Enter a correct Alphabet against Number");
        userInputField.image.color = Color.red;
        userInputField.text = "TRY AGAIN";
        break;
    }
}
public void Result()
{
    if (display8.text == "H" && display21.text == "U" && display12.text == "L" && display11.text == "K") {
    //  DisplayComment.text = "Excellent";
        Debug.Log ("Working");
    } 
    else 
    {
        userInputField.text = "Complete All Boxes";
    }
}