コード例 #1
0
    public void ShowZoomDetail()
    {
        if (CurrentDetail != this)
        {
            //Lazy loading
            if (bPendingInitialization)
            {
                Initialize();
            }

            //Close any open zoom detail that cannot be open when other one is
            if (CurrentDetail && CurrentDetail.CloseOnExternalActivation)
            {
                CurrentDetail.ExitZoomDetail();
            }

            //Setup
            CurrentDetail = this;
            if (ExitTransform == null)
            {
                ExitPoint = new Trans(MyManager.Instance.playerGameObject.transform);
            }
            else
            {
                ExitPoint = new Trans(ExitTransform);
            }

            //Queue smooth transport
            _playerObject.SmoothTransport(new Trans(TargetPosition ? TargetPosition : gameObject.transform), EaseMoveTo.DefaultSmoothTime, null, !ShouldForceRotation);

            if (ZoomCanvas)
            {
                ZoomCanvas.SetActive(true);
            }

            if (OnShown != null)
            {
                OnShown.Invoke();
            }
        }
    }
コード例 #2
0
    public void ExitZoomDetail()
    {
        if (bPendingInitialization)
        {
            Initialize();
        }

        //Remove
        CurrentDetail = null;

        _playerObject.SmoothTransport(ExitPoint, -1, null, !ShouldForceRotation);

        if (ZoomCanvas)
        {
            ZoomCanvas.SetActive(false);
        }

        if (OnExit != null)
        {
            OnExit.Invoke();
        }
    }
コード例 #3
0
    void Awake()
    {
        DetailZoom = GetComponent <ZoomInDetail>();

        //UI Components, search for the text ones
        UnityEngine.UI.Text[] TextComponents = transform.GetComponentsInChildren <UnityEngine.UI.Text>(true);
        foreach (UnityEngine.UI.Text T in TextComponents)
        {
            if (T.gameObject.tag == "ResourceTitle")
            {
                TitleText = T;
            }
            else if (T.gameObject.tag == "ResourceDetail")
            {
                DetailText = T;
            }
        }

        //Image objects and wrappers
        UnityEngine.UI.Image[] ImageComponents = transform.GetComponentsInChildren <UnityEngine.UI.Image>(true);
        foreach (UnityEngine.UI.Image T in ImageComponents)
        {
            if (T.gameObject.tag == "ResourceImageWrapper")
            {
                ContentImage = T;
                ImageWrapper = ContentImage.transform.parent.gameObject;
                break;
            }
        }

        //Look for the optionlist
        ListController    = transform.GetComponentInChildren <ListViewController>(true);
        OptionListWrapper = ListController.transform.parent.gameObject; //Looks awful, but the scroll has always this structure


        if (!TitleText || !DetailText || !ImageWrapper || !OptionListWrapper || !ListController)
        {
            Debug.LogError("UI Components not found, maybe you changed their tag?");
        }

        if (!DetailZoom)
        {
            Debug.LogError("ZoomInDetail component not found, cannot show");
        }

        if (!UI)
        {
            Debug.LogError("No UI Component bound, cannot continue");
        }

        //Generate the dictionary using the serializable keyvalue pair
        _blueprintPrefabs = new Dictionary <TipoContenido, GameObject>();
        foreach (TipoGameObjectValuePair KV in BlueprintPrefabs)
        {
            _blueprintPrefabs.Add(KV.Key, KV.Value);
        }

        //Manually hide, we don't want to start showing resources without them being selected
        UI.SetActive(false);

        //Check for auto open config
        bDeferedOpen = bOpenOnStart;
    }