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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
using System;
using System.Collections.Generic;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient
{
internal class DecalLoadTask : EquipLoadTask
{
public Texture2D decalTex = null;
protected LoadAsyncTask loadTask = null;
protected LoadCallBack loadCb = null;
private PartLoadTask faceTask = null;
private PartLoadCallback m_PartLoadCb = null;
public DecalLoadTask(EPartType p, PartLoadCallback partLoadCb, PartLoadTask face) : base(p)
{
this.loadCb = new LoadCallBack(this.LoadFinish);
this.faceTask = face;
this.m_PartLoadCb = partLoadCb;
}
public override void Load(XEntity e, int prefessionID, ref FashionPositionInfo newFpi, bool async, HashSet<string> loadedPath)
{
bool flag = base.IsSamePart(ref newFpi);
if (flag)
{
bool flag2 = this.m_PartLoadCb != null;
if (flag2)
{
this.m_PartLoadCb(this, false);
}
}
else
{
this.Reset(e);
bool flag3 = base.MakePath(ref newFpi, loadedPath);
if (flag3)
{
if (async)
{
this.loadTask = XSingleton<XResourceLoaderMgr>.singleton.GetShareResourceAsync<Texture2D>(this.location, ".tga", this.loadCb, this);
}
else
{
Texture2D sharedResource = XSingleton<XResourceLoaderMgr>.singleton.GetSharedResource<Texture2D>(this.location, ".tga", true, false);
this.LoadFinish(sharedResource, this);
}
}
else
{
bool flag4 = this.m_PartLoadCb != null;
if (flag4)
{
this.m_PartLoadCb(this, false);
}
}
}
}
private void LoadFinish(UnityEngine.Object obj, object cbOjb)
{
bool flag = this.processStatus == EProcessStatus.EProcessing;
if (flag)
{
this.processStatus = EProcessStatus.EPreProcess;
this.decalTex = (obj as Texture2D);
bool flag2 = this.m_PartLoadCb != null;
if (flag2)
{
this.m_PartLoadCb(this, false);
}
}
}
public override void Reset(XEntity e)
{
base.Reset(e);
bool flag = this.decalTex != null;
if (flag)
{
XSingleton<XResourceLoaderMgr>.singleton.UnSafeDestroyShareResource(this.location, ".tga", this.decalTex, false);
this.decalTex = null;
}
bool flag2 = this.loadTask != null;
if (flag2)
{
this.loadTask.CancelLoad(this.loadCb);
this.loadTask = null;
}
}
public void PostLoad(CombineMeshTask combineMeshTask)
{
bool flag = this.decalTex != null;
Texture texture;
if (flag)
{
texture = this.decalTex;
}
else
{
texture = this.faceTask.GetTexture();
}
bool flag2 = texture != null;
if (flag2)
{
bool isOnepart = combineMeshTask.isOnepart;
if (isOnepart)
{
ShaderManager.SetTexture(combineMeshTask.mpb, texture, ShaderManager._ShaderKeyIDFace);
}
else
{
ShaderManager.SetTexture(combineMeshTask.mpb, texture, ShaderManager._ShaderKeyIDSkin[0]);
}
}
this.processStatus = EProcessStatus.EProcessed;
}
}
}
|