summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/Equip/EquipLoadTask.cs
blob: c821a180f970f97b79488f5e3435bafe55af4d9e (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using System;
using System.Collections.Generic;
using XUtliPoolLib;

namespace XMainClient
{
	internal class EquipLoadTask
	{
		public EPartType part = EPartType.ENum;

		public FashionPositionInfo fpi;

		public EProcessStatus processStatus = EProcessStatus.ENotProcess;

		protected string location = "";

		public EquipLoadTask(EPartType p)
		{
			this.part = p;
			this.fpi.Reset();
		}

		public bool IsSamePart(ref FashionPositionInfo newFpi)
		{
			return this.fpi.Equals(newFpi) && this.processStatus >= EProcessStatus.EPreProcess;
		}

		public bool MakePath(ref FashionPositionInfo newFpi, HashSet<string> loadedPath)
		{
			this.fpi = newFpi;
			bool flag = this.fpi.presentID > 0u;
			if (flag)
			{
				this.location = "Prefabs/" + XSingleton<XEntityMgr>.singleton.EntityInfo.GetByPresentID(this.fpi.presentID).Prefab;
				this.processStatus = EProcessStatus.EProcessing;
			}
			else
			{
				bool flag2 = !string.IsNullOrEmpty(this.fpi.fashionName);
				if (flag2)
				{
					bool flag3 = this.fpi.fashionName.StartsWith("/");
					if (flag3)
					{
						this.location = "Equipments" + this.fpi.fashionName;
					}
					else
					{
						this.location = "Equipments/" + this.fpi.fashionName;
					}
					this.processStatus = EProcessStatus.EProcessing;
				}
			}
			bool flag4 = loadedPath != null;
			bool result;
			if (flag4)
			{
				bool flag5 = !string.IsNullOrEmpty(this.location) && !loadedPath.Contains(this.location);
				if (flag5)
				{
					loadedPath.Add(this.location);
					result = true;
				}
				else
				{
					this.processStatus = EProcessStatus.EProcessed;
					result = false;
				}
			}
			else
			{
				result = !string.IsNullOrEmpty(this.location);
			}
			return result;
		}

		public virtual void Load(XEntity e, int prefessionID, ref FashionPositionInfo newFpi, bool async, HashSet<string> loadedPath)
		{
			bool flag = loadedPath != null;
			if (flag)
			{
				bool flag2 = !string.IsNullOrEmpty(this.location) && !loadedPath.Contains(this.location);
				if (flag2)
				{
					loadedPath.Add(this.location);
				}
				else
				{
					this.processStatus = EProcessStatus.EProcessed;
				}
			}
		}

		public virtual void Reset(XEntity e)
		{
			this.processStatus = EProcessStatus.ENotProcess;
			this.location = "";
		}
	}
}