private void removeSceneRef()
 {
     if (!SceneRefs.IsSet <IScreenContainerStateHandler>())
     {
         SceneRefs.Remove((IScreenContainerStateHandler)this);
     }
 }
예제 #2
0
 private void Awake()
 {
     eventChannel = new EventChannel(Service.Get <EventDispatcher>());
     eventChannel.AddListener <PopupEvents.ShowPopup>(onShowPopup);
     SceneRefs.SetPopupManager(this);
     ClubPenguin.Core.SceneRefs.Set(this);
     Service.Get <EventDispatcher>().DispatchEvent(default(PopupEvents.PopupManagerReady));
 }
예제 #3
0
        public void Awake()
        {
            SceneRefs.Set(this);
            renderingState = true;
            GameObject gameObject = GameObject.FindGameObjectWithTag("MainCamera");

            mainCamera = gameObject.GetComponent <Camera>();
        }
예제 #4
0
 private void Awake()
 {
     if (UnityEngine.Object.FindObjectsOfType <BlobShadowRenderer>().Length > 1)
     {
         throw new Exception("A scene should only contain 1 BlobShadowRenderer.");
     }
     SceneRefs.Set(this);
 }
 public void OnEnable()
 {
     if (SceneRefs.IsSet <IScreenContainerStateHandler>())
     {
         isShowingKeyboard = SceneRefs.Get <IScreenContainerStateHandler>().IsKeyboardShown;
     }
     Service.Get <EventDispatcher>().AddListener <KeyboardEvents.KeyboardHidden>(onKeyboardHidden);
     Service.Get <EventDispatcher>().AddListener <KeyboardEvents.KeyboardShown>(onKeyboardShown);
 }
        public void OnPreRender()
        {
            BlobShadowRenderer blobShadowRenderer = SceneRefs.Get <BlobShadowRenderer>();

            if (blobShadowRenderer != null)
            {
                blobShadowRenderer.RenderBlobs();
            }
        }
 private void Awake()
 {
     CameraCullingMaskHelper.HideLayer(Camera.main, "IconRender");
     SceneRefs.SetClothingDesignerCameraController(this);
     mainCamera             = GetComponent <Camera>();
     isAnimatingCamera      = false;
     isAnimatingViewport    = false;
     checkPosition          = false;
     wasOriginalViewportSet = false;
 }
 public void OnDestroy()
 {
     if (dispatcher != null)
     {
         dispatcher.DispatchEvent(new InputEvents.MoveEvent(Vector2.zero));
     }
     if (SceneRefs.IsSet <VirtualJoystick>() && SceneRefs.Get <VirtualJoystick>() == this)
     {
         SceneRefs.Remove(this);
     }
 }
 private void OnDestroy()
 {
     this.ObjectAdded   = null;
     this.ObjectRemoved = null;
     SceneRefs.Remove(this);
     awakeEvents.RemoveAllListeners();
     for (int i = 0; i < sceneModifiers.Length; i++)
     {
         sceneModifiers[i].Destroy();
     }
 }
 private void setup()
 {
     referencesRemovedCount = 0;
     contentCacheGameObject = SceneRefs.Get <PrefabCacheTracker>();
     if (contentCacheGameObject != null)
     {
         contentCacheGameObject.ReferencesRemoved += onReferencesRemoved;
     }
     Service.Get <EventDispatcher>().AddListener <SceneTransitionEvents.SceneSwapLoadStarted>(onSceneSwapLoadStarted);
     isSetup = true;
 }
 protected override void handleEvent()
 {
     if (SceneRefs.Get <IScreenContainerStateHandler>().IsKeyboardShown)
     {
         Service.Get <EventDispatcher>().AddListener <KeyboardEvents.KeyboardHidden>(onKeyboardClosed);
     }
     else
     {
         base.handleEvent();
     }
 }
 private void Awake()
 {
     SceneRefs.Set(this);
     eventChannel = new EventChannel(Service.Get <EventDispatcher>());
     eventChannel.AddListener <PopupEvents.ShowCameraSpacePopup>(onShowPopup);
     popupManagerTransform = base.transform;
     canvas = GetComponent <Canvas>();
     defaultPlaneDistance = canvas.planeDistance;
     defaultOrderInLayer  = canvas.sortingOrder;
     disableCamera();
 }
 public void Start()
 {
     if (SceneRefs.IsSet <BlobShadowRenderer>())
     {
         this.blobShadowRenderer = SceneRefs.Get <BlobShadowRenderer>();
         this.SetIsActive(this.blobShadowRenderer.IsShadowsVisible);
     }
     this.eventDispatcher.AddListener <BlobShadowEvents.DisableBlobShadows>(new EventHandlerDelegate <BlobShadowEvents.DisableBlobShadows>(this.onDisableBlobShadows), EventDispatcher.Priority.DEFAULT);
     this.eventDispatcher.AddListener <BlobShadowEvents.EnableBlobShadows>(new EventHandlerDelegate <BlobShadowEvents.EnableBlobShadows>(this.onEnableBlobShadows), EventDispatcher.Priority.DEFAULT);
     this.ScaleX = 0.6f;
     this.ScaleZ = 0.6f;
 }
 private void Awake()
 {
     if (SceneRefs.IsSet <VirtualJoystick>())
     {
         SceneRefs.Remove(SceneRefs.Get <VirtualJoystick>());
     }
     SceneRefs.Set(this);
     joystick     = GetComponent <RectTransform>();
     joystickBase = base.transform.GetChild(0).GetComponent <RectTransform>();
     joystickPad  = base.transform.GetChild(0).GetChild(0).GetComponent <RectTransform>();
     dispatcher   = Service.Get <EventDispatcher>();
 }
