예제 #1
0
            private void LoadRoles()
            {
                if (m_roles != null)
                {
                    return;
                }

                m_roles = new RobotList <Role>();

                // No roles to load on new users.
                if (IsNew)
                {
                    return;
                }

                Query q = new StoredProc("usp_GetUsersRoles");

                q.CnnStr = Helpers.Config["DB:Security"];
                q.Parameters.AddWithValue("@Username", Login);

                IList <int> roles = q.ExecuteList <int>();

                foreach (int role in roles)
                {
                    Role r = UserSecurity.Roles.Find(Role.ById, role);

                    if (r != null)
                    {
                        m_roles.Add(r);
                    }
                }
            }
예제 #2
0
        /// <summary>
        /// Initializes security for SCOUT.
        /// </summary>
        static public void Initialize()
        {
#pragma warning disable 168
            // Preload the roles.
            RobotList <Role> r = Roles;
#pragma warning restore 168
        }
예제 #3
0
        private void LoadSuppliers()
        {
            m_organizations = Organization.GetActiveOrganizations();

            orgBinding.DataSource             = m_organizations;
            suppSelList.Properties.DataSource = orgBinding;
        }
        public void FertilizeData()
        {
            string robotId;
            string landId;
            bool   validate;
            int    countRobots = 0;

            Console.WriteLine("List of lands:");
            LandList.ForEach(l =>
            {
                Console.WriteLine($"ID: {l.Id} | Fertility: {l.Fertility}%");
            });
            Console.WriteLine("Available robots:");
            RobotList.ForEach(r =>
            {
                if (r.Activated)
                {
                    Console.WriteLine($"ID:{r.Id} | Battery: {r.Battery}/{r.MaxBattery}");
                }
                countRobots++;
            });
            if (countRobots > 0)
            {
                Console.Write("Enter the land id: ");
                landId = Console.ReadLine();
                StringValidate.Value = landId;
                validate             = StringValidate.ValidateField();

                Console.Write("Enter the robot id: ");
                robotId = Console.ReadLine();
                StringValidate.Value = robotId;
                validate             = validate && StringValidate.ValidateField();
                if (validate)
                {
                    Land  l = LandList.FirstOrDefault(p => p.Id == landId);
                    Robot r = RobotList.FirstOrDefault(c => c.Id == robotId && c.Activated);
                    if (l != null)
                    {
                        Handler.Fertilize(l);
                    }
                    else
                    {
                        Console.WriteLine("No available lands match the entered id");
                    }
                }
                else
                {
                    Console.WriteLine("The data input was invalid");
                }
            }
            else
            {
                Console.WriteLine("No available robots");
            }
        }
예제 #5
0
        public string DeleteIndividualRobot(int index)
        {
            var targetRobot = RobotList.Find(x => x.Index == index);

            if (targetRobot == null)
            {
                return("해당 로봇이 없습니다.");
            }

            RobotList.Remove(targetRobot);
            return($"ID {index}번 로봇을 삭제하였습니다.");
        }
예제 #6
0
        public string MoveIndividualRobot(int index, int direction)
        {
            var targetRobot = RobotList.Find(x => x.Index == index);

            if (targetRobot == null)
            {
                return("해당 로봇이 없습니다.");
            }
            var locationValues = targetRobot.Move(direction, RoomWidthSize, RoomVerticalSize);

            return($"{targetRobot.GetType()} 타입의 {targetRobot.Model}가 {locationValues[0]} {locationValues[1]} 위치에서 {locationValues[2]} {locationValues[3]} 로 이동하였습니다.");
        }
예제 #7
0
        private void CreateNewOrg()
        {
            EditOrganizationForm dlg = new EditOrganizationForm(null);

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                RobotList <Organization> orgs = (RobotList <Organization>)
                                                customerEdit.Properties.DataSource;

                orgs.Add(dlg.Organization);
                customerEdit.EditValue = dlg.Organization.Id;
            }
        }
예제 #8
0
    public void Start()
    {
        var audio = GetComponentsInChildren <AudioSource>();

        m_hitSE  = audio[0];
        m_deadSE = audio[1];

        m_maxHp = m_hp;
        if (m_chargeArea != null)
        {
            m_robotList = m_chargeArea.GetComponent <RobotList>();
        }
    }
예제 #9
0
            static public RobotList <User> GetUsers()
            {
                Query q = new StoredProc("usp_GetAllUsers");

                q.CnnStr = Helpers.Config["DB:Security"];

                RobotList <User> rval = new RobotList <User>(
                    q.ExecuteList <User>());

                rval.ApplySort("FullName", ListSortDirection.Ascending);

                return(rval);
            }
        public void RobotData(string option)
        {
            string id;
            bool   validate;
            string state;

            Console.WriteLine("List of robots:");
            RobotList.ForEach(r =>
            {
                state = (r.Activated) ? "on" : "off";
                Console.Write($"ID:{r.Id} | Battery: {r.Battery}/{r.MaxBattery} | ");
                Console.WriteLine($"State: {state}");
            });
            Console.Write("Enter the robot id: ");
            id = Console.ReadLine();
            StringValidate.Value = id;
            validate             = StringValidate.ValidateField();
            if (validate)
            {
                Robot r = RobotList.FirstOrDefault(c => c.Id == id);
                if (r != null)
                {
                    if (option == "3")
                    {
                        Handler.Upgrade(r);
                    }
                    else if (option == "4")
                    {
                        Handler.ChargeRobot(r);
                    }
                    else if (option == "5")
                    {
                        Handler.OnOffRobot(r);
                    }
                }
                else
                {
                    Console.WriteLine("No robots match the entered id");
                }
            }
            else
            {
                Console.WriteLine("The data input was invalid");
            }
        }
예제 #11
0
        public bool InputRobotData(string type, string name, int x, int y, int price, int distance, int power)
        {
            switch (type)
            {
            case "c":

                var newCleaningRobot = new CleaningRobot(Utils.CreateNewIndex(RobotList), name, price, x, y, distance, power);
                RobotList.Add(newCleaningRobot);
                return(true);

            case "d":

                var newDogRobot = new DogRobot(Utils.CreateNewIndex(RobotList), name, price, x, y, distance, power);
                RobotList.Add(newDogRobot);
                return(true);

            default:
                return(false);
            }
        }
예제 #12
0
        public string SearchForRobotByIndex(int index)
        {
            var targetRobots = RobotList.FindAll(x => x.Index == index);

            return(Utils.RobotListToString(targetRobots));
        }
        public void HaverstData()
        {
            string landId;
            string robotId;
            bool   validate;
            int    countRobots = 0;
            int    countCrops  = 0;

            Console.WriteLine("Lands with crops ready to harvest:");
            LandList.ForEach(l =>
            {
                if (l.Used && l.LandCrop.Growth == 100)
                {
                    Console.Write($"ID: {l.Id} | Crop: {l.LandCrop.Type} | ");
                    Console.WriteLine($"Edibility {l.LandCrop.Edibility}%");
                    countCrops++;
                }
            });
            if (countCrops > 0)
            {
                Console.WriteLine("Available robots:");
                RobotList.ForEach(r =>
                {
                    if (r.Activated)
                    {
                        Console.WriteLine($"ID:{r.Id} | Battery: {r.Battery}/{r.MaxBattery}");
                    }
                    countRobots++;
                });
                if (countRobots > 0)
                {
                    Console.Write("Enter the land id: ");
                    landId = Console.ReadLine();
                    StringValidate.Value = landId;
                    validate             = StringValidate.ValidateField();

                    Console.Write("Enter the robot id: ");
                    robotId = Console.ReadLine();
                    StringValidate.Value = robotId;
                    validate             = validate && StringValidate.ValidateField();
                    if (validate)
                    {
                        Land l = LandList.FirstOrDefault(c =>
                                                         c.Id == landId && c.Used && c.LandCrop.Growth == 100);
                        Robot r = RobotList.FirstOrDefault(c => c.Id == robotId && c.Activated);
                        if (l != null && r != null)
                        {
                            Handler.Harvest(l);
                        }
                        else
                        {
                            Console.WriteLine("No robots or lands match the entered id");
                        }
                    }
                    else
                    {
                        Console.WriteLine("The data input was invalid");
                    }
                }
                else
                {
                    Console.WriteLine("No available robots");
                }
            }
            else
            {
                Console.WriteLine("No current crops");
            }
        }
