示例#1
0
        public override void OnInitializationComplete()
        {
            checkPreferredTextSize();
            GameSettings gameSettings = Service.Get <GameSettings>();

            if (gameSettings.FirstSession && PlatformUtils.GetPlatformType() != PlatformType.Standalone)
            {
                if (MonoSingleton <NativeAccessibilityManager> .Instance.IsEnabled)
                {
                    AudioController audioController = Service.Get <AudioController>();
                    if (gameSettings != null && audioController != null)
                    {
                        audioController.SetMusicVolume(0f);
                        gameSettings.MusicVolume.SetValue(0f);
                        audioController.SetSFXVolume(0f);
                        gameSettings.SfxVolume.SetValue(0f);
                    }
                    loadScene();
                }
                else
                {
                    CoroutineRunner.Start(playIntroVideo(), this, "playIntroVideo");
                }
            }
            else
            {
                loadScene();
            }
        }
        private void init()
        {
            getReferences();
            originalCameraPosition = cinematicCameraFishingController.transform.position;
            _rodPropLineParent     = _rodPropLineEndTransform.parent;
            SimpleSpringInterper simpleSpringInterper = reelSpring;

            simpleSpringInterper.OnSpringValueChanged = (SimpleSpringInterper.SpringValueChangedHandler)Delegate.Combine(simpleSpringInterper.OnSpringValueChanged, new SimpleSpringInterper.SpringValueChangedHandler(OnReelSpringUpdated));
            locomotionBroadcaster.BroadcastOnControlsLocked();
            eventDispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElement("Joystick", hideElement: true));
            userControl.enabled = true;
            eventDispatcher.DispatchEvent(new ControlsScreenEvents.SetButton(bobberContentKey, 0));
            Quaternion quaternion = Quaternion.Euler(config.PlayerRotationTowardsWater);

            player.GetComponent <RunController>().SnapToFacing(quaternion * Vector3.forward);
            prizeDropContainer.transform.localPosition = config.PrizeDropOffset;
            patternIndex = getRandomPatternIndex();
            setGameplayState(FishingGameplayStates.WaitingForServer, forceChange: true);
            CoroutineRunner.Start(ExecuteCast(), this, "ExecuteCast");
            getFishingGamePrize();
            clickListener = GetComponent <ClickListener>();
            eventDispatcher.DispatchEvent(new PlayerCardEvents.SetEnablePlayerCard(enable: false));
            if (PlatformUtils.GetPlatformType() != PlatformType.Standalone)
            {
                eventDispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElementGroup("MainNavButtons"));
                eventDispatcher.DispatchEvent(new UIDisablerEvents.DisableUIElement("ChatButtons"));
            }
        }
 private void startScreen()
 {
     if (Service.Get <ApplicationService>().RequiresUpdate)
     {
         ForcedUpgrade.OpenForcedUpgradePrompt();
         Service.Get <LoadingController>().RemoveLoadingSystem(this);
         return;
     }
     if (PlatformUtils.GetPlatformType() == PlatformType.Standalone && Service.Get <ApplicationService>().UpdateAvailable)
     {
         CPDataEntityCollection     cPDataEntityCollection = Service.Get <CPDataEntityCollection>();
         DataEntityHandle           entityByType           = cPDataEntityCollection.GetEntityByType <UpgradeAvailablePromptData>();
         UpgradeAvailablePromptData component = cPDataEntityCollection.GetComponent <UpgradeAvailablePromptData>(entityByType);
         if (!component.HasSeenUpgradeAvailablePrompt)
         {
             component.HasSeenUpgradeAvailablePrompt = true;
             ForcedUpgrade.OpenOptionalUpgradePrompt();
         }
     }
     Service.Get <EventDispatcher>().AddListener <SessionEvents.SessionEndedEvent>(onSessionEnded);
     if (!Service.Get <SessionManager>().HasSession)
     {
         firstTimeSetup();
     }
     else
     {
         setupScreen();
     }
     Service.Get <LoadingController>().RemoveLoadingSystem(this);
 }
 private void Start()
 {
     setupListeners();
     if (PlatformUtils.GetPlatformType() == PlatformType.Standalone)
     {
         CatalogShopItemsPerRow = StandaloneCatalogShopItemsPerRow;
     }
 }
示例#5
0
 private bool onCellPhoneClosed(CellPhoneEvents.CellPhoneClosed evt)
 {
     Object.Destroy(base.gameObject);
     Service.Get <EventDispatcher>().DispatchEvent(new AwayFromKeyboardEvent(AwayFromKeyboardStateType.Here));
     if (PlatformUtils.GetPlatformType() == PlatformType.Mobile)
     {
         ClubPenguin.Core.SceneRefs.Get <CameraRenderingControl>().EnableRendering();
     }
     return(false);
 }
