Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ResearchManager Class Reference
Inheritance diagram for ResearchManager:
EClass

Public Member Functions

void SetOwner (FactionBranch _branch)
 
void OnSimulateDay ()
 
void TryAddPlans (string idResource, int lv)
 
bool IsListBarter (string idPlan)
 
bool HasPlan (string idPlan)
 
bool IsComplete (string id, int rank=-1)
 
void AddPlan (string id)
 
void AddPlan (ResearchPlan p)
 
bool CanCompletePlan (ResearchPlan p)
 
void CompletePlan (ResearchPlan p)
 
void ShowNewPlans (Action onComplete=null)
 

Public Attributes

List< ResearchPlanplans = new List<ResearchPlan>()
 
List< ResearchPlanfinished = new List<ResearchPlan>()
 
List< ResearchPlannewPlans = new List<ResearchPlan>()
 
ResearchPlan focused
 
FactionBranch branch
 

Additional Inherited Members

- Static Public Member Functions inherited from EClass
static int rnd (int a)
 
static int curve (int a, int start, int step, int rate=75)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 
- Static Public Attributes inherited from EClass
static Core core
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 6 of file ResearchManager.cs.

Member Function Documentation

◆ AddPlan() [1/2]

void ResearchManager.AddPlan ( ResearchPlan  p)
inline

Definition at line 97 of file ResearchManager.cs.

98 {
100 plans.Add(p);
101 newPlans.Add(p);
102 WidgetPopText.Say("rewardPlan".lang(p.Name));
103 }
List< ResearchPlan > plans
List< ResearchPlan > newPlans
FactionBranch branch
void SetOwner(FactionBranch _branch)
Definition: ResearchPlan.cs:31
static void Say(string text, FontColor fontColor=FontColor.Default, Sprite sprite=null)

References branch, ResearchPlan.Name, newPlans, plans, WidgetPopText.Say(), and ResearchPlan.SetOwner().

◆ AddPlan() [2/2]

void ResearchManager.AddPlan ( string  id)
inline

Definition at line 92 of file ResearchManager.cs.

93 {
95 }
void AddPlan(string id)
static ResearchPlan Create(string id)

References AddPlan(), and ResearchPlan.Create().

Referenced by AddPlan(), ShowNewPlans(), and TryAddPlans().

◆ CanCompletePlan()

bool ResearchManager.CanCompletePlan ( ResearchPlan  p)
inline

Definition at line 105 of file ResearchManager.cs.

106 {
108 {
109 return false;
110 }
111 return true;
112 }
HomeResourceManager resources
SourceResearch.Row source
Definition: ResearchPlan.cs:23

References branch, HomeResourceManager.knowledge, FactionBranch.resources, ResearchPlan.source, and BaseHomeResource.value.

Referenced by ItemResearch.SetPlan().

◆ CompletePlan()

void ResearchManager.CompletePlan ( ResearchPlan  p)
inline

Definition at line 114 of file ResearchManager.cs.

115 {
116 if (focused == p)
117 {
118 focused = null;
119 }
120 p.OnComplete();
121 WidgetPopText.Say("completePlan".lang(p.Name), FontColor.Great);
122 if (p.source.maxLv > p.rank)
123 {
124 p.rank++;
125 p.exp = (p.lastExp = 0);
126 SE.Play("good");
127 }
128 else
129 {
130 plans.Remove(p);
131 finished.Add(p);
132 SE.Play("good");
133 }
134 }
FontColor
Definition: FontColor.cs:2
ResearchPlan focused
List< ResearchPlan > finished
void OnComplete()
Definition: ResearchPlan.cs:65

References finished, focused, ResearchPlan.Name, ResearchPlan.OnComplete(), plans, ResearchPlan.rank, WidgetPopText.Say(), and ResearchPlan.source.

◆ HasPlan()

bool ResearchManager.HasPlan ( string  idPlan)
inline

Definition at line 58 of file ResearchManager.cs.

59 {
60 foreach (ResearchPlan item in plans.Concat(finished))
61 {
62 if (item.id == idPlan)
63 {
64 return true;
65 }
66 }
67 return false;
68 }

References finished, item, and plans.

Referenced by IsListBarter().

◆ IsComplete()

bool ResearchManager.IsComplete ( string  id,
int  rank = -1 
)
inline

Definition at line 70 of file ResearchManager.cs.

