Inheritance: MonoBehaviour
示例#1
0
        public static void PrintAllVehicles()
        {
            int option = MainMenus.ExecuteMenu(PrintSortingOptions, 4);

            List <Vehicle> copyList = new List <Vehicle>(allVehicles);

            if (option == 1)
            {
                copyList.Sort(ByNameAscending);
            }
            else if (option == 2)
            {
                copyList.Sort(ByNameDescending);
            }
            else if (option == 3)
            {
                copyList.Sort(ByPriceAscending);
            }
            else if (option == 4)
            {
                copyList.Sort(ByPriceDescending);
            }

            Console.WriteLine("List of vehicles in the system:");
            foreach (Vehicle v in copyList)
            {
                Console.WriteLine(v);
            }
        }
示例#2
0
    /// <summary>
    /// Sets a menu to active.
    /// </summary>
    /// <param name="aMenu">The menu you would like to set active. Please note see the overloaded method to send a Menu object rather than enumerated type.</param>
    public void SetMenu(MainMenus aMenu)
    {
        switch (aMenu)
        {
        case MainMenus.MainMenu:
            SetMenu(mainMenuUI);
            break;

        case MainMenus.PauseMenu:
            SetMenu(pauseMenuUI);
            break;

        case MainMenus.DialogueMenu:
            SetMenu(dialogueMenuUI);
            break;

        case MainMenus.GameOver:
            SetMenu(gameOverMenuUI);
            break;

        default:
            SetMenu(null);
            break;
        }
    }
示例#3
0
        public static void Menu()
        {
            int optionOperation = MainMenus.ExecuteMenu(PrintMenu, 4);

            if (optionOperation == 4)
            {
                return;
            }

            int optionEntity = MainMenus.SelectEntity();

            if (optionEntity == 1 && optionOperation == 1)
            {
                VehicleUI.AddVehicle();
            }
            else if (optionEntity == 1 && optionOperation == 2)
            {
                VehicleUI.DeleteVehicle();
            }
            else if (optionEntity == 1 && optionOperation == 3)
            {
                Console.WriteLine("Change is not possible!");
            }
            else if (optionEntity == 2 && optionOperation == 3)
            {
                Console.WriteLine("Change is not possible!");
            }
        }
示例#4
0
    public void GotoNextMenu()
    {
        //Get the next menu but go back to zero if its the last one.
        int nextMenuNum = ((int)currentMenu + 1) % 5;

        currentMenu = (MainMenus)nextMenuNum;

        menuAnimator.SetTrigger(currentMenu.ToString().ToLower());
    }
示例#5
0
    public void GotoPreviousMenu()
    {
        string currentMenuString = currentMenu.ToString();

        //Get the previous menu enum.
        if((MainMenus)Enum.Parse(typeof(MainMenus), currentMenuString) - 1 < 0)
        {
            currentMenu = MainMenus.DIRECTIONS;
        }
        else
        {
            currentMenu = (MainMenus)Enum.Parse(typeof(MainMenus), currentMenuString) - 1;
        }

        //Move with mechanim
        menuAnimator.SetTrigger(currentMenu.ToString().ToLower());
    }
示例#6
0
    /// <summary>
    /// Changes the menu to a new menu
    /// </summary>
    /// <param name="newMenu">the menu to change to</param>
    public void ChangeMenu(MainMenus newMenu)
    {
        //check if menu exists in dictionary
        if (!uiDict.ContainsKey(newMenu))
        {
            Debug.Log(newMenu + " is not in the uiDict dictionary!");
            return;
        }

        //loop through the dictionary and disable all the menus
        foreach (KeyValuePair <MainMenus, GameObject> entry in uiDict)
        {
            entry.Value.SetActive(false);
        }

        //enable the menu to change to
        uiDict[newMenu].SetActive(true);
    }
示例#7
0
        static void Main(string[] args)
        {
            LoadData();

            while (true)
            {
                int option = MainMenus.ExecuteMenu(BasicMenuPrint, 2);

                if (option == 1)
                {
                    BasicMenu.Menu();
                }
                else if (option == 2)
                {
                    SaveData();
                    break;
                }
            }
        }
