當前位置: 首頁>>代碼示例>>C#>>正文


C# Base.getOccupiedLivingSpace方法代碼示例

本文整理匯總了C#中Base.getOccupiedLivingSpace方法的典型用法代碼示例。如果您正苦於以下問題:C# Base.getOccupiedLivingSpace方法的具體用法?C# Base.getOccupiedLivingSpace怎麽用?C# Base.getOccupiedLivingSpace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Base的用法示例。


在下文中一共展示了Base.getOccupiedLivingSpace方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnGUI


//.........這裏部分代碼省略.........
        }
        if(soldierToggle){
            //GUI for right side of screen

            if(selectionSoldierExist){
                Soldier tempSoldier = getSoldier (selectedSoldier);
                /*
                if(GUI.Button (new Rect(Screen.width/2*1.5f,Screen.height*0.3f+(25)*12,Screen.width/4,Screen.height*0.1f),"Equip Soldier")){
                    //OPEN MENU FOR EQUIPPING SOLDIERS
                    equipMenu = true;
                }
                */
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.3f,Screen.width/2*0.8f,20),"Health: "+tempSoldier.getHealth());
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.3f+(25),Screen.width/2*0.8f,20),"Accuracy: "+tempSoldier.getAccuracy());
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.3f+(25)*2,Screen.width/2*0.8f,20),"Mind state: "+tempSoldier.getMind());
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.3f+(25)*3,Screen.width/2*0.8f,20),"Sniping Skills: "+tempSoldier.getSnipePower());
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.3f+(25)*4,Screen.width/2*0.8f,20),"Assault Skills: "+tempSoldier.getAssaultPower());
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.3f+(25)*5,Screen.width/2*0.8f,20),"Close Combat Skills: "+tempSoldier.getCloseCombatPower());
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.3f+(25)*6,Screen.width/2*0.8f,20),"Number of Aliens Killed: "+tempSoldier.getAliens());
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.3f+(25)*7,Screen.width/2*0.8f,20),"Number of Missions done: "+tempSoldier.getMissions());
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.3f+(25)*8,Screen.width/2*0.8f,20),"Rank: "+ranks[tempSoldier.getRank ()]);
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.3f+(25)*10,Screen.width/2*0.8f,20),"Yearly Salary: $"+SALARIES[tempSoldier.getRank ()]);
                DateTime temp1 = gameManager.Instance.getTime (),temp2 = new DateTime(temp1.Year+1,1,1);
                TimeSpan span= temp2.Subtract(temp1);
                int salary = (int)((Double)SALARIES[tempSoldier.getRank ()] * span.TotalDays/365.242199);
                GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.5f+(25)*11,Screen.width/2*0.8f,20),"Cost of hiring till end of current year: $"+salary);
                //GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.5f+(25)*10,Screen.width/2*0.8f,20),"Date: "+salary);
            }
        }

        //Show # of employees person can hire in current base and # of soldiers/cientists/workers/pilots hired
        GUI.skin = toggleSkin;
        GUI.Label (new Rect(Screen.width/2,Screen.height*0.1f,Screen.width/10,Screen.height*0.1f),"Occupation: "
            +curBase.getOccupiedLivingSpace()+"/"+curBase.getLivingSpace());
        GUI.Label (new Rect(Screen.width/2+Screen.width/10,Screen.height*0.1f,Screen.width/10,Screen.height*0.1f),"Soldiers Hired: "
            +curBase.getNumbSoldiers());
        GUI.Label (new Rect(Screen.width/2+Screen.width*2/10,Screen.height*0.1f,Screen.width/10,Screen.height*0.1f),"Scientists Hired: "
            +curBase.getNumbScientists());
        GUI.Label (new Rect(Screen.width/2+Screen.width*3/10,Screen.height*0.1f,Screen.width/10,Screen.height*0.1f),"Workers Hired: "
            +curBase.getNumbWorkers());
        GUI.Label (new Rect(Screen.width/2+Screen.width*4/10,Screen.height*0.1f,Screen.width/10,Screen.height*0.1f),"Pilots Hired: "
            +curBase.getNumbPilots());
        GUI.skin = null;
        //An absolute-positioned example: We make a scrollview that has a really large client
        // rect and put it in a small rect on the screen.
        scrollPosition = GUI.BeginScrollView (new Rect (0,Screen.height*0.1f,Screen.width/2,Screen.height*0.9f),scrollPosition, new Rect (0, 0, Screen.width/2, scrollbarSize));

        GUI.skin = employeeSkin;
        // Everything under here will be inside the ScollGui View
        if(soldierToggle){
        //GUI for left side of screen
            LinkedList<Soldier> hired = curBase.getHiredSoldiers();
            Soldier[] tempArray1=new Soldier[hired.Count];
            hired.CopyTo (tempArray1,0);
            for(int i = 0;i<hired.Count;i++){
                if(tempArray1[i].getId()==selectedSoldier){
                    GUI.skin = selectedEmployeeSkin;
                }else{
                    GUI.skin = employeeSkin;
                }
                if(GUI.Button (new Rect(Screen.width/2*0.1f,Screen.height*0.10f+(60*i),Screen.width/4*0.90f,50), tempArray1[i].getName ())){
                    selectedSoldier=tempArray1[i].getId ();
                    selectionSoldierExist = true;
                }
                GUI.skin = selectedEmployee;
                if(GUI.Button(new Rect(Screen.width/2*0.60f,Screen.height*0.10f+(60*i),30,30),"")){
開發者ID:jshamash,項目名稱:psalmon-xcom,代碼行數:67,代碼來源:EmployeeScript.cs


注:本文中的Base.getOccupiedLivingSpace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。