Beispiel #1
0
    void OnGUI()
    {
        //guitext.text = theMakeMode.ToString();
        if(theMakeMode==TheMakeModes.BrowseObj){
            GUI.skin = guiskin;

            selectedChair = GUI.SelectionGrid(new Rect(0,0,Screen.width,btnSize),selectedChair,texChairs,5);
            selectedLamp = GUI.SelectionGrid(new Rect(0,btnSize,Screen.width,btnSize),selectedLamp,texLamps,5);

            if(selectedChair!=-1){
                currentChair = selectedChair;
                Move (goChairs[currentChair].transform,curChair.transform.position);
                curChair = goChairs[currentChair];
                MoveElsewhereBut(goChairs,currentChair);
                curActive = curChair;
                selectedChair=-1;
            }
            if(selectedLamp!=-1){
                currentLamp = selectedLamp;
                Move (goLamps[currentLamp].transform,curLamp.transform.position);
                curLamp = goLamps[currentLamp];
                MoveElsewhereBut(goLamps,currentLamp);
                curActive = curLamp;
                selectedLamp=-1;
            }

            if(currentChair!=-1){
                GUI.DrawTexture(new Rect(currentChair*btnSize,0,btnSize,btnSize),texChairsGreen[currentChair]);
            }
            if(currentLamp!=-1){
                GUI.DrawTexture(new Rect(currentLamp*btnSize,btnSize,btnSize,btnSize),texLampsGreen[currentLamp]);
            }

            if(Input.touchCount==1){
                if(Input.GetTouch(0).phase==TouchPhase.Began){
                    touchStart = Input.GetTouch(0).position;
                    touchEnd = touchStart;
                }else if(Input.GetTouch (0).phase == TouchPhase.Ended){
                    touchEnd = Input.GetTouch (0).position;

                    float diff = (touchEnd.y-touchStart.y);
                    if(diff>280f){
                        theMakeMode = TheMakeModes.Default;
                        //guitext.text = touchEnd.ToString()+" "+touchStart.ToString()+" "+diff.ToString();
                    }
                    touchStart=touchEnd;
                }

            }
            /*
            GUI.skin = guiblackish;
            if(GUI.Button (new Rect(margin,Screen.height - margin - btnSize,btnSize,btnSize),"<")){
                theMakeMode=TheMakeModes.Default;
            }*/

        }else{
            GUI.DrawTexture(rectTopStrip,texTopStrip);

            GUI.skin = guiblackish;

                if(GUI.Button (rectTopRight2,texBrowseObj)){
                    theMakeMode=TheMakeModes.BrowseObj;
                }

            if(GUI.Button(rectTopLeft,texSearch)){
                // TODO **************** back to model search screen

            }

            if(GUI.Button (rectTopRight3,texSeeThru)){
                ToggleSeeThru();
            }

            if(theMakeMode == TheMakeModes.Share){
                if(GUI.Button (rectTopRight,texShare)){
                    theMakeMode=TheMakeModes.Default;
                }

                // TODO ****************** add social
                if(GUI.Button (rectBottom1,texTwitter)){

                }
                if(GUI.Button (rectBottom2,texFacebook)){

                }
                if(GUI.Button (rectBottom3,texGoogle)){

                }
                if(GUI.Button (rectBottom4,texTumblr)){

                }
                if(GUI.Button (rectBottom5,texFlickr)){

                }
            }else{
                if(GUI.Button (rectTopRight,texShare)){
                    theMakeMode=TheMakeModes.Share;
                }
            }
        }
    }
Beispiel #2
0
    void OnGUI()      //guitext.text = theMakeMode.ToString();
    {
        if (theMakeMode == TheMakeModes.BrowseObj)
        {
            GUI.skin = guiskin;

            selectedChair = GUI.SelectionGrid(new Rect(0, 0, Screen.width, btnSize), selectedChair, texChairs, 5);
            selectedLamp  = GUI.SelectionGrid(new Rect(0, btnSize, Screen.width, btnSize), selectedLamp, texLamps, 5);

            if (selectedChair != -1)
            {
                currentChair = selectedChair;
                Move(goChairs[currentChair].transform, curChair.transform.position);
                curChair = goChairs[currentChair];
                MoveElsewhereBut(goChairs, currentChair);
                curActive     = curChair;
                selectedChair = -1;
            }
            if (selectedLamp != -1)
            {
                currentLamp = selectedLamp;
                Move(goLamps[currentLamp].transform, curLamp.transform.position);
                curLamp = goLamps[currentLamp];
                MoveElsewhereBut(goLamps, currentLamp);
                curActive    = curLamp;
                selectedLamp = -1;
            }

            if (currentChair != -1)
            {
                GUI.DrawTexture(new Rect(currentChair * btnSize, 0, btnSize, btnSize), texChairsGreen[currentChair]);
            }
            if (currentLamp != -1)
            {
                GUI.DrawTexture(new Rect(currentLamp * btnSize, btnSize, btnSize, btnSize), texLampsGreen[currentLamp]);
            }

            if (Input.touchCount == 1)
            {
                if (Input.GetTouch(0).phase == TouchPhase.Began)
                {
                    touchStart = Input.GetTouch(0).position;
                    touchEnd   = touchStart;
                }
                else if (Input.GetTouch(0).phase == TouchPhase.Ended)
                {
                    touchEnd = Input.GetTouch(0).position;

                    float diff = (touchEnd.y - touchStart.y);
                    if (diff > 280f)
                    {
                        theMakeMode = TheMakeModes.Default;
                        //guitext.text = touchEnd.ToString()+" "+touchStart.ToString()+" "+diff.ToString();
                    }
                    touchStart = touchEnd;
                }
            }

            /*
             * GUI.skin = guiblackish;
             * if(GUI.Button (new Rect(margin,Screen.height - margin - btnSize,btnSize,btnSize),"<")){
             *      theMakeMode=TheMakeModes.Default;
             * }*/
        }
        else
        {
            GUI.DrawTexture(rectTopStrip, texTopStrip);


            GUI.skin = guiblackish;

            if (GUI.Button(rectTopRight2, texBrowseObj))
            {
                theMakeMode = TheMakeModes.BrowseObj;
            }


            if (GUI.Button(rectTopLeft, texSearch))
            {
                // TODO **************** back to model search screen
            }


            if (GUI.Button(rectTopRight3, texSeeThru))
            {
                ToggleSeeThru();
            }

            if (theMakeMode == TheMakeModes.Share)
            {
                if (GUI.Button(rectTopRight, texShare))
                {
                    theMakeMode = TheMakeModes.Default;
                }

                // TODO ****************** add social
                if (GUI.Button(rectBottom1, texTwitter))
                {
                }
                if (GUI.Button(rectBottom2, texFacebook))
                {
                }
                if (GUI.Button(rectBottom3, texGoogle))
                {
                }
                if (GUI.Button(rectBottom4, texTumblr))
                {
                }
                if (GUI.Button(rectBottom5, texFlickr))
                {
                }
            }
            else
            {
                if (GUI.Button(rectTopRight, texShare))
                {
                    theMakeMode = TheMakeModes.Share;
                }
            }
        }
    }