示例#8
0
        public static void Menu()
        {
            int optionOperation = MainMenus.ExecuteMenu(PrintMenu, 6);

            if (optionOperation == 6)
            {
                return;
            }

            int optionEntity = MainMenus.SelectEntity();

            if (optionOperation == 1 && optionEntity == 1)
            {
                VehicleUI.PrintAllVehicles();
            }
            else if (optionOperation == 2 && optionEntity == 1)
            {
                VehicleUI.PrintExistingVehicles();
            }
            else if (optionOperation == 3 && optionEntity == 1)
            {
                VehicleUI.PrintDeletedVehicles();
            }
            else if (optionOperation == 4 && optionEntity == 1)
            {
                VehicleUI.PrintSoldVehicles();
            }
            else if (optionOperation == 4 && optionEntity == 2)
            {
                Console.WriteLine("Options 4 and 5 are only possible for vehicles!");
            }
            else if (optionOperation == 5 && optionEntity == 1)
            {
                VehicleUI.PrintUnsoldVehicles();
            }
            else if (optionOperation == 5 && optionEntity == 2)
            {
                Console.WriteLine("Options 4 and 5 are only possible for vehicles!");
            }
        }
示例#9
0
        public static void FirstMenu()
        {
            while (true)
            {
                int opcija = MainMenus.ExecuteMenu(MenuPrint, 6);

                if (opcija == 1)
                {
                    EntryDeleteEditUI.Menu();
                }

                else if (opcija == 2)
                {
                    OverviewUI.Menu();
                }

                else if (opcija == 3)
                {
                    Console.WriteLine("In Progress");
                }

                else if (opcija == 4)
                {
                    Console.WriteLine("In Progress");
                }

                else if (opcija == 5)
                {
                    Console.WriteLine("In Progress");
                }

                else if (opcija == 6)
                {
                    break;
                }
            }
        }
