Elin Modding Docs Doc
Loading...
Searching...
No Matches
LayerEditPCC.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x0200053E RID: 1342
6public class LayerEditPCC : ELayer
7{
8 // Token: 0x17000B1C RID: 2844
9 // (get) Token: 0x06002463 RID: 9315 RVA: 0x000CD09C File Offset: 0x000CB29C
10 public bool UniformMode
11 {
12 get
13 {
14 return this.mode == UIPCC.Mode.UniformM || this.mode == UIPCC.Mode.UniformF;
15 }
16 }
17
18 // Token: 0x17000B1D RID: 2845
19 // (get) Token: 0x06002464 RID: 9316 RVA: 0x000CD0B2 File Offset: 0x000CB2B2
20 public bool IsMale
21 {
22 get
23 {
24 return this.mode == UIPCC.Mode.UniformM;
25 }
26 }
27
28 // Token: 0x06002465 RID: 9317 RVA: 0x000CD0C0 File Offset: 0x000CB2C0
29 public void Activate(Chara _chara, UIPCC.Mode m, string idUniform = null, Action _onKill = null)
30 {
31 this.chara = (_chara.IsPCC ? _chara : ELayer.pc);
32 this.mode = m;
33 this.uiPCC.exportPath = CorePath.user + "PCC/";
34 this.uiPCC.onShowPalette = delegate(PCC pcc, string id, PCC.Part part, TestActor actor)
35 {
36 LayerColorPicker layerColorPicker = ELayer.ui.AddLayer<LayerColorPicker>();
37 Color color = pcc.data.GetColor(id);
38 layerColorPicker.SetColor(color, color, delegate(PickerState state, Color _c)
39 {
40 pcc.data.SetColor(id, _c);
41 actor.Reset();
42 });
43 };
44 PCCData newData = new PCCData();
45 newData.Set(this.chara.pccData);
46 this.backup = IO.DeepCopy<PCCData>(newData);
47 this.backupPortrait = this.chara.c_idPortrait;
48 if (this.UniformMode)
49 {
50 ELayer.game.uniforms.Apply(newData, idUniform, this.IsMale, false);
51 this.windows[0].SetCaption("_uniform".lang(ELayer.sources.jobs.map[idUniform].GetName().ToTitleCase(false), this.IsMale ? "male".lang() : "female".lang(), null, null, null));
52 }
53 else
54 {
55 ELayer.game.uniforms.Apply(newData, PCCUniformManager.dummy);
56 }
57 this.uiPCC.Init(newData, this.mode);
58 this.SetPortraitSlider();
59 this.windows[0].AddBottomButton("reset", delegate
60 {
61 if (this.UniformMode)
62 {
63 ELayer.game.uniforms.RemoveUniform(newData);
64 }
65 this.uiPCC.Reset(this.backup);
66 this.chara.c_idPortrait = this.backupPortrait;
67 this.SetPortraitSlider();
68 ELayer.Sound.Play("offering");
69 newData.colors.Clear();
70 }, false);
71 if (this.UniformMode)
72 {
73 PCCData otherUni = ELayer.game.uniforms.GetUniform(idUniform, !this.IsMale);
74 if (otherUni != null)
75 {
76 this.windows[0].AddBottomButton("copyUniform", delegate
77 {
78 PCCData pccdata = new PCCData();
79 pccdata.Set(this.chara.pccData);
80 ELayer.game.uniforms.Apply(pccdata, otherUni);
81 this.uiPCC.Reset(pccdata);
82 ELayer.Sound.Play("offering");
83 }, false);
84 }
85 }
86 this.windows[2].SetActive(true);
87 this.portrait.SetActive(!this.UniformMode);
88 if (_onKill != null)
89 {
90 base.SetOnKill(_onKill);
91 }
92 }
93
94 // Token: 0x06002466 RID: 9318 RVA: 0x000CD2F0 File Offset: 0x000CB4F0
95 public void Apply()
96 {
97 PCCData data = this.uiPCC.pcc.data;
98 ELayer.game.uniforms.Apply(data, this.chara.job.id, this.IsMale, true);
99 this.chara.pccData.Set(data);
100 PCC.Get(this.chara.pccData).Build(false);
101 this.chara.SetInt(105, IntColor.ToInt(this.chara.pccData.GetHairColor(false)));
102 this.applied = true;
103 }
104
105 // Token: 0x06002467 RID: 9319 RVA: 0x000CD386 File Offset: 0x000CB586
106 public override void OnKill()
107 {
108 this.Apply();
109 }
110
111 // Token: 0x06002468 RID: 9320 RVA: 0x000CD390 File Offset: 0x000CB590
112 private void Update()
113 {
114 Color hairColor = this.uiPCC.actor.data.GetHairColor(false);
115 if (hairColor != this.lastHair)
116 {
117 this.portrait.SetChara(this.chara, this.uiPCC.actor.data);
118 this.lastHair = hairColor;
119 }
120 int wheel = EInput.wheel;
121 if (InputModuleEX.IsPointerOver(this.windows[1].transform))
122 {
123 if (wheel < 0)
124 {
125 this.uiPCC.actor.provider.NextDir(15f);
126 }
127 if (wheel > 0)
128 {
129 this.uiPCC.actor.provider.PrevDir();
130 }
131 }
132 }
133
134 // Token: 0x06002469 RID: 9321 RVA: 0x000CD440 File Offset: 0x000CB640
135 public void SetPortraitSlider()
136 {
137 if (!this.sliderPortrait)
138 {
139 return;
140 }
141 List<ModItem<Sprite>> list = Portrait.ListPlayerPortraits(this.chara.bio.gender, this.chara != ELayer.pc);
142 this.sliderPortrait.SetList<ModItem<Sprite>>(list.Find((ModItem<Sprite> a) => a.id == this.chara.c_idPortrait), list, delegate(int a, ModItem<Sprite> b)
143 {
144 this.chara.c_idPortrait = b.id;
145 this.portrait.SetChara(this.chara, this.uiPCC.actor.data);
146 }, delegate(ModItem<Sprite> a)
147 {
148 if (!a.id.IsEmpty())
149 {
150 return a.id;
151 }
152 return "None";
153 });
154 }
155
156 // Token: 0x040013CF RID: 5071
157 public UIPCC.Mode mode;
158
159 // Token: 0x040013D0 RID: 5072
160 public UIPCC uiPCC;
161
162 // Token: 0x040013D1 RID: 5073
163 public Portrait portrait;
164
165 // Token: 0x040013D2 RID: 5074
166 public Chara chara;
167
168 // Token: 0x040013D3 RID: 5075
169 public UISlider sliderPortrait;
170
171 // Token: 0x040013D4 RID: 5076
172 public PCCData backup;
173
174 // Token: 0x040013D5 RID: 5077
175 public string backupPortrait;
176
177 // Token: 0x040013D6 RID: 5078
178 public bool applied;
179
180 // Token: 0x040013D7 RID: 5079
181 private Color lastHair;
182}
Definition Chara.cs:12