Exemplo n.º 1
0
    void OnGUI()
    {
        GUI.skin = skin;
        GUI.Box(new Rect(55, 0, 370, 30), titleName, "Title");
        GUI.Label(new Rect(430, 0, 50, 50), iconScene, "LabelNormal");
        if(!GS.showingItemDetail)
        {
            if(!GS.pressAvatar)
            {

                GS.DrawAvatar();
                //draw percent of wareHouse
                GUI.Label(new Rect(50, 35, 150, 25), "Money: "+ GS.money);
                    GS.drawStretch(1, new Rect(200, 35, 200, 25), GS.currentWareHouse,
                        GS.wareHouse, true);

                GUIStyle style = new GUIStyle(GUI.skin.customStyles[2]);
                style.fontSize = 18;
                style.fontStyle = FontStyle.Bold;
                if(NuItem>0)
                {

                    GUI.Label(new Rect(50, 60, 70, 30), " Name ", style);
                    GUI.Label(new Rect(120, 60, 55, 30), "| Price ", style);
                    GUI.Label(new Rect(175, 60, 70, 30), "| vMana ", style);
                    GUI.Label(new Rect(245, 60, 70, 30), "| vBlood ", style);
                    GUI.Label(new Rect(315, 60, 75, 30), "| %Attack ", style);
                    GUI.Label(new Rect(390, 60, 90, 30), "| %Defence", style);

                    GUI.Box(new Rect(-5, 80, 485, 200), "", "BoxGroup1");
                    scrollViewVector = GUI.BeginScrollView (new Rect(6, 88, 465, 177), scrollViewVector, new Rect (0, 0, 449, (50*NuItem>177)?(50*NuItem):178)); //63 is height of a skill row
                        for(int i = 0; i<NuItem; i++)
                        {
                            drawItemRow(i, 449, 50);
                        }
                    GUI.EndScrollView();
                }
                else{
                    GUI.Box(new Rect(0, 50, 476, 220), "You have no skill", "BoxGroup1");
                }

                GUI.Label(new Rect(10, 270, 50, 50), iconBack);
                if(GUI.Button(new Rect(10, 270, 50, 50), "", "ButtonCover"))
                {
                    Application.LoadLevel("Screen10");
                }
                if(GUI.Button(new Rect(190, 275, 100, 40), "Buy", "ButtonGeneral"))
                {
                    if(selectingItem!=-1 && GS.money>=listItem[selectingItem].priceBuy)
                    {
                        GS.money -= listItem[selectingItem].priceBuy;
                        WareHouse ser=new WareHouse();
                        //update money
                        int a=ser.UpdateMoneyUser(GS.idUser,GS.money);
                        //update ware house
                        a=ser.BuyItem(GS.idUser,listItem[selectingItem].id);
                    }
                    else
                    {
                        showMoneyLow =true;
                    }
                }
                if(GUI.Button(new Rect(420, 270, 50, 50), "",  "buttonMore"))
                {
                    if(selectingItem!=-1)
                    {
                        GS.loadItemDetail(selectingItem);
                        GS.showingItemDetail = true;
                    }
                }
            }
            else{
                GS.PressAvatar();
            }
        }
        else
        {
            GS.showItemDetail();
        }
    }