Ejemplo n.º 1
0
    void OnValidate()
    {
        MJAData.fontResolution = fontResolution;
        MJAData.textScale      = textScale;
        MJAData.lineSpacing    = lineSpacing;
        MJAData.mainImageSize  = mainImageSize;
        MJAData.maxLines       = maxLines;

        if (listView != null)
        {
            listView.Reshape();
        }
        if (detailView != null)
        {
            detailView.Reshape();
        }
    }
Ejemplo n.º 2
0
    void Update()
    {
        bool moved = false;

        if (inList)
        {
            if (UnityEngine.Input.GetKeyDown(KeyCode.DownArrow))
            {
                moved = listView.Move(1);
                listView.Update();
            }
            else if (UnityEngine.Input.GetKeyDown(KeyCode.UpArrow))
            {
                moved = listView.Move(-1);
                listView.Update();
            }
            else if (UnityEngine.Input.GetKeyDown(KeyCode.Return))
            {
                inList = false;
                detailView.Move(0);
                listView.Cleanup();
                listView = detailView.CreateListView();
                listView.transform.position = spawnPosition;
                listView.Update();
            }
            if (moved)
            {
                detailView.SetId(listView.CurrentId);
            }
        }
        else
        {
            if (UnityEngine.Input.GetKeyDown(KeyCode.DownArrow))
            {
                moved = detailView.Move(1);
                detailView.Update();
            }
            else if (UnityEngine.Input.GetKeyDown(KeyCode.UpArrow))
            {
                moved = detailView.Move(-1);
                detailView.Update();
            }
            else if (UnityEngine.Input.GetKeyDown(KeyCode.Return))
            {
                inList = true;
                listView.Move(0);
                detailView.Cleanup();
                detailView = listView.CreateDetailView();
                detailView.transform.position = spawnPosition;
                detailView.Reshape();
            }
            if (moved)
            {
                listView.Cleanup();
                listView = detailView.CreateListView();
                listView.transform.position = spawnPosition;
                listView.Update();
            }
        }

        // move the two panels into place
        if (inList)
        {
            listView.transform.position   = Vector3.Lerp(listView.transform.position, leftPosition, 0.2f);
            detailView.transform.position = Vector3.Lerp(detailView.transform.position, rightPosition, 0.2f);
        }
        else
        {
            listView.transform.position   = Vector3.Lerp(listView.transform.position, rightPosition, 0.2f);
            detailView.transform.position = Vector3.Lerp(detailView.transform.position, leftPosition, 0.2f);
        }
    }