71 {
72 foreach (ResearchPlan item in finished)
73 {
74 if (item.source.id == id)
75 {
76 return true;
77 }
78 }
79 if (rank != -1)
80 {
81 foreach (ResearchPlan plan in plans)
82 {
83 if (plan.source.id == id && plan.rank >= rank)
84 {
85 return true;
86 }
87 }
88 }
89 return false;
90 }

References finished, item, plans, ResearchPlan.rank, and ResearchPlan.source.

◆ IsListBarter()

bool ResearchManager.IsListBarter ( string  idPlan)
inline

Definition at line 48 of file ResearchManager.cs.

49 {
51 if (row.money > 0)
52 {
53 return !branch.researches.HasPlan(row.id);
54 }
55 return false;
56 }
Definition: EClass.cs:5
static SourceManager sources
Definition: EClass.cs:42
ResearchManager researches
bool HasPlan(string idPlan)
SourceResearch researches

References branch, HasPlan(), SourceResearch.Row.id, SourceResearch.Row.money, FactionBranch.researches, SourceManager.researches, and EClass.sources.

◆ OnSimulateDay()

void ResearchManager.OnSimulateDay ( )
inline

Definition at line 35 of file ResearchManager.cs.

36 {
37 newPlans.Clear();
38 }

References newPlans.

Referenced by FactionBranch.OnSimulateDay().

◆ SetOwner()

void ResearchManager.SetOwner ( FactionBranch  _branch)
inline

Definition at line 22 of file ResearchManager.cs.

23 {
24 branch = _branch;
25 foreach (ResearchPlan plan in plans)
26 {
27 plan.SetOwner(_branch);
28 }
29 foreach (ResearchPlan item in finished)
30 {
31 item.SetOwner(_branch);
32 }
33 }

References branch, finished, item, plans, and ResearchPlan.SetOwner().

Referenced by FactionBranch.SetOwner().

◆ ShowNewPlans()

void ResearchManager.ShowNewPlans ( Action  onComplete = null)
inline

Definition at line 136 of file ResearchManager.cs.

137 {
139 List<ResearchPlan> list = new List<ResearchPlan>();
140 foreach (SourceResearch.Row row in EClass.sources.researches.rows)
141 {
142 list.Add(ResearchPlan.Create(row.id));
143 }
144 Rand.SetSeed();
145 foreach (ResearchPlan item in list)
146 {
147 _ = item;
148 }
149 EClass.core.ui.AddLayer<LayerList>().SetSize().SetList2(list, (ResearchPlan p) => p.Name, delegate(ResearchPlan p, ItemGeneral b)
150 {
153 onComplete?.Invoke();
154 }, delegate
155 {
156 });
157 }
UI ui
Definition: Core.cs:63
static Game game
Definition: EClass.cs:8
static Core core
Definition: EClass.cs:6
int seed
Definition: Game.cs:197
Definition: Rand.cs:4
static void SetSeed(int a=-1)
Definition: Rand.cs:37

References AddPlan(), branch, EClass.core, ResearchPlan.Create(), EClass.game, item, ResearchPlan.Name, FactionBranch.researches, SourceManager.researches, Game.seed, FactionBranch.seedPlan, Rand.SetSeed(), EClass.sources, and Core.ui.

◆ TryAddPlans()

void ResearchManager.TryAddPlans ( string  idResource,
int  lv 
)
inline

Definition at line 40 of file ResearchManager.cs.

41 {
42 foreach (SourceResearch.Row item in EClass.sources.researches.rows.Where((SourceResearch.Row r) => r.resource.Length > 1 && r.resource[0] == idResource && r.resource[1].ToInt() == lv))
43 {
44 AddPlan(item.id);
45 }
46 }

References AddPlan(), item, SourceManager.researches, and EClass.sources.

Member Data Documentation

◆ branch

FactionBranch ResearchManager.branch

Definition at line 20 of file ResearchManager.cs.

Referenced by AddPlan(), CanCompletePlan(), IsListBarter(), SetOwner(), and ShowNewPlans().

◆ finished

List<ResearchPlan> ResearchManager.finished = new List<ResearchPlan>()

◆ focused

ResearchPlan ResearchManager.focused

◆ newPlans

List<ResearchPlan> ResearchManager.newPlans = new List<ResearchPlan>()

Definition at line 15 of file ResearchManager.cs.

Referenced by AddPlan(), OnSimulateDay(), and UIHomeInfo.RefreshReport().

◆ plans


The documentation for this class was generated from the following file: