Projekt

Obecné

Profil

« Předchozí | Další » 

Revize da24cc5e

Přidáno uživatelem Milan Horínek před téměř 2 roky(ů)

Generator a snaha o learning phase

Zobrazit rozdíly:

workdir/Asociace/Assembly-CSharp.csproj
134 134
    <Compile Include="Assets\Scripts\_Template\OutputData\DataCollector.cs" />
135 135
    <Compile Include="Assets\Scripts\_Template\OutputData\TaskResults.cs" />
136 136
    <Compile Include="Assets\Scripts\Tools\Platform.cs" />
137
    <Compile Include="Assets\Scripts\Data\Input\Exam.cs" />
138
    <Compile Include="Assets\Scripts\Data\Input\Pair.cs" />
137 139
  </ItemGroup>
138 140
  <ItemGroup>
139 141
    <None Include="Assets\Libs\TextMesh Pro\Resources\Shaders\TMPro.cginc" />
workdir/Asociace/Assets/Scenes/Task.unity
276 276
  m_AnchoredPosition: {x: 0, y: 0}
277 277
  m_SizeDelta: {x: 100, y: 100}
278 278
  m_Pivot: {x: 0.5, y: 0.5}
279
--- !u!1 &255239378
280
GameObject:
281
  m_ObjectHideFlags: 0
282
  m_CorrespondingSourceObject: {fileID: 0}
283
  m_PrefabInstance: {fileID: 0}
284
  m_PrefabAsset: {fileID: 0}
285
  serializedVersion: 6
286
  m_Component:
287
  - component: {fileID: 255239379}
288
  - component: {fileID: 255239381}
289
  - component: {fileID: 255239380}
290
  m_Layer: 5
291
  m_Name: Dash
292
  m_TagString: Untagged
293
  m_Icon: {fileID: 0}
294
  m_NavMeshLayer: 0
295
  m_StaticEditorFlags: 0
296
  m_IsActive: 1
297
--- !u!224 &255239379
298
RectTransform:
299
  m_ObjectHideFlags: 0
300
  m_CorrespondingSourceObject: {fileID: 0}
301
  m_PrefabInstance: {fileID: 0}
302
  m_PrefabAsset: {fileID: 0}
303
  m_GameObject: {fileID: 255239378}
304
  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
305
  m_LocalPosition: {x: 0, y: 0, z: 0}
306
  m_LocalScale: {x: 1, y: 1, z: 1}
307
  m_ConstrainProportionsScale: 0
308
  m_Children: []
309
  m_Father: {fileID: 2016511102}
310
  m_RootOrder: 2
311
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
312
  m_AnchorMin: {x: 0.5, y: 0.5}
313
  m_AnchorMax: {x: 0.5, y: 0.5}
314
  m_AnchoredPosition: {x: -50, y: 160}
315
  m_SizeDelta: {x: 220, y: 200}
316
  m_Pivot: {x: 0.5, y: 0.5}
317
--- !u!114 &255239380
318
MonoBehaviour:
319
  m_ObjectHideFlags: 0
320
  m_CorrespondingSourceObject: {fileID: 0}
321
  m_PrefabInstance: {fileID: 0}
322
  m_PrefabAsset: {fileID: 0}
323
  m_GameObject: {fileID: 255239378}
324
  m_Enabled: 1
325
  m_EditorHideFlags: 0
326
  m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
327
  m_Name: 
328
  m_EditorClassIdentifier: 
329
  m_Material: {fileID: 0}
330
  m_Color: {r: 0, g: 0, b: 0, a: 1}
331
  m_RaycastTarget: 1
332
  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
333
  m_Maskable: 1
334
  m_OnCullStateChanged:
335
    m_PersistentCalls:
336
      m_Calls: []
337
  m_FontData:
338
    m_Font: {fileID: 12800000, guid: e3265ab4bf004d28a9537516768c1c75, type: 3}
339
    m_FontSize: 150
340
    m_FontStyle: 0
341
    m_BestFit: 0
342
    m_MinSize: 1
343
    m_MaxSize: 150
344
    m_Alignment: 4
345
    m_AlignByGeometry: 0
346
    m_RichText: 1
347
    m_HorizontalOverflow: 0
348
    m_VerticalOverflow: 0
