예제 #1
0
        protected override void Start()
        {
            base.Start();
            if (ClubPenguin.Core.SceneRefs.IsSet <SceneManipulationService>())
            {
                sceneManipulationService = ClubPenguin.Core.SceneRefs.Get <SceneManipulationService>();
                sceneManipulationService.ObjectRemoved    += onObjectAddedOrRemoved;
                sceneManipulationService.ObjectAdded      += onObjectAddedOrRemoved;
                sceneManipulationService.NewObjectCreated += onObjectAddedOrRemoved;
            }
            if (ClubPenguin.Core.SceneRefs.IsSet <ObjectManipulationInputController>())
            {
                objectManipulationInputController = ClubPenguin.Core.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>();
        }
예제 #2
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     if (sceneManipulationService != null)
     {
         sceneManipulationService.ObjectRemoved    -= onObjectAddedOrRemoved;
         sceneManipulationService.ObjectAdded      -= onObjectAddedOrRemoved;
         sceneManipulationService.NewObjectCreated -= onObjectAddedOrRemoved;
     }
     if (decorationCategoryManager != null)
     {
         DecorationCategoryManager obj = decorationCategoryManager;
         obj.CategoryRefreshedEvent = (CategoryRefreshedEvent)Delegate.Remove(obj.CategoryRefreshedEvent, new CategoryRefreshedEvent(onCategoryUpdated));
     }
     if (objectManipulationInputController != null)
     {
         objectManipulationInputController.InteractionStateChanged -= onInteractionStateChanged;
     }
     if (dragContainerInstance != null)
     {
         UnityEngine.Object.Destroy(dragContainerInstance);
     }
 }