Exemple #1
0
        public static void init()
        {
            // Load resource (texture)
            treasure = new GameTexture(0,0,(Texture2D)Resources.Load("Texture/treasure"));

            num=new GameTexture[8];
            for(int i=0;i<8;i++){
                num[i] = new GameTexture(0,0,(Texture2D)Resources.Load("Texture/"+(i+1)));
            }
            treasureBG=new GameTexture[3];
            for(int i=0;i<3;i++){
                treasureBG[i] = new GameTexture(0,0,(Texture2D)Resources.Load("Texture/treasureBG"+(i+1)));
            }
            treasureSelect = new GameTexture(0,0,(Texture2D)Resources.Load("Texture/treasureSelect"));
            treasureRemainBG = new GameTexture(151,73,(Texture2D)Resources.Load("Texture/treasureRemainBG"));

            up=new GameTexture(55,55,(Texture2D)Resources.Load("Texture/up"));
            down=new GameTexture(55,55,(Texture2D)Resources.Load("Texture/down"));
            left=new GameTexture(55,55,(Texture2D)Resources.Load("Texture/left"));
            right=new GameTexture(55,55,(Texture2D)Resources.Load("Texture/right"));

            yoursOthers=new GameTexture(86,100,(Texture2D)Resources.Load("Texture/yoursOthers"));
            yours=new GameTexture(86,50);
            others=new GameTexture(86,50);

            waitForYourTurn=new GameTexture(331,36,(Texture2D)Resources.Load("Texture/waitForYourTurn"));
            youWin=new GameTexture(222,47,(Texture2D)Resources.Load("Texture/youWin"));
            youLost=new GameTexture(232,42,(Texture2D)Resources.Load("Texture/youLost"));

            confirm=new GameTexture(114,32,(Texture2D)Resources.Load("Texture/confirm"));
            endConfirm=new GameTexture(confirm);

            startGame = new GameTexture(188,50,(Texture2D)Resources.Load("Texture/startGame"));
            endGame = new GameTexture(95,50,(Texture2D)Resources.Load("Texture/end"));

            back=new GameTexture(139,50,(Texture2D)Resources.Load("Texture/back"));

            checkingNetwork=new GameTexture(518,46,(Texture2D)Resources.Load("Texture/checkingNetwork"));
            pleaseWait=new GameTexture(400,41,(Texture2D)Resources.Load("Texture/pleaseWait"));

            practice=new GameTexture(224,50,(Texture2D)Resources.Load("Texture/practice"));
            vsComputer=new GameTexture(312,50,(Texture2D)Resources.Load("Texture/vsComputer"));
            vsPlayer=new GameTexture(262,50,(Texture2D)Resources.Load("Texture/vsPlayer"));

            local=new GameTexture(141,50,(Texture2D)Resources.Load("Texture/local"));

            createRoom=new GameTexture(264,50,(Texture2D)Resources.Load("Texture/createRoom"));
            joinGame=new GameTexture(236,50,(Texture2D)Resources.Load("Texture/joinGame"));

            yourIPAddress=new GameTexture(297,41,(Texture2D)Resources.Load("Texture/yourIPAddress"));
            ipAddress=new GameTexture(540,41);
            waitingForConnection=new GameTexture(405,42,(Texture2D)Resources.Load("Texture/waitingForConnection"));

            enterAnotherIP=new GameTexture(330,66,(Texture2D)Resources.Load("Texture/enterAnotherIP"));
            ipSpace=new GameTexture(519,138,(Texture2D)Resources.Load("Texture/ipSpace"));
            ipTextField=new GameTexture(346,92);
            connect=new GameTexture(181,50,(Texture2D)Resources.Load("Texture/connect"));

            synchronization=new GameTexture(452,37,(Texture2D)Resources.Load("Texture/synchronization"));

            easy=new GameTexture(122,50,(Texture2D)Resources.Load("Texture/easy"));
            normal=new GameTexture(144,50,(Texture2D)Resources.Load("Texture/normal"));
            hard=new GameTexture(133,50,(Texture2D)Resources.Load("Texture/hard"));

            commonBackGround = new GameTexture(0,0,(Texture2D)Resources.Load("Texture/commonBackGround"));
            firstPage = new GameTexture(0,0,(Texture2D)Resources.Load("Texture/firstPage"));
            playPage = new GameTexture(0,0,(Texture2D)Resources.Load("Texture/playPage"));

            backPage2=new GameTexture(back);
            backPage4=new GameTexture(back);
            backPage5=new GameTexture(back);
            backPage6=new GameTexture(back);
            backPage7=new GameTexture(back);
            backPage9=new GameTexture(back);
            backGame=new GameTexture(back);

            // set coordinate of each GUI element
            startGame.set(GameGUISettings.screenCenterX-startGame.width/2,GameGUISettings.screenCenterY+startGame.height*3,startGame.width,startGame.height);
            endGame.set(GameGUISettings.screenCenterX-endGame.width/2,GameGUISettings.screenCenterY+endGame.height*4+GameGUISettings.buttonMargin,endGame.width,endGame.height);

            practice.set(GameGUISettings.screenCenterX-practice.width/2,GameGUISettings.screenCenterY-(practice.height+GameGUISettings.buttonMargin)*2,practice.width,practice.height);
            vsComputer.set(GameGUISettings.screenCenterX-vsComputer.width/2,GameGUISettings.screenCenterY-(vsComputer.height+GameGUISettings.buttonMargin),vsComputer.width,vsComputer.height);
            vsPlayer.set(GameGUISettings.screenCenterX-vsPlayer.width/2,GameGUISettings.screenCenterY,vsPlayer.width,vsPlayer.height);
            backPage2.set(GameGUISettings.screenCenterX-back.width/2,GameGUISettings.screenCenterY+(back.height+GameGUISettings.buttonMargin),back.width,back.height);

            checkingNetwork.set(GameGUISettings.screenCenterX-checkingNetwork.width/2,GameGUISettings.screenCenterY-(checkingNetwork.height+GameGUISettings.buttonMargin),checkingNetwork.width,checkingNetwork.height);
            pleaseWait.set(GameGUISettings.screenCenterX-pleaseWait.width/2,GameGUISettings.screenCenterY,pleaseWait.width+GameGUISettings.buttonMargin,pleaseWait.height);

            local.set(GameGUISettings.screenCenterX-local.width/2,GameGUISettings.screenCenterY-(local.height+GameGUISettings.buttonMargin),local.width,local.height);
            backPage4.set(GameGUISettings.screenCenterX-back.width/2,GameGUISettings.screenCenterY+GameGUISettings.buttonMargin,back.width,back.height);

            createRoom.set(GameGUISettings.screenCenterX-createRoom.width/2,GameGUISettings.screenCenterY-(createRoom.height+GameGUISettings.buttonMargin)*3/2,createRoom.width,createRoom.height);
            joinGame.set(GameGUISettings.screenCenterX-joinGame.width/2,GameGUISettings.screenCenterY-(joinGame.height+GameGUISettings.buttonMargin)/2,joinGame.width,joinGame.height);
            backPage5.set(GameGUISettings.screenCenterX-back.width/2,GameGUISettings.screenCenterY+(back.height+GameGUISettings.buttonMargin)/2,back.width,back.height);

            yourIPAddress.set(GameGUISettings.screenCenterX-yourIPAddress.width/2,GameGUISettings.screenCenterY-(yourIPAddress.height+GameGUISettings.buttonMargin)*2,yourIPAddress.width,yourIPAddress.height);
            ipAddress.set(GameGUISettings.screenCenterX-ipAddress.width/2,GameGUISettings.screenCenterY-(ipAddress.height+GameGUISettings.buttonMargin),ipAddress.width,ipAddress.height);
            waitingForConnection.set(GameGUISettings.screenCenterX-waitingForConnection.width/2,GameGUISettings.screenCenterY,waitingForConnection.width,waitingForConnection.height);
            backPage6.set(GameGUISettings.screenCenterX-back.width/2,GameGUISettings.screenCenterY+(back.height+GameGUISettings.buttonMargin),back.width,back.height);

            enterAnotherIP.set(GameGUISettings.screenCenterX-enterAnotherIP.width/2,GameGUISettings.screenCenterY-(enterAnotherIP.height+GameGUISettings.buttonMargin)*2,enterAnotherIP.width,enterAnotherIP.height);
            ipSpace.set(GameGUISettings.screenCenterX-ipSpace.width/2,GameGUISettings.screenCenterY-(ipSpace.height+GameGUISettings.buttonMargin)/3*2,ipSpace.width,ipSpace.height);
            ipTextField.set(GameGUISettings.screenCenterX-ipTextField.width/2,GameGUISettings.screenCenterY-(ipTextField.height+GameGUISettings.buttonMargin)*3/4,ipTextField.width,ipTextField.height);
            connect.set(GameGUISettings.screenCenterX-connect.width/2,GameGUISettings.screenCenterY+(connect.height+GameGUISettings.buttonMargin)/2,connect.width,connect.height);
            backPage7.set(GameGUISettings.screenCenterX-back.width/2,GameGUISettings.screenCenterY+(back.height+GameGUISettings.buttonMargin)*3/2,back.width,back.height);

            synchronization.set(GameGUISettings.screenCenterX-synchronization.width/2,GameGUISettings.screenCenterY-synchronization.height/2,synchronization.width,synchronization.height);

            easy.set(GameGUISettings.screenCenterX-easy.width/2,GameGUISettings.screenCenterY-(easy.height+GameGUISettings.buttonMargin)*2,easy.width,easy.height);
            normal.set(GameGUISettings.screenCenterX-normal.width/2,GameGUISettings.screenCenterY-(normal.height+GameGUISettings.buttonMargin),normal.width,normal.height);
            hard.set(GameGUISettings.screenCenterX-hard.width/2,GameGUISettings.screenCenterY,hard.width,hard.height);
            backPage9.set(GameGUISettings.screenCenterX-back.width/2,GameGUISettings.screenCenterY+(back.height+GameGUISettings.buttonMargin),back.width,back.height);

            up.set(GameGUISettings.screenCenterX-up.width/2,GameGUISettings.buttonOffsetY+GameGUISettings.treasureMargin,up.width,up.height);
            down.set(GameGUISettings.screenCenterX-down.width/2,GameGUISettings.buttonOffsetY+GameGUISettings.treasureMargin+down.height*5/2,down.width,down.height);
            left.set(GameGUISettings.screenCenterX-left.width*15/8,GameGUISettings.buttonOffsetY+GameGUISettings.treasureMargin+left.height*5/4,left.width,left.height);
            right.set(GameGUISettings.screenCenterX+right.width*7/8,GameGUISettings.buttonOffsetY+GameGUISettings.treasureMargin+right.height*5/4,right.width,right.height);

            confirm.set(GameGUISettings.screenCenterX+confirm.width,GameGUISettings.buttonOffsetY+GameGUISettings.treasureMargin+confirm.height*5/2,confirm.width,confirm.height);
            treasureRemainBG.set(GameGUISettings.screenCenterX-treasureRemainBG.width*5/3,GameGUISettings.buttonOffsetY+GameGUISettings.treasureMargin+treasureRemainBG.height*4/5,treasureRemainBG.width,treasureRemainBG.height);

            yoursOthers.set(WindowSettings.startX+yoursOthers.width/5,WindowSettings.startY+yoursOthers.height/5,yoursOthers.width,yoursOthers.height);
            yours.set(WindowSettings.startX+yours.width*6/5,WindowSettings.startY+yoursOthers.height/5,yours.width,yours.height);
            others.set(WindowSettings.startX+others.width*6/5,WindowSettings.startY+yoursOthers.height/5+others.height,others.width,others.height);

            waitForYourTurn.set(GameGUISettings.screenCenterX-waitForYourTurn.width/2,GameGUISettings.buttonOffsetY+waitForYourTurn.height/2,waitForYourTurn.width,waitForYourTurn.height);
            youWin.set(GameGUISettings.screenCenterX-youWin.width/2,GameGUISettings.buttonOffsetY+youWin.height/2,youWin.width,youWin.height);
            youLost.set(GameGUISettings.screenCenterX-youLost.width/2,GameGUISettings.buttonOffsetY+youLost.height/2,youLost.width,youLost.height);
            endConfirm.set(GameGUISettings.screenCenterX-endConfirm.width/2,GameGUISettings.buttonOffsetY+youWin.height*3/2,endConfirm.width,endConfirm.height);

            backGame.set(WindowSettings.startX+WindowSettings.screenWidth-backGame.width*4/3,WindowSettings.startY+backGame.height,backGame.width,backGame.height);
        }