-
Notifications
You must be signed in to change notification settings - Fork 0
/
Word.cs
76 lines (64 loc) · 1.92 KB
/
Word.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using sjms.Domain;
using sjms.Subject;
using System;
using System.Collections.Generic;
using System.Text;
namespace sjms
{
public class Word
{
public Word()
{
roles = new List<Actor>();
guaiwus = new List<Actor>();
roleControl = new ConcreteAllyControlCenter("人物");
guaiwuControl = new ConcreteAllyControlCenter("怪物");
initList();
}
private void initList()
{
ActorController director = new ActorController();
for (int i = 0; i < 10; i++)
{
ActorBuilder builder = new RoleBuilder(roleControl);
Actor a = director.Construct(builder);
roles.Add(a);
}
for (int i = 0; i < 100; i++)
{
ActorBuilder guaiwub = new GuaiWuBuilder(guaiwuControl);
Actor a = director.Construct(guaiwub);
guaiwus.Add(a);
}
ActorBuilder self = new RoleBuilder(roleControl);
selfRole = director.Construct(self);
}
private ConcreteAllyControlCenter roleControl { get; set; }
private ConcreteAllyControlCenter guaiwuControl { get; set; }
private IList<Actor> roles { get; set; }
private IList<Actor> guaiwus { get; set; }
public IList<Actor> GetRolesList()
{
return roles;
}
private Actor selfRole { get; set; }
public Actor GetGuaiWu()
{
Random r = new Random();
return guaiwus[r.Next(guaiwus.Count)];
}
public Actor GetSelfRole()
{
return selfRole;
}
public static Word GetInstance()
{
return Self.instance;
}
private class Self
{
static Self() { }
internal static readonly Word instance = new Word();
}
}
}