349
    m_LineSpacing: 1
350
  m_Text: "\u2014"
351
--- !u!222 &255239381
352
CanvasRenderer:
353
  m_ObjectHideFlags: 0
354
  m_CorrespondingSourceObject: {fileID: 0}
355
  m_PrefabInstance: {fileID: 0}
356
  m_PrefabAsset: {fileID: 0}
357
  m_GameObject: {fileID: 255239378}
358
  m_CullTransparentMesh: 0
279 359
--- !u!1 &291388078
280 360
GameObject:
281 361
  m_ObjectHideFlags: 0
......
305 385
  m_ConstrainProportionsScale: 0
306 386
  m_Children:
307 387
  - {fileID: 178914314}
388
  - {fileID: 2016511102}
308 389
  m_Father: {fileID: 52936798}
309 390
  m_RootOrder: 0
310 391
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......
391 472
  m_PrefabAsset: {fileID: 0}
392 473
  m_GameObject: {fileID: 304498249}
393 474
  m_CullTransparentMesh: 0
475
--- !u!1 &310863374
476
GameObject:
477
  m_ObjectHideFlags: 0
478
  m_CorrespondingSourceObject: {fileID: 0}
479
  m_PrefabInstance: {fileID: 0}
480
  m_PrefabAsset: {fileID: 0}
481
  serializedVersion: 6
482
  m_Component:
483
  - component: {fileID: 310863375}
484
  - component: {fileID: 310863377}
485
  - component: {fileID: 310863376}
486
  m_Layer: 5
487
  m_Name: Right Text
488
  m_TagString: Untagged
489
  m_Icon: {fileID: 0}
490
  m_NavMeshLayer: 0
491
  m_StaticEditorFlags: 0
492
  m_IsActive: 1
493
--- !u!224 &310863375
494
RectTransform:
495
  m_ObjectHideFlags: 0
496
  m_CorrespondingSourceObject: {fileID: 0}
497
  m_PrefabInstance: {fileID: 0}
498
  m_PrefabAsset: {fileID: 0}
499
  m_GameObject: {fileID: 310863374}
500
  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
501
  m_LocalPosition: {x: 0, y: 0, z: 0}
502
  m_LocalScale: {x: 1, y: 1, z: 1}
503
  m_ConstrainProportionsScale: 0
504
  m_Children: []
505
  m_Father: {fileID: 2016511102}
506
  m_RootOrder: 1
507
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
508
  m_AnchorMin: {x: 0.5, y: 0.5}
509
  m_AnchorMax: {x: 0.5, y: 0.5}
510
  m_AnchoredPosition: {x: 480, y: 160}
511
  m_SizeDelta: {x: 700, y: 170}
512
  m_Pivot: {x: 0.5, y: 0.5}
513
--- !u!114 &310863376
514
MonoBehaviour:
515
  m_ObjectHideFlags: 0
516
  m_CorrespondingSourceObject: {fileID: 0}
517
  m_PrefabInstance: {fileID: 0}
518
  m_PrefabAsset: {fileID: 0}
519
  m_GameObject: {fileID: 310863374}
520
  m_Enabled: 1
521
  m_EditorHideFlags: 0
522
  m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
523
  m_Name: 
524
  m_EditorClassIdentifier: 
525
  m_Material: {fileID: 0}
526
  m_Color: {r: 1, g: 1, b: 1, a: 1}
527
  m_RaycastTarget: 1
528
  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
529
  m_Maskable: 1
530
  m_OnCullStateChanged:
531
    m_PersistentCalls:
532
      m_Calls: []
533
  m_FontData:
534
    m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
535
    m_FontSize: 14
536
    m_FontStyle: 0
537
    m_BestFit: 0
538
    m_MinSize: 10
539
    m_MaxSize: 40
540
    m_Alignment: 0
541
    m_AlignByGeometry: 0
542
    m_RichText: 1
543
    m_HorizontalOverflow: 0
544
    m_VerticalOverflow: 0
545
    m_LineSpacing: 1
546
  m_Text: 
547
--- !u!222 &310863377
548
CanvasRenderer:
549
  m_ObjectHideFlags: 0
550
  m_CorrespondingSourceObject: {fileID: 0}
551
  m_PrefabInstance: {fileID: 0}
