Exemple #1
0
 public void DoClock(IContext context, int hour)
 {
     if (hour < 9 || 17 <= hour)
     {
         context.ChangeState(NightState.GetInstance());
     }
 }
Exemple #2
0
    public void BuildFirstNightList()
    {
        NightState = NightState.FirstNight;

        ClearList();

        List <EntryInfo> entryInfos          = new List <EntryInfo>();
        List <EntryInfo> afterDawnEntryInfos = new List <EntryInfo>();

        if (GrimoireManager.Instance.TownSize >= 7)
        {
            entryInfos.Add(new EntryInfo("Minion Info", Color.white, MinionInfoOrder, null));
            entryInfos.Add(new EntryInfo("Demon Info", Color.white, DemonInfoOrder, null));
        }

        List <RoleData> roles = GrimoireManager.Instance.GetLivingPlayerRoles();

        foreach (var role in roles)
        {
            if (role.FirstNightOrder < 0)
            {
                continue;
            }

            if (role.IsNightOrderAfterDawn)
            {
                afterDawnEntryInfos.Add(new EntryInfo(role.RoleName, RoleData.RoleColors[(int)role.RoleType], role.FirstNightOrder, role));
            }
            else
            {
                entryInfos.Add(new EntryInfo(role.RoleName, RoleData.RoleColors[(int)role.RoleType], role.FirstNightOrder, role));
            }
        }

        entryInfos = entryInfos.OrderBy(x => x.NightOrder).ToList();
        foreach (var entryInfo in entryInfos)
        {
            AddEntry(entryInfo.Text, entryInfo.Color, entryInfo.RoleData);
        }

        AddEntry("Dawn", Color.white, null);

        afterDawnEntryInfos = afterDawnEntryInfos.OrderBy(x => x.NightOrder).ToList();
        foreach (var afterDawnEntryInfo in afterDawnEntryInfos)
        {
            AddEntry(afterDawnEntryInfo.Text, afterDawnEntryInfo.Color, afterDawnEntryInfo.RoleData);
        }
    }
Exemple #3
0
 public void ToXml(XmlWriter w)
 {
     w.WriteStartElement("Game");
     w.WriteAttributeString("CreatedDate", CreatedDate.ToString());
     w.WriteAttributeString("Points", Points.ToString());
     w.WriteAttributeString("GameDate", GameDate.ToString());
     w.WriteAttributeString("NightState", NightState.ToString());
     w.WriteStartElement("Buildings");
     foreach (Building item in ListOfBuildings)
     {
         item.ToXml(w);
     }
     w.WriteEndElement();
     w.WriteStartElement("Materials");
     foreach (Material item in ListOfMaterials.Materials)
     {
         item.ToXml(w);
     }
     w.WriteEndElement();
     w.WriteEndElement();
 }
Exemple #4
0
    public void BuildOtherNightsList()
    {
        NightState = NightState.OtherNight;

        ClearList();

        AddEntry("Dusk", Color.white, null);

        List <RoleData> roles = GrimoireManager.Instance.GetLivingPlayerRoles();

        roles = roles.OrderBy(x => x.OtherNightOrder).ToList();
        foreach (var role in roles)
        {
            if (role.OtherNightOrder < 0)
            {
                continue;
            }

            AddEntry(role.RoleName, RoleData.RoleColors[(int)role.RoleType], role);
        }

        AddEntry("Dawn", Color.white, null);
    }