11 public virtual string idString
21 public virtual string RecipeID
31 public virtual string pathRenderData
35 return "Scene/Render/Data/";
41 public virtual string idRenderData
45 return this._idRenderData;
55 return ResourceCache.Load<
RenderData>(this.pathRenderData +
"_Default");
61 public virtual string pathSprite
65 return "Scene/Render/Data/";
71 public virtual string idSprite
81 public virtual string prefabName
90 public bool HasTag(CTAG _tag)
92 return this.tag.Contains(_tag.ToString());
96 public virtual string GetSearchName(
bool jp)
101 if ((result = this._nameSearch) ==
null)
103 return this._nameSearch = this.name.ToLower();
106 else if ((result = this._nameSearchJP) ==
null)
108 result = (this._nameSearchJP = base.GetText(
"name",
false).ToLower());
120 if ((result = this._category) ==
null)
122 result = (this._category = this.sources.categories.map[this.category]);
130 public string RecipeCat
135 if ((result = this._recipeCat) ==
null)
137 result = (this._recipeCat = this.Category.recipeCat);
144 public bool ContainsTag(
string _tag)
146 return this.tag.Contains(_tag);
155 return Core.Instance.sources;
160 public override void OnImportData(SourceData data)
162 base.OnImportData(data);
163 this._tiles =
new int[0];
168 public void SetRenderData()
170 this.replacer =
new SpriteReplacer();
171 if (this.idRenderData.IsEmpty())
173 this.renderData = this.defaultRenderData;
175 else if (this.idRenderData[0] ==
'@')
177 string[] array = this.idRenderData.Replace(
"@",
"").Split(
'#', StringSplitOptions.None);
178 string text = array[0];
179 if (array.Length > 1)
181 this.aliasPref = array[1];
183 this.renderData =
RenderRow.DictRenderData.TryGetValue(text,
null);
184 if (this.renderData ==
null)
186 RenderData renderData = (ResourceCache.Load<
RenderData>(this.pathRenderData + text) ?? this.defaultRenderData).Instantiate<RenderData>();
190 renderData2.offset.x = renderData2.offset.x + renderData.pass.pmesh.size.x * 0.5f;
192 renderData3.offset.y = renderData3.offset.y + renderData.pass.pmesh.size.y * 0.5f;
196 float num = renderData.pass.pmesh.size.x * 0.5f + renderData.pass.pmesh.pos.x;
197 float num2 = renderData.pass.pmesh.size.y * 0.5f + renderData.pass.pmesh.pos.y;
199 renderData4.offset.x = renderData4.offset.x + num;
201 renderData5.offset.y = renderData5.offset.y + num2;
203 renderData6.offsetBack.x = renderData6.offsetBack.x + num;
205 renderData7.offsetBack.y = renderData7.offsetBack.y + num2;
207 renderData8.heldPos.x = renderData8.heldPos.x + num * 0.7f;
209 renderData9.heldPos.y = renderData9.heldPos.y + num2 * 0.7f;
211 renderData.pass =
null;
212 this.renderData = renderData;
213 RenderRow.DictRenderData[text] = renderData;
218 this.renderData = (ResourceCache.Load<
RenderData>(this.pathRenderData + this.idRenderData) ?? this.defaultRenderData);
220 if (!Application.isEditor &&
this.pref ==
null)
222 if (this.aliasPref.IsEmpty())
228 this.pref = this.sources.cards.map[this.aliasPref].pref;
231 if (!this.renderData.initialized)
233 this.renderData.Init();
236 string a = this.colorType;
241 this.useRandomColor =
true;
246 this.useAltColor =
true;
248 if (this.defMat[0] ==
'!')
250 this.fixedMaterial =
true;
251 this.defMat = this.defMat.Substring(1, this.defMat.Length - 1);
255 this.fixedMaterial =
false;
257 if (!this.sources.materials.alias.ContainsKey(
this.defMat))
259 Debug.Log(this.defMat);
261 this.DefaultMaterial = this.sources.materials.alias[this.defMat];
265 public virtual void SetTiles()
267 if (!this.renderData || !this.renderData.pass)
271 if (this._tiles.Length !=
this.tiles.Length)
273 this._tiles =
new int[this.tiles.Length];
274 for (
int i = 0; i < this.tiles.Length; i++)
276 this._tiles[i] = this.tiles[i] / 100 * (int)this.renderData.pass.pmesh.tiling.x +
this.tiles[i] % 100;
282 public int ConvertTile(
int tile)
284 return this.renderData.ConvertTile(tile);
288 public Sprite GetSprite(
int dir = 0,
int skin = 0,
bool snow =
false)
290 if (this.replacer.HasSprite(
this.idSprite))
292 return this.replacer.data.GetSprite(snow);
294 int[] array =
null ?? this._tiles;
295 if (this.sprites ==
null)
297 this.sprites =
new Sprite[(this.skins ==
null) ? 1 : (this.skins.Length + 1), (array.Length == 0) ? 1 : array.Length];
299 if (skin != 0 && skin >= this.sprites.GetLength(0))
303 if (dir >= array.Length)
307 if (!this.sprites[skin, dir])
309 MeshPass pass = this.renderData.pass;
312 Texture2D texture2D = pass.mat.GetTexture(
"_MainTex") as Texture2D;
317 num = Mathf.Abs(array[dir]);
321 num = Mathf.Abs(array[dir] + this.skins[skin - 1] * ((array[dir] > 0) ? 1 : -1));
323 int num2 = (int)((
float)texture2D.width / pmesh.tiling.x);
324 int num3 = (int)((
float)texture2D.height / pmesh.tiling.y);
325 int num4 = (int)((
float)num % pmesh.tiling.x);
326 int num5 = (int)((
float)num / pmesh.tiling.x);
327 this.sprites[skin, dir] = Sprite.Create(texture2D,
new Rect((
float)(num4 * num2), (
float)(texture2D.height - (num5 + 1) * num3), (
float)num2, (
float)(num3 * (
this.renderData.multiSize ? 2 : 1))), Vector2.zero, 100f, 0U, SpriteMeshType.FullRect);
331 this.sprites[skin, dir] = SpriteSheet.Get(this.idSprite);
332 if (!this.sprites[skin, dir])
334 this.sprites[skin, dir] = (Resources.Load<Sprite>(this.pathSprite + this.idSprite) ?? Resources.Load<Sprite>(this.pathSprite + this.idSprite +
"_0"));
337 if (!this.sprites[skin, dir])
339 this.sprites[skin, dir] = Core.Instance.refs.spriteNull;
342 return this.sprites[skin, dir];
346 public void SetSpriteRenderer(SpriteRenderer sr, Sprite sprite =
null,
int matCol = 0,
bool setTransform =
true,
int dir = 0)
348 sr.sprite = (sprite ?? this.GetSprite(dir, 0,
false));
351 sr.sprite =
EClass.core.refs.spriteThingActor;
353 int num = (matCol == 0) ? 104025 : matCol;
354 float num2 = (float)(num / 262144) * 0.01f;
361 Color color =
new Color(num3 * (
float)(num % 262144 / 4096) + num4, num3 * (
float)(num % 4096 / 64) + num4, num3 * (
float)(num % 64) + num4, 1f);
365 float num5 = sr.bounds.max.x - sr.bounds.min.x;
366 Vector3 max = sr.bounds.max;
367 Vector3 min = sr.bounds.min;
368 sr.transform.localPosition =
new Vector3(-0.5f * num5, 0f, 0f);
379 public void SetImage(Image image, Sprite sprite =
null,
int matCol = 0,
bool setNativeSize =
true,
int dir = 0,
int idSkin = 0)
381 image.sprite = (sprite ?? this.GetSprite(dir, idSkin,
false));
382 int num = (matCol == 0) ? 104025 : matCol;
384 image.color =
new Color(num2 * (
float)(num % 262144 / 4096), num2 * (
float)(num % 4096 / 64), num2 * (
float)(num % 64), (
float)(num / 262144) * 0.01f)
388 RectTransform rectTransform = image.Rect();
390 rectTransform.pivot = this.renderData.imagePivot -
new Vector2(0.01f * (
float)sourcePref.pivotX, 0.01f * (
float)sourcePref.pivotY);
391 float x = Mathf.Abs(image.transform.localScale.x) * (float)((sprite || this._tiles.Length == 0 ||
this._tiles[dir %
this._tiles.Length] >= 0) ? 1 : -1);
392 float y = image.transform.localScale.y;
393 image.transform.localScale =
new Vector3(x, y, image.transform.localScale.z);
394 sourcePref.Validate();
397 image.SetNativeSize();
398 if (this.renderData.imageScale.x != 1f ||
this.renderData.imageScale.y != 1f || sourcePref.scaleIcon != 0)
400 rectTransform.sizeDelta =
new Vector2(rectTransform.sizeDelta.x * (
this.renderData.imageScale.x + (
float)sourcePref.scaleIcon * 0.01f), rectTransform.sizeDelta.y * (
this.renderData.imageScale.y + (
float)sourcePref.scaleIcon * 0.01f));
408 p.tile = (float)this.GetTile(mat ?? this.DefaultMaterial, dir);
409 p.matColor = (float)this.GetColorInt(mat ?? this.DefaultMaterial);
410 p.mat = (mat ?? this.DefaultMaterial);
420 shared.tile = (float)this.GetTile(mat, dir);
421 shared.matColor = (float)this.GetColorInt(mat);
429 shared.color = 11010048f;
430 vector = Core.Instance.scene.camSupport.renderPos;
431 if (this.renderData.multiSize)
438 shared.color = 10485760f;
439 BaseTileMap tileMap = Core.Instance.screen.tileMap;
440 vector = *point.Position(bridgeHeight);
451 return this._tiles[dir % this._tiles.Length];
457 if (this.useAltColor)
459 if (this.colorMod != 0)
461 return BaseTileMap.GetColorInt(ref mat.altColor,
this.colorMod);
467 if (this.colorMod != 0)
469 return BaseTileMap.GetColorInt(ref mat.matColor,
this.colorMod);
476 public static Dictionary<string, RenderData> DictRenderData =
new Dictionary<string, RenderData>();
503 public int tempChance;
512 public string name_JP;
515 public string detail;
518 public string detail_JP;
521 public string _idRenderData;
524 public string _tileType;
527 public string defMat;
530 public string colorType;
533 public string category;
536 public string idSound;
539 public string aliasPref;
542 public string[] components;
545 public string[] factory;
548 public string[] recipeKey;
560 public bool multisize;
571 public Sprite[,] sprites;
579 public bool useAltColor;
583 public bool useRandomColor;
587 public bool fixedMaterial;
595 public SpriteReplacer replacer;
599 public string _nameSearch;
603 public string _nameSearchJP;
611 private string _recipeCat;