示例#6
0
        private void ResetCamera()
        {
            CinematographyEvents.CameraLogicResetEvent evt = default(CinematographyEvents.CameraLogicResetEvent);
            GameObject gameObject = ((PlatformUtils.GetPlatformType() == PlatformType.Mobile) ? board.CameraPosition : board.StandaloneCameraPosition);

            evt.Controller = gameObject.GetComponent <CameraController>();
            dispatcher.DispatchEvent(evt);
            dispatcher.DispatchEvent(new CinematographyEvents.ChangeCameraTarget(localPlayerGameObject.transform));
            Camera.main.cullingMask |= 1 << LayerMask.NameToLayer("AllPlayerInteractibles");
            Camera.main.cullingMask |= 1 << LayerMask.NameToLayer("PhysicsObjects");
            Camera.main.cullingMask |= 1 << LayerMask.NameToLayer("LocalPlayer");
        }
        public void SetGraphicsQuality()
        {
            string text = "";

            if (PlatformUtils.GetPlatformType() == PlatformType.Standalone)
            {
                text = "Standalone_";
            }
            else if (PlatformUtils.GetPlatformType() == PlatformType.Mobile)
            {
                text = "Mobile_";
            }
            else
            {
                string message = Enum.GetName(typeof(string), PlatformUtils.GetPlatformType());
                Log.LogErrorFormatted("Quality setting not defined on Platform {0}", message);
            }
            if (graphicsQualityToggleHigh.isOn)
            {
                antiAliasingToggle.isOn          = true;
                cameraPostToggle.isOn            = true;
                lodPenguinQualityToggleHigh.isOn = true;
                text += "High";
                SetTogglesInteractable(true, antiAliasingToggle, cameraPostToggle);
                SetPenguinTogglesInteractable(true, lodPenguinQualityToggleHigh, lodPenguinQualityToggleMedium);
            }
            else if (graphicsQualityToggleMedium.isOn)
            {
                antiAliasingToggle.isOn            = true;
                cameraPostToggle.isOn              = false;
                lodPenguinQualityToggleMedium.isOn = true;
                text += "Medium";
                SetTogglesInteractable(true, antiAliasingToggle);
                SetTogglesInteractable(false, cameraPostToggle);
                SetPenguinTogglesInteractable(true, lodPenguinQualityToggleMedium);
                SetPenguinTogglesInteractable(false, lodPenguinQualityToggleHigh);
            }
            else if (graphicsQualityToggleLow.isOn)
            {
                antiAliasingToggle.isOn         = false;
                cameraPostToggle.isOn           = false;
                lodPenguinQualityToggleLow.isOn = true;
                text += "Low";
                SetTogglesInteractable(false, antiAliasingToggle, cameraPostToggle);
                SetPenguinTogglesInteractable(false, lodPenguinQualityToggleHigh, lodPenguinQualityToggleMedium);
            }
            if (isInitialized)
            {
                customGraphicsService.SetGraphicsLevel(text);
            }
        }
        private void setupCamera()
        {
            if (outlineCamera == null)
            {
                GameObject gameObject = new GameObject("OutlineCamera");
                gameObject.layer = OutlineLayer;
                outlineCamera    = gameObject.AddComponent <Camera>();
                outlineCamera.transform.SetParent(referenceCamera.transform, worldPositionStays: false);
                outlineCamera.transform.localPosition = Vector3.zero;
                outlineCamera.transform.localRotation = Quaternion.identity;
                AudioListener component = outlineCamera.GetComponent <AudioListener>();
                if (component != null)
                {
                    Object.Destroy(component);
                }
            }
            outlineCamera.CopyFrom(referenceCamera);
            outlineCamera.rect = new Rect(0f, 0f, 1f, 1f);
            int num = 1 << OutlineLayer;

            outlineCamera.cullingMask     = num;
            referenceCamera.cullingMask  &= ~num;
            outlineCamera.clearFlags      = CameraClearFlags.Color;
            outlineCamera.backgroundColor = Color.black;
            bool flag = PlatformUtils.GetPlatformType() == PlatformType.Standalone;

            MaxRenderTextureSize = (flag ? 512 : 512);
            int num2 = MaxRenderTextureSize;
            int num3 = MaxRenderTextureSize;

            if (referenceCamera.aspect > 1f)
            {
                num3 = Mathf.RoundToInt((float)num2 / referenceCamera.aspect);
            }
            else
            {
                num2 = Mathf.RoundToInt((float)num3 * referenceCamera.aspect);
            }
            outlineRtt = new RenderTexture(num2, num3, 24);
            if (flag)
            {
                outlineRtt.antiAliasing = 2;
            }
            outlineCamera.targetTexture = outlineRtt;
            ClothingOutlinerImageEffect component2 = referenceCamera.gameObject.GetComponent <ClothingOutlinerImageEffect>();

            outlinerEffect = component2 ?? referenceCamera.gameObject.AddComponent <ClothingOutlinerImageEffect>();
            outlinerEffect.OutlineTexture = outlineRtt;
            outlinerEffect.AnimationCurve = OutlinerAnimationCurve;
        }
