Я довольно новичок в программировании и нуждается в помощи с Prgram, который я делаю < /p>
с использованием UnityEngine; < /p>
с использованием unityEngine.ui; < /p>
unumerics; Unityeditor.shadergraph.internal; < /p>
Использование системы; < /p>
public class screenmanager: monobehaviour
{< /p>
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];
}
}
< /code>
} < /p>
Использование UnityEngine; < /p>
Использование System.collections.generic; < /p>
Использование System; < /p>
public Class Themist: monobehaviour
{< /p>
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>
}; < /p>
} < /p>
Im в настоящее время делаю игру с опасностью и работаю над тем, что я хотел использовать словарь и получить тему Keys и отображать их на моем экране, но я не работал с списком или Dolary. Когда я пытаюсь положить на экран или в массив, я получаю эту ошибку, не может косвенно преобразовать тип «unityEngine.transform» в строку строки 27, не может неявно преобразовать тип '(строковый вопрос, строковый ответ) [] «строка» в строке 86. Любая справка приспособлена
Подробнее здесь: https://stackoverflow.com/questions/797 ... y-promblem
Поместите ключи в документацию в массивную PROMBLEM [закрыто] ⇐ C#
Место общения программистов C#
-
Anonymous
1756572058
Anonymous
Я довольно новичок в программировании и нуждается в помощи с Prgram, который я делаю < /p>
с использованием UnityEngine; < /p>
с использованием unityEngine.ui; < /p>
unumerics; Unityeditor.shadergraph.internal; < /p>
Использование системы; < /p>
public class screenmanager: monobehaviour
{< /p>
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[i];
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[i].text = topicList.qaBank[topic];
}
}
< /code>
} < /p>
Использование UnityEngine; < /p>
Использование System.collections.generic; < /p>
Использование System; < /p>
public Class Themist: monobehaviour
{< /p>
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>
}; < /p>
} < /p>
Im в настоящее время делаю игру с опасностью и работаю над тем, что я хотел использовать словарь и получить тему Keys и отображать их на моем экране, но я не работал с списком или Dolary. Когда я пытаюсь положить на экран или в массив, я получаю эту ошибку, не может косвенно преобразовать тип «unityEngine.transform» в строку строки 27, не может неявно преобразовать тип '(строковый вопрос, строковый ответ) [] «строка» в строке 86. Любая справка приспособлена
Подробнее здесь: [url]https://stackoverflow.com/questions/79751284/putting-keys-in-docuumentation-into-a-array-promblem[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия