public void Init(SceneManipulationService sceneManipulationService, Bounds boundsForCameraTarget, float minCameraDistance) { this.sceneManipulationService = sceneManipulationService; this.boundsForCameraTarget = boundsForCameraTarget; this.minCameraDistance = minCameraDistance; sceneManipulationService.ObjectManipulationInputController.InteractionStateChanged += OnObjectManipulationInputControllerInteractionStateChanged; IsInitialized = true; }
public void OnDestroy() { if (objectManipulationInputController != null) { objectManipulationInputController.InteractionStateChanged -= OnObjectManipulationInputControllerInteractionStateChanged; } if (SceneRefs.IsSet <SceneManipulationService>()) { sceneManipulationService = SceneRefs.Get <SceneManipulationService>(); sceneManipulationService.ObjectRemoved -= onSceneManipulationServiceObjectRemoved; } Service.Get <EventDispatcher>().RemoveListener <ObjectManipulationEvents.ConfirmPlacementSelectedItemEvent>(OnConfirmPlacementSelectedItemEvent); }
public void Start() { if (objectManipulationInputController != null) { objectManipulationInputController.InteractionStateChanged += OnObjectManipulationInputControllerInteractionStateChanged; } if (SceneRefs.IsSet <SceneManipulationService>()) { sceneManipulationService = SceneRefs.Get <SceneManipulationService>(); sceneManipulationService.ObjectRemoved += onSceneManipulationServiceObjectRemoved; } Service.Get <EventDispatcher>().AddListener <ObjectManipulationEvents.ConfirmPlacementSelectedItemEvent>(OnConfirmPlacementSelectedItemEvent, EventDispatcher.Priority.FIRST); }
protected override void Awake() { base.Awake(); progressionBadge.SetActive(value: false); mascotBadges.SetActive(value: false); memberlockBadge.SetActive(value: false); itemCountPanel.SetActive(value: false); SizeIconSelector.SetActive(value: false); button = GetComponent <Button>(); button.onClick.AddListener(onButton); sceneManipulationService = ClubPenguin.Core.SceneRefs.Get <SceneManipulationService>(); TutorialManager tutorialManager = Service.Get <TutorialManager>(); tutorialManager.TutorialCompleteAction = (Action <TutorialDefinition>)Delegate.Remove(tutorialManager.TutorialCompleteAction, new Action <TutorialDefinition>(onTutorialComplete)); }
internal override List <KeyValuePair <DecorationDefinition, int> > GetDefinitionsToDisplay() { List <KeyValuePair <DecorationDefinition, int> > list = new List <KeyValuePair <DecorationDefinition, int> >(); if (sceneLayoutData != null) { foreach (DecorationLayoutData item2 in sceneLayoutData.GetLayoutEnumerator()) { DecorationLayoutData current = item2; if (current.Type == DecorationLayoutData.DefinitionType.Decoration && dictionaryOfDecorationDefinitions.ContainsKey(current.DefinitionId)) { DecorationDefinition decorationDefinition = dictionaryOfDecorationDefinitions[current.DefinitionId]; int availableDecorationCount = SceneRefs.Get <SceneManipulationService>().GetAvailableDecorationCount(decorationDefinition.Id); KeyValuePair <DecorationDefinition, int> item = new KeyValuePair <DecorationDefinition, int>(decorationDefinition, availableDecorationCount); if (!list.Contains(item)) { list.Add(item); } } } } if (SceneRefs.IsSet <SceneManipulationService>()) { SceneManipulationService sceneManipulationService = SceneRefs.Get <SceneManipulationService>(); if (sceneManipulationService.IsObjectSelectedForAdd) { ObjectManipulator currentObjectManipulator = sceneManipulationService.ObjectManipulationInputController.CurrentObjectManipulator; if (currentObjectManipulator != null) { int definitionId = currentObjectManipulator.GetComponent <ManipulatableObject>().DefinitionId; DecorationDefinition decorationDefinition = dictionaryOfDecorationDefinitions[definitionId]; int availableDecorationCount = sceneManipulationService.GetAvailableDecorationCount(decorationDefinition.Id); KeyValuePair <DecorationDefinition, int> item = new KeyValuePair <DecorationDefinition, int>(decorationDefinition, availableDecorationCount); if (!list.Contains(item)) { list.Add(item); } } } } return(list); }
protected override void Start() { base.Start(); if (SceneRefs.IsSet <SceneManipulationService>()) { sceneManipulationService = SceneRefs.Get <SceneManipulationService>(); sceneManipulationService.ObjectRemoved += onObjectAddedOrRemoved; sceneManipulationService.ObjectAdded += onObjectAddedOrRemoved; sceneManipulationService.NewObjectCreated += onObjectAddedOrRemoved; } if (SceneRefs.IsSet <ObjectManipulationInputController>()) { objectManipulationInputController = SceneRefs.Get <ObjectManipulationInputController>(); objectManipulationInputController.InteractionStateChanged += onInteractionStateChanged; } recentDecorationsService = Service.Get <RecentDecorationsService>(); decorationInventoryService = Service.Get <DecorationInventoryService>(); decorationCategoryManager = GetComponentInChildren <DecorationCategoryManager>(); if (decorationCategoryManager != null) { DecorationCategoryManager obj = decorationCategoryManager; obj.CategoryRefreshedEvent = (CategoryRefreshedEvent)Delegate.Combine(obj.CategoryRefreshedEvent, new CategoryRefreshedEvent(onCategoryUpdated)); } totalDragHeight = (base.transform as RectTransform).rect.height; GameObject gameObject = GameObject.Find("IglooMenuLoader"); if (gameObject != null) { totalDragHeight += (gameObject.transform as RectTransform).rect.height; } Canvas componentInParent = GetComponentInParent <Canvas>(); if (componentInParent != null) { Assert.AreEqual(componentInParent.transform.localScale.x, componentInParent.transform.localScale.y); totalDragHeight *= componentInParent.transform.localScale.x; } returnToPreviousState = GetComponentInParent <ReturnToFSMStateOnInteractionState>(); }
private bool onDuplicateSelectedObject(IglooUIEvents.DuplicateSelectedObject evt) { SceneLayoutData activeSceneLayoutData = layoutManager.GetActiveSceneLayoutData(); if (activeSceneLayoutData.IsLayoutAtMaxItemLimit()) { Log.LogError(this, "Attempting to duplicate when max items already met"); return(false); } DecorationLayoutData data = default(DecorationLayoutData); bool flag = false; Vector3 zero = Vector3.zero; UnityEngine.Quaternion identity = UnityEngine.Quaternion.identity; Vector3 one = Vector3.one; if (!ClubPenguin.Core.SceneRefs.IsSet <ObjectManipulationInputController>()) { Log.LogError(this, "ObjectManipulationInputController not set when attempting to duplicate."); return(false); } ObjectManipulationInputController objectManipulationInputController = ClubPenguin.Core.SceneRefs.Get <ObjectManipulationInputController>(); if (objectManipulationInputController.CurrentlySelectedObject == null) { Log.LogError(this, "Currently selected object was null when attempting to duplicate."); return(false); } ManipulatableObject component = objectManipulationInputController.CurrentlySelectedObject.GetComponent <ManipulatableObject>(); zero = component.transform.position; identity = component.transform.rotation; Transform parent = component.transform.parent; component.transform.parent = null; one = component.transform.localScale; component.transform.parent = parent; data.DefinitionId = component.DefinitionId; data.Type = component.Type; if (true && ClubPenguin.Core.SceneRefs.IsSet <SceneManipulationService>()) { SceneManipulationService sceneManipulationService = ClubPenguin.Core.SceneRefs.Get <SceneManipulationService>(); if (data.Type == DecorationLayoutData.DefinitionType.Decoration) { Vector3 vector = Vector3.right; if (objectManipulationInputController.CurrentlySelectedObject.GetComponent <PartneredObject>() != null || objectManipulationInputController.CurrentlySelectedObject.GetComponent <SplittableObject>() != null) { vector = Vector3.right * 3f; } DecorationDefinition decorationDefinition = Service.Get <DecorationInventoryService>().GetDecorationDefinition(data.DefinitionId); int availableDecorationCount = sceneManipulationService.GetAvailableDecorationCount(data.DefinitionId); if (decorationDefinition != null && availableDecorationCount > 0) { sceneManipulationService.AddNewObject(decorationDefinition.Prefab, zero + vector, identity, one, data, setManipulationInputStateToDrag: false); } } else { StructureDefinition structureDefinition = Service.Get <DecorationInventoryService>().GetStructureDefinition(data.DefinitionId); int availableDecorationCount = sceneManipulationService.GetAvailableStructureCount(data.DefinitionId); if (structureDefinition != null && availableDecorationCount > 0) { sceneManipulationService.AddNewObject(structureDefinition.Prefab, zero + Vector3.right, identity, one, data, setManipulationInputStateToDrag: false); } } } return(false); }
public EditModeModifier(SceneManipulationService sceneManipulationService) { this.sceneManipulationService = sceneManipulationService; structureDefinitions = Service.Get <IGameData>().Get <Dictionary <int, StructureDefinition> >(); }