feat: new algo questions
This commit is contained in:
parent
f254c044e8
commit
3625e36f88
@ -38,7 +38,7 @@ RenderSettings:
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 705507994}
|
||||
m_IndirectSpecularColor: {r: 0.18018535, g: 0.22559482, b: 0.30677685, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.18028328, g: 0.22571328, b: 0.3069218, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
@ -1395,7 +1395,7 @@ MonoBehaviour:
|
||||
- {fileID: 1854893636}
|
||||
- {fileID: 2065109614}
|
||||
- {fileID: 1197279072}
|
||||
promptList: {fileID: 0}
|
||||
promptList: {fileID: 11400000, guid: 21907abc84e40403ca34c4fb9ab30b06, type: 2}
|
||||
votingTime: 20
|
||||
--- !u!114 &375256413
|
||||
MonoBehaviour:
|
||||
|
@ -6,6 +6,7 @@
|
||||
using UnityEngine;
|
||||
using Newtonsoft.Json;
|
||||
using System.Linq;
|
||||
using Google.MiniJSON;
|
||||
|
||||
public class RoomManager : MonoBehaviour
|
||||
{
|
||||
@ -298,43 +299,26 @@ public void HostHasStartedGame()
|
||||
public void GeneratePrompts()
|
||||
{
|
||||
System.Random rnd = new();
|
||||
List<Prompt> prompts = promptList.prompts.OrderBy(x => rnd.Next()).Take(myRoom.players.Count() * 2).ToList();
|
||||
List<Player> fullPlayers = myRoom.players.Values.ToList().Concat(myRoom.players.Values.ToList()).OrderBy(x => rnd.Next()).ToList();
|
||||
List<Prompt> prompts = promptList.prompts.OrderBy(x => rnd.Next()).Take(myRoom.players.Count()).ToList();
|
||||
List<Player> players = myRoom.players.Values.ToList().OrderBy(x => rnd.Next()).ToList();
|
||||
Dictionary<string, Question> questions = new();
|
||||
|
||||
foreach (Prompt prompt in prompts)
|
||||
for (int i = 0; i < players.Count(); i++)
|
||||
{
|
||||
Dictionary<string, Proposition> propositions = new();
|
||||
Player basePlayer = fullPlayers[0];
|
||||
|
||||
propositions.Add(Guid.NewGuid().ToString(), new Proposition()
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
owner = basePlayer,
|
||||
creationDate = DateTime.Now.ToOADate()
|
||||
});
|
||||
|
||||
//fullPlayers.RemoveAt(0);
|
||||
|
||||
for (int i = 1; i < fullPlayers.Count(); i++)
|
||||
{
|
||||
Player secondPlayer = fullPlayers[i];
|
||||
|
||||
if (basePlayer.id != secondPlayer.id)
|
||||
propositions.Add(j.ToString(), new Proposition()
|
||||
{
|
||||
propositions.Add(Guid.NewGuid().ToString(), new Proposition()
|
||||
{
|
||||
owner = secondPlayer,
|
||||
creationDate = DateTime.Now.ToOADate()
|
||||
});
|
||||
|
||||
fullPlayers.RemoveAt(0);
|
||||
break;
|
||||
}
|
||||
owner = players[i + j < players.Count() ? i + j : 0],
|
||||
creationDate = DateTime.Now.ToOADate()
|
||||
});
|
||||
}
|
||||
|
||||
questions.Add(Guid.NewGuid().ToString(), new Question()
|
||||
questions.Add(i.ToString(), new Question()
|
||||
{
|
||||
promptId = prompt.id,
|
||||
promptId = prompts[i].id,
|
||||
propositions = propositions,
|
||||
creationDate = DateTime.Now.ToOADate(),
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user