示例#1
0
        public void Update(GameObject component)
        {
            if (_holderGameObject == null)
            {
                Logger.AppendLine("DeckTileHolder.Update - _holderGameObject is null");
                _holderGameObject = new GameObject();
                _holderGameObject.transform.localScale = Vector3.one;
                var goCamera      = CameraUtils.FindFirstByLayer(component.gameObject.layer);
                var mousePosition = Input.mousePosition;
                mousePosition.z = goCamera.nearClipPlane + 1.0f;
                mousePosition.x = WidthAtScale;
                var mouseWorldPos = goCamera.ScreenToWorldPoint(mousePosition);
                _holderGameObject.transform.localPosition = mouseWorldPos;
                _holderGameObject.transform.localScale    = new Vector3(0.01f, 0.01f, 0.01f);

                _tileDict.Clear();
                while (_tiles.Count > 0)
                {
                    var index = _tiles.Count - 1;
                    var tile  = _tiles[index];
                    Object.Destroy(tile.Tile.gameObject);
                    _tiles.RemoveAt(index);
                }
            }
            else
            {
                var goCamera      = CameraUtils.FindFirstByLayer(component.gameObject.layer);
                var mousePosition = Input.mousePosition;
                mousePosition.z = goCamera.nearClipPlane + 1.0f;
                mousePosition.x = WidthAtScale;
                var mouseWorldPos = goCamera.ScreenToWorldPoint(mousePosition);
                _holderGameObject.transform.localPosition = mouseWorldPos;
            }
        }
示例#2
0
    private void InitInputBlocker()
    {
        Camera camera      = CameraUtils.FindFirstByLayer(base.gameObject.layer);
        float  worldOffset = this.m_Bones.m_InputBlocker.position.z - base.transform.position.z;

        this.m_inputBlocker = CameraUtils.CreateInputBlocker(camera, "QuickChatInputBlocker", this, worldOffset).AddComponent <PegUIElement>();
        this.m_inputBlocker.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnInputBlockerReleased));
    }
示例#3
0
    private void InitInputBlocker()
    {
        GameObject obj2 = CameraUtils.CreateInputBlocker(CameraUtils.FindFirstByLayer(base.gameObject.layer), "RecruitAFriendInputBlocker", this);

        obj2.transform.position = this.m_Bones.m_InputBlocker.position;
        this.m_inputBlocker     = obj2.AddComponent <PegUIElement>();
        this.m_inputBlocker.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnInputBlockerReleased));
    }
示例#4
0
    private void TrackPressed(UIEvent e)
    {
        Camera camera    = CameraUtils.FindFirstByLayer(base.gameObject.layer);
        Plane  dragPlane = new Plane(-camera.transform.forward, this.track.transform.position);
        float  num       = Mathf.Clamp(this.GetTouchPoint(dragPlane, camera).y, this.thumbMax.position.y, this.thumbMin.position.y);

        this.list.ScrollValue = (num - this.thumbMin.position.y) / (this.thumbMax.position.y - this.thumbMin.position.y);
    }
    private void InitInputBlocker()
    {
        GameObject obj2 = CameraUtils.CreateInputBlocker(CameraUtils.FindFirstByLayer(base.gameObject.layer), "AddFriendInputBlocker");

        obj2.transform.parent = base.transform.parent;
        this.m_inputBlocker   = obj2.AddComponent <PegUIElement>();
        this.m_inputBlocker.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnInputBlockerReleased));
        TransformUtil.SetPosZ(this.m_inputBlocker, base.transform.position.z + 1f);
    }
    protected virtual void Awake()
    {
        GameObject obj2 = (GameObject)GameUtils.InstantiateGameObject(this.m_menuDefPrefab, null, false);

        this.m_menu = obj2.GetComponent <ButtonListMenuDef>();
        OverlayUI.Get().AddGameObject(base.gameObject, CanvasAnchor.CENTER, false, CanvasScaleMode.HEIGHT);
        this.SetTransform();
        this.m_blocker = CameraUtils.CreateInputBlocker(CameraUtils.FindFirstByLayer(obj2.layer), "GameMenuInputBlocker", this, obj2.transform, 10f).AddComponent <PegUIElement>();
        FatalErrorMgr.Get().AddErrorListener(new FatalErrorMgr.ErrorCallback(this.OnFatalError));
        this.m_blocker.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnBlockerRelease));
    }
