Exemplo n.º 1
0
        private static void CreateDPad()
        {
            if (!tckGUIobj)
            {
                CreateTouchManager();
            }

            SetupController <DPadUgui>(ref DpadMain, tckGUIobj.transform, "DPad" + FindObjectsOfType <DPadUgui>().Length.ToString(), true);

            DPadUgui dpadTemp = DpadMain.GetComponent <DPadUgui>();

            dpadTemp.normalSprite  = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/ArrowNormal.png");
            dpadTemp.pressedSprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/ArrowPressed.png");
            dpadTemp.MyName        = DpadMain.name;
            dpadTemp.myData.touchzoneRect.sizeDelta = new Vector2(200f, 200f);
            dpadTemp.myData.touchzoneImage.sprite   = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/Touchzone.png");

            SetupController <DPadArrowUgui>(ref DpadArrowUP, DpadMain.transform, "ArrowUP", true, DPadArrowUgui.ArrowTypes.UP);
            SetupController <DPadArrowUgui>(ref DpadArrowDOWN, DpadMain.transform, "ArrowDOWN", true, DPadArrowUgui.ArrowTypes.DOWN);
            SetupController <DPadArrowUgui>(ref DpadArrowLEFT, DpadMain.transform, "ArrowLEFT", true, DPadArrowUgui.ArrowTypes.LEFT);
            SetupController <DPadArrowUgui>(ref DpadArrowRIGHT, DpadMain.transform, "ArrowRIGHT", true, DPadArrowUgui.ArrowTypes.RIGHT);

            DpadArrowUP.GetComponent <Image>().sprite    = dpadTemp.normalSprite;
            DpadArrowDOWN.GetComponent <Image>().sprite  = dpadTemp.normalSprite;
            DpadArrowLEFT.GetComponent <Image>().sprite  = dpadTemp.normalSprite;
            DpadArrowRIGHT.GetComponent <Image>().sprite = dpadTemp.normalSprite;

            DpadMain.transform.localScale = Vector3.one;
            dpadTemp.myData.touchzoneRect.anchoredPosition = RandomPos;
        }
