Пример #1
0
        public List <ClientModel> clientListToModelViewList(List <Client> clientList)
        {
            object             objectLock = new object();
            List <ClientModel> output     = new List <ClientModel>();

            lock (objectLock)
                foreach (Client client in clientList)
                {
                    ClientModel cvm = (ClientModel)_main.ModelCreator.createModel(QOBDModels.Enums.EModel.CLIENT);
                    if (AgentList.Count() > 0)
                    {
                        var result = AgentList.Where(x => x.ID.Equals(client.AgentId)).ToList();
                        cvm.Agent.Agent = (result.Count > 0) ? result[0] : new Agent();
                    }
                    cvm.Client = client;
                    output.Add(cvm);
                }
            return(output);
        }
Пример #2
0
        GameInfo(int day, int agent, Judge mediumResult, Judge divineResult, int executedAgent,
                 int latestExecutedAgent, int cursedFox, int attackedAgent, int guardedAgent,
                 List <Vote> voteList, List <Vote> latestVoteList,
                 List <Vote> attackVoteList, List <Vote> latestAttackVoteList,
                 List <Talk> talkList, List <Whisper> whisperList,
                 List <int> lastDeadAgentList, List <Role> existingRoleList,
                 Dictionary <int, string> statusMap, Dictionary <int, string> roleMap,
                 Dictionary <int, int> remainTalkMap, Dictionary <int, int> remainWhisperMap)
        {
            // 引数からプロパティへ
            Day                  = day;
            Agent                = Agent.GetAgent(agent);
            MediumResult         = mediumResult;
            DivineResult         = divineResult;
            ExecutedAgent        = Agent.GetAgent(executedAgent);
            LatestExecutedAgent  = Agent.GetAgent(latestExecutedAgent);
            CursedFox            = Agent.GetAgent(cursedFox);
            AttackedAgent        = Agent.GetAgent(attackedAgent);
            GuardedAgent         = Agent.GetAgent(guardedAgent);
            VoteList             = voteList;
            LatestVoteList       = latestVoteList;
            AttackVoteList       = attackVoteList;
            LatestAttackVoteList = latestAttackVoteList;
            TalkList             = talkList;
            WhisperList          = whisperList;
            LastDeadAgentList    = lastDeadAgentList.Select(i => Agent.GetAgent(i)).ToList();
            ExistingRoleList     = existingRoleList;
            StatusMap            = statusMap.ToDictionary(p => Agent.GetAgent(p.Key), p => (Status)Enum.Parse(typeof(Status), p.Value));
            RoleMap              = roleMap.ToDictionary(p => Agent.GetAgent(p.Key), p => (Role)Enum.Parse(typeof(Role), p.Value));
            RemainTalkMap        = remainTalkMap.ToDictionary(p => Agent.GetAgent(p.Key), p => p.Value);
            RemainWhisperMap     = remainWhisperMap.ToDictionary(p => Agent.GetAgent(p.Key), p => p.Value);

            // その他のプロパティ
            Role           = RoleMap[Agent];
            AgentList      = StatusMap.Keys.ToList();
            AliveAgentList = AgentList.Where(a => StatusMap[a] == Status.ALIVE).ToList();
        }