552
  m_PrefabAsset: {fileID: 0}
553
  m_GameObject: {fileID: 310863374}
554
  m_CullTransparentMesh: 0
394 555
--- !u!1 &361082131
395 556
GameObject:
396 557
  m_ObjectHideFlags: 0
......
1952 2113
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
1953 2114
  m_AnchorMin: {x: 0, y: 0}
1954 2115
  m_AnchorMax: {x: 0, y: 0}
1955
  m_AnchoredPosition: {x: 401.0656, y: 0}
1956
  m_SizeDelta: {x: 802.1312, y: 0}
2116
  m_AnchoredPosition: {x: 0, y: 0}
2117
  m_SizeDelta: {x: 0, y: 0}
1957 2118
  m_Pivot: {x: 0.5, y: 0.5}
1958 2119
--- !u!114 &1729012035
1959 2120
MonoBehaviour:
......
2049 2210
  m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
2050 2211
  m_Name: 
2051 2212
  m_EditorClassIdentifier: 
2213
--- !u!1 &1851563705
2214
GameObject:
2215
  m_ObjectHideFlags: 0
2216
  m_CorrespondingSourceObject: {fileID: 0}
2217
  m_PrefabInstance: {fileID: 0}
2218
  m_PrefabAsset: {fileID: 0}
2219
  serializedVersion: 6
2220
  m_Component:
2221
  - component: {fileID: 1851563706}
2222
  - component: {fileID: 1851563708}
2223
  - component: {fileID: 1851563707}
2224
  m_Layer: 5
2225
  m_Name: Left Text
2226
  m_TagString: Untagged
2227
  m_Icon: {fileID: 0}
2228
  m_NavMeshLayer: 0
2229
  m_StaticEditorFlags: 0
2230
  m_IsActive: 1
2231
--- !u!224 &1851563706
2232
RectTransform:
2233
  m_ObjectHideFlags: 0
2234
  m_CorrespondingSourceObject: {fileID: 0}
2235
  m_PrefabInstance: {fileID: 0}
2236
  m_PrefabAsset: {fileID: 0}
2237
  m_GameObject: {fileID: 1851563705}
2238
  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
2239
  m_LocalPosition: {x: 0, y: 0, z: 0}
2240
  m_LocalScale: {x: 1, y: 1, z: 1}
2241
  m_ConstrainProportionsScale: 0
2242
  m_Children: []
2243
  m_Father: {fileID: 2016511102}
2244
  m_RootOrder: 0
2245
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
2246
  m_AnchorMin: {x: 0.5, y: 0.5}
2247
  m_AnchorMax: {x: 0.5, y: 0.5}
2248
  m_AnchoredPosition: {x: -580, y: 160}
2249
  m_SizeDelta: {x: 700, y: 170}
2250
  m_Pivot: {x: 0.5, y: 0.5}
2251
--- !u!114 &1851563707
2252
MonoBehaviour:
2253
  m_ObjectHideFlags: 0
2254
  m_CorrespondingSourceObject: {fileID: 0}
2255
  m_PrefabInstance: {fileID: 0}
2256
  m_PrefabAsset: {fileID: 0}
2257
  m_GameObject: {fileID: 1851563705}
2258
  m_Enabled: 1
2259
  m_EditorHideFlags: 0
2260
  m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
2261
  m_Name: 
2262
  m_EditorClassIdentifier: 
2263
  m_Material: {fileID: 0}
2264
  m_Color: {r: 1, g: 1, b: 1, a: 1}
2265
  m_RaycastTarget: 1
2266
  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
2267
  m_Maskable: 1
2268
  m_OnCullStateChanged:
2269
    m_PersistentCalls:
2270
      m_Calls: []
2271
  m_FontData:
2272
    m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
2273
    m_FontSize: 14
2274
    m_FontStyle: 0
2275
    m_BestFit: 0
2276
    m_MinSize: 10
2277
    m_MaxSize: 40
2278
    m_Alignment: 0
2279
    m_AlignByGeometry: 0
2280
    m_RichText: 1
2281
    m_HorizontalOverflow: 0
2282
    m_VerticalOverflow: 0
2283
    m_LineSpacing: 1
2284
  m_Text: 
2285
--- !u!222 &1851563708
2286
CanvasRenderer:
2287
  m_ObjectHideFlags: 0
