public void OnDestroy() { objectManipulationInputController.ObjectDeselected -= onObjectManipulationInputControllerObjectDeselected; ObjectManipulationInputController obj = objectManipulationInputController; obj.BeforeDragComplete = (Action <ObjectManipulator, Action <bool> >)Delegate.Remove(obj.BeforeDragComplete, new Action <ObjectManipulator, Action <bool> >(onConfirmSquashedObjectBeforeDragComplete)); }
public void SetObjectManipulationController(ObjectManipulationInputController controller) { if (objectManipulationInputController == null) { objectManipulationInputController = controller; objectManipulationInputController.ObjectDeselected += OnObjectManipulatorObjectDeselected; } }
public void Awake() { objectManipulationInputController = GetComponent <ObjectManipulationInputController>(); objectManipulationInputController.ObjectDeselected += onObjectManipulationInputControllerObjectDeselected; ObjectManipulationInputController obj = objectManipulationInputController; obj.BeforeDragComplete = (Action <ObjectManipulator, Action <bool> >)Delegate.Combine(obj.BeforeDragComplete, new Action <ObjectManipulator, Action <bool> >(onConfirmSquashedObjectBeforeDragComplete)); }
public void SetTrackedObject(ObjectManipulator obj, int size, ObjectManipulationInputController inputController) { trackedObject = obj; trackedObjectSize = size; if (base.isActiveAndEnabled) { enabledAttractionPoints(); } this.inputController = inputController; inputController.BeforeDragPosition += checkForSnapPosition; }
public void ClearCurrentLayout() { if (ObjectManipulationInputController != null) { ObjectManipulationInputController.Reset(); } int childCount = sceneLayoutContainer.childCount; for (int num = childCount - 1; num >= 0; num--) { ManipulatableObject component = sceneLayoutContainer.GetChild(num).GetComponent <ManipulatableObject>(); if (component != null) { component.RemoveObject(deleteChildren: true); } } }
private void onNewObjectLoaded(GameObject prefab, PrefabCacheTracker.PrefabRequest request, Vector3 worldPosition, Quaternion rotation, Vector3 scale, DecorationLayoutData data, bool setManipulationInputStateToDrag) { if (prefab == null) { Log.LogErrorFormatted(this, "Prefab was null"); return; } GameObject gameObject = UnityEngine.Object.Instantiate(prefab, sceneLayoutContainer); if (gameObject == null) { Log.LogErrorFormatted(this, "Instantiate returned a null game object for prefab {0}", prefab); return; } isNewObject = true; prefabCacheTracker.SetCache(gameObject, request.ContentKey); gameObject.transform.position = worldPosition; gameObject.transform.rotation = rotation; gameObject.transform.localScale = scale; ManipulatableObject arg = addObjectManipulator(gameObject, data); ObjectManipulationInputController.SelectState setSelectStateTo = ((!setManipulationInputStateToDrag) ? ObjectManipulationInputController.SelectState.Active : ObjectManipulationInputController.SelectState.Drag); if (ObjectManipulationInputController != null) { ObjectManipulationInputController.SelectNewObject(gameObject, setSelectStateTo); } SplittableObject component = gameObject.GetComponent <SplittableObject>(); if (component != null) { if (SceneLayoutData.LayoutCount >= SceneLayoutData.MaxLayoutItems - 2) { UnityEngine.Object.Destroy(gameObject); ResetAfterMaxReached(); } else { component.SetObjectManipulationController(ObjectManipulationInputController); component.ChildrenSplit += onSplittableObjectChildrenSplit; } } selectedObjectStartingId = null; this.NewObjectCreated.InvokeSafe(arg); }
public void Start() { scaleSlider = GetComponentInChildren <Slider>(); objectManipulationInputController = SceneRefs.Get <ObjectManipulationInputController>(); objectManipulationInputController.InteractionStateChanged += onObjectManipulationInputControllerInteractionStateChanged; objectManipulationInputController.ObjectSelected += onObjectManipulationInputControllerObjectSelected; RotationWheel rotationWheel = RotationWheel; rotationWheel.SelectedStateChanged = (Action <bool>)Delegate.Combine(rotationWheel.SelectedStateChanged, new Action <bool>(OnRotationWheelSelectionStateChanged)); if (PlatformUtils.GetPlatformType() == PlatformType.Mobile) { HideScaleControls(); HideRotationControls(); } else { InitializeControls(); } }
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 void OnEnable() { objectManipulationInputController = SceneRefs.Get <ObjectManipulationInputController>(); objectManipulationInputController.InteractionStateChanged += onObjectManipulationInputControllerInteractionStateChanged; }
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); }
private void Awake() { objectManipulationInputController = GetComponent <ObjectManipulationInputController>(); }
private void Awake() { objManipulationController = GetComponent <ObjectManipulationInputController>(); stateMachineContextListener = GetComponent <StateMachineContextListener>(); stateMachineContextListener.OnContextAdded += onContextAdded; }
private void ResetAfterMaxReached() { ObjectManipulationInputController.Abort(); Service.Get <EventDispatcher>().DispatchEvent(default(ObjectManipulationEvents.EndDragInventoryItem)); Service.Get <EventDispatcher>().DispatchEvent(default(SceneLayoutEvents.SceneMaxItemsEvent)); }