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

Public Member Functions

void Init ()
 
void Deactivate ()
 
void SetVisible (bool visible)
 
void DestorySprites ()
 
void RefreshOptions ()
 
void Refresh ()
 
void RefreshCategory (DirectoryInfo dir=null)
 
void OpenFolder ()
 

Static Public Member Functions

static void Activate ()
 
- Static Public Member Functions inherited from EMono
static int rnd (int a)
 

Public Attributes

GameObject goMain
 
GameObject goCat
 
GameObject goOption
 
UIList listCat
 
UIList listCatSub
 
UIDynamicList list
 
CanvasGroup cg
 
UIButton buttonSave
 
UIButton buttonEdit
 
UIButton buttonDelete
 
UIButton toggleRotate
 
UIButton toggleIgnoreBlock
 
Dictionary< string, Sprite > dictSprite = new Dictionary<string, Sprite>()
 
DirectoryInfo rootDir
 

Static Public Attributes

static PartialMapMenu Instance
 
static DirectoryInfo lastDir
 
static DirectoryInfo lastDirSub
 
- Static Public Attributes inherited from EMono
static Core core
 

Properties

AM_Copy am [get]
 
DirectoryInfo dir [get]
 
bool IsEditor [get]
 
PartialMap partial [get]
 
- Properties inherited from EMono
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 Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SoundManager Sound [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 6 of file PartialMapMenu.cs.

Member Function Documentation

◆ Activate()

static void PartialMapMenu.Activate ( )
inlinestatic

Definition at line 50 of file PartialMapMenu.cs.

51 {
52 if (!Instance)
53 {
54 Instance = Util.Instantiate<PartialMapMenu>("UI/BuildMenu/PartialMapMenu", EMono.ui);
55 Instance.Init();
56 }
58 MapPiece.CacheMap.Clear();
59 }
Definition: EMono.cs:4
static UI ui
Definition: EMono.cs:15
static Dictionary< string, PartialMap > CacheMap
Definition: MapPiece.cs:43
static PartialMapMenu Instance
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References MapPiece.CacheMap, Init(), Instance, Refresh(), EMono.ui, and Util.

Referenced by AM_Copy.OnActivate().

◆ Deactivate()

void PartialMapMenu.Deactivate ( )
inline

Definition at line 84 of file PartialMapMenu.cs.

85 {
87 Object.DestroyImmediate(Instance.gameObject);
88 }
void DestorySprites()

References DestorySprites(), and Instance.

Referenced by AM_Copy.OnDeactivate().

◆ DestorySprites()

void PartialMapMenu.DestorySprites ( )
inline

Definition at line 96 of file PartialMapMenu.cs.

97 {
98 foreach (Sprite value in dictSprite.Values)
99 {
100 Object.Destroy(value.texture);
101 Object.Destroy(value);
102 }
103 dictSprite.Clear();
104 }
Dictionary< string, Sprite > dictSprite

References dictSprite.

Referenced by Deactivate(), AM_Copy.OnSave(), and AM_Copy.RefreshMenu().

◆ Init()

void PartialMapMenu.Init ( )
inline

Definition at line 61 of file PartialMapMenu.cs.

62 {
63 rootDir = new DirectoryInfo(CorePath.MapPieceSaveUser);
64 goCat.SetActive(IsEditor);
66 if (!IsEditor)
67 {
68 return;
69 }
71 if (lastDir != null)
72 {
73 listCat.Select((DirectoryInfo a) => a.FullName == lastDir.FullName);
74 am.dir = lastDir;
75 }
76 if (lastDirSub != null)
77 {
79 listCatSub.Select((DirectoryInfo a) => a.FullName == lastDirSub.FullName);
80 am.dir = lastDirSub;
81 }
82 }
static string MapPieceSaveUser
Definition: CorePath.cs:202
GameObject goCat
static DirectoryInfo lastDir
void RefreshCategory(DirectoryInfo dir=null)
static DirectoryInfo lastDirSub
DirectoryInfo rootDir
void Select(int index=0, bool invoke=false)
Definition: UIList.cs:644

References goCat, IsEditor, lastDir, lastDirSub, listCat, listCatSub, CorePath.MapPieceSaveUser, RefreshCategory(), RefreshOptions(), rootDir, and UIList.Select().

Referenced by Activate().

◆ OpenFolder()

void PartialMapMenu.OpenFolder ( )
inline

Definition at line 253 of file PartialMapMenu.cs.

254 {
256 }
static string MapPieceSave
Definition: CorePath.cs:200
static void ShowExplorer(string itemPath, bool selectFirstFile=false)
Definition: Util.cs:228

References CorePath.MapPieceSave, and Util.

◆ Refresh()

void PartialMapMenu.Refresh ( )
inline

Definition at line 124 of file PartialMapMenu.cs.

125 {
126 list.callbacks = new UIList.Callback<MapMetaData, ButtonGrid>
127 {
128 onClick = delegate(MapMetaData a, ButtonGrid b)
129 {
130 SE.Click();
131 am.Import(a.path);
132 am.partialMap.name = a.name;
133 },
134 onRedraw = delegate(MapMetaData a, ButtonGrid b, int i)
135 {
136 string path = a.path.GetFullFileNameWithoutExtension() + ".txt";
137 if (File.Exists(path))
138 {
139 string str = File.ReadAllText(path);
140 if (!str.IsEmpty())
141 {
142 a.name = str;
143 }
144 }
145 if (a.name.IsEmpty())
146 {
147 a.name = "unknown";
148 }
149 b.mainText.SetText(IsEditor ? new FileInfo(a.path).Name : a.name);
150 b.subText.text = Lang._currency(a.partial.value);
151 Sprite sprite = dictSprite.TryGetValue(a.path);
152 if (!sprite)
153 {
154 string path2 = a.path.GetFullFileNameWithoutExtension() + ".jpg";
155 if (File.Exists(path2))
156 {
157 Texture2D texture2D = new Texture2D(1, 1);
158 byte[] source = File.ReadAllBytes(path2);
159 texture2D.LoadImage(source.ToArray());
160 sprite = Sprite.Create(texture2D, new Rect(0f, 0f, texture2D.width, texture2D.height), new Vector2(0.5f, 0.5f));
161 b.icon.sprite = sprite;
162 dictSprite[a.path] = sprite;
163 }
164 }
165 if ((bool)sprite)
166 {
167 b.icon.sprite = sprite;
168 }
169 UIButton componentInDirectChildren = b.GetComponentInDirectChildren<UIButton>();
170 componentInDirectChildren.SetActive(IsEditor);
171 componentInDirectChildren.SetOnClick(delegate
172 {
173 SE.Click();
174 am.overwritePath = a.path;
175 am.RefreshMenu(show: false);
176 });
177 },
178 onList = delegate
179 {
180 foreach (FileInfo item in dir.GetFiles().Concat(MOD.listPartialMaps))
181 {
182 if (item.Name.EndsWith(".mp"))
183 {
184 MapMetaData metaData = Map.GetMetaData(item.FullName);
185 if (metaData != null && metaData.partial != null)
186 {
187 list.Add(metaData);
188 }
189 }
190 }
191 }
192 };
193 list.List();
194 }
void Import(string path)
Definition: AM_Copy.cs:242
void RefreshMenu(bool show)
Definition: AM_Copy.cs:260
Definition: Lang.cs:6
static string _currency(object a, string IDCurrency)
Definition: Lang.cs:162
Definition: MOD.cs:7
static List< FileInfo > listPartialMaps
Definition: MOD.cs:22
string name
Definition: MapMetaData.cs:7
PartialMap partial
Definition: MapMetaData.cs:19
string path
Definition: MapMetaData.cs:21
Definition: Map.cs:13
static MapMetaData GetMetaData(string pathZip)
Definition: Map.cs:732
DirectoryInfo dir
UIDynamicList list
UIText mainText
Definition: UIButton.cs:102
override void List()
override void Add(object o)
Definition: UIList.cs:9
void SetText(string s)
Definition: UIText.cs:159

References Lang._currency(), UIDynamicList.Add(), am, dictSprite, dir, Map.GetMetaData(), AM_Copy.Import(), IsEditor, item, list, UIDynamicList.List(), MOD.listPartialMaps, UIButton.mainText, MapMetaData.name, MapMetaData.partial, MapMetaData.path, AM_Copy.RefreshMenu(), UIText.SetText(), and PartialMap.value.

Referenced by Activate(), AM_Copy.OnSave(), RefreshCategory(), and AM_Copy.RefreshMenu().

◆ RefreshCategory()

void PartialMapMenu.RefreshCategory ( DirectoryInfo  dir = null)
inline

Definition at line 196 of file PartialMapMenu.cs.

197 {
198 UIList _listCat = listCat;
199 bool isMain = true;
200 if (dir == null)
201 {
202 dir = rootDir;
203 }
204 if (dir.FullName != rootDir.FullName)
205 {
206 _listCat = listCatSub;
207 isMain = false;
208 }
209 _listCat.Clear();
210 _listCat.callbacks = new UIList.Callback<DirectoryInfo, UIButton>
211 {
212 onClick = delegate(DirectoryInfo a, UIButton b)
213 {
214 SE.Click();
215 _listCat.Select(a);
216 am.dir = a;
217 if (isMain)
218 {
219 lastDir = (lastDirSub = a);
221 }
222 else
223 {
224 lastDirSub = a;
225 }
226 Refresh();
227 },
228 onInstantiate = delegate(DirectoryInfo a, UIButton b)
229 {
230 int num = 0;
231 FileInfo[] files = a.GetFiles("*.mp", SearchOption.AllDirectories);
232 for (int j = 0; j < files.Length; j++)
233 {
234 _ = files[j];
235 num++;
236 }
237 b.mainText.text = ((a == dir && !isMain) ? "(Root)" : (a.Name + "(" + num + ")"));
238 },
239 onList = delegate
240 {
241 _listCat.Add(isMain ? rootDir : dir);
242 DirectoryInfo[] array = (isMain ? new DirectoryInfo(CorePath.MapPieceSave).GetDirectories() : dir.GetDirectories());
243 foreach (DirectoryInfo o in array)
244 {
245 _listCat.Add(o);
246 }
247 }
248 };
249 _listCat.List();
250 listCatSub.SetActive(listCatSub.items.Count > 1);
251 }
List< object > items
Definition: UIList.cs:241
override void Clear()
Definition: UIList.cs:349
override void Add(object item)
Definition: UIList.cs:302
override void List()
Definition: UIList.cs:717

References UIList.Add(), UIList.Clear(), dir, UIList.items, lastDir, lastDirSub, UIList.List(), listCat, listCatSub, CorePath.MapPieceSave, Refresh(), RefreshCategory(), rootDir, and UIList.Select().

Referenced by Init(), AM_Copy.OnSave(), and RefreshCategory().

◆ RefreshOptions()

void PartialMapMenu.RefreshOptions ( )
inline

Definition at line 106 of file PartialMapMenu.cs.

107 {
108 goOption.SetActive(IsEditor && partial != null);
109 if (partial != null)
110 {
111 toggleRotate.SetToggle(partial.allowRotate, delegate(bool on)
112 {
113 partial.allowRotate = on;
114 partial.Update();
115 });
117 {
118 partial.ignoreBlock = on;
119 partial.Update();
120 });
121 }
122 }
UIButton toggleRotate
GameObject goOption
UIButton toggleIgnoreBlock
PartialMap partial
bool allowRotate
Definition: PartialMap.cs:55
bool ignoreBlock
Definition: PartialMap.cs:58
void Update()
Definition: PartialMap.cs:403
void SetToggle(bool isOn, Action< bool > onToggle=null)
Definition: UIButton.cs:341

