Restore action bar bindings only from daemon state
This commit is contained in:
parent
7e80803a88
commit
718f2fb8db
2 changed files with 6 additions and 64 deletions
|
|
@ -8671,7 +8671,11 @@ static void RequireActionBarBindingRequestAuthority(string root)
|
||||||
{
|
{
|
||||||
"var newbinds = Enumerable.Range(0, 64)",
|
"var newbinds = Enumerable.Range(0, 64)",
|
||||||
".Zip(\r\n bindings,",
|
".Zip(\r\n bindings,",
|
||||||
"groupIndex >= CurrentEntity.WeaponGroups.Length"
|
"groupIndex >= CurrentEntity.WeaponGroups.Length",
|
||||||
|
"ApplyDefaultActionBarBindings",
|
||||||
|
"ProjectActionBarBindings",
|
||||||
|
"ProjectActionBarBinding(slot, slot?.Binding)",
|
||||||
|
"Enumerable.Range(0, CurrentEntity.WeaponGroups.Length)"
|
||||||
};
|
};
|
||||||
|
|
||||||
var legacyHits = forbiddenSymbols
|
var legacyHits = forbiddenSymbols
|
||||||
|
|
|
||||||
|
|
@ -585,53 +585,6 @@ public class ActionGameManager : MonoBehaviour
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private AetheriaRuntimeActionBarBindingCommit[] ProjectActionBarBindings()
|
|
||||||
{
|
|
||||||
return _actionBarSlots?
|
|
||||||
.Select(ProjectActionBarBinding)
|
|
||||||
.Where(binding => binding != null)
|
|
||||||
.ToArray() ?? Array.Empty<AetheriaRuntimeActionBarBindingCommit>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static AetheriaRuntimeActionBarBindingCommit ProjectActionBarBinding(ActionBarSlot slot)
|
|
||||||
{
|
|
||||||
return ProjectActionBarBinding(slot, slot?.Binding);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static AetheriaRuntimeActionBarBindingCommit ProjectActionBarBinding(
|
|
||||||
ActionBarSlot slot,
|
|
||||||
ActionBarBinding binding)
|
|
||||||
{
|
|
||||||
switch (binding)
|
|
||||||
{
|
|
||||||
case ActionBarConsumableBinding consumable:
|
|
||||||
return new AetheriaRuntimeActionBarBindingCommit
|
|
||||||
{
|
|
||||||
ControlPath = slot.ControlPath ?? "",
|
|
||||||
Kind = "consumable",
|
|
||||||
ItemKey = consumable.TargetItemKey
|
|
||||||
};
|
|
||||||
case ActionBarGearBinding gear:
|
|
||||||
return new AetheriaRuntimeActionBarBindingCommit
|
|
||||||
{
|
|
||||||
ControlPath = slot.ControlPath ?? "",
|
|
||||||
Kind = "gear",
|
|
||||||
ItemKey = gear.TargetItemKey,
|
|
||||||
EquipmentIndex = gear.EquipmentIndex,
|
|
||||||
BehaviorIndex = gear.BehaviorIndex
|
|
||||||
};
|
|
||||||
case ActionBarWeaponGroupBinding weaponGroup:
|
|
||||||
return new AetheriaRuntimeActionBarBindingCommit
|
|
||||||
{
|
|
||||||
ControlPath = slot.ControlPath ?? "",
|
|
||||||
Kind = "weapon_group",
|
|
||||||
WeaponGroup = weaponGroup.Group
|
|
||||||
};
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static AetheriaRuntimeActionBarBindingCommit ToActionBarBindingCommit(
|
private static AetheriaRuntimeActionBarBindingCommit ToActionBarBindingCommit(
|
||||||
AetheriaRuntimeActionBarBindingSnapshot binding)
|
AetheriaRuntimeActionBarBindingSnapshot binding)
|
||||||
{
|
{
|
||||||
|
|
@ -751,10 +704,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (bindings == null || bindings.Count == 0)
|
if (bindings == null || bindings.Count == 0)
|
||||||
{
|
|
||||||
ApplyDefaultActionBarBindings();
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
var slotsByControlPath = _actionBarSlots
|
var slotsByControlPath = _actionBarSlots
|
||||||
.Where(slot => !string.IsNullOrWhiteSpace(slot?.ControlPath))
|
.Where(slot => !string.IsNullOrWhiteSpace(slot?.ControlPath))
|
||||||
|
|
@ -776,18 +726,6 @@ public class ActionGameManager : MonoBehaviour
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ApplyDefaultActionBarBindings()
|
|
||||||
{
|
|
||||||
if (CurrentEntity?.WeaponGroups == null || _actionBarSlots == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
foreach (var pair in Enumerable.Range(0, CurrentEntity.WeaponGroups.Length)
|
|
||||||
.Zip(_actionBarSlots, (groupIndex, slot) => (groupIndex, slot)))
|
|
||||||
{
|
|
||||||
pair.slot.Binding = new ActionBarWeaponGroupBinding(CurrentEntity, pair.slot, pair.groupIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ActionBarBinding CreateActionBarBinding(ActionBarSlot slot, Entity entity, DragObject dragAction)
|
private ActionBarBinding CreateActionBarBinding(ActionBarSlot slot, Entity entity, DragObject dragAction)
|
||||||
{
|
{
|
||||||
var binding = CreateActionBarBindingCommit(slot, entity, dragAction);
|
var binding = CreateActionBarBindingCommit(slot, entity, dragAction);
|
||||||
|
|
@ -3321,7 +3259,7 @@ public class ActionGameManager : MonoBehaviour
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var resolvedActionBarBindings = actionBarBindings ?? ProjectActionBarBindings();
|
var resolvedActionBarBindings = actionBarBindings ?? Array.Empty<AetheriaRuntimeActionBarBindingCommit>();
|
||||||
CurrentEntity = entity;
|
CurrentEntity = entity;
|
||||||
DeathPost.weight = 0;
|
DeathPost.weight = 0;
|
||||||
ZoneRenderer.PerspectiveEntity = CurrentEntity;
|
ZoneRenderer.PerspectiveEntity = CurrentEntity;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue