protected override void OnLocalPlayerSpawned(LocalPlayerSpawnedEventArgs args) { UnityAsyncHelper.UnityMainThreadContext.PostAsync(async () => { CharacterActionBarInstanceModel[] barInstanceModels = await CharacterService.GetCharacterActionBarDataAsync(PlayerDetails.LocalPlayerGuid.EntityId); foreach (CharacterActionBarInstanceModel actionBarModel in barInstanceModels) { ActionBarStateChangePublisher.PublishEvent(this, new ActionBarButtonStateChangedEventArgs(actionBarModel.BarIndex, actionBarModel.Type, actionBarModel.ActionId)); ActionBarCollection.Add(actionBarModel); } }); }
protected override void OnActionBarButtonPressed(ActionBarIndex index) { //If we have a set index then we can just send the request to interact/cast if (ActionBarCollection.IsSet(index)) { if (Logger.IsDebugEnabled) { Logger.Debug($"Action bar Index: {index} pressed."); } if (ActionBarCollection[index].Type == ActionBarIndexType.Spell) { SendService.SendMessage(new SpellCastRequestPayload(ActionBarCollection[index].ActionId)); } } else { if (Logger.IsDebugEnabled) { Logger.Debug($"Action bar Index: {index} pressed but no associated action."); } } }