References PartialMap.allowRotate, goOption, PartialMap.ignoreBlock, IsEditor, partial, UIButton.SetToggle(), toggleIgnoreBlock, toggleRotate, and PartialMap.Update().

Referenced by Init(), and SetVisible().

◆ SetVisible()

void PartialMapMenu.SetVisible ( bool  visible)
inline

Definition at line 90 of file PartialMapMenu.cs.

91 {
93 goMain.SetActive(visible);
94 }
GameObject goMain

References goMain, and RefreshOptions().

Referenced by AM_Copy.RefreshMenu().

Member Data Documentation

◆ buttonDelete

UIButton PartialMapMenu.buttonDelete

Definition at line 32 of file PartialMapMenu.cs.

Referenced by AM_Copy.RefreshMenu().

◆ buttonEdit

UIButton PartialMapMenu.buttonEdit

Definition at line 30 of file PartialMapMenu.cs.

Referenced by AM_Copy.RefreshMenu().

◆ buttonSave

UIButton PartialMapMenu.buttonSave

Definition at line 28 of file PartialMapMenu.cs.

Referenced by AM_Copy.RefreshMenu().

◆ cg

CanvasGroup PartialMapMenu.cg

Definition at line 26 of file PartialMapMenu.cs.

◆ dictSprite

