当前位置: 首页>>代码示例>>C#>>正文


C# Base.addHiredScientist方法代码示例

本文整理汇总了C#中Base.addHiredScientist方法的典型用法代码示例。如果您正苦于以下问题:C# Base.addHiredScientist方法的具体用法?C# Base.addHiredScientist怎么用?C# Base.addHiredScientist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Base的用法示例。


在下文中一共展示了Base.addHiredScientist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnGUI

    void OnGUI()
    {
        //Try to create a pop-up window
        if(popUpWindow){
            GUI.Window (1,new Rect(Screen.width/3,Screen.height/3,Screen.width/3,Screen.height/3),createPopUpWindow,"");
        }
        if(equipMenu){
            //GUI.Window (2,new Rect(Screen.width/4,Screen.height/4,Screen.width/2,Screen.height/2),createEquipWindow,"");
        }

        curBase = gameManager.Instance.getCurrentBase();
        //Left portion of screen
        GUI.skin = toggleSkin;
        if(GUI.Toggle (new Rect(0,0,Screen.width/8,Screen.height*0.1f),soldierToggle,"Soldier")){
            soldierToggle=true;
            scientistToggle=false;
            workerToggle=false;
            pilotToggle=false;
        }
        if(GUI.Toggle(new Rect(Screen.width*1/8,0,Screen.width/8,Screen.height*0.1f),scientistToggle,"Scientist")){
            soldierToggle=false;
            scientistToggle=true;
            workerToggle=false;
            pilotToggle=false;
        }
        if(GUI.Toggle(new Rect(Screen.width*2/8,0,Screen.width/8,Screen.height*0.1f),workerToggle,"Worker")){
            soldierToggle=false;
            scientistToggle=false;
            workerToggle=true;
            pilotToggle=false;
        }
        if(GUI.Toggle(new Rect(Screen.width*3/8,0,Screen.width/8,Screen.height*0.1f),pilotToggle,"Pilot")){
            soldierToggle=false;
            scientistToggle=false;
            workerToggle=false;
            pilotToggle=true;
        }
        //GUI for the Right Side of the Screen
        GUI.Label (new Rect(Screen.width/2+Screen.width*1/10,0,Screen.width*2/10,Screen.height*0.1f),"Money: "+gameManager.Instance.getMoney ());
        GUI.skin = null;

        if(GUI.Button (new Rect(Screen.width/2+Screen.width*4/10,0,Screen.width/10,Screen.height*0.1f),"Back")){
            //Changing state to get back to base manager
            gameManager.Instance.setLevel("BaseManager");
        }
        GUI.Box (new Rect(Screen.width/2,Screen.height*0.1f+2,Screen.width/2,Screen.height*0.1f),"");
        //GUI.Box(new Rect(Screen.width/2,Screen.height*0.3f+2,Screen.width/2,Screen.height*0.7f-2),"Employee Information");
        if(selectionSoldierExist){
            if(soldierToggle){
                GUI.Label (new Rect(Screen.width/2*1.1f,Screen.height*0.2f,200,20),"Employee Name:");
                string tempName = getSoldier(selectedSoldier).getName();
                string newName = tempName;
                //GUI.TextField(new Rect(Screen.width/2*1.1f,Screen.height*0.35f+25,Screen.width/2*0.8f,20),newName);
                newName = GUI.TextField(new Rect(Screen.width/2*1.1f,Screen.height*0.2f+20,Screen.width/2*0.8f,20),newName,40);
                if(tempName!=newName){
                    changeSoldierName(selectedSoldier,newName);
                }
            }
        }
        if(selectionNameExist&&!soldierToggle){
            GUI.Label (new Rect(Screen.width/2*1.1f,Screen.height*0.35f,200,20),"Employee Name:");
            if(scientistToggle){
                string check = nameSelectedEmployee.Substring (0,4);
                if(check.Equals ("Dr. ")){
                    string tempName = nameSelectedEmployee;
                    nameSelectedEmployee = nameSelectedEmployee.Substring(4, nameSelectedEmployee.Length-4);
                    nameSelectedEmployee = GUI.TextField(new Rect(Screen.width/2*1.1f,Screen.height*0.35f+25,Screen.width/2*0.8f,20),nameSelectedEmployee,40);
                    nameSelectedEmployee = "Dr. "+nameSelectedEmployee;
                    if (tempName!=nameSelectedEmployee){
                        if(afhScientists.Remove(tempName)){
                            afhScientists.AddLast (nameSelectedEmployee);
                        }else{
                            curBase.removeHiredScientist(tempName);
                            curBase.addHiredScientist(nameSelectedEmployee);
                        }
                    }
                    GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.5f+(25)*10,Screen.width/2*0.8f,20),"Yearly Salary: $"+EMPLOYEEWAGE);
                    DateTime temp1 = gameManager.Instance.getTime (),temp2 = new DateTime(temp1.Year+1,1,1);
                    TimeSpan span= temp2.Subtract(temp1);
                    int salary = (int)((Double)EMPLOYEEWAGE * 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);
                }
            }else if(workerToggle){
                if(nameSelectedEmployee.Length>=6){
                    string check = nameSelectedEmployee.Substring (0,7);
                    if(check.Equals ("Worker ")){
                        string tempName = nameSelectedEmployee;
                        nameSelectedEmployee = nameSelectedEmployee.Substring(7, nameSelectedEmployee.Length-7);
                        nameSelectedEmployee = GUI.TextField(new Rect(Screen.width/2*1.1f,Screen.height*0.35f+25,Screen.width/2*0.8f,20),nameSelectedEmployee,40);
                        nameSelectedEmployee = "Worker "+nameSelectedEmployee;
                        if (tempName!=nameSelectedEmployee){
                            if(afhWorkers.Remove(tempName)){
                                afhWorkers.AddLast (nameSelectedEmployee);
                            }else{
                                curBase.removeHiredWorker(tempName);
                                curBase.addHiredWorker(nameSelectedEmployee);
                            }
                        }
                    }
                    GUI.Label (new Rect(Screen.width/2*1.2f,Screen.height*0.5f+(25)*10,Screen.width/2*0.8f,20),"Yearly Salary: $"+EMPLOYEEWAGE);
//.........这里部分代码省略.........
开发者ID:jshamash,项目名称:psalmon-xcom,代码行数:101,代码来源:EmployeeScript.cs


注:本文中的Base.addHiredScientist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。