예제 #14
0
    public void MoveBtnAction()
    {
        MinionControl.transform.GetComponent <UnitSelecter>().SelectedUnit = null;
        SelectedRobot = null;
        panelStates   = null;

        activeRobots = MinionControl.GetComponent <RobotList>();

        //if a robot is available
        if (activeRobots.Count < 1)
        {
            Debug.Log("Not enough robots to open manual command");
            return;
        }
        else
        {
            panelStates = new bool[panels.Count];

            //Save panel states, states will be reloaded after instantiation of new panel
            for (int i = 0; i < panels.Count - 1; i++)
            {
                if (i < 2)
                {
                    panelStates[i] = false;
                }
                else
                {
                    panelStates[i] = panels[i].activeSelf;
                }
            }


            //close currently open panels
            ClosePanels(panels);
            MenuOpen = false;

            if (activeRobots.Count == 1 && !CheckManualPanelExists(activeRobots.Get(0)))
            {
                //instantiate the manual robot control menu
                manualPanel = (GameObject)GameObject.Instantiate(ManualPanel);

                SelectedRobot = activeRobots.Get(0);

                manualPanel.gameObject.transform.Find("RobotName").GetComponent <Text>().text =
                    SelectedRobot.GetComponent <Robot>().GetRobotName();

                childTransform = manualPanel.transform;
                childTransform.SetParent(canvas.transform, false);

                //add button functions
                addBtnFunctions(manualPanel);
                //      Debug.Log("Selected robot: ");
                //      Debug.Log(SelectedRobot);
                ManualMoveCommander commander = manualPanel.GetComponent <ManualMoveCommander>();

                commander.SetRobot(SelectedRobot.gameObject);
                //    Debug.Log("set robot: ");
                //   Debug.Log(commander.GetRobot());

                //return the panels to their original states
                for (int i = 0; i < panels.Count; i++)
                {
                    panels[i].SetActive(panelStates[i]);
                }

                panels.Add(manualPanel);
                ManualPanels.Add(manualPanel);
                //TogglePanel(panels[2]);
            }

            //if more than one robot is available
            else
            {
                // add popup: choose robot
                Debug.Log("Select your player or RMB to cancel");

                //set selectingRobot flag to true;
                MinionControl.transform.GetComponent <UnitSelecter>().selectingRobot       = true;
                MinionControl.transform.GetComponent <UnitSelecter>().RobotSelected        = false;
                MinionControl.transform.GetComponent <UnitSelecter>().selectingDestination = false;

                StartCoroutine(SelectingTarget());
            }
        }
    }
예제 #15
0
        public string SearchByRobotPriceRange(int min, int max)
        {
            var targetRobots = RobotList.FindAll(x => x.Price >= min && x.Price <= max);

            return(Utils.RobotListToString(targetRobots));
        }
        public void AsignData()
        {
            string landId;
            string robotId;
            bool   validate;
            int    countRobots = 0;
            int    countEvents = 0;

            Console.WriteLine("Lands with active events:");
            LandList.ForEach(l =>
            {
                if (l.Used && l.LandCrop.EventBool)
                {
                    Console.WriteLine($"ID: {l.Id} | Event: {l.LandCrop.CurrentEvent.Name}");
                    countEvents++;
                }
            });
            if (countEvents > 0)
            {
                Console.WriteLine("Available robots:");
                RobotList.ForEach(r =>
                {
                    if (r.Activated)
                    {
                        Console.WriteLine($"ID:{r.Id} | Battery: {r.Battery}/{r.MaxBattery}");
                    }
                    countRobots++;
                });
                if (countRobots > 0)
                {
                    Console.Write("Enter the land id: ");
                    landId = Console.ReadLine();
                    StringValidate.Value = landId;
                    validate             = StringValidate.ValidateField();

                    Console.Write("Enter the robot id: ");
                    robotId = Console.ReadLine();
                    StringValidate.Value = robotId;
                    validate             = validate && StringValidate.ValidateField();
                    if (validate)
                    {
                        Land l = LandList.FirstOrDefault(c =>
                                                         c.Id == landId && c.Used && c.LandCrop.EventBool);
                        Robot r = RobotList.FirstOrDefault(c => c.Id == robotId && c.Activated);
                        if (l != null && r != null)
                        {
                            Handler.ClearEvent(l);
                        }
                        else
                        {
                            Console.WriteLine("No robots or lands match the entered id");
                        }
                    }
                    else
                    {
                        Console.WriteLine("The data input was invalid");
                    }
                }
                else
                {
                    Console.WriteLine("No available robots");
                }
            }
            else
            {
                Console.WriteLine("No current events");
            }
        }
예제 #17
0
        public string SearchForRobotByName(string name)
        {
            var targetRobots = RobotList.FindAll(x => x.Model == name);

            return(Utils.RobotListToString(targetRobots));
        }