2288
  m_CorrespondingSourceObject: {fileID: 0}
2289
  m_PrefabInstance: {fileID: 0}
2290
  m_PrefabAsset: {fileID: 0}
2291
  m_GameObject: {fileID: 1851563705}
2292
  m_CullTransparentMesh: 0
2052 2293
--- !u!1 &1896176078
2053 2294
GameObject:
2054 2295
  m_ObjectHideFlags: 0
......
2183 2424
  border: {fileID: 1357186458}
2184 2425
  examining: {fileID: 1967963960}
2185 2426
  LinearTimer: {fileID: 178914313}
2427
  TextObjects: {fileID: 2016511101}
2186 2428
--- !u!114 &1896176084
2187 2429
MonoBehaviour:
2188 2430
  m_ObjectHideFlags: 0
......
2247 2489
  m_AnchoredPosition: {x: 0, y: 0}
2248 2490
  m_SizeDelta: {x: 100, y: 100}
2249 2491
  m_Pivot: {x: 0.5, y: 0.5}
2492
--- !u!1 &2016511101
2493
GameObject:
2494
  m_ObjectHideFlags: 0
2495
  m_CorrespondingSourceObject: {fileID: 0}
2496
  m_PrefabInstance: {fileID: 0}
2497
  m_PrefabAsset: {fileID: 0}
2498
  serializedVersion: 6
2499
  m_Component:
2500
  - component: {fileID: 2016511102}
2501
  m_Layer: 5
2502
  m_Name: Text Objects
2503
  m_TagString: Untagged
2504
  m_Icon: {fileID: 0}
2505
  m_NavMeshLayer: 0
2506
  m_StaticEditorFlags: 0
2507
  m_IsActive: 0
2508
--- !u!224 &2016511102
2509
RectTransform:
2510
  m_ObjectHideFlags: 0
2511
  m_CorrespondingSourceObject: {fileID: 0}
2512
  m_PrefabInstance: {fileID: 0}
2513
  m_PrefabAsset: {fileID: 0}
2514
  m_GameObject: {fileID: 2016511101}
2515
  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
2516
  m_LocalPosition: {x: 0, y: 0, z: 0}
2517
  m_LocalScale: {x: 1, y: 1, z: 1}
2518
  m_ConstrainProportionsScale: 0
2519
  m_Children:
2520
  - {fileID: 1851563706}
2521
  - {fileID: 310863375}
2522
  - {fileID: 255239379}
2523
  m_Father: {fileID: 291388079}
2524
  m_RootOrder: 1
2525
  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
2526
  m_AnchorMin: {x: 0.5, y: 0.5}
2527
  m_AnchorMax: {x: 0.5, y: 0.5}
2528
  m_AnchoredPosition: {x: 0, y: 0}
2529
  m_SizeDelta: {x: 100, y: 100}
2530
  m_Pivot: {x: 0.5, y: 0.5}
2250 2531
--- !u!1 &2033945652
2251 2532
GameObject:
2252 2533
  m_ObjectHideFlags: 0
