Поместите ключи в документацию в массивную PROMBLEM [закрыто]C#

Место общения программистов C#
Ответить
Гость
 Поместите ключи в документацию в массивную PROMBLEM [закрыто]

Сообщение Гость »

Я довольно новичок в программировании и нуждался в помощи с программой, которую я делаю < /p>
using UnityEngine;

using UnityEngine.UI;

using TMPro;

using System.Numerics;

using UnityEditor.ShaderGraph.Internal;

using System;

public class ScreenManager : MonoBehaviour

{
public TMP_Text[] texts = new TMP_Text[6];

public Camera cam;

public String[,] questions;

public TopicList topicList;

// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
displayTopics();
questions = new String[6, 6];
for (int i = 0; i < 6; i++)
{
questions[i, 0] = topicList.topics;
for (int j = 0; j < 6; j++)
{

String Topics = questions[i, 0];

}

}

}

// Update is called once per frame
void Update()
{

if (Input.GetMouseButtonDown(0))
{
Ray ray = cam.ScreenPointToRay(Input.mousePosition);

RaycastHit hit;
if (Physics.Raycast(ray, out hit, 100))
{
Debug.DrawLine(transform.position, ray.direction, Color.red);
if (hit.collider.tag == "200Trigger")
{
Debug.Log("200 hit");

}

}

}

}

void displayTopics()
{

int i = 0;
foreach (string topic in topicList.qaBank.Keys)
{
i++;

texts.text = topicList.qaBank[topic];

}

}
}

using UnityEngine;

using System.Collections.Generic;

using System;

public class TopicList : MonoBehaviour
{

public List topics = new List();

public void Start()
{

}

// Topic categories

// Questions and Answers mapped by topic
public Dictionary qaBank =
new Dictionary()
{
{
"Math", new (string, string)[]
{
("What is 5 × 6?", "30"),
("What is the square root of 81?", "9"),
("What is 12 × 12?", "144"),
("What is the value of π rounded to 2 decimal places?", "3.14"),
("What is 7! (factorial)?", "5040"),
("What is the derivative of x²?", "2x")
}
},
{
"Science", new (string, string)[]
{
("What planet is known as the Red Planet?", "Mars"),
("What gas do humans need to breathe?", "Oxygen"),
("What force keeps us on the ground?", "Gravity"),
("What is H2O commonly called?", "Water"),
("What part of the cell is the powerhouse?", "Mitochondria"),
("What is the speed of light in vacuum (m/s)?", "299,792,458")
}
},
{
"History", new (string, string)[]
{
("Who was the first President of the United States?", "George Washington"),
("What year did World War II end?", "1945"),
("Who wrote the Declaration of Independence?", "Thomas Jefferson"),
("What empire built the Colosseum?", "The Roman Empire"),
("Who was known as the Maid of Orléans?", "Joan of Arc"),
("Who was the British Prime Minister during WWII?", "Winston Churchill")
}
},
{
"Geography", new (string, string)[]
{
("What is the largest ocean?", "Pacific Ocean"),
("What is the capital of France?", "Paris"),
("What is the longest river in the world?", "Nile River"),
("Which desert is the largest in the world?", "Sahara"),
("What continent is Brazil in?", "South America"),
("Mount Everest lies between Nepal and what country?", "China")
}
},
{
"Literature", new (string, string)[]
{
("Who wrote 'Romeo and Juliet'?", "William Shakespeare"),
("What is the name of the hobbit in 'The Lord of the Rings'?", "Frodo Baggins"),
("Who wrote 'The Raven'?", "Edgar Allan Poe"),
("What is the first book of the Bible?", "Genesis"),
("Who wrote '1984'?", "George Orwell"),
("In Greek myth, who was the goddess of wisdom?", "Athena")
}
},
{
"Vtubing", new (string, string)[]
{
("Who is considered the first popular VTuber?", "Kizuna AI"),
("Which company manages Hololive?", "Cover Corp"),
("What is the main streaming platform for most VTubers?", "YouTube"),
("Which VTuber is known as the 'Shark Girl'?", "Gawr Gura"),
("What software is often used for Live2D VTuber models?", "VTube Studio"),
("Who is the purple-haired AI VTuber known for osu! and variety streaming?", "Neuro-sama")
}
}
};

}
< /code>
Я в настоящее время делаю игру с угрозой Stlye и работаю над экраном, я хотел использовать словарь, получить тему Keys и отобразить их на моем экране, но я не работал со списком или словарем. Когда я пытаюсь положить на экран или в массив, я получаю эту ошибку, не может косвенно преобразовать тип «unityEngine.transform» в строку строки 27, не может неявно преобразовать тип '(строковый вопрос, строковый ответ) [] «строка» в строке 86. Любая справка приспособлена

Подробнее здесь: https://stackoverflow.com/questions/797 ... y-promblem
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»