Ejemplo n.º 1
0
    void Start()
    {
        guiBackground = (Texture2D)Resources.Load("GUIBackground");
        _readXml      = this.GetComponent <URGData>();

        if (MainUST)
        {
            touchArea.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1f);
        }
        else
        {
            touchArea.SetActive(false);
        }


        _readXml.init();


        if (Enable)
        {
            urg = UrgDevice.GetComponent <Urg>();
            urg.init();

            data.urgPosOffsetx = PlayerPrefs.GetFloat(USTObjs_Name + " URG Offset X");
            data.urgPosOffsety = PlayerPrefs.GetFloat(USTObjs_Name + " URG Offset Y");
            data.urgScalex     = PlayerPrefs.GetFloat(USTObjs_Name + " Scalex", data.urgScalex);
            data.urgScaley     = PlayerPrefs.GetFloat(USTObjs_Name + " Scaley", data.urgScaley);

            data.urgRotate = PlayerPrefs.GetFloat(USTObjs_Name + " Rotate", data.urgRotate);

            data.guiScale = PlayerPrefs.GetInt(USTObjs_Name + " GUI Scale");

            urg.PosOffset = new Vector3(data.urgPosOffsetx, data.urgPosOffsety);
            urg._Scale    = new Vector3(data.urgScalex, data.urgScaley);
            urg.Rotate    = data.urgRotate;

            if (MainUST)
            {
                data.TAoffPosx  = PlayerPrefs.GetFloat(USTObjs_Name + "Touch AreaPosX");
                data.TAoffPosy  = PlayerPrefs.GetFloat(USTObjs_Name + "Touch AreaPosY");
                data.scaleRatex = PlayerPrefs.GetFloat(USTObjs_Name + "Touch Width");
                data.scaleRatey = PlayerPrefs.GetFloat(USTObjs_Name + "Touch Height");

                TAoffPos.x  = data.TAoffPosx;
                TAoffPos.y  = data.TAoffPosy;
                scaleRate.x = data.scaleRatex;
                scaleRate.y = data.scaleRatey;
            }

            urg.DrawMesh = false;

            if (urg != null)
            {
                urg.Connect();
            }

            px = urg.PosOffset.x;
            py = urg.PosOffset.y;

            scalex = urgScale.x;
            scaley = urgScale.y;

            _style.fontSize = data.guiScale;
        }
        else
        {
            if (MainUST)
            {
                touchArea.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0f);
            }
        }
    }