workdir/Asociace/Assets/Scripts/Data/Input/Exam.cs
1
using System;
2
using System.Text;
3
using Tools;
4
using UnityEngine;
5

  
6
namespace Data.Input
7
{
8

  
9
    /// <summary>
10
    /// Class represents the exam part of the game
11
    /// </summary>
12
    public class Exam
13
    {
14
        /// <summary>
15
        /// Array of all options
16
        /// </summary>
17
        private string[] Options;
18

  
19
        /// <summary>
20
        /// The correct part of the pair
21
        /// </summary>
22
        private readonly string CorrectWord;
23

  
24
        /// <summary>
25
        /// The displaying part of the pair
26
        /// </summary>
27
        private readonly string WordToDisplay;
28

  
29
        /// <summary>
30
        /// The original string without any edit
31
        /// </summary>
32
        private readonly string OriginalDisplayingWord;
33

  
34
        public Exam(Pair pair, int round)
35
        {
36
            string[] pairItems = new string[] { pair.t1, pair.t2 };
37
            int rn = General.GetRandomInt(pairItems.Length);
38

  
39
            this.CorrectWord = pairItems[rn];
40
            this.WordToDisplay = pairItems[1 - rn];
41
            this.OriginalDisplayingWord = WordToDisplay;
42
            this.WordToDisplay = HideChars(this.WordToDisplay, round);
43

  
44
            InitializeOptions();
45
        }
46

  
47
        /// <summary>
48
        /// Initializes array and sets all options.
49
        /// </summary>
50
        private void InitializeOptions()
51
        {
52
            this.Options = new string[Constants.OPTIONS_NUMBER];
53

  
54
            for (int i = 0; i < Constants.OPTIONS_NUMBER; i++)
55
            {
56
                string tmp;
57
                do
58
                {
59
                    int rn = General.GetRandomInt(RoundDataGenerator.Instance.AllPairs.Count);
60
                    tmp = new string[] { RoundDataGenerator.Instance.AllPairs[rn].t1, RoundDataGenerator.Instance.AllPairs[rn].t2 }[General.GetRandomInt(2)];
61
                } while (Array.IndexOf(this.Options, tmp) > -1 || tmp.Equals(this.CorrectWord) || tmp.Equals(this.WordToDisplay));
62

  
63
                this.Options[i] = tmp;
64
            }
65

  
66
            this.Options[General.GetRandomInt(Constants.OPTIONS_NUMBER)] = this.CorrectWord;
67
        }
68

  
69
        /// <summary>
70
        /// Hides some characters from the pair option
71
        /// </summary>
72
        /// <param name="s">the string</param>
73
        /// <returns>the string with hidden characters</returns>
74
        private string HideChars(string s, int round)
75
        {
76
            StringBuilder str = new StringBuilder(s);
77
            for (int i = 0; i < Task.Configuration.RoundsCharsToHide[round]; i++)
78
            {
79
                str[General.GetRandomInt(str.Length)] = Constants.HIDDEN_CHAR;
80
            }
81
            return str.ToString();
82
        }
83

  
84
        /// <summary>
85
        /// Returns the results
86
        /// </summary>
87
        /// <returns>correct word</returns>
88
        public string GetCorrectWord()
89
        {
90
            return this.CorrectWord;
91
        }
92

  
93
        /// <summary>
94
        /// returns word to be displayed
95
        /// </summary>
96
        /// <returns>word to be displayed</returns>
97
        public string GetDisplayingWord()
98
        {
99
            return this.WordToDisplay;
100
        }
101

  
102
        /// <summary>
103
        /// returns word to be displayed
104
        /// </summary>
105
        /// <returns>word to be displayed</returns>
106
        public string GetOriginalDisplayingWord()
107
        {
108
            return this.OriginalDisplayingWord;
109
        }
110

  
111
        /// <summary>
112
        /// Returns all options in one part
113
        /// </summary>
114
        /// <returns></returns>
115
        public string[] GetOptions()
116
        {
117
            return this.Options;
118
        }
119

  
120
        public string GetPair()
121
        {
122
            return "(" + this.OriginalDisplayingWord + "," + this.CorrectWord + ")";
123
        }
124

  
125
    }
126

  
127
}
workdir/Asociace/Assets/Scripts/Data/Input/Exam.cs.meta
1
fileFormatVersion: 2
2
guid: b39597a5f325f79459e6a6d1cdb98e6a
3
MonoImporter:
4
  externalObjects: {}
5
  serializedVersion: 2
6
  defaultReferences: []
7
  executionOrder: 0
8
  icon: {instanceID: 0}
9
  userData: 
10
  assetBundleName: 
11
  assetBundleVariant: 
workdir/Asociace/Assets/Scripts/Data/Input/Pair.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6

  
7
namespace Data.Input
8
{
9
    public class Pair
10
    {
11

  
12
        /// <summary>
13
        /// Text of first word
14
        /// </summary>
15
        public string t1;
16

  
17
        /// <summary>
18
        /// Text of second word
19
        /// </summary>
20
        public string t2;
21

  
22
        public Pair(string s)
23
        {
24
            string[] tmp = s.Trim().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
25
            this.t1 = tmp[0].ToUpper();
26
            this.t2 = tmp[1].ToUpper();
27
        }
28

  
29
        public override string ToString()
30
        {
31
            return "(" + this.t1 + "," + this.t2 + ")";
32
        }
33
    }
34
}
workdir/Asociace/Assets/Scripts/Data/Input/Pair.cs.meta
1
fileFormatVersion: 2
2
guid: a90f0bf1e25b43c4f86d924e2d9629d6
3
MonoImporter:
4
  externalObjects: {}
