84 lines
2.7 KiB
C#
84 lines
2.7 KiB
C#
using UnityEngine;
|
|||
|
|
|
||
|
|
namespace ScrewsMaster
|
||
|
|
{
|
||
|
|
public class QuestionBankKit
|
||
|
|
{
|
||
|
|
public static GameQuestionData GetQuestionTable(QuestionBank questionBankVo, bool isGuide)
|
||
|
|
{
|
||
|
|
if (isGuide)
|
||
|
|
{
|
||
|
|
return GetQuestionTableInternal(questionBankVo, 0, "newbie");
|
||
|
|
}
|
||
|
|
|
||
|
|
var bankTypeArr = questionBankVo.tableKey;
|
||
|
|
var nextIndexBankType = Random.Range(0, bankTypeArr.Length);
|
||
|
|
|
||
|
|
if (!GameHelper.IsGiftSwitch() && questionBankVo.type.Contains(2))
|
||
|
|
{
|
||
|
|
for (var i = 0; i < questionBankVo.type.Count; i++)
|
||
|
|
{
|
||
|
|
if (questionBankVo.type[i] != 2)
|
||
|
|
{
|
||
|
|
continue;
|
||
|
|
}
|
||
|
|
|
||
|
|
nextIndexBankType = i;
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
var questionType = questionBankVo.type[nextIndexBankType];
|
||
|
|
|
||
|
|
return GetQuestionTableInternal(questionBankVo, questionType, bankTypeArr[nextIndexBankType]);
|
||
|
|
}
|
||
|
|
|
||
|
|
private static GameQuestionData GetQuestionTableInternal(QuestionBank questionBankVo, int questionType,
|
||
|
|
string bankTypeKey)
|
||
|
|
{
|
||
|
|
var questionModel = new GameQuestionData
|
||
|
|
{
|
||
|
|
questionName = bankTypeKey,
|
||
|
|
questionType = questionType
|
||
|
|
};
|
||
|
|
|
||
|
|
var language = GameHelper.GetDeviceLanguage().ToUpper();
|
||
|
|
|
||
|
|
var tableKey = bankTypeKey;
|
||
|
|
if (language.Equals("PT") || language.Equals("ES") || language.Equals("RU"))
|
||
|
|
{
|
||
|
|
tableKey = $"{bankTypeKey}_{language}";
|
||
|
|
}
|
||
|
|
|
||
|
|
// var questionData = ConfigSystem.GetQuestion(tableKey).GetRandomQuestion();
|
||
|
|
// questionModel.questionTitle = questionData.subject;
|
||
|
|
// questionModel.answer = new[]
|
||
|
|
// {
|
||
|
|
// questionData.answer_one, questionData.answer_two, questionData.answer_three,
|
||
|
|
// questionData.answer_four
|
||
|
|
// };
|
||
|
|
// questionModel.logoId = questionData.Picture_name;
|
||
|
|
if (language.Equals("PT"))
|
||
|
|
{
|
||
|
|
questionModel.desc = questionBankVo.desc_pt;
|
||
|
|
}
|
||
|
|
else if (language.Equals("ES"))
|
||
|
|
{
|
||
|
|
questionModel.desc = questionBankVo.desc_es;
|
||
|
|
}
|
||
|
|
else if (language.Equals("RU"))
|
||
|
|
{
|
||
|
|
questionModel.desc = questionBankVo.desc_ru;
|
||
|
|
}
|
||
|
|
|
||
|
|
// questionModel.questionTableID = questionData.id;
|
||
|
|
|
||
|
|
if (bankTypeKey == "newbie")
|
||
|
|
{
|
||
|
|
questionModel.isGuide = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
return questionModel;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|