Пример #1
0
 /// <summary>
 /// 内部データの初期化
 /// </summary>
 private void InitData()
 {
     // ゲーム状態管理の初期化
     CurrentGameCondition = (int)GameCondition.Progress;
     ErrorCode            = (int)ErrorType.None;
     // データ初期化
     Performance           = new TypingPerformance();
     numOfTask             = ConfigScript.Tasks;
     correctTypeNum        = 0;
     misTypeNum            = 0;
     totalTypingTime       = 0.0;
     keyPerMin             = 0.0;
     accuracyValue         = 0.0;
     currentTaskNumber     = 0;
     lastJudgeTime         = -1.0;
     isRecMistype          = false;
     isInputValid          = false;
     isIntervalEnded       = false;
     isSentenceMistyped    = false;
     CurrentTypingSentence = "";
     cpuTypeString         = "";
     UIOriginSentence.text = "";
     UIYomigana.text       = "";
     UIType.text           = "";
     InitKeyCodeQueue();
     if (ConfigScript.IsBeginnerMode)
     {
         INTERVAL = 0f;
     }
 }
Пример #2
0
    private void BeforeTest()
    {
        TP = new TypingPerformance();
        var type = TP.GetType();

        Assert.IsNotNull(TP);
        // テストデータを挿入
        for (int i = 0; i < TEST_SENTENCE_NUM; ++i)
        {
            TP.AddOriginSentence(testSentenceOriginList[i]);
            TP.AddTypedSentenceList(testSentenceTypeList[i]);
            TP.AddTypeJudgeList(testJudgeList[i]);
            TP.AddTypeTimeList(testTypeTimeList[i]);
        }

        // 正しく挿入されてるかチェック
        var prop1  = type.GetProperty("OriginSentenceList");
        var value1 = (List <string>)prop1.GetValue(TP);

        for (int i = 0; i < TEST_SENTENCE_NUM; ++i)
        {
            Assert.IsTrue(value1[i].Equals(testSentenceOriginList[i]));
        }
        var prop2  = type.GetProperty("TypedSentenceList");
        var value2 = (List <string>)prop2.GetValue(TP);

        for (int i = 0; i < TEST_SENTENCE_NUM; ++i)
        {
            Assert.IsTrue(value2[i].Equals(testSentenceTypeList[i]));
        }
        var prop3  = type.GetProperty("TypeJudgeList");
        var value3 = (List <List <int> >)prop3.GetValue(TP);

        for (int i = 0; i < TEST_SENTENCE_NUM; ++i)
        {
            for (int j = 0; j < testJudgeList[i].Count(); ++j)
            {
                Assert.IsTrue(value3[i][j] == testJudgeList[i][j]);
            }
        }
        var prop4  = type.GetProperty("TypeTimeList");
        var value4 = (List <List <double> >)prop4.GetValue(TP);

        for (int i = 0; i < TEST_SENTENCE_NUM; ++i)
        {
            for (int j = 0; j < testTypeTimeList[i].Count(); ++j)
            {
                Assert.IsTrue(value4[i][j] == testTypeTimeList[i][j]);
            }
        }
    }