示例#7
0
    public void ShowSocialTooltip(GameObject targetObject, string headline, string bodytext, float scale, GameLayer layer)
    {
        this.ShowTooltip(headline, bodytext, scale, true);
        SceneUtils.SetLayer(this.m_tooltip, layer);
        Camera camera  = CameraUtils.FindFirstByLayer(targetObject.layer);
        Camera camera2 = CameraUtils.FindFirstByLayer(this.m_tooltip.layer);

        if (camera != camera2)
        {
            Vector3 position = camera.WorldToScreenPoint(this.m_tooltip.transform.position);
            Vector3 vector2  = camera2.ScreenToWorldPoint(position);
            this.m_tooltip.transform.position = vector2;
        }
    }
    private Rect ComputeBounds()
    {
        Camera  camera = CameraUtils.FindFirstByLayer(base.gameObject.layer);
        Vector2 lhs    = camera.WorldToScreenPoint(this.inputTopLeft.transform.position);
        Vector2 rhs    = camera.WorldToScreenPoint(this.inputBottomRight.transform.position);

        lhs.y = Screen.height - lhs.y;
        rhs.y = Screen.height - rhs.y;
        Vector2 vector3 = Vector2.Min(lhs, rhs);
        Vector2 vector4 = Vector2.Max(lhs, rhs);
        float   left    = Mathf.Round(vector3.x);
        float   right   = Mathf.Round(vector4.x);

        return(Rect.MinMaxRect(left, Mathf.Round(vector3.y), right, Mathf.Round(vector4.y)));
    }
    private bool Init()
    {
        if (this.m_MaskCamera != null)
        {
            return(false);
        }
        if (this.m_MaskCameraGameObject != null)
        {
            UnityEngine.Object.Destroy(this.m_MaskCameraGameObject);
        }
        this.m_RenderCamera = !this.m_UseCameraFromLayer ? Camera.main : CameraUtils.FindFirstByLayer(this.m_CameraFromLayer);
        if (this.m_RenderCamera == null)
        {
            return(false);
        }
        this.m_MaskCameraGameObject = new GameObject("MaskCamera");
        SceneUtils.SetLayer(this.m_MaskCameraGameObject, GameLayer.CameraMask);
        this.m_MaskCameraGameObject.transform.parent        = this.m_RenderCamera.gameObject.transform;
        this.m_MaskCameraGameObject.transform.localPosition = Vector3.zero;
        this.m_MaskCameraGameObject.transform.localRotation = Quaternion.identity;
        this.m_MaskCameraGameObject.transform.localScale    = Vector3.one;
        int num = GameLayer.CameraMask.LayerBit();

        foreach (GameLayer layer in this.m_CullingMasks)
        {
            num |= layer.LayerBit();
        }
        this.m_MaskCamera = this.m_MaskCameraGameObject.AddComponent <Camera>();
        this.m_MaskCamera.CopyFrom(this.m_RenderCamera);
        this.m_MaskCamera.clearFlags  = CameraClearFlags.Nothing;
        this.m_MaskCamera.cullingMask = num;
        this.m_MaskCamera.depth       = this.m_RenderCamera.depth + 1f;
        if (this.m_ClipObjects == null)
        {
            this.m_ClipObjects = base.gameObject;
        }
        foreach (Transform transform in this.m_ClipObjects.GetComponentsInChildren <Transform>())
        {
            GameObject gameObject = transform.gameObject;
            if (gameObject != null)
            {
                SceneUtils.SetLayer(gameObject, GameLayer.CameraMask);
            }
        }
        this.UpdateCameraClipping();
        UniversalInputManager.Get().AddCameraMaskCamera(this.m_MaskCamera);
        return(true);
    }
