コード例 #1
0
        void Awake()
        {
            IM = GameObject.FindGameObjectWithTag("InputManager").GetComponent<InputManager>();
            GM = GUIManager.Instance;
            EM = EventManager.Instance;

            camera.enabled = false;
            camera.rect = objectViewArea;

            // this box goes to GUIManager, who will render it behind the camera render, creating borders.
            showboxEdge = new Rect(objectViewArea.x * Screen.width - edgeStyleForShowbox.border.left,
                                   objectViewArea.y * Screen.height - edgeStyleForShowbox.border.top,
                                   objectViewArea.width * Screen.width + edgeStyleForShowbox.border.right*2,
                                   objectViewArea.height * Screen.height + edgeStyleForShowbox.border.bottom*2);

            textbox = ((GameObject)Instantiate(pagedTextPrefab)).GetComponent<PagedTextbox>();
            textbox.SetPosition(Screen.width*textboxViewArea.x, Screen.height*textboxViewArea.y);
            // textbox is a4 shaped now: setting x wont matter
            textbox.SetSize(Screen.height*textboxViewArea.height / Mathf.Sqrt(2), Screen.height*textboxViewArea.height);
            textbox.Show = false;

            closeButtonRect = new Rect(Screen.width - closeButton.width, 0, closeButton.width, closeButton.height);

            EM.ViewHistoricalObject += HandleViewHistoricalObject;
            EM.HideHistoricalObject += HandleHideHistoricalObject;
        }
コード例 #2
0
        // Use this for initialization
        void Start()
        {
            EM = EventManager.Instance;
            gm = GameObject.FindGameObjectWithTag("GUIManager").GetComponent<GUIManager>();

            textbox = ((GameObject)Instantiate(textboxPrefab)).GetComponent<PagedTextbox>();
            textboxwidthofheightp =textboxheightp/Mathf.Sqrt(2);

            studentr = new Rect(0,0,studenttexture.width,studenttexture.height);
            studentr = PH.ScaleToRatio(studentr);

            float textx = studentr.width + 10;
            float texty = Screen.height * (1-textboxheightp)/2;
            textbox.SetSize(Screen.height*textboxwidthofheightp, Screen.height*textboxheightp);
            textbox.SetPosition(textx, texty);

            studentshow = new Vector3(0, Screen.height - studentr.height);
            studenthide = new Vector3(-studentr.width, studentshow.y);
            studentcurrent = studenthide;

            textshow = new Vector3(textx, texty);
            texthide = new Vector3(textx, Screen.height);
            textcurrent = texthide;

            closeButtonRect = new Rect(Screen.width - closeButton.width, 0, closeButton.width, closeButton.height);

            movet = 0;
            moving = false;

            EM.DisplayLetter += HandleDisplayLetter;
        }