scancscode 1.0.28 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,194 @@
1
+ using FairyGUI;
2
+ using TEngine.UI;
3
+ using TEngine.Redux;
4
+ using FaBao.ExportedConfigs;
5
+ using FaBao.TEvent;
6
+ using System;
7
+ using FaBao.TAction;
8
+ using FaBao.TAction.TGuild;
9
+ using TD.NetProto;
10
+
11
+ namespace FaBao.UI.GuildUI
12
+ {
13
+ public partial class GuildDonateDialog
14
+ {
15
+ public override IArchitecture GetArchitecture()
16
+ {
17
+ return App.Instance;
18
+ }
19
+
20
+ protected override void OnCreate()
21
+ {
22
+ base.OnCreate();
23
+ }
24
+
25
+ protected override void OnShow(object param)
26
+ {
27
+ this.RegisterEvent<MyGuildInfoChangeEvent>(OnMyGuildInfoChange);
28
+
29
+ var configs = GuildDonationTable.Configs;
30
+ if (configs == null || configs.Count == 0)
31
+ {
32
+ Close();
33
+ return;
34
+ }
35
+
36
+ var freeConfig = configs[0];
37
+ var paidConfig = configs[1];
38
+
39
+ var playerConfig = this.GetModel<UserInfoModel>().MyGuildInfo;
40
+ if (playerConfig == null)
41
+ {
42
+ Close();
43
+ return;
44
+ }
45
+
46
+ string[] freeRewardsInfo = freeConfig.Rewards.Split('|');
47
+ string[] paidRewardsInfo = paidConfig.Rewards.Split('|');
48
+ var freeItemId = freeRewardsInfo[0];
49
+ var freeValue = freeRewardsInfo[1];
50
+ var paidItemId = paidRewardsInfo[0];
51
+ var paidValue = paidRewardsInfo[1];
52
+ var freeItemConfig = ItemTable.GetConfigById(int.Parse(freeItemId));
53
+ var paidItemConfig = ItemTable.GetConfigById(int.Parse(paidItemId));
54
+
55
+ //免费捐献
56
+ m_icon_freeDonateReward.url = FUISys.Instance.GetIconUrl(freeItemConfig?.Icon);
57
+ m_text_freeDonateVal.text = $"+[color=#2F823C]{freeValue}[/color]";
58
+ m_text_remainFreeCount.text = $"剩余次数:[color=#2F823C]{playerConfig.TodayFreeContributionCount}[/color]";
59
+
60
+ if (freeConfig.TitleIcon != "")
61
+ {
62
+ m_freeIcon_holder.url = freeConfig.TitleIcon;
63
+ }
64
+
65
+ if (freeConfig.CardDes != "")
66
+ {
67
+ m_btn_free.text = freeConfig.CardDes;
68
+ }
69
+
70
+ if (playerConfig.TodayFreeContributionCount == 0)
71
+ {
72
+ m_btn_free.text = "已捐献";
73
+ m_btn_free.enabled = false;
74
+ m_redDot.visible = false;
75
+ }
76
+ else
77
+ {
78
+ m_btn_free.enabled = true;
79
+ m_redDot.visible = true;
80
+ }
81
+
82
+ //付费捐献
83
+ m_icon_paidDonateReward.url = FUISys.Instance.GetIconUrl(paidItemConfig?.Icon);
84
+ m_text_paidDonateVal.text = $"+[color=#2F823C]{paidValue}[/color]";
85
+ m_btn_paid.text = $"<img src='ui://a0w66rlc7bhfusff'/ width = '70' height = '70'>{paidConfig.Quantity}";
86
+ m_text_remainPaidCount.text = $"剩余次数:[color=#2F823C]{playerConfig.TodayPayContributionCount}[/color]";
87
+
88
+ if (paidConfig.TitleIcon != "")
89
+ {
90
+ m_paidIcon_holder.url = paidConfig.TitleIcon;
91
+ }
92
+
93
+ if (paidConfig.CardDes != "")
94
+ {
95
+ m_btn_paid.text = paidConfig.CardDes;
96
+ }
97
+
98
+ if (playerConfig.TodayPayContributionCount < 1)
99
+ {
100
+ m_btn_paid.text = "已捐献";
101
+ }
102
+
103
+ if (playerConfig.TodayPayContributionCount == 0)
104
+ {
105
+ m_btn_paid.grayed = true;
106
+ }
107
+ else
108
+ {
109
+ m_btn_paid.grayed = false;
110
+ }
111
+ }
112
+
113
+ protected override void OnClose()
114
+ {
115
+ this.UnRegisterEvent<MyGuildInfoChangeEvent>(OnMyGuildInfoChange);
116
+ }
117
+
118
+ private void OnMyGuildInfoChange(MyGuildInfoChangeEvent obj)
119
+ {
120
+ if (obj == null || obj.MyGuildInfo == null) return;
121
+
122
+ var guildInfo = obj.MyGuildInfo;
123
+
124
+ m_text_remainFreeCount.text = $"剩余次数:[color=#2F823C]{guildInfo.TodayFreeContributionCount}[/color]";
125
+ m_text_remainPaidCount.text = $"剩余次数:[color=#2F823C]{guildInfo.TodayPayContributionCount}[/color]";
126
+
127
+ if (guildInfo.TodayFreeContributionCount == 0)
128
+ {
129
+ m_btn_free.enabled = false;
130
+ m_btn_free.text = "已捐献";
131
+ m_redDot.visible = false;
132
+ }
133
+ else
134
+ {
135
+ m_btn_free.enabled = true;
136
+ m_redDot.visible = true;
137
+ }
138
+
139
+ if (guildInfo.TodayPayContributionCount < 1)
140
+ {
141
+ m_btn_paid.grayed = true;
142
+ m_btn_paid.text = "已捐献";
143
+ }
144
+ else
145
+ {
146
+ m_btn_paid.grayed = false;
147
+ }
148
+ }
149
+
150
+ #region 按钮点击事件
151
+
152
+ private void OnBtnClose()
153
+ {
154
+ Close();
155
+ }
156
+
157
+ private async void OnBtnFree()
158
+ {
159
+ var userGuild = this.GetModel<UserInfoModel>().MyGuildInfo;
160
+ if (userGuild == null) return;
161
+
162
+ if (userGuild.TodayFreeContributionCount < 1)
163
+ {
164
+ Toast.Info("本日已捐献,请明天再来");
165
+ return;
166
+ }
167
+
168
+ var result = await this.GetModel<GuildModel>().DispatchAction(new Guild_Action_GuildDonate(ContributionType.ContributionFree));
169
+ if (!result)
170
+ {
171
+ Toast.Info("免费捐献失败");
172
+ }
173
+ }
174
+
175
+ private async void OnBtnPaid()
176
+ {
177
+ var userGuild = this.GetModel<UserInfoModel>().MyGuildInfo;
178
+ if (userGuild == null) return;
179
+
180
+ if (userGuild.TodayPayContributionCount < 1)
181
+ {
182
+ Toast.Info("本日已捐献,请明天再来");
183
+ return;
184
+ }
185
+
186
+ if (!await this.GetModel<GuildModel>().DispatchAction(new Guild_Action_GuildDonate(ContributionType.ContributionPay)))
187
+ {
188
+ Toast.Info("付费捐献失败");
189
+ }
190
+ }
191
+
192
+ #endregion
193
+ }
194
+ }
@@ -0,0 +1,362 @@
1
+ using System.Collections.Generic;
2
+ using Cysharp.Threading.Tasks;
3
+ using FaBao.Constant;
4
+ using FaBao.Data;
5
+ using FaBao.ExportedConfigs;
6
+ using FaBao.TAction.TCard;
7
+ using FaBao.TAction.TRune;
8
+ using FaBao.TEvent;
9
+ using FaBao.UI.Basics;
10
+ using FaBao.UI.BasicUI;
11
+ using FaBao.UI.Comp;
12
+ using FairyGUI;
13
+ using Google.Protobuf.Collections;
14
+ using TEngine;
15
+ using TEngine.UI;
16
+ using TEngine.Redux;
17
+ using UnityEngine;
18
+
19
+ namespace FaBao.UI.SutraUI
20
+ {
21
+ public partial class MainSutraDetailDialog
22
+ {
23
+ public class MainSutraDetailDialogParam
24
+ {
25
+ public List<Card.SutraCardData> SutraCardList;
26
+
27
+ public int Index;
28
+
29
+ public Card.SutraCardData CardData { get; set; }
30
+ }
31
+
32
+ public override IArchitecture GetArchitecture()
33
+ {
34
+ return App.Instance;
35
+ }
36
+
37
+ private Card.SutraCardData _sutraCardData;
38
+
39
+ protected override void OnCreate()
40
+ {
41
+ base.OnCreate();
42
+ }
43
+
44
+ private int _index = -1;
45
+
46
+ private List<Card.SutraCardData> _sutraCardList;
47
+
48
+ protected override void OnShow(object param)
49
+ {
50
+ this.RegisterEvent<UpdateSutraCardEvent>(OnUpdateSutraCard);
51
+
52
+ var mParam = GetParam<MainSutraDetailDialogParam>();
53
+ if (mParam == null) return;
54
+
55
+ _sutraCardData = mParam.CardData;
56
+ _sutraCardList = mParam.SutraCardList;
57
+
58
+ if (_sutraCardList == null || _sutraCardList.Count == 0)
59
+ {
60
+ m_btn_next.visible = false;
61
+ m_btn_prev.visible = false;
62
+ }
63
+ else
64
+ {
65
+ for (var index = 0; index < _sutraCardList.Count; index++)
66
+ {
67
+ if (_sutraCardList[index].ConfigId == _sutraCardData.ConfigId)
68
+ {
69
+ _index = index;
70
+ }
71
+ }
72
+ }
73
+
74
+ Refresh();
75
+ }
76
+
77
+ protected override void OnHide()
78
+ {
79
+ this.UnRegisterEvent<UpdateSutraCardEvent>(OnUpdateSutraCard);
80
+ }
81
+
82
+ #region 事件监听
83
+
84
+ private void OnUpdateSutraCard(UpdateSutraCardEvent obj)
85
+ {
86
+ if (obj == null) return;
87
+ if (obj.SutraCardData.ConfigId != _sutraCardData.ConfigId) return;
88
+
89
+ _sutraCardData = obj.SutraCardData;
90
+ Refresh();
91
+ }
92
+
93
+ #endregion
94
+
95
+ private void Refresh()
96
+ {
97
+ //刷新按钮
98
+ m_btn_next.visible = _index < _sutraCardList?.Count - 1;
99
+ m_btn_prev.visible = _index > 0;
100
+
101
+ if (_sutraCardData == null) return;
102
+
103
+ var cardTable = _sutraCardData.GetConfig();
104
+ if (cardTable == null) return;
105
+
106
+ var sutraConfig = _sutraCardData.GetSutraConfig();
107
+
108
+ //基本信息
109
+ m_text_name.text = cardTable.Name.TR();
110
+
111
+ bool showTexture = string.IsNullOrEmpty(cardTable.PrefabRes);
112
+ m_icon_sutra.visiable = showTexture;
113
+ m_effect_sutra.visible = !showTexture;
114
+ if (showTexture)
115
+ {
116
+ m_icon_sutra.icon = FUISys.Instance.GetIconUrl(cardTable.BigIcon);
117
+ }
118
+ else
119
+ {
120
+ m_effect_sutra.ShowEffect(cardTable.PrefabRes, 0.65f);
121
+ }
122
+ m_icon_level.icon = FUISys.Instance.GetIconUrl(_sutraCardData.LevelIcon);
123
+ m_icon_property.icon = FUISys.Instance.GetIconUrl(_sutraCardData.ElementIcon);
124
+ m_attri.selectedIndex = (int)sutraConfig.Element - 991001;
125
+ m_text_potrem1.text = sutraConfig.Poetry[0].TR();
126
+ m_text_potrem2.text = sutraConfig.Poetry[1].TR();
127
+ var activeSkill = _sutraCardData.SkillConfig();
128
+ if (activeSkill != null)
129
+ {
130
+ m_btn_activeSkill.icon = FUISys.Instance.GetIconUrl(activeSkill.Icon);
131
+ }
132
+
133
+ //设置攻击力道心值加成
134
+ m_text_atkAdd.text = (_sutraCardData.AttackUp() / 100).ToString("0.0") + "%".TR();
135
+ m_text_hpAdd.text = (_sutraCardData.HpUp() / 100).ToString("0.0") + "%".TR();
136
+
137
+ //技能
138
+ var skillConfig = _sutraCardData.PassiveSkillConfig(false);
139
+ m_text_skillName.text = skillConfig.Name.TR();
140
+ var passiveSkillConfig = _sutraCardData.PassiveSkillConfig(true);
141
+ m_text_skill.text = passiveSkillConfig != null ? passiveSkillConfig.Description.TR() : "被动技能未解锁".TR();
142
+ if (_sutraCardData.GetSkillCheck())
143
+ {
144
+ m_effect_skillUnlock.ShowEffect("Effect_FaBao_Unlock");
145
+ }
146
+
147
+ #region 升级信息
148
+
149
+ //星级
150
+ m_list_star.RemoveChildrenToPool();
151
+ for (int i = 0; i < _sutraCardData.LevelStar; i++)
152
+ {
153
+ var item = m_list_star.AddItemFromPool() as ItemSutraStarSComp;
154
+ if (item == null) continue;
155
+ item.SetSutraStar(_sutraCardData.Level);
156
+ }
157
+
158
+ m_text_quality.text = Tr.Format("{0}阶", _sutraCardData.Quality);
159
+
160
+ //设置通玄值
161
+ m_text_tongXuan.text = "通玄:".TR() + (_sutraCardData.InheritAtkPercent / 100).ToString("0.0") + "%".TR();
162
+
163
+ var dependLockInfo = _sutraCardData.DependUpgradeLevelUnLock();
164
+ if (dependLockInfo.Item1)
165
+ {
166
+ //可以升级
167
+ m_upgrade.visible = true;
168
+ m_text_upgradeTip.visible = false;
169
+ //刷新升级按钮
170
+ var fragmentItemId = (int)sutraConfig.FragmentItemId;
171
+ var curCount = this.GetModel<DepotModel>().GetItemCount(fragmentItemId);
172
+ var levelConfig = _sutraCardData.GetSutraLevelConfig();
173
+ var costCount = (int)levelConfig.NeedFragments;
174
+ var itemConfig = ItemTable.GetConfigById(fragmentItemId);
175
+ m_loader_cost.url = FUISys.Instance.GetIconUrl(itemConfig.Icon);
176
+ var enough = curCount >= costCount;
177
+ m_text_cost.text = enough
178
+ ? Tr.Format("[color=#1B8049]{0}/{1}[/color]", curCount, costCount)
179
+ : Tr.Format("[color=#E55E5A]{0}/{1}[/color]", curCount, costCount);
180
+ m_btn_upgrade.enabled = enough;
181
+ }
182
+ else
183
+ {
184
+ //不可以升级
185
+ m_upgrade.visible = false;
186
+ m_text_upgradeTip.visible = true;
187
+ m_text_upgradeTip.text = dependLockInfo.Item2.TR();
188
+ }
189
+
190
+ #endregion
191
+
192
+ #region 羁绊列表
193
+
194
+ m_list_fate.RemoveChildrenToPool();
195
+ var sutraTable = _sutraCardData.GetSutraConfig();
196
+ if (sutraTable != null)
197
+ {
198
+ var list = _sutraCardData.GetAllFates();
199
+ if (list.Count > 0)
200
+ {
201
+ for (var i = 0; i < list.Count; i++)
202
+ {
203
+ var fateConfig = SutraFateTable.GetConfigById(list[i].FateId);
204
+ if (fateConfig == null) continue;
205
+ var item = m_list_fate.AddItemFromPool(ItemFateIconAndNameComp.URL) as ItemFateIconAndNameComp;
206
+ if (item == null) continue;
207
+ item.BindData(fateConfig, true);
208
+ }
209
+ }
210
+ else
211
+ {
212
+ var fates = sutraTable.Fates;
213
+ for (var i = 0; i < fates.Length; i++)
214
+ {
215
+ var fateConfig = SutraFateTable.GetConfigById((int)fates[i]);
216
+ if (fateConfig == null) continue;
217
+ var item = m_list_fate.AddItemFromPool(ItemFateIconAndNameComp.URL) as ItemFateIconAndNameComp;
218
+ if (item == null) continue;
219
+ item.BindData(fateConfig, false);
220
+ }
221
+ }
222
+ }
223
+
224
+ #endregion
225
+
226
+ if (_sutraCardData.GetFateCheck())
227
+ {
228
+ m_effect_fateUnlock.ShowEffect("Effect_FaBao_Unlock");
229
+ }
230
+
231
+ #region 灵纹信息
232
+
233
+ m_text_runeSlot.text = Tr.Format("({0}/6)", _sutraCardData.Card.RuneOpenCount);
234
+
235
+ m_btn_unloadRune.visible = _sutraCardData.HasInlayRune(); //当前有镶嵌的灵纹才显示一键卸载按钮
236
+
237
+ var runeSlots = _sutraCardData.GetRuneList();
238
+ m_list_rune.RemoveChildrenToPool();
239
+ foreach (var kvPair in runeSlots)
240
+ {
241
+ var slotId = kvPair.Key;
242
+ var runeData = kvPair.Value;
243
+ var item = m_list_rune.AddItemFromPool(ItemRuneSlotComp.URL) as ItemRuneSlotComp;
244
+ if (item == null) continue;
245
+ item.BindData(slotId, runeData, _sutraCardData);
246
+ }
247
+
248
+ #endregion
249
+
250
+ #region 等级词条列表
251
+
252
+ m_list_levelAttri.RemoveChildrenToPool();
253
+ var qualityAffixConfigs = _sutraCardData.GetSutraLevelAffixConfigs();
254
+ foreach (var config in qualityAffixConfigs)
255
+ {
256
+ var item = m_list_levelAttri.AddItemFromPool(ItemSutraLevelAffixComp.URL) as ItemSutraLevelAffixComp;
257
+ if (item == null) continue;
258
+ item.BindData(_sutraCardData, config);
259
+ }
260
+
261
+ #endregion
262
+
263
+ _sutraCardData.ClearRed();
264
+ }
265
+
266
+ private void OnBtnClose()
267
+ {
268
+ Close();
269
+ }
270
+
271
+ private void OnBtnActiveSkill()
272
+ {
273
+ var sutraTable = _sutraCardData.GetSutraConfig();
274
+ int tagId = (int)sutraTable.Tag[0];
275
+ SutraLabelTable table = SutraLabelTable.GetConfigById(tagId);
276
+ int tipId = (int)table.TipsId;
277
+ if (tipId <= 0)
278
+ {
279
+ Log.Error($"Can not find tagId in sutra : {_sutraCardData.Card.Id}");
280
+ return;
281
+ }
282
+
283
+ //获取BattleLayer中对应组件位置
284
+ var screenPos = m_btn_activeSkill.LocalToGlobal(new Vector2(0.5f, 0));
285
+ var logicScreenPos = GRoot.inst.GlobalToLocal(screenPos);
286
+
287
+ var param = new CommonTipFloatDialog.CommonTipFloatDialogParam
288
+ {
289
+ TipId = tipId,
290
+ AlignType = CommonTipFloatDialog.AlignType.BottomToPoint,
291
+ OriPosition = logicScreenPos
292
+ };
293
+
294
+ FUISys.Instance.ShowLayer<CommonTipFloatDialog>(UISceneType.Main, param);
295
+ }
296
+
297
+ private void OnBtnValueInfo()
298
+ {
299
+ FUISys.Instance.ShowLayer<DetailAttriDialog.DetailAttriDialog>(UISceneType.Main, new DetailAttriDialog.DetailAttriDialog.DetailAttriDialogParam()
300
+ {
301
+ SutraData = _sutraCardData
302
+ });
303
+ }
304
+
305
+ private async void OnBtnUpgrade()
306
+ {
307
+ this.SendEvent(new TutorialTriggerEvent(283));
308
+ await this.GetModel<CardModel>().DispatchAction(new Card_Action_UpgradeSutraLevel(new MapField<int, int>
309
+ {
310
+ { _sutraCardData.Card.Id, 1 }
311
+ }));
312
+ }
313
+
314
+ private void OnBtnPrev()
315
+ {
316
+ _index--;
317
+ _sutraCardData = _sutraCardList[_index];
318
+ Refresh();
319
+ }
320
+
321
+ private void OnBtnNext()
322
+ {
323
+ _index++;
324
+ _sutraCardData = _sutraCardList[_index];
325
+ Refresh();
326
+ }
327
+
328
+ private async void OnBtnUnloadRune()
329
+ {
330
+ if (RuneModel.UnloadRuneConfirmSwitch)
331
+ {
332
+ FUISys.Instance.ShowLayer<MainConfirmDialog>(UISceneType.Main, new MainConfirmDialog.MainConfirmDialogParam()
333
+ {
334
+ Title = "提示",
335
+ Content = "是否一键卸下法宝当前镶嵌灵纹",
336
+ ShowCancelBtn = true,
337
+ ConfirmText = "确认",
338
+ ConfirmCallback = async () =>
339
+ {
340
+ //灵纹一键下阵
341
+ if (await this.GetModel<CardModel>().DispatchAction(new Rune_Action_CleanRune(_sutraCardData.Card.Id)))
342
+ {
343
+ Toast.Info("卸载成功");
344
+ }
345
+ },
346
+ CancelText = "取消",
347
+ CancelCallback = () => RuneModel.UnloadRuneConfirmSwitch = true,
348
+ CheckBoxText = "本次登录不再提示",
349
+ CheckBoxCallback = selected => RuneModel.UnloadRuneConfirmSwitch = !selected
350
+ }).Forget();
351
+ }
352
+ else
353
+ {
354
+ //灵纹一键下阵
355
+ if (await this.GetModel<CardModel>().DispatchAction(new Rune_Action_CleanRune(_sutraCardData.Card.Id)))
356
+ {
357
+ Toast.Info("卸载成功");
358
+ }
359
+ }
360
+ }
361
+ }
362
+ }
@@ -0,0 +1,8 @@
1
+ import { CmdExecutor } from "../src/CmdExecutor";
2
+
3
+ describe('TestCmdExecutor', () => {
4
+ test("test convert", async () => {
5
+ // await CmdExecutor.testConvert();
6
+ expect(true).toBe(true);
7
+ }, 50000);
8
+ });
@@ -1,7 +0,0 @@
1
- export interface CodeSnippet {
2
- originalIndex: number;
3
- originalCode: string;
4
- convertedCode: string;
5
- literals: string[];
6
- unexpects: string[];
7
- }
@@ -1,6 +0,0 @@
1
- import test from "node:test";
2
- import { CmdExecutor } from "./CmdExecutor";
3
-
4
- test("test convert", () => {
5
- CmdExecutor.testConvert()
6
- });
@@ -1,6 +0,0 @@
1
- import test from "node:test";
2
- import { CmdExecutor } from "./CmdExecutor";
3
-
4
- test("test slim csv", () => {
5
- CmdExecutor.testSlimCsv();
6
- });
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- import { CmdExecutor } from "./CmdExecutor";
2
-
3
- CmdExecutor.testConvert()