5
  serializedVersion: 2
6
  defaultReferences: []
7
  executionOrder: 0
8
  icon: {instanceID: 0}
9
  userData: 
10
  assetBundleName: 
11
  assetBundleVariant: 
workdir/Asociace/Assets/Scripts/Tools/General.cs
234 234
            }
235 235
            return true;
236 236
        }
237

  
238
        public static int GetRandomInt(int limit)
239
        {
240
            return random.Next(limit);
241
        }
237 242
    }
238 243
}
workdir/Asociace/Assets/Scripts/Tools/RealTime.cs
18 18
        /// </summary>
19 19
        private static Stopwatch gameTime;
20 20

  
21
        /// <summary>
22
        /// Display time of the current pair
23
        /// </summary>
24
        private static Stopwatch pairDisplayTime;
25

  
21 26
        public static float TotalTime => totalTime.Time();
22 27

  
23 28
        public static float GameTime => gameTime.Time();
......
28 33
        {
29 34
            totalTime = new Stopwatch();
30 35
            gameTime = new Stopwatch();
36
            pairDisplayTime = new Stopwatch();
31 37
            totalTime.Start();
32 38
        }
33 39

  
......
87 93
                }
88 94
                return counter + DiffBetweenCurrAndStartTime();
89 95
            }
96

  
97
            public void Reset()
98
            {
99
                counter = 0;
100
            }
90 101
            
91 102
            public void Start()
92 103
            {
workdir/Asociace/Assets/Scripts/Ui/Components/TimeBar.cs
25 25
        /// </summary>
26 26
        private static float startGameTime;
27 27

  
28
        public static bool learningPart;
29

  
28 30
        static TimeBar()
29 31
        {
30 32
            currentMaxTime = -1;
33
            learningPart = false;
31 34
        }
32 35

  
33 36
        private void Start()
workdir/Asociace/Assets/Scripts/_Template/InputData/RoundData.cs
1 1

2
using System.Collections.Generic;
3

  
2 4
namespace Data.Input
3 5
{
4 6
    /// <summary>
......
6 8
    /// </summary>
7 9
    public class RoundData
8 10
    {
11
        public List<Exam> RoundPairs;
12

  
9 13
        public RoundData()
10 14
        {
15
            this.RoundPairs = new List<Exam>();
11 16
        }
12 17
    }
13 18
}
workdir/Asociace/Assets/Scripts/_Template/InputData/RoundDataGenerator.cs
1 1

2
using System.Collections.Generic;
3
using Tools;
4

  
2 5
namespace Data.Input
3 6
{
4 7
    /// <summary>
......
11 14
        /// </summary>
12 15
        public static RoundDataGenerator Instance { get; }
13 16
        static RoundDataGenerator() => Instance = new RoundDataGenerator();
14
        private RoundDataGenerator() { }
17

  
18
        public List<Pair> AllPairs;
19

  
20
        private RoundDataGenerator() {
21
            AllPairs = new List<Pair>();
22
            foreach (string s in Task.Configuration.PairsStrings)
23
                AllPairs.Add(new Pair(s));
24
        }
15 25

  
16 26
        /// <summary>
17 27
        /// Generated round data.
18 28
        /// </summary>
19 29
        private RoundData[] rounds;
20
        
30

  
21 31
        /// <summary>
22 32
        /// Prepare data for all rounds of the task.
23 33
        /// </summary>
24 34
        public void GenerateRoundData()
25 35
        {
26
            rounds = new RoundData[Task.Configuration.NumOfRounds];
27
            for (int i = 0; i < rounds.Length; i++)
36
            for (int round = 0; round < Task.Configuration.NumOfRounds; round++)
28 37
            {
29
                rounds[i] = new RoundData();
38
                List<Pair> pairs = new List<Pair>();
39
                Task.Configuration.Rounds[round] = new RoundData();
40
                for (int i = 0; i < Task.Configuration.RoundsPairsNumber[round]; i++)
41
                {
42
                    Pair tmp;
43
                    do
44
                    {
45
                        tmp = AllPairs[General.GetRandomInt(AllPairs.Count)];
46
                    } while (pairs.Contains(tmp));
47

  
48
                    pairs.Add(tmp);
49
                    Task.Configuration.Rounds[round].RoundPairs.Add(new Exam(tmp, round));
50
                }
30 51
            }
31 52
        }
32 53
    }
workdir/Asociace/Assets/Scripts/_Template/OutputData/DataCollector.cs
26 26
        /// </summary>
27 27
        public static int Round => Instance.gameResults.rounds.Count - 1;
28 28

  
29
        /// <summary>
30
        /// Index of current showing pair
31
        /// </summary>
32
        public int currentPairIndex;
33

  
29 34
        /// <summary>
30 35
        /// If the last round is currently in progress.
31 36
        /// </summary>
......
50 55
            currentRound = null;
51 56
            actionId = 1;
52 57
            currentCovering = null;
58
            currentPairIndex = 0;
53 59
        }