예제 #15
0
 public void Awake()
 {
     SceneRefs.Set(this);
     dispatcher = Service.Get <EventDispatcher>();
     mainCamera = Camera.main.transform;
     nodes      = new Transform[3];
     nodes[0]   = GameplayCameraLeaf;
     nodes[1]   = CinematicCameraLeaf;
     nodes[2]   = ChaseCameraLeaf;
     curNode    = CameraContext.Gameplay;
     nextNode   = curNode;
 }
예제 #16
0
 public void Start()
 {
     if (SceneRefs.IsSet <BlobShadowRenderer>())
     {
         blobShadowRenderer = SceneRefs.Get <BlobShadowRenderer>();
         SetIsActive(blobShadowRenderer.IsShadowsVisible);
     }
     eventDispatcher.AddListener <BlobShadowEvents.DisableBlobShadows>(onDisableBlobShadows);
     eventDispatcher.AddListener <BlobShadowEvents.EnableBlobShadows>(onEnableBlobShadows);
     ScaleX = 0.6f;
     ScaleZ = 0.6f;
 }
예제 #17
0
 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);
 }
예제 #18
0
 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);
 }
예제 #19
0
 private void Update()
 {
     if (SceneRefs.IsSet <BaseCamera>())
     {
         Transform transform  = SceneRefs.Get <BaseCamera>().transform;
         Transform transform2 = base.transform;
         if ((bool)AttachPoint)
         {
             transform2.position = AttachPoint.position;
         }
         transform2.LookAt(transform2.position + transform.rotation * Vector3.forward, transform.rotation * Vector3.up);
     }
 }
        private void Awake()
        {
            SceneRefs.SetCollectibleController(this);
            CPDataEntityCollection cPDataEntityCollection = Service.Get <CPDataEntityCollection>();

            if (cPDataEntityCollection.TryGetComponent <InZoneCollectiblesData>(cPDataEntityCollection.LocalPlayerHandle, out currentRoomState))
            {
                initCurrentRoomState();
            }
            else
            {
                cPDataEntityCollection.EventDispatcher.AddListener <DataEntityEvents.ComponentAddedEvent <InZoneCollectiblesData> >(onInZoneCollectiblesDataAdded);
            }
        }
예제 #21
0
    internal override List <KeyValuePair <DecorationDefinition, int> > GetDefinitionsToDisplay()
    {
        List <KeyValuePair <DecorationDefinition, int> > list = new List <KeyValuePair <DecorationDefinition, int> >();
        List <KeyValuePair <DecorationDefinition, int> > availableDecorations = SceneRefs.Get <SceneManipulationService>().GetAvailableDecorations();

        for (int i = 0; i < availableDecorations.Count; i++)
        {
            if (availableDecorations[i].Key.CategoryKey.Id == categoryDefinition.Id)
            {
                list.Add(availableDecorations[i]);
            }
        }
        return(list);
    }
