Esempio n. 1
0
        private void LoadContextualControlsLayout()
        {
            PropUser localPlayerPropUser = Service.Get <PropService>().LocalPlayerPropUser;

            if (localPlayerPropUser != null && localPlayerPropUser.Prop != null)
            {
                PropControlsOverride propControls = localPlayerPropUser.Prop.PropControls;
                if (!isInShallowWater && propControls.DivingControls != null && !string.IsNullOrEmpty(propControls.DivingControls.Key))
                {
                    dispatcher.DispatchEvent(new ControlsScreenEvents.SetRightOption(propControls.DivingControls));
                }
                else
                {
                    dispatcher.DispatchEvent(new ControlsScreenEvents.SetRightOption(propControls.SwimControls));
                }
            }
            else if (GetComponentInChildren <InvitationalItemExperience>() != null)
            {
                InvitationalItemExperience componentInChildren = GetComponentInChildren <InvitationalItemExperience>();
                if (!isInShallowWater && componentInChildren.DivingControlLayout != null && !string.IsNullOrEmpty(componentInChildren.DivingControlLayout.Key))
                {
                    dispatcher.DispatchEvent(new ControlsScreenEvents.SetRightOption(componentInChildren.DivingControlLayout));
                }
                else
                {
                    dispatcher.DispatchEvent(new ControlsScreenEvents.SetRightOption(componentInChildren.SwimControlLayout));
                }
            }
            else
            {
                LoadControlsLayout();
            }
        }
Esempio n. 2
0
        public static void UnEquipProp(GameObject player)
        {
            if (player.IsDestroyed())
            {
                return;
            }
            AvatarDataHandle component = player.GetComponent <AvatarDataHandle>();

            if (!(component != null) || !component.IsLocalPlayer)
            {
                return;
            }
            InvitationalItemExperience componentInChildren = player.GetComponentInChildren <InvitationalItemExperience>();

            if (componentInChildren != null)
            {
                UnityEngine.Object.Destroy(componentInChildren.gameObject);
            }
            PropUser component2 = player.GetComponent <PropUser>();

            if (component2 != null && component2.Prop != null)
            {
                PropCancel component3 = component2.Prop.GetComponent <PropCancel>();
                if (component3 != null)
                {
                    component3.UnequipProp(immediate: true);
                }
            }
        }
    private void Start()
    {
        button               = GetComponentInParent <Button>();
        inputButton          = button.GetComponent <InputButton>();
        trayInputButton      = button.GetComponent <TrayInputButton>();
        interactButtonToggle = GetComponent <InteractButtonToggle>();
        tooltipButton        = button.gameObject.AddComponent <TooltipInputButton>();
        PropUser component = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <PropUser>();
        Prop     prop      = component.Prop;

        if (prop != null)
        {
            propValidator = prop.GetComponent <PropValidateDeployLocation>();
            if (propValidator != null)
            {
                validator = propValidator.GetValidator();
                if (validator == null)
                {
                    propValidator.OnValidatorSpawned += onValidatorSpawned;
                }
                else
                {
                    onValidPositionChanged(validator.IsValidPosition);
                    validator.OnValidPositionChanged += onValidPositionChanged;
                }
            }
        }
        Content.LoadAsync(onTooltipLoaded, TooltipPrefab);
    }
Esempio n. 4
0
        public override void OnEnter()
        {
            bool     flag      = false;
            PropUser component = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <PropUser>();

            if (component != null && component.Prop != null)
            {
                flag = component.Prop.PropId == propDefinition.GetNameOnServer();
                if (flag)
                {
                    Animator componentInParent = base.Owner.GetComponentInParent <Animator>();
                    if (componentInParent != null)
                    {
                        AnimatorStateInfo animatorStateInfo = LocomotionUtils.GetAnimatorStateInfo(componentInParent, 1);
                        flag = LocomotionUtils.IsHolding(animatorStateInfo) || LocomotionUtils.IsRetrieving(animatorStateInfo);
                    }
                    else
                    {
                        LogWarning("Failed to get the animator controller. IsHoldingPropAction could only determine that the owner has a prop component and did not check the animator's state.");
                    }
                }
            }
            if (flag)
            {
                base.Fsm.Event(OnTrueEvent);
            }
            else
            {
                base.Fsm.Event(OnFalseEvent);
            }
            Finish();
        }
