private void onExperienceStarted(string instanceId, long ownerId, bool isOwnerLocalPlayer, PropDefinition propDef) { try { invitationExperienceInstanceId = instanceId; invitingPlayerId = ownerId; isInvitationLocalPlayer = isOwnerLocalPlayer; invitingPlayerObject = getInvitingPlayerObject(); if (invitingPlayerObject != null) { invitingPlayerAvatarView = invitingPlayerObject.GetComponent <AvatarView>(); } CPMMOItemId identifier = new CPMMOItemId(long.Parse(invitationExperienceInstanceId), CPMMOItemId.CPMMOItemParent.PLAYER); serverObjectHandle = dataEntityCollection.FindEntity <ServerObjectItemData, CPMMOItemId>(identifier); if (serverObjectHandle.IsNull) { onItemRemoved(); return; } serverObjectData = dataEntityCollection.GetComponent <ServerObjectItemData>(serverObjectHandle); AvailableItemQuantity = propDef.TotalItemQuantity; totalItemQuantity = propDef.TotalItemQuantity; setupNetworkServiceListeners(); if (isOwnerLocalPlayer) { GameObject target = dataEntityCollection.GetComponent <GameObjectReferenceData>(dataEntityCollection.LocalPlayerHandle).GameObject; InputButtonGroupContentKey inputButtonGroupContentKey = (LocomotionHelper.IsCurrentControllerOfType <SwimController>(target) ? ((!(LocomotionHelper.GetCurrentController(target) as SwimController).IsInShallowWater) ? DivingControlLayout : SwimControlLayout) : ((!LocomotionHelper.IsCurrentControllerOfType <SitController>(target)) ? ControlLayout : ((!(LocomotionHelper.GetCurrentController(target) as SitController).IsUnderwater) ? SitControlLayout : SitSwimControlLayout))); if (inputButtonGroupContentKey != null && !string.IsNullOrEmpty(inputButtonGroupContentKey.Key)) { Service.Get <EventDispatcher>().DispatchEvent(new ControlsScreenEvents.SetRightOption(inputButtonGroupContentKey)); } else { Log.LogError(this, "Did not find a valid controls content key for this state"); } ParticipationData component = dataEntityCollection.GetComponent <ParticipationData>(dataEntityCollection.LocalPlayerHandle); if (component != null) { component.CurrentParticipationState = ParticipationState.Participating; component.IsInteractButtonAvailable = false; } } Service.Get <EventDispatcher>().AddListener <PenguinInteraction.InteractionStartedEvent>(onInteractionStarted); if (invitingPlayerAvatarView != null) { if (invitingPlayerAvatarView.IsReady) { onAvatarReady(); } invitingPlayerAvatarView.OnReady += onAvatarViewReady; } switchToCamera(); } catch (FormatException ex) { Log.LogException(this, ex); } }
public void ReturnToDefaultRightOption() { ButtonGroupContentKey = null; ButtonOverrides.Clear(); if (this.OnReturnToDefaultRightOption != null) { this.OnReturnToDefaultRightOption(); } }
public void SetRightOption(InputButtonGroupContentKey buttonGroupContentKey) { if (buttonGroupContentKey == null || string.IsNullOrEmpty(buttonGroupContentKey.Key)) { throw new ArgumentNullException("buttonGroupContentKey", "This key cannot be null, and cannot have a null key string"); } ButtonGroupContentKey = buttonGroupContentKey; ButtonOverrides.Clear(); if (this.OnSetRightOption != null) { this.OnSetRightOption(buttonGroupContentKey); } }
private void ShowPropControls() { if (Prop.IsOwnerLocalPlayer) { PropControlsOverride propControls = Prop.PropControls; GameObject target = dataEntityCollection.GetComponent <GameObjectReferenceData>(dataEntityCollection.LocalPlayerHandle).GameObject; InputButtonGroupContentKey inputButtonGroupContentKey = (LocomotionHelper.IsCurrentControllerOfType <SwimController>(target) ? ((!(LocomotionHelper.GetCurrentController(target) as SwimController).IsInShallowWater) ? getDivingControls(propControls) : propControls.SwimControls) : (LocomotionHelper.IsCurrentControllerOfType <SlideController>(target) ? getTubingControls(propControls) : ((!LocomotionHelper.IsCurrentControllerOfType <SitController>(target)) ? propControls.DefaultControls : ((!(LocomotionHelper.GetCurrentController(target) as SitController).IsUnderwater) ? getSittingControls(propControls) : propControls.SitSwimControls)))); if (inputButtonGroupContentKey != null && !string.IsNullOrEmpty(inputButtonGroupContentKey.Key)) { Service.Get <EventDispatcher>().DispatchEvent(new ControlsScreenEvents.SetRightOption(inputButtonGroupContentKey)); } else { Log.LogError(this, "Did not find a valid controls content key for this state"); } } }
public SetRightOption(InputButtonGroupContentKey rightButtonGroupContentKey) { RightButtonGroupContentKey = rightButtonGroupContentKey; }