예제 #22
0
 public void Awake()
 {
     SceneRefs.Set(this);
     desiredTransform = new GameObject().transform;
     feeler           = new Vector3[feelerCount];
     feeler[0]        = base.transform.forward;
     feeler[1]        = Vector3.down;
     feeler[2]        = Vector3.up;
     feeler[3]        = Vector3.right;
     feeler[4]        = Vector3.left;
     feeler[5]        = Vector3.back;
     feeler[6]        = (Vector3.right + Vector3.down).normalized;
     feeler[7]        = (Vector3.left + Vector3.down).normalized;
     base.enabled     = false;
 }
 private void setSceneRef()
 {
     if (SceneRefs.IsSet <IScreenContainerStateHandler>())
     {
         IScreenContainerStateHandler screenContainerStateHandler = SceneRefs.Get <IScreenContainerStateHandler>();
         if (!object.ReferenceEquals(screenContainerStateHandler, this))
         {
             SceneRefs.Remove(screenContainerStateHandler);
             SceneRefs.Set((IScreenContainerStateHandler)this);
         }
     }
     else
     {
         SceneRefs.Set((IScreenContainerStateHandler)this);
     }
 }
예제 #24
0
 protected virtual void Start()
 {
     if (PooledScrollRect.ElementPoolOverride == null)
     {
         goPoolOverride = SceneRefs.Get <GameObjectPoolOverride>();
     }
     displayListRetrieved = false;
     if (SceneRefs.Get <IScreenContainerStateHandler>().IsOpen)
     {
         loadContentPrefabs();
     }
     else
     {
         eventDispatcher.AddListener <TrayEvents.TrayOpened>(onTrayOpened);
     }
 }
예제 #25
0
 public void Awake()
 {
     dispatcher = Service.Get <EventDispatcher>();
     if (SceneRefs.IsSet <VirtualJoystick>())
     {
         joystick = SceneRefs.Get <VirtualJoystick>();
         CoroutineRunner.Start(getTopOfJoystickInPixels(), this, "getTopOfJoystickInPixels");
     }
     else
     {
         dispatcher.AddListener <VirtualJoystickEvents.JoystickAdded>(onJoystickAdded);
     }
     dispatcher.AddListener <CinematographyEvents.DisableElasticGlancer>(onGlancerDisabled);
     dispatcher.AddListener <CinematographyEvents.EnableElasticGlancer>(onGlancerEnabled);
     isGlancerEnabled = GlobalGlancersEnabled;
 }
예제 #26
0
 internal virtual void Awake()
 {
     SceneRefs.Set(Camera.main);
     SceneRefs.Set(this);
     Set(GetComponent <CameraController>());
     desiredGoal           = base.transform.position;
     constrainedGoal       = base.transform.position;
     lookat                = base.transform.position + base.transform.forward;
     glance                = Quaternion.identity;
     velocityFilterSamples = new List <Vector3>();
     maxMoveSpeed          = -1f;
     maxAimSpeed           = -1f;
     moveBlendState        = default(TransitionBlendState);
     aimBlendState         = default(TransitionBlendState);
     Snap();
 }
        public void Awake()
        {
            canvas                     = GetComponent <Canvas>();
            canvasScalerExt            = GetComponent <CanvasScalerExt>();
            manipulatableObject        = GetComponentInParent <ManipulatableObject>();
            decorationInventoryService = Service.Get <DecorationInventoryService>();
            confirmButtonImage         = ConfirmButton.GetComponent <Image>();
            duplicateButtonImage       = DuplicateButton.GetComponent <Image>();
            baseCamera                 = SceneRefs.Get <BaseCamera>();
            BaseCamera obj = baseCamera;

            obj.Moved = (System.Action)Delegate.Combine(obj.Moved, new System.Action(OnCameraMoved));
            Service.Get <EventDispatcher>().AddListener <InputEvents.ZoomEvent>(onInputZoom);
            IsInitialized   = false;
            isDecorationSet = false;
            hide();
        }
        private void Awake()
        {
            dataEntityCollection       = Service.Get <CPDataEntityCollection>();
            eventDispatcher            = Service.Get <EventDispatcher>();
            decorationInventoryService = Service.Get <DecorationInventoryService>();
            sceneHandle = dataEntityCollection.FindEntityByName("ActiveSceneData");
            awakeEvents = new EventChannel(eventDispatcher);
            awakeEvents.AddListener <SceneTransitionEvents.LayoutGameObjectsLoaded>(onLayoutGameObjectsLoaded);
            sceneModifiers = new ISceneModifier[1]
            {
                new EditModeModifier(this)
            };
            IGameData gameData = Service.Get <IGameData>();

            decorationDefinitions = gameData.Get <Dictionary <int, DecorationDefinition> >();
            structureDefinitions  = gameData.Get <Dictionary <int, StructureDefinition> >();
            SceneRefs.Set(this);
        }
        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();
            }
        }
    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);
    }