本帖最后由 YSLP 于 2024-2-16 11:05 编辑
共享经验
该方法自己暂时没发现什么bug,但我只玩到第一章不确定后续稳定性。
方法如下:
UIBattleFinish中的show函数将队友的id全部添加到ids中: public override void Show()
{
base.Show();
this.ids.Clear();
IEnumerator<string> enumerator = this.PartyCreationSystem.Player.Members.GetEnumerator();
DataComponentSystem<NpcComponent, NpcItem> system = Game.World.GetSystem<NpcDataSystem>();
while (enumerator.MoveNext())
{
string id = enumerator.Current;
CharacterPropertyInfo characterPropertyInfo = new CharacterPropertyInfo(system[id]);
characterPropertyInfo.Calculate(0);
this.ids.Add(new ValueTuple<string, int>(id, characterPropertyInfo.GetLevel()));
}
int num = Mathf.Min(this.pageCount, this.ids.Count);
for (int i = 0; i < num; i++)
{
WgBattleFinishPortrait wgBattleFinishPortrait = UnityEngine.Object.Instantiate<WgBattleFinishPortrait>(this.portraitPrefab, this.portraitViewport);
wgBattleFinishPortrait.Initialize(this.ids.Item1);
wgBattleFinishPortrait.gameObject.SetActive(true);
}
this.rolePage++;
}
原版代码如下:public override void Show()
{
base.Show();
this.ids.Clear();
foreach (IEntity entity in this.fsm.Controller.Units.Union(this.fsm.Controller.deadUnits))
{
string id = entity.GetComponent<BattleUnit>().Id;
if (this.PartyCreationSystem.Player.Members.Contains(id))
{
BattlePropertyComponent component = entity.GetComponent<BattlePropertyComponent>();
this.ids.Add(new ValueTuple<string, int>(id, component.Level));
}
}
DataComponentSystem<NpcComponent, NpcItem> system = Game.World.GetSystem<NpcDataSystem>();
string text = this.PartyCreationSystem.Player.Members[0];
CharacterPropertyInfo characterPropertyInfo = new CharacterPropertyInfo(system[text]);
characterPropertyInfo.Calculate(0);
if (this.ids.Count == 0)
{
this.ids.Add(new ValueTuple<string, int>(text, characterPropertyInfo.GetLevel()));
}
int num = Mathf.Min(this.pageCount, this.ids.Count);
for (int i = 0; i < num; i++)
{
WgBattleFinishPortrait wgBattleFinishPortrait = UnityEngine.Object.Instantiate<WgBattleFinishPortrait>(this.portraitPrefab, this.portraitViewport);
wgBattleFinishPortrait.Initialize(this.ids.Item1);
wgBattleFinishPortrait.gameObject.SetActive(true);
}
this.rolePage++;
}
思路是战斗结束添加经验时,会调用ids中的包含的id,通过将所有队友id添加进ids中实现战斗结束后经验共享。=====================================================================
秘籍不减少
参考Heluo.Data.PropsCategory修改Heluo.UI.WGWarehouse的RemoveItem(InventoryData data, int count)
思路是判断为物品类别为秘籍时直接结束函数不进行后续减少数量的操作
我自己实现跳过的代码如下,由于我自己只玩到了第一章暂时不确定后续是否有问题。
PropsCategory[] booktypes = {
PropsCategory.Book,
PropsCategory.HeartFormula,
PropsCategory.FightBook,
PropsCategory.SwordBook,
PropsCategory.BladeBook,
PropsCategory.DaggerBook,
PropsCategory.DartsBook,
PropsCategory.NormalBook};
int id = Array.IndexOf(booktypes, data.Item.SmallCategory);
if (id != -1)
{
return;
}
|