示例#9
0
        public override void OnEnter()
        {
            PlatformType platformType  = PlatformUtils.GetPlatformType();
            PlatformType platformType2 = platformType;

            if (platformType2 == PlatformType.Standalone)
            {
                base.Fsm.Event(OnStandalone);
            }
            else
            {
                base.Fsm.Event(OnMobile);
            }
            Finish();
        }
 private void onButtonClick()
 {
     GetComponent <Button>().onClick.RemoveListener(onButtonClick);
     if (sessionManager.IsLoggingOut || !sessionManager.HasSession)
     {
         gameStateController.ReturnToHome();
     }
     else if (PlatformUtils.GetPlatformType() == PlatformType.Mobile)
     {
         loadPreviousScene();
     }
     else
     {
         Service.Get <EventDispatcher>().DispatchEvent(default(CellPhoneEvents.ReturnToHomeScreen));
     }
 }
示例#11
0
 private void Start()
 {
     dispatcher   = Service.Get <EventDispatcher>();
     eventChannel = new EventChannel(dispatcher);
     Service.Get <EventDispatcher>().DispatchEvent(new AwayFromKeyboardEvent(AwayFromKeyboardStateType.CellPhone, faceCamera: true));
     eventChannel.AddListener <CellPhoneEvents.ChangeCellPhoneScreen>(onChangeScreen);
     eventChannel.AddListener <CellPhoneEvents.CellPhoneClosed>(onCellPhoneClosed);
     eventChannel.AddListener <CellPhoneEvents.ReturnToHomeScreen>(onReturnToHome);
     eventChannel.AddListener <CellPhoneEvents.HideLoadingScreen>(onHideLoadingScreen);
     if (PlatformUtils.GetPlatformType() == PlatformType.Mobile)
     {
         ClubPenguin.Core.SceneRefs.Get <CameraRenderingControl>().DisableRendering(includeChat: true, cullUILayer: false);
     }
     loadScreen(homeScreenContentKey, showLoadingScreen: false);
     dispatcher.DispatchEvent(default(RewardEvents.SuppressLevelUpPopup));
 }
示例#12
0
    public virtual void UpdateState()
    {
        if (Input.touchCount == 1 && PlatformUtils.GetPlatformType() != PlatformType.Standalone)
        {
            ProcessOneTouch(ITouch.fromTouch(Input.GetTouch(0)));
            return;
        }
        if (Input.touchCount == 2)
        {
            ProcessTwoTouchPinchAndZoom();
            return;
        }
        ITouch touch = ITouch.fromMouse();

        if (touch.phase != TouchPhase.Canceled)
        {
            ProcessOneTouch(touch);
        }
    }
        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();
            }
        }
示例#14
0
    protected bool checkButtonDrag(Vector2 dragDelta)
    {
        float num = (PlatformUtils.GetPlatformType() == PlatformType.Standalone) ? (dragDelta.x / DragDeltaDampenX) : dragDelta.x;

        return(dragDelta.y > 20f || (dragDelta.y > 3f && dragDelta.y >= num && num > -5f && num < 5f));
    }
示例#15
0
    public override void Start()
    {
        RememberMeService rememberMeService = Service.Get <RememberMeService>();

        rememberedData = rememberMeService.GetRememberMeData();
        if (rememberedData.AccountData == null)
        {
            string text = rememberMeService.CurrentUsername;
            if (string.IsNullOrEmpty(text))
            {
                text = rememberMeService.Usernames[0];
            }
            rememberedData.AccountData = rememberMeService.LoadAccountData(text);
        }
        string username = rememberedData.AccountData.Username;

        SoftLoginSelector.IsOn = (username == rememberMeService.CurrentUsername && PlatformUtils.GetPlatformType() != PlatformType.Mobile);
        showGeneralError(rememberedData.GeneralErrorMessage);
        rememberedData.GeneralErrorMessage = string.Empty;
        setPasswordValid             = false;
        PasswordField.TextInput.text = rememberedData.AccountData.Password;
        RememberPassword.isOn        = !string.IsNullOrEmpty(PasswordField.TextInput.text);
        if (!string.IsNullOrEmpty(PasswordField.TextInput.text))
        {
            PasswordField.HasError             = false;
            PasswordField.IsValidationComplete = true;
            setPasswordValid = true;
        }
        AvatarRenderTextureComponent componentInChildren = GetComponentInChildren <AvatarRenderTextureComponent>();

        if (componentInChildren != null)
        {
            componentInChildren.RenderAvatar(rememberedData.AccountData.Outfit, rememberedData.AccountData.BodyColor);
        }
        if (DisplayName != null)
        {
            DisplayName.text = rememberedData.AccountData.DisplayName;
        }
        if (MembershipSelector != null)
        {
            int index = 0;
            switch (rememberedData.AccountData.MembershipType)
            {
            case MembershipType.Member:
                index = 1;
                break;

            case MembershipType.None:
            case MembershipType.AllAccessEventMember:
            {
                AllAccessService allAccessService = Service.Get <AllAccessService>();
                if (allAccessService.IsAllAccessActive() && AllAccessHelper.HasSeenAllAccessFlow(allAccessService.GetAllAccessEventKey(), rememberedData.AccountData.DisplayName))
                {
                    index = 2;
                }
                break;
            }
            }
            MembershipSelector.SelectSprite(index);
        }
        bool isBanned = false;

        if (rememberedData.AccountData.Banned.HasValue)
        {
            DateTime?expirationDate = rememberedData.AccountData.Banned.Value.ExpirationDate;
            if (!expirationDate.HasValue)
            {
                isBanned = true;
            }
            else if ((rememberedData.AccountData.Banned.Value.ExpirationDate - DateTime.Now).Value.TotalHours >= 0.0)
            {
                isBanned = true;
            }
        }
        updateBannedState(isBanned);
        base.Start();
    }
        protected void onDrag(Vector2 touchPosition)
        {
            if (dragContainer == null)
            {
                return;
            }
            bool       flag       = true;
            float      num        = 1136f;
            GameObject gameObject = GameObject.FindWithTag("UIHud");

            if (gameObject != null)
            {
                num = gameObject.GetComponentInChildren <CanvasScalerExt>().ReferenceResolutionY;
            }
            bool    flag2  = PlatformUtils.GetPlatformType() == PlatformType.Standalone;
            Vector2 vector = touchPosition;

            if (!flag2)
            {
                vector += DragIconOffset * ((float)Screen.height / num);
            }
            Ray ray = mainCamera.ScreenPointToRay(vector);

            if (Physics.Raycast(ray, out var hitInfo))
            {
                GameObject          gameObject2 = hitInfo.collider.gameObject;
                SkinnedMeshRenderer component   = gameObject2.GetComponent <SkinnedMeshRenderer>();
                if (component != null && component.sharedMaterial.shader.name.Contains("Equipment"))
                {
                    lastTouchedPosition = touchPosition;
                    Texture2D texture2D = gameObject2.GetComponent <SkinnedMeshRenderer>().sharedMaterial.GetTexture(EquipmentShaderParams.DECALS_123_OPACITY_TEX) as Texture2D;
                    if (texture2D == null)
                    {
                        Log.LogErrorFormatted(this, "Unable to retrieve decal 123 map on item {0}. Property did not exist {1}.", gameObject2.name, EquipmentShaderParams.DECALS_123_OPACITY_TEX);
                        return;
                    }
                    Vector2 textureCoord = hitInfo.textureCoord;
                    textureCoord.Scale(new Vector2(texture2D.width, texture2D.height));
                    Color pixel = texture2D.GetPixel((int)textureCoord.x, (int)textureCoord.y);
                    if (Mathf.Abs(pixel.r) < Mathf.Epsilon && Mathf.Abs(pixel.g) < Mathf.Epsilon && Mathf.Abs(pixel.b) < Mathf.Epsilon)
                    {
                        flag = true;
                    }
                    else if (pixel.r > pixel.g && pixel.r > pixel.b)
                    {
                        dragChannelRed(hitInfo.textureCoord, component);
                        flag = false;
                    }
                    else if (pixel.g > pixel.r && pixel.g > pixel.b)
                    {
                        dragChannelGreen(hitInfo.textureCoord, component);
                        flag = false;
                    }
                    else
                    {
                        dragChannelBlue(hitInfo.textureCoord, component);
                        flag = false;
                    }
                }
            }
            if (flag)
            {
                dragContainer.Show();
                setRelativeIconPostion(touchPosition);
                if (channelUpdated != 0)
                {
                    dragChannelNone();
                }
            }
            else
            {
                dragContainer.Hide(instant: true);
            }
        }