Exemplo n.º 2
0
        private static void CreateDPad()
        {
            if (!tckGUIobj)
            {
                CreateTouchManager();
            }

            SetupController <DPadGuiTexture>(ref DpadMain, tckGUIobj.transform, "DPad" + tckGUIobj.GetComponentsInChildren <DPadGuiTexture>().Length.ToString(), Vector3.zero);

            DPadGuiTexture dpadTemp = DpadMain.GetComponent <DPadGuiTexture>();

            dpadTemp.myData.touchzoneGUITexture         = dpadTemp.GetComponent <GUITexture>();
            dpadTemp.myData.touchzoneGUITexture.color   = ElementTransparency.colorHalfGuiTexture;
            dpadTemp.myData.touchzoneGUITexture.texture = Resources.LoadAssetAtPath <Texture2D>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/Touchzone.png");
            dpadTemp.MyName             = DpadMain.name;
            dpadTemp.myData.ImageWidth  = 12f;
            dpadTemp.myData.ImageHeight = 12f;
            dpadTemp.myData.OffsetX     = Random.Range(-35f, 35f);
            dpadTemp.myData.OffsetY     = Random.Range(-35f, 35f);

            DPadArrowGuiTexture tempArrow = null;

            //
            SetupController <DPadArrowGuiTexture>(ref DpadArrowUP, DpadMain.transform, "ArrowUP", Vector3.zero);
            tempArrow                    = DpadArrowUP.GetComponent <DPadArrowGuiTexture>();
            tempArrow.ArrowType          = DPadArrowBase.ArrowTypes.UP;
            tempArrow.normalTexture      = Resources.LoadAssetAtPath <Texture2D>("Assets/" + nameAbbrev + "/Base/Resources/Textures/ArrowUpNormal.png");
            tempArrow.pressedTexture     = Resources.LoadAssetAtPath <Texture2D>("Assets/" + nameAbbrev + "/Base/Resources/Textures/ArrowUpPressed.png");
            tempArrow.myData.ImageWidth  = 4f;
            tempArrow.myData.ImageHeight = 4f;
            //
            SetupController <DPadArrowGuiTexture>(ref DpadArrowDOWN, DpadMain.transform, "ArrowDOWN", Vector3.zero);
            tempArrow                    = DpadArrowDOWN.GetComponent <DPadArrowGuiTexture>();
            tempArrow.ArrowType          = DPadArrowBase.ArrowTypes.DOWN;
            tempArrow.normalTexture      = Resources.LoadAssetAtPath <Texture2D>("Assets/" + nameAbbrev + "/Base/Resources/Textures/ArrowDownNormal.png");
            tempArrow.pressedTexture     = Resources.LoadAssetAtPath <Texture2D>("Assets/" + nameAbbrev + "/Base/Resources/Textures/ArrowDownPressed.png");
            tempArrow.myData.ImageWidth  = 4f;
            tempArrow.myData.ImageHeight = 4f;
            //
            SetupController <DPadArrowGuiTexture>(ref DpadArrowLEFT, DpadMain.transform, "ArrowLEFT", Vector3.zero);
            tempArrow                    = DpadArrowLEFT.GetComponent <DPadArrowGuiTexture>();
            tempArrow.ArrowType          = DPadArrowBase.ArrowTypes.LEFT;
            tempArrow.normalTexture      = Resources.LoadAssetAtPath <Texture2D>("Assets/" + nameAbbrev + "/Base/Resources/Textures/ArrowLeftNormal.png");
            tempArrow.pressedTexture     = Resources.LoadAssetAtPath <Texture2D>("Assets/" + nameAbbrev + "/Base/Resources/Textures/ArrowLeftPressed.png");
            tempArrow.myData.ImageWidth  = 4f;
            tempArrow.myData.ImageHeight = 4f;
            //
            SetupController <DPadArrowGuiTexture>(ref DpadArrowRIGHT, DpadMain.transform, "ArrowRIGHT", Vector3.zero);
            tempArrow                    = DpadArrowRIGHT.GetComponent <DPadArrowGuiTexture>();
            tempArrow.ArrowType          = DPadArrowBase.ArrowTypes.RIGHT;
            tempArrow.normalTexture      = Resources.LoadAssetAtPath <Texture2D>("Assets/" + nameAbbrev + "/Base/Resources/Textures/ArrowRightNormal.png");
            tempArrow.pressedTexture     = Resources.LoadAssetAtPath <Texture2D>("Assets/" + nameAbbrev + "/Base/Resources/Textures/ArrowRightPressed.png");
            tempArrow.myData.ImageWidth  = 4f;
            tempArrow.myData.ImageHeight = 4f;

            TouchManagerGuiTexture.Obsolete();
        }
        private static void CreateDPad()
        {
            if (!tckGUIobj)
            {
                CreateTouchManager();
            }

            SetupController <DPadSpriteRenderer>(ref DpadMain, tckGUIobj.transform, "DPad" + FindObjectsOfType <DPadSpriteRenderer>().Length.ToString());
            DPadSpriteRenderer dpadTemp = DpadMain.GetComponent <DPadSpriteRenderer>();

            DPadArrowSpriteRenderer tempArrow = null;

            //
            SetupController <DPadArrowSpriteRenderer>(ref DpadArrowUP, DpadMain.transform, "ArrowUP");
            tempArrow                      = DpadArrowUP.GetComponent <DPadArrowSpriteRenderer>();
            tempArrow.ArrowType            = DPadArrowBase.ArrowTypes.UP;
            DpadArrowUP.transform.rotation = Quaternion.Euler(0f, 0f, 90f);
            //
            SetupController <DPadArrowSpriteRenderer>(ref DpadArrowDOWN, DpadMain.transform, "ArrowDOWN");
            tempArrow           = DpadArrowDOWN.GetComponent <DPadArrowSpriteRenderer>();
            tempArrow.ArrowType = DPadArrowBase.ArrowTypes.DOWN;
            DpadArrowDOWN.transform.rotation = Quaternion.Euler(0f, 0f, 270f);
            //
            SetupController <DPadArrowSpriteRenderer>(ref DpadArrowLEFT, DpadMain.transform, "ArrowLEFT");
            tempArrow           = DpadArrowLEFT.GetComponent <DPadArrowSpriteRenderer>();
            tempArrow.ArrowType = DPadArrowBase.ArrowTypes.LEFT;
            DpadArrowLEFT.transform.rotation = Quaternion.Euler(0f, 0f, 180f);
            //
            SetupController <DPadArrowSpriteRenderer>(ref DpadArrowRIGHT, DpadMain.transform, "ArrowRIGHT");
            tempArrow           = DpadArrowRIGHT.GetComponent <DPadArrowSpriteRenderer>();
            tempArrow.ArrowType = DPadArrowBase.ArrowTypes.RIGHT;
            //
            SetupController <TouchzoneResizeEvents>(ref DpadTouchzone, DpadMain.transform, "touchzone");

            dpadTemp.myData.touchzoneSprite    = DpadTouchzone.GetComponent <SpriteRenderer>();
            dpadTemp.myData.touchzoneTransform = DpadTouchzone.transform;

            dpadTemp.myData.touchzoneSprite.sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/Touchzone.png");
            dpadTemp.normalSprite  = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/ArrowNormal.png");
            dpadTemp.pressedSprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/" + nameAbbrev + "/Base/Resources/Sprites/ArrowPressed.png");

            dpadTemp.MyName = DpadMain.name;

            dpadTemp.myData.OffsetX = Random.Range(-50f, 50f);
            dpadTemp.myData.OffsetY = Random.Range(-50f, 50f);

            TouchManagerSpriteRenderer.Obsolete();
        }