示例#10
0
    public void Drag()
    {
        float   num;
        Vector3 min    = this.m_track.GetComponent <BoxCollider>().bounds.min;
        Camera  camera = CameraUtils.FindFirstByLayer(this.m_track.layer);
        Plane   plane  = new Plane(-camera.transform.forward, min);
        Ray     ray    = camera.ScreenPointToRay(UniversalInputManager.Get().GetMousePosition());

        if (plane.Raycast(ray, out num))
        {
            Vector3 vector2 = base.transform.InverseTransformPoint(ray.GetPoint(num));
            TransformUtil.SetLocalPosZ(this.m_thumb.gameObject, Mathf.Clamp(vector2.z, this.m_sliderStartLocalPos.z, this.m_sliderEndLocalPos.z));
            this.m_scrollValue = Mathf.Clamp01((vector2.z - this.m_sliderStartLocalPos.z) / (this.m_sliderEndLocalPos.z - this.m_sliderStartLocalPos.z));
            this.UpdateScrollAreaPosition(false);
        }
    }
示例#11
0
    private void ShowInput()
    {
        this.m_inputText.gameObject.SetActive(false);
        Camera camera = CameraUtils.FindFirstByLayer(base.gameObject.layer);
        Bounds bounds = this.m_inputText.GetBounds();
        Rect   rect   = CameraUtils.CreateGUIViewportRect(camera, bounds.min, bounds.max);

        UniversalInputManager.TextInputParams parms = new UniversalInputManager.TextInputParams {
            m_owner             = base.gameObject,
            m_password          = true,
            m_rect              = rect,
            m_updatedCallback   = new UniversalInputManager.TextInputUpdatedCallback(this.OnInputUpdated),
            m_completedCallback = new UniversalInputManager.TextInputCompletedCallback(this.OnInputComplete),
            m_canceledCallback  = new UniversalInputManager.TextInputCanceledCallback(this.OnInputCanceled),
            m_font              = this.m_inputText.TrueTypeFont,
            m_alignment         = 4,
            m_maxCharacters     = (this.m_challengeType != ChallengeType.CVV) ? 0 : 4
        };
        UniversalInputManager.Get().UseTextInput(parms, false);
    }
示例#12
0
    private void ShowInput()
    {
        this.m_quantityText.gameObject.SetActive(false);
        Camera camera = CameraUtils.FindFirstByLayer(base.gameObject.layer);
        Bounds bounds = this.m_quantityText.GetBounds();
        Rect   rect   = CameraUtils.CreateGUIViewportRect(camera, bounds.min, bounds.max);

        UniversalInputManager.TextInputParams parms = new UniversalInputManager.TextInputParams {
            m_owner                        = base.gameObject,
            m_number                       = true,
            m_rect                         = rect,
            m_updatedCallback              = new UniversalInputManager.TextInputUpdatedCallback(this.OnInputUpdated),
            m_completedCallback            = new UniversalInputManager.TextInputCompletedCallback(this.OnInputComplete),
            m_canceledCallback             = new UniversalInputManager.TextInputCanceledCallback(this.OnInputCanceled),
            m_font                         = this.m_quantityText.GetLocalizedFont(),
            m_alignment                    = 4,
            m_maxCharacters                = 2,
            m_touchScreenKeyboardHideInput = true
        };
        UniversalInputManager.Get().UseTextInput(parms, false);
    }
示例#13
0
    protected virtual void Awake()
    {
        s_instance = this;
        CollectionManager.Get().RegisterAchievesCompletedListener(new CollectionManager.DelOnAchievesCompleted(this.OnCollectionAchievesCompleted));
        AchieveManager.Get().TriggerLaunchDayEvent();
        AchieveManager.Get().UpdateActiveAchieves(new AchieveManager.ActiveAchievesUpdatedCallback(this.OnAchievesUpdated));
        this.m_hitbox.gameObject.SetActive(false);
        string key = "GLOBAL_CLICK_TO_CONTINUE";

        if (UniversalInputManager.Get().IsTouchMode())
        {
            key = "GLOBAL_CLICK_TO_CONTINUE_TOUCH";
        }
        this.m_continueText.Text = GameStrings.Get(key);
        this.m_continueText.gameObject.SetActive(false);
        PegUI.Get().SetInputCamera(CameraUtils.FindFirstByLayer(GameLayer.IgnoreFullScreenEffects));
        SceneUtils.SetLayer(this.m_hitbox.gameObject, GameLayer.IgnoreFullScreenEffects);
        SceneUtils.SetLayer(this.m_continueText.gameObject, GameLayer.IgnoreFullScreenEffects);
        if (!Network.ShouldBeConnectedToAurora())
        {
            this.UpdateRewards();
        }
    }