54 60

  
55 61
        /// <summary>
workdir/Asociace/Assets/Scripts/_Template/TaskMainCamera.cs
8 8
using Ui.Components;
9 9
using Ui.GuiStrings;
10 10
using Ui.Panels;
11
using Unity.VisualScripting;
11 12
using UnityEngine;
12 13
using UnityEngine.UI;
13 14

  
......
88 89
        /// </summary>
89 90
        public GameObject LinearTimer;
90 91

  
92
        /// <summary>
93
        /// Gameobjects containing all text objects.
94
        /// </summary>
95
        public GameObject TextObjects;
96

  
91 97
        protected override void Awake()
92 98
        {
93 99
            base.Awake();
......
105 111
            StartCoroutine(UncoverStage(StartFirstRound));
106 112
        }
107 113

  
114

  
108 115
        /// <summary>
109 116
        /// Function that starts the tutorial or the first round of the task according to <see cref="SceneManager.TutorialIsRunning"/>.
110 117
        /// </summary>
......
427 434

  
428 435
        private void LearningPhase()
429 436
        {
430
            
437

  
431 438
        }
432 439

  
433
        /// <summary>
434
        /// Function controls linear timer. It changes fill amount and color based on remaining time.
435
        /// </summary>
436
        /// <param name="time">elapsed display time of one pair</param>
437
        private void LinearTimerControl(float time)
440
        private void AfterOptionClickControl(bool correct, string clickID = null)
438 441
        {
439
            Image frontRadialTimer = LinearTimer.transform.GetChild(1).gameObject.GetComponent<Image>();
440
            float percentage = (Task.Configuration.PairDisplayTime - time) / Task.Configuration.PairDisplayTime;
441
            frontRadialTimer.color = Color.Lerp(Constants.RED_COLOR, Constants.GREEN_COLOR, percentage);
442
            frontRadialTimer.fillAmount = percentage;
442
            //DisableAllButtons();
443

  
444
            var rightText = TextObjects.transform.GetChild(1).GetComponent<Text>();
445
            rightText.text = Task.Configuration.Rounds[DataCollector.Round].RoundPairs[DataCollector.Instance.currentPairIndex].GetCorrectWord();
446
            rightText.color = new Color(0.1f, 0.50f, 0);
447
            TextObjects.transform.GetChild(0).GetComponent<Text>().text = (Task.Configuration.Rounds[DataCollector.Round].RoundPairs[DataCollector.Instance.currentPairIndex].GetOriginalDisplayingWord());
448
            //Audio.GetComponent<AudioPlayer>().Play(correct);
449
            DataCollector.Instance.currentPairIndex++;
450
            /*
451

  
452
            if (currentPairIndex == InputParams.RoundsPairsNumber[round])
453
            {
454
                ShowSolution(clickID);
455
            }
456
            else
457
            {
458
                solutionOfOnePairShowing = WaitAndContinue2();
459
                Continue.gameObject.SetActive(true);
460
                Continue.GetComponentInChildren<Text>().text = ConfigFiles.Inputs.Data.Continue.ToString();
461
                StartCoroutine(solutionOfOnePairShowing);
462
            }
463
            */
443 464
        }
444 465
    }
445 466
}
... Rozdílový soubor je zkrácen, protože jeho délka přesahuje max. limit.

Také k dispozici: Unified diff