Dictionary<string, Sprite> PartialMapMenu.dictSprite = new Dictionary<string, Sprite>()

Definition at line 38 of file PartialMapMenu.cs.

Referenced by DestorySprites(), and Refresh().

◆ goCat

GameObject PartialMapMenu.goCat

Definition at line 16 of file PartialMapMenu.cs.

Referenced by Init().

◆ goMain

GameObject PartialMapMenu.goMain

Definition at line 14 of file PartialMapMenu.cs.

Referenced by SetVisible().

◆ goOption

GameObject PartialMapMenu.goOption

Definition at line 18 of file PartialMapMenu.cs.

Referenced by RefreshOptions().

◆ Instance

PartialMapMenu PartialMapMenu.Instance
static

Definition at line 8 of file PartialMapMenu.cs.

Referenced by Activate(), and Deactivate().

◆ lastDir

DirectoryInfo PartialMapMenu.lastDir
static

Definition at line 10 of file PartialMapMenu.cs.

Referenced by Init(), and RefreshCategory().

◆ lastDirSub

DirectoryInfo PartialMapMenu.lastDirSub
static

Definition at line 12 of file PartialMapMenu.cs.

Referenced by Init(), and RefreshCategory().

◆ list

UIDynamicList PartialMapMenu.list

Definition at line 24 of file PartialMapMenu.cs.