示例#10
0
        /// <summary>
        /// 根据权限列表加载菜单
        /// </summary>
        /// <param name="FuncList">功能权限列表</param>
        private void LoadMenus(List <T_ADMM_FuncList> FuncList)
        {
            try
            {
                if (FuncList.Count > 0 && FuncList != null)
                {
                    //将所有一级菜单统计出来
                    var query = from Func in FuncList
                                where Func.Levels == 0
                                select Func;

                    int i = 0;
                    //逐一将一级菜单加入分组
                    foreach (var Func1 in query)
                    {
                        NavBarGroup NBG1 = new NavBarGroup();
                        NBG1.Caption = Func1.FuncNam;

                        //新建树菜单
                        TrList_Menus      = new DevExpress.XtraTreeList.TreeList();
                        TrList_Menus.Dock = System.Windows.Forms.DockStyle.Fill;
                        TrList_Menus.Name = "TrList_" + Func1.GroupID;
                        //新建树菜单列
                        DevExpress.XtraTreeList.Columns.TreeListColumn Col_FuncID = new DevExpress.XtraTreeList.Columns.TreeListColumn();
                        Col_FuncID.Name      = "FuncID";
                        Col_FuncID.FieldName = "FuncID";
                        Col_FuncID.Caption   = "FuncID";

                        DevExpress.XtraTreeList.Columns.TreeListColumn Col_ParentID = new DevExpress.XtraTreeList.Columns.TreeListColumn();
                        Col_ParentID.Name      = "ParentID";
                        Col_ParentID.Caption   = "ParentID";
                        Col_ParentID.FieldName = "ParentID";

                        DevExpress.XtraTreeList.Columns.TreeListColumn Col_FuncNam = new DevExpress.XtraTreeList.Columns.TreeListColumn();
                        Col_FuncNam.Name         = "FuncNam";
                        Col_FuncNam.Caption      = "FuncNam";
                        Col_FuncNam.FieldName    = "FuncNam";
                        Col_FuncNam.Visible      = true;
                        Col_FuncNam.VisibleIndex = 2;

                        DevExpress.XtraTreeList.Columns.TreeListColumn Col_FrmNam = new DevExpress.XtraTreeList.Columns.TreeListColumn();
                        Col_FrmNam.Name      = "FrmNam";
                        Col_FrmNam.Caption   = "FrmNam";
                        Col_FrmNam.FieldName = "FrmNam";

                        //将列添加到树菜单
                        TrList_Menus.Columns.AddRange(new DevExpress.XtraTreeList.Columns.TreeListColumn[] {
                            Col_FuncID,
                            Col_ParentID,
                            Col_FuncNam,
                            Col_FrmNam
                        }
                                                      );
                        TrList_Menus.KeyFieldName             = "FuncID";
                        TrList_Menus.ParentFieldName          = "ParentID";
                        TrList_Menus.OptionsView.ShowColumns  = false;
                        TrList_Menus.OptionsBehavior.Editable = false;
                        ////设置树菜单背景色
                        //TrList_Menus.BackColor = Color.White;
                        ////设置树菜单空白区域的背景色
                        //TrList_Menus.Appearance.Empty.BackColor = Color.Transparent;
                        //设置树菜单节点竖向边框不显示
                        TrList_Menus.OptionsView.ShowVertLines = false;
                        //设置树菜单节点横向边框不显示
                        TrList_Menus.OptionsView.ShowHorzLines = false;
                        //设置树菜单节点的字体大小
                        TrList_Menus.Appearance.Row.Font = new System.Drawing.Font("Tahoma", 10F);
                        //TrList_Menus.OptionsView.ShowIndentAsRowStyle = true;

                        ////设置获得焦点单元格背景色
                        //TrList_Menus.Appearance.FocusedCell.BackColor = System.Drawing.Color.LightSteelBlue;
                        //TrList_Menus.Appearance.FocusedCell.BackColor2 = System.Drawing.Color.SteelBlue;

                        //TrList_Menus.Appearance.FocusedCell.Options.UseBackColor = true;
                        //TrList_Menus.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Style3D;
                        //TrList_Menus.LookAndFeel.UseDefaultLookAndFeel = false;

                        //注册鼠标双击事件
                        if (Func1.GroupID == "ADM")
                        {
                            TrList_Menus.DoubleClick += new System.EventHandler(TrList_ADM_DoubleClick);
                        }
                        else if (Func1.GroupID == "Test")
                        {
                            TrList_Menus.DoubleClick += new System.EventHandler(TrList_Test_DoubleClick);
                        }
                        else if (Func1.GroupID == "test1")
                        {
                            TrList_Menus.DoubleClick += new System.EventHandler(TrList_Test1_DoubleClick);
                        }

                        List_Container.Add(new NavBarGroupControlContainer());
                        List_Container[i].Name = "Contain_" + Func1.GroupID;

                        //将容器加入导航控件
                        Nav_ADM.Controls.Add(List_Container[i]);

                        //将树菜单加入容器
                        List_Container[i].Controls.Add(TrList_Menus);

                        //将容器加入菜单组
                        NBG1.ControlContainer = List_Container[i];

                        //将菜单组加入导航控件
                        Nav_ADM.Groups.Add(NBG1);

                        //将该菜单组所有的子菜单全部统计出来
                        var query1 = from Func in FuncList
                                     where Func.GroupID == Func1.GroupID
                                     select new { FuncID = Func.FuncID, ParentID = Func.ParentID, FuncNam = Func.FuncNam, FrmNam = Func.FrmNam } into query2
                        select query2;

                        //将查询结果转换为集合
                        List <MainMenus> ListTreeData = new List <MainMenus>();
                        foreach (var TreeData1 in query1)
                        {
                            MainMenus TreeData = new MainMenus();
                            TreeData.FuncID   = TreeData1.FuncID;
                            TreeData.ParentID = TreeData1.ParentID;
                            TreeData.FuncNam  = TreeData1.FuncNam;
                            TreeData.FrmNam   = TreeData1.FrmNam;

                            ListTreeData.Add(TreeData);
                        }
                        //树控件绑定数据源
                        TrList_Menus.DataSource = ListTreeData;
                        i += 1;
                    }
                }
            }
            catch (Exception Ex)
            {
                Common.ShowMsg(Ex.Message);
            }
        }
示例#11
0
 void Start()
 {
     menuAnimator = GetComponentInChildren<Animator>();
     currentMenu = MainMenus.NEWGAME;
 }