Esempio n. 5
0
        private int hasEquippedProp()
        {
            bool     flag      = false;
            int      result    = -1;
            PropUser component = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <PropUser>();

            if (component != null && component.Prop != null)
            {
                int num = PropDefinition.Length;
                for (int i = 0; i < num; i++)
                {
                    flag = component.Prop.PropId == PropDefinition[i].GetNameOnServer();
                    if (flag)
                    {
                        result = i;
                        break;
                    }
                }
                if (flag)
                {
                    Animator componentInParent = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponentInParent <Animator>();
                    if (componentInParent != null)
                    {
                        AnimatorStateInfo animatorStateInfo = LocomotionUtils.GetAnimatorStateInfo(componentInParent, 1);
                        flag = LocomotionUtils.IsHolding(animatorStateInfo) || LocomotionUtils.IsRetrieving(animatorStateInfo);
                    }
                }
            }
            if (!flag)
            {
                result = -1;
            }
            return(result);
        }
    private IEnumerator Start()
    {
        dispatcher = Service.Get <EventDispatcher>();
        propUser   = GetComponentInParent <PropUser>();
        GameObject localPlayer = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject;

        isLocalPlayer = (localPlayer == propUser.gameObject);
        yield return(null);

        if (isLocalPlayer)
        {
            switch (Trigger)
            {
            case DisableTrigger.Start:
                disableControls();
                break;

            case DisableTrigger.Use:
                addListenerToPropUse();
                break;
            }
        }
        else
        {
            Object.Destroy(this);
        }
    }
Esempio n. 7
0
 private PropUser getPropUser(Animator animator)
 {
     if (propUser == null)
     {
         propUser = animator.GetComponent <PropUser>();
     }
     return(propUser);
 }
Esempio n. 8
0
 public UsePropCMD(PropUser propUser, Vector3 destination, bool destroyInstanceOnRemove, string experienceInstanceId, System.Action onCompleteHandler = null)
 {
     this.propUser                = propUser;
     this.destination             = destination;
     this.destroyInstanceOnRemove = destroyInstanceOnRemove;
     this.experienceInstanceId    = experienceInstanceId;
     this.onCompleteHandler       = onCompleteHandler;
 }
Esempio n. 9
0
 public void Start()
 {
     if (!ClubPenguin.SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.IsDestroyed())
     {
         propUser = ClubPenguin.SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <PropUser>();
         propUser.EPropRemoved += onPropRemoved;
     }
 }
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        PropUser component = animator.gameObject.GetComponent <PropUser>();

        if (component != null)
        {
            component.ResetAnimController();
        }
    }
Esempio n. 11
0
    private void addEventListeners()
    {
        PropUser component = player.GetComponent <PropUser>();

        component.EPropSpawned    += onPropStartRetrieve;
        component.EPropRetrieved  += onPropRetrieved;
        component.EPropUseStarted += onUsePropStarted;
        component.EPropStored     += onPropStored;
    }
Esempio n. 12
0
        private void setPropModeOnPropEquip(long playerId)
        {
            PropUser component = playerIdToAnimator[playerId].gameObject.GetComponent <PropUser>();

            component.EPropRetrieved += delegate
            {
                playerIdToAnimator[playerId].SetInteger(ANIMATOR_HASH_PENGUIN_PROPMODE, 3);
            };
        }
 public RetrievePropCMD(string propId, PrefabContentKey propContentKey, PropUser propUser, long ownerId, bool isOwnerLocalPlayer, Action <Prop> onPropInstantiatedHandler = null, System.Action onCompleteHandler = null)
 {
     this.propId                    = propId;
     this.propContentKey            = propContentKey;
     this.propUser                  = propUser;
     this.ownerId                   = ownerId;
     this.isOwnerLocalPlayer        = isOwnerLocalPlayer;
     this.onPropInstantiatedHandler = onPropInstantiatedHandler;
     this.onCompleteHandler         = onCompleteHandler;
     avatarView = propUser.GetComponent <AvatarView>();
 }
    private string getCurrentPropName()
    {
        GameObject localPlayerGameObject = ClubPenguin.SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject;
        PropUser   component             = localPlayerGameObject.GetComponent <PropUser>();

        if (component != null && component.Prop != null)
        {
            return(component.Prop.PropId);
        }
        return("");
    }
Esempio n. 15
0
 public void Start()
 {
     if (!SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.IsDestroyed())
     {
         propUser = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <PropUser>();
         if (PersistWhenSitting)
         {
             locoEventBroadcaster = propUser.GetComponent <LocomotionEventBroadcaster>();
             locoEventBroadcaster.OnControllerChangedEvent += onControllerChangedEvent;
         }
         propUser.EPropUseStarted += onPropUseStarted;
     }
 }