Referenced by Refresh().

◆ listCat

UIList PartialMapMenu.listCat

Definition at line 20 of file PartialMapMenu.cs.

Referenced by Init(), and RefreshCategory().

◆ listCatSub

UIList PartialMapMenu.listCatSub

Definition at line 22 of file PartialMapMenu.cs.

Referenced by Init(), and RefreshCategory().

◆ rootDir

DirectoryInfo PartialMapMenu.rootDir

Definition at line 40 of file PartialMapMenu.cs.

Referenced by Init(), and RefreshCategory().

◆ toggleIgnoreBlock

UIButton PartialMapMenu.toggleIgnoreBlock

Definition at line 36 of file PartialMapMenu.cs.

Referenced by RefreshOptions().

◆ toggleRotate

UIButton PartialMapMenu.toggleRotate

Definition at line 34 of file PartialMapMenu.cs.

Referenced by RefreshOptions().

Property Documentation

◆ am

AM_Copy PartialMapMenu.am
get

Definition at line 42 of file PartialMapMenu.cs.

Referenced by Refresh().

◆ dir

DirectoryInfo PartialMapMenu.dir
get

Definition at line 44 of file PartialMapMenu.cs.

Referenced by Refresh(), and RefreshCategory().

◆ IsEditor

bool PartialMapMenu.IsEditor
get

Definition at line 46 of file PartialMapMenu.cs.

Referenced by Init(), Refresh(), and RefreshOptions().

◆ partial

PartialMap PartialMapMenu.partial
get

Definition at line 48 of file PartialMapMenu.cs.

Referenced by RefreshOptions().


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