Esempio n. 16
0
        private string getCurrentPropName(long sessionId = 0L)
        {
            GameObject gameObject = ((sessionId == 0) ? SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject : getPlayerGameObj(sessionId));

            if (gameObject != null)
            {
                PropUser component = gameObject.GetComponent <PropUser>();
                if (component != null && component.Prop != null)
                {
                    return(component.Prop.PropId);
                }
            }
            return("");
        }
Esempio n. 17
0
    private IEnumerator setUpPropEvents(GameObject player)
    {
        GameObject localPlayer = ClubPenguin.SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject;
        PropUser   propUser    = localPlayer.GetComponent <PropUser>();

        while (propUser == null)
        {
            propUser = localPlayer.GetComponent <PropUser>();
            yield return(null);
        }
        propUser.EPropRetrieved    += onPropRetrieved;
        propUser.EPropStored       += onPropUsed;
        propUser.EPropUseCompleted += onPropUsed;
        propUser.EPropRemoved      += onPropUsed;
    }
Esempio n. 18
0
 public override void OnExit()
 {
     if (player != null)
     {
         PropUser component = player.GetComponent <PropUser>();
         if (component != null)
         {
             component.EPropSpawned    -= onPropStartRetrieve;
             component.EPropRetrieved  -= onPropRetrieved;
             component.EPropUseStarted -= onUsePropStarted;
             component.EPropStored     -= onPropStored;
         }
     }
     Service.Get <EventDispatcher>().RemoveListener <PlayerSpawnedEvents.LocalPlayerSpawned>(onPlayerSpawned);
 }
 public void OnTriggerEnter(Collider otherCollider)
 {
     if (otherCollider.CompareTag("SwordCollider"))
     {
         if (Particles != null)
         {
             Vector3 a = Vector3.Normalize(base.transform.position - otherCollider.transform.position);
             Object.Instantiate(Particles, otherCollider.transform.position + a * 0.15f, Quaternion.LookRotation(-a));
         }
         PropUser propUserRef = otherCollider.transform.parent.GetComponent <Prop>().PropUserRef;
         if (!string.IsNullOrEmpty(QuestEvent) && propUserRef.CompareTag("Player"))
         {
             Service.Get <QuestService>().SendEvent(QuestEvent);
         }
     }
 }
Esempio n. 20
0
 public override void OnActivate()
 {
     base.OnActivate();
     if (SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject != null)
     {
         propUser = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject.GetComponent <PropUser>();
         if (Event == ConsumableEvent.COMPLETE)
         {
             propUser.EPropRemoved += onPropUseCompleted;
         }
         else
         {
             onPropUseCompleted(propUser.Prop);
         }
     }
 }
Esempio n. 21
0
    public override void OnEnter()
    {
        player = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject;
        PropUser component = player.GetComponent <PropUser>();

        if (component != null)
        {
            addEventListeners();
        }
        else
        {
            Service.Get <EventDispatcher>().AddListener <PlayerSpawnedEvents.LocalPlayerSpawned>(onPlayerSpawned);
        }
        if (!WaitForAction.Value)
        {
            Finish();
        }
    }
Esempio n. 22
0
        private void LoadContextualControlsLayout()
        {
            PropUser localPlayerPropUser = Service.Get <PropService>().LocalPlayerPropUser;

            if (localPlayerPropUser != null && localPlayerPropUser.Prop != null)
            {
                dispatcher.DispatchEvent(new ControlsScreenEvents.SetRightOption(localPlayerPropUser.Prop.PropControls.DefaultControls));
            }
            else if (GetComponentInChildren <InvitationalItemExperience>() != null)
            {
                InvitationalItemExperience componentInChildren = GetComponentInChildren <InvitationalItemExperience>();
                dispatcher.DispatchEvent(new ControlsScreenEvents.SetRightOption(componentInChildren.ControlLayout));
            }
            else if (!(prevLocoController is SlideController))
            {
                LoadControlsLayout();
            }
        }
Esempio n. 23
0
 public void PlayCelebrationAnimation(List <long> playersToReward)
 {
     foreach (long item in playersToReward)
     {
         DataEntityHandle dataEntityHandle = dataEntityCollection.FindEntity <SessionIdData, long>(item);
         if (dataEntityHandle.IsNull || !dataEntityCollection.TryGetComponent <GameObjectReferenceData>(dataEntityHandle, out var component) || (component?.GameObject.IsDestroyed() ?? true))
         {
             continue;
         }
         PropUser component2 = component.GameObject.GetComponent <PropUser>();
         if (!(component2 != null) || component2.IsAllowedToCelebrate())
         {
             Animator component3 = component.GameObject.GetComponent <Animator>();
             if (component3 != null)
             {
                 component3.Play(AnimationHashes.States.TorsoCelebration, AnimationHashes.Layers.Torso);
             }
         }
     }
 }
Esempio n. 24
0
    public IEnumerator Start()
    {
        GameObject localPlayer = SceneRefs.ZoneLocalPlayerManager.LocalPlayerGameObject;
        PropUser   propUser    = GetComponentInParent <PropUser>();

        if (propUser.gameObject != localPlayer)
        {
            UnityEngine.Object.Destroy(this);
            yield break;
        }
        AssetRequest <GameObject> request = Content.LoadAsync(ValidatorContentKey);

        yield return(request);

        validator = UnityEngine.Object.Instantiate(request.Asset).GetComponent <PropSpawnLocationValidator>();
        if (this.OnValidatorSpawned != null)
        {
            this.OnValidatorSpawned(validator);
        }
    }
        protected override void Update()
        {
            PropUser component = GetComponent <PropUser>();
            ParticipationController component2         = GetComponent <ParticipationController>();
            ParticipationState      participationState = (ParticipationState)Enum.Parse(typeof(ParticipationState), State);

            if (component != null && component2 != null)
            {
                Competitor <GameObject> currentInteractingParticipantReference = component2.GetCurrentInteractingParticipantReference();
                if (component2.IsInteractingWithGameObject(base.gameObject) && participationState == ParticipationState.Pending)
                {
                    component2.StopParticipation(new ParticipationRequest(ParticipationRequest.Type.Stop, currentInteractingParticipantReference, "SetPlayerParticipationStateAction"));
                }
                else if (participationState == ParticipationState.Participating)
                {
                    component2.StartParticipation(new ParticipationRequest(ParticipationRequest.Type.Start, base.gameObject, "SetPlayerParticipationStateAction"));
                }
            }
            Completed();
        }
    private void StopDancingMode(GameObject go)
    {
        if (!(go != null))
        {
            return;
        }
        PropUser component = go.GetComponent <PropUser>();

        if (component != null && IsPropObserved(component.Prop))
        {
            PropCancel component2 = component.Prop.gameObject.GetComponent <PropCancel>();
            if (component2 != null)
            {
                component2.UnequipProp(immediate: true);
            }
            if (go.CompareTag("Player"))
            {
                Service.Get <PropService>().LocalPlayerStoreProp();
            }
        }
    }
Esempio n. 27
0
 private void applyIK()
 {
     if (propUser == null)
     {
         propUser = GetComponent <PropUser>();
         if (propUser == null)
         {
             return;
         }
     }
     if (curPropGO == null)
     {
         if (propUser.Prop != null)
         {
             resetIK(propUser.Prop.gameObject);
         }
         else
         {
             InvitationalItemController componentInChildren = GetComponentInChildren <InvitationalItemController>();
             if (componentInChildren != null)
             {
                 curPropGO = componentInChildren.gameObject;
                 resetIK(curPropGO);
             }
         }
     }
     if (curPropGO == null && isHoldingProp)
     {
         AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(1);
         if (!LocomotionUtils.IsUsing(currentAnimatorStateInfo))
         {
             resetIK(null);
         }
     }
     if (propIK != null && ikBones.Count > 0)
     {
         AnimatorStateInfo animatorStateInfo = LocomotionUtils.GetAnimatorStateInfo(animator);
         for (int i = 0; i < ikBones.Count; i++)
         {
             if (swim.IsInShallowWater)
             {
                 if (LocomotionUtils.IsIdling(animatorStateInfo))
                 {
                     ikBones[i].TargetAngle = propIK.IKModifiers[i].IdleZRot;
                 }
                 else
                 {
                     ikBones[i].TargetAngle = propIK.IKModifiers[i].SwimMoveZRot;
                 }
             }
             else if (LocomotionUtils.IsIdling(animatorStateInfo))
             {
                 ikBones[i].TargetAngle = propIK.IKModifiers[i].IdleZRot;
             }
             else
             {
                 ikBones[i].TargetAngle = propIK.IKModifiers[i].DiveMoveZRot;
             }
         }
     }
     blendIK();
 }
Esempio n. 28
0
 public StorePropCMD(PropUser propUser, bool destroyInstance, Action <bool> onCompleteHandler = null)
 {
     this.propUser          = propUser;
     this.destroyInstance   = destroyInstance;
     this.onCompleteHandler = onCompleteHandler;
 }