Beispiel #1
0
    public bool OpenUI(UIClass type)
    {
        bool openOrClosed = false;

        switch (type)
        {
        case UIClass.inventoryUI:
            if (UI.currentUIEnabled != UIClass.hotbarUI)
            {
                openOrClosed = false;
                UI.UISwitchTo(UIClass.hotbarUI);
            }
            else
            {
                openOrClosed = true;
                UI.UISwitchTo(UIClass.inventoryUI);
            }
            break;

        case UIClass.mechanismUI:
            if (UI.currentUIEnabled != UIClass.hotbarUI)
            {
                openOrClosed = false;
                UI.UISwitchTo(UIClass.hotbarUI);
            }
            else
            {
                openOrClosed = true;
                UI.UISwitchTo(UIClass.mechanismUI);
            }
            break;
        }

        return(openOrClosed);
    }
        public void GetData(UIClass classModel)
        {
            var cp = CommonDataManager.GetCPCase(base.LocalID);

            if (cp != null)
            {
                _cpcase = cp;

                List <UIStudent> students = new List <UIStudent>();
                _class = cp.Classes.FirstOrDefault(c => c.ID.Equals(classModel.ID));
                _class.Students?.ForEach(s =>
                {
                    UIStudent student = new UIStudent()
                    {
                        ID   = s.ID,
                        Name = s.Name
                    };
                    students.Add(student);
                });

                this.Students = new ObservableCollection <UIStudent>(students);

                _studentCollectionView        = (ListCollectionView)CollectionViewSource.GetDefaultView(this.Students);
                _studentCollectionView.Filter = StudentContains;
            }
        }
Beispiel #3
0
    public void UISwitchTo(UIClass type)
    {
        UICloseAll();

        currentUIEnabled = type;

        switch (type)
        {
        case UIClass.hotbarUI:
            hotbarUI.baseGo.SetActive(true);
            break;

        case UIClass.inventoryUI:
            inventoryUI.baseGo.SetActive(true);
            break;

        case UIClass.mechanismUI:
            mechanismUI.baseGo.SetActive(true);
            break;

        default:
            Debug.Log("None set for " + type.ToString());
            break;
        }
    }
Beispiel #4
0
 public void SetUI(UIClass ui)
 {
     this.ui = ui;
     ui.UpdateCoins(coins);
     ui.UpdateLives(lives);
     ui.UpdateScore(score);
 }
Beispiel #5
0
        public void TestGreeting(string name, Language language, string expectedResult)
        {
            // Arrange - Setup variables and create an instance of the class under test
            string  consoleOutput;
            UIClass ui = new UIClass(name, language);

            // Act - call the method under test and save the results
            using (StringWriter sw = new StringWriter())
            {
                // Capture the original console output...can we still write to it if we want to?
                TextWriter originalConsole = Console.Out;

                // redirect the consoleoutput to our StringWriter so we can capture it
                Console.SetOut(sw);

                // Write to the original console and see if it shows in the Test Output panel
                originalConsole.WriteLine("*** Console Out has been re-directed to a string ***");

                // Call method(s) that write to the console.
                ui.GreetUser();

                // Done calling methods...capture the output into a string
                consoleOutput = sw.ToString();
            }
            string expected = expectedResult + Environment.NewLine;

            Assert.AreEqual <string>(expected, consoleOutput);
        }
Beispiel #6
0
        public static float Calculate(string departure, string destination, UIClass type, UIDiscount discount, bool singleFare)
        {
            float ret            = 0;
            int   tariefeenheden = Tariefeenheden.getTariefeenheden(departure, destination);

            switch (type)
            {
            case UIClass.FirstClass:
                ret = FirstClassCalculator.Calculate(tariefeenheden, discount);
                break;

            case UIClass.SecondClass:
                ret = SecondClassCalculator.Calculate(tariefeenheden, discount);
                break;
            }

            if (singleFare)
            {
                return(ret);
            }
            else
            {
                return(ret * 2);
            }
        }
        /// <summary>
        /// 获取班级,根据课程ID
        /// </summary>
        /// <param name="cp"></param>
        /// <param name="courseID"></param>
        /// <returns></returns>
        public static List <UIClass> GetClasses(this CPCase cp, string courseID)
        {
            List <UIClass> classes = new List <UIClass>();

            var results = cp.Classes.Where(c => c.Settings.Any(s => s.CourseID.Equals(courseID)));

            if (results != null)
            {
                var course = cp.Courses.FirstOrDefault(c => c.ID.Equals(courseID));

                results?.ToList()?.ForEach(r =>
                {
                    UIClass classInfo = new UIClass()
                    {
                        ID       = r.ID,
                        CourseID = courseID,
                        Course   = course.Name,
                        Name     = r.Name
                    };

                    // 课时数
                    var lessons       = cp.ClassHours.Count(ch => ch.ClassID.Equals(r.ID) && ch.CourseID.Equals(course.ID));
                    classInfo.Lessons = lessons;

                    classes.Add(classInfo);
                });
            }
            return(classes);
        }
 public Ticket(string from, string to, UIClass cls, UIWay way)
 {
     this.from = from;
     this.to   = from;
     this.cls  = cls;
     this.way  = way;
 }
        /// <summary>
        /// 根据教师ID获取班级
        /// </summary>
        /// <param name="cp"></param>
        /// <param name="teacherID">教师ID</param>
        /// <returns></returns>
        public static List <UIClass> GetClassesByTeacherID(this CPCase cp, string teacherID)
        {
            List <UIClass> classes = new List <UIClass>();

            var classHours = (from ch in cp.ClassHours where ch.TeacherIDs.Contains(teacherID) select ch);

            var groups = classHours?.GroupBy(g => $"{g.CourseID}|{g.ClassID}");

            if (groups != null)
            {
                foreach (var g in groups)
                {
                    var keys = g.Key.Split('|');

                    var classModel = cp.Classes.FirstOrDefault(ch => ch.ID.Equals(keys[1]));
                    if (classModel != null)
                    {
                        var course = cp.Courses.FirstOrDefault(c => c.ID.Equals(keys[0]))?.Name;

                        UIClass ui = new UIClass()
                        {
                            ID       = classModel.ID,
                            Name     = classModel.Name,
                            Course   = course,
                            CourseID = keys[0]
                        };
                        classes.Add(ui);
                    }
                }
            }
            return(classes);
        }
        public void SetClasses(List <UIClass> classes)
        {
            UIClass header = new UIClass()
            {
                ID         = "0",
                Name       = string.Empty,
                HourIndexs = new List <Models.Administrative.UIClassHourIndex>(),
            };

            var maxIndex = classes.Max(c => c.HourIndexs.Count);

            for (int i = 1; i <= maxIndex; i++)
            {
                var classHour = new Models.Administrative.UIClassHourIndex()
                {
                    Index = i
                };
                header.HourIndexs.Add(classHour);

                classHour.PropertyChanged += ClassHour_PropertyChanged;
            }

            // 临时班级
            List <UIClass> tempClasses = new List <UIClass>();

            tempClasses.AddRange(classes.Select(c => c.DeepClone()));
            tempClasses.Insert(0, header);

            // 班级列表
            this.Classes = tempClasses;

            // 绑定头部选中状态
            var totalIndex = header.HourIndexs.Count;

            header.HourIndexs.ForEach(hi =>
            {
                var indexes = new List <UIClassHourIndex>();

                this.Classes.Where(c => !c.ID.Equals("0"))?.ToList().ForEach(c =>
                {
                    if (c.HourIndexs.Count >= hi.Index)
                    {
                        indexes.Add(c.HourIndexs[hi.Index - 1]);
                    }
                });

                if (indexes.Count >= 2)
                {
                    var all = indexes.All(i => i.IsChecked);
                    if (all)
                    {
                        hi.IsChecked = true;
                    }
                }
                else
                {
                    hi.IsChecked = false;
                }
            });
        }
Beispiel #11
0
        protected float calculatePrice(string from, string to,UIDiscount discount, UIClass classKind)
        {
            // Get number of tariefeenheden
            int tariefeenheden = Tariefeenheden.getTariefeenheden(from ,to);

            // Compute the column in the table based on choices
            int tableColumn;

            // First based on class
            if (UIClass.FirstClass == classKind)
                tableColumn = 3;
            else
                tableColumn = 0;

            // Then, on the discount
            if (UIDiscount.TwentyDiscount == discount)
                tableColumn += 1;
            else if (UIDiscount.FortyDiscount == discount)
                tableColumn += 2;

            // Get price
            float price = PricingTable.getPrice(tariefeenheden, tableColumn);
            if (info.Way == UIWay.Return)
            {
                price *= 2;
            }
            // Add 50 cent if paying with credit card
            if (info.Payment == UIPayment.CreditCard)
            {
                price += 0.50f;
            }
            return price;
        }
Beispiel #12
0
 protected string determineClass(UIClass classKind)
 {
     if (classKind == UIClass.FirstClass)
         return "Klasse: eerste klasse";
     else
         return "Klasse: tweede klasse";
 }
        void ViewStudents(object obj)
        {
            UIClass classModel = obj as UIClass;

            StudentWindow window = new StudentWindow(classModel);

            window.ShowDialog();
        }
Beispiel #14
0
 public Purchase(String arr, String dep, UIDiscount discountt, UIClass class_t, UIPayment paymenttype)
 {
     dep_station  = dep;
     arr_station  = arr;
     discounttype = discountt;
     classtype    = class_t;
     paymentType  = paymenttype;
 }
Beispiel #15
0
 public void UIClassBadConstructor(IController ic)
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         UIClass ui = new UIClass(ic);
     }
                                           );
 }
Beispiel #16
0
 public Ticket(UIClass seatClass, UIDiscount discount, UIWay way, string from, string to)
 {
     this.seatClass = ClassAssigner.GetClass(seatClass);
     this.discount  = DiscountAssigner.GetDiscount(discount);
     this.way       = way;
     this.from      = from;
     this.to        = to;
 }
Beispiel #17
0
 public TicketautomaatInvoer(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment)
 {
     this.from     = from;
     this.to       = to;
     this.cls      = cls;
     this.way      = way;
     this.discount = discount;
     this.payment  = payment;
 }
Beispiel #18
0
 public Ticket(string dep, string dest, UIClass type, UIDiscount disc, bool single)
 {
     departure   = dep;
     destination = dest;
     ticketType  = type;
     discount    = disc;
     singleFare  = single;
     price       = PriceCalculator.Calculate(departure, destination, ticketType, discount, singleFare);
 }
Beispiel #19
0
    public void InitializeUI(UIClass type)
    {
        for (int i = 0; i < hotbar.Count; i++)
        {
            Item bar = hotbar[i];

            switch (type)
            {
            case UIClass.hotbarUI:
                UI.SetSlotFor(UISlotType.hotbar, UITypes.hotbarUI_hotslots, i);
                break;

            case UIClass.inventoryUI:
                UI.SetSlotFor(UISlotType.hotbar, UITypes.inventoryUI_hotSlots, i);
                break;

            case UIClass.mechanismUI:
                UI.SetSlotFor(UISlotType.hotbar, UITypes.mechanismUI_hotSlots, i);
                break;
            }
        }

        for (int i = 0; i < inventory.Count; i++)
        {
            Item inv = inventory[i];

            switch (type)
            {
            case UIClass.inventoryUI:
                UI.SetSlotFor(UISlotType.inventory, UITypes.inventoryUI_invSlots, i);
                break;

            case UIClass.mechanismUI:
                UI.SetSlotFor(UISlotType.inventory, UITypes.mechanismUI_invSlots, i);
                break;
            }
        }

        switch (type)
        {
        case UIClass.hotbarUI:
            UI.hotbarUI.initialized = true;
            break;

        case UIClass.inventoryUI:
            UI.inventoryUI.initialized = true;
            break;

        case UIClass.mechanismUI:
            UI.mechanismUI.initialized = true;
            break;

        default:
            Debug.Log("None set for " + type.ToString());
            break;
        }
    }
Beispiel #20
0
 public UIInfo(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment)
 {
     this.from = from;
     this.to = to;
     this.cls = cls;
     this.way = way;
     this.discount = discount;
     this.payment = payment;
 }
Beispiel #21
0
 public Ticket(string from, string to, UIClass cls, int way, float discount, Payment payment)
 {
     this.from = from;
     this.to = to;
     this.cls = cls;
     this.way = way;
     this.discount = discount;
     this.payment = payment;
 }
Beispiel #22
0
 public UIInfo(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment)
 {
     this.from     = from;
     this.to       = to;
     this.cls      = cls;
     this.way      = way;
     this.discount = discount;
     this.payment  = payment;
 }
Beispiel #23
0
 public Bestelling(string from, string to, UIClass cls, UIWay way, UIDiscount discount, UIPayment payment, int aantalKaartjes)
 {
     this.from           = from;
     this.to             = to;
     this.cls            = cls;
     this.way            = way;
     this.discount       = discount;
     this.payment        = payment;
     this.aantalKaartjes = aantalKaartjes;
 }
        void createCourseCommand(object obj)
        {
            UIClass uiClass = obj as UIClass;

            var currentCourses = uiClass.Courses.Select(sc =>
            {
                return(new UICourse()
                {
                    ID = sc.CourseID,
                    Name = sc.Course
                });
            })?.ToList();

            // 获取所有课程
            var cpCase    = CommonDataManager.GetCPCase(base.LocalID);
            var uiCourses = cpCase.Courses?.Select(s =>
            {
                return(new UICourse()
                {
                    ID = s.ID,
                    Name = s.Name
                });
            })?.ToList();

            ChooseCourseWindow chooseWindow = new ChooseCourseWindow(currentCourses, uiCourses);

            chooseWindow.Closed += (s, arg) =>
            {
                if (chooseWindow.DialogResult.Value)
                {
                    chooseWindow.Courses.ForEach(c =>
                    {
                        var has = uiClass.Courses.Any(uc => uc.Course.Equals(c.Name));
                        if (!has)
                        {
                            var classCourse = new Models.Administrative.UIClassCourse
                            {
                                ClassID   = uiClass.ID,
                                ClassName = uiClass.Name,
                                CourseID  = c.ID,
                                Course    = c.Name,
                            };

                            this.createClassHours(classCourse);
                            uiClass.Courses.Add(classCourse);
                            uiClass.RaiseLessons();
                        }
                    });

                    this.RaisePropertyChanged(() => ShowUniform);
                }
            };
            chooseWindow.ShowDialog();
        }
        void C_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            UIClass classModel = sender as UIClass;

            if (e.PropertyName.Equals(nameof(classModel.IsChecked)))
            {
                if (classModel.IsChecked)
                {
                    var courseLevel = values.FirstOrDefault(v => v.CourseID.Equals(classModel.CourseID) && v.LevelID.Equals(classModel.LevelID));
                    if (courseLevel != null)
                    {
                        var uicourse = this.Courses.FirstOrDefault(c => c.CourseID.Equals(classModel.CourseID) && c.LevelID.Equals(classModel.LevelID));
                        uicourse.SelectClasses = uicourse.Classes.Count(c => c.IsChecked);

                        this.SelectTeacher.HasOperation = true;

                        var targetClass = courseLevel.Classes.FirstOrDefault(c => c.ID.Equals(classModel.ID));
                        if (targetClass != null)
                        {
                            var cl = CommonDataManager.GetCLCase(base.LocalID);

                            if (!targetClass.TeacherIDs.Contains(this.SelectTeacher.ID))
                            {
                                targetClass.TeacherIDs.Add(this.SelectTeacher.ID);
                                classModel.TeacherString = cl.GetTeachersByIds(targetClass.TeacherIDs)?.Select(t => t.Name)?.Parse();
                            }
                        }
                    }
                }
                else
                {
                    var courseLevel = values.FirstOrDefault(v => v.CourseID.Equals(classModel.CourseID) && v.LevelID.Equals(classModel.LevelID));
                    if (courseLevel != null)
                    {
                        var uicourse = this.Courses.FirstOrDefault(c => c.CourseID.Equals(classModel.CourseID) && c.LevelID.Equals(classModel.LevelID));
                        uicourse.SelectClasses = uicourse.Classes.Count(c => c.IsChecked);

                        if (this.Courses.All(cc => cc.SelectClasses == 0))
                        {
                            this.SelectTeacher.HasOperation = false;
                        }

                        var targetClass = courseLevel.Classes.FirstOrDefault(c => c.ID.Equals(classModel.ID));
                        if (targetClass != null)
                        {
                            var cl = CommonDataManager.GetCLCase(base.LocalID);

                            targetClass.TeacherIDs.Remove(this.SelectTeacher.ID);
                            classModel.TeacherString = cl.GetTeachersByIds(targetClass.TeacherIDs)?.Select(t => t.Name)?.Parse();
                        }
                    }
                }
            }
        }
        private static int Class(UIClass FirstOrSecond)
        {
            switch (FirstOrSecond)
            {
            case UIClass.FirstClass:
                return(3);

            default:
                return(0);
            }
        }
Beispiel #27
0
        // This had to change, it should also consider the class!
        public float getPrice(int tfe, UIClass typeClass)
        {
            switch (typeClass)
            {
            case UIClass.FirstClass:
                return(PricingTable.getPrice(tfe, 3));

            default:
                return(PricingTable.getPrice(tfe, 0));
            }
        }
Beispiel #28
0
        public Ticket(UIInfo info)
        {
            klasse      = info.Class;
            discount    = info.Discount;
            destination = info.To;
            origin      = info.From;
            way         = info.Way;

            GetPrice g = new GetPrice(klasse, discount, destination, origin, way);

            price = g.ReturnPrice();
        }
Beispiel #29
0
        //Chooses the correct Seatclass
        public static SeatClass GetClass(UIClass info)
        {
            SeatClass seatclass = null;

            switch (info)
            {
            case UIClass.FirstClass: seatclass = new FirstClass(); break;

            case UIClass.SecondClass: seatclass = new SecondClass(); break;
            }
            return(seatclass);
        }
Beispiel #30
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            UI.LoadContent(Content, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);
            UIClass.LoadContent(Content);
            UpgradeSystem.LoadContent(Content, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            WeaponList.LoadContent(Content);
            ChopperList.LoadContent(Content);
            EffectsList.LoadContent(Content);

            EnemyMaker.LoadContent(Content);

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Level level = new Level(500, 500);


            Player player = new Player(ChopperList.GetChopper(ChopperType.Training), new Vector2(500, 2000));

            //Player player = new Player(ChopperList.GetChopper(0), new Vector2(0, 0));
            hud    = new Hud(Content.Load <SpriteFont>("hudFont"));
            camera = new Camera();
            //camera.Position = player.PlayerSpriteCenter;
            camera.Position = player.PlayerCenter;
            gameManager     = new GameManager(level, player);

            List <Sprite> listOfEnemies = new List <Sprite>();

            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.MGun, new Vector2(0, 0), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.MGun, new Vector2(0, 700), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.MGun, new Vector2(700, 700), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.MGun, new Vector2(700, 0), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.Rocket, new Vector2(350, 350), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.RocketHoming, new Vector2(800, 800), 0, 0));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.ShotGun, new Vector2(500, 500), 3, 1));
            listOfEnemies.Add(EnemyMaker.GetTurret(TurretType.ShotGun, new Vector2(250, 450), 5, 0.5f));

            level.AddEntity(listOfEnemies, true, true, true);

            listOfEnemies.Clear();
            listOfEnemies.Add(new Building(Content.Load <Texture2D>("building"), new Vector2(1000, 1000)));
            List <Helipad> listOfHelipads = new List <Helipad>();

            listOfHelipads.Add(new Helipad(Content.Load <Texture2D>("Allies\\helipad"), new Vector2(500, 2000)));
            level.AddLandingPad(listOfHelipads);

            level.AddEntity(listOfEnemies, true, true, false);

            missionScreen      = new MissionScreen(1, "GameTest", "Yarrr mission is to blow up\nevery turret. Then return\nto the base\n\nWASD - Move \nLeft\\Right arrow - rotate\nSpace - fire \nX and L - land\\lift \nU - upgrade (on helipad)\nP- developer stats\n+ and - - zoom ", graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, Color.SaddleBrown);
            GameData.menuState = MenuState.MissionMenu;
            // TODO: use this.Content to load your game content here
        }
Beispiel #31
0
        //void selectClassHourCountCommand(object obj)
        //{

        //}

        void chooseTeacherCommand(object obj)
        {
            UIClass model = obj as UIClass;

            var cl = base.GetClCase(base.LocalID);

            var allTeachers = cl.Teachers.Select(s =>
            {
                return(new Models.Base.UITeacher()
                {
                    ID = s.ID,
                    Name = s.Name
                });
            })?.ToList();

            var teachers = (from ut in model.TeacherIDs
                            from t in cl.Teachers
                            where ut.Equals(t.ID)
                            select new Models.Base.UITeacher()
            {
                ID = t.ID,
                Name = t.Name
            })?.ToList();

            Arranging.Dialog.ChooseTeacherWindow window = new Arranging.Dialog.ChooseTeacherWindow(teachers, allTeachers);
            window.Closed += (s, arg) =>
            {
                if (window.DialogResult.Value)
                {
                    // 清空教师
                    model.TeacherIDs.Clear();
                    model.TeacherString = string.Empty;
                    if (window.Teachers.Count > 0)
                    {
                        // 选择名称
                        var selectedNames = window.Teachers.Select(st =>
                        {
                            return(st.Name);
                        });
                        model.TeacherString = selectedNames?.Parse();

                        // 选择ID
                        var selectedIDs = window.Teachers.Select(st =>
                        {
                            return(st.ID);
                        });
                        model.TeacherIDs = selectedIDs?.ToList();
                    }
                }
            };
            window.ShowDialog();
        }
        void deleteCommand(object obj)
        {
            var confirm = this.ShowDialog("提示信息", "确认删除?", CustomControl.Enums.DialogSettingType.OkAndCancel, CustomControl.Enums.DialogType.Warning);

            if (confirm == CustomControl.Enums.DialogResultType.OK)
            {
                UIClass uiClass = obj as UIClass;
                this.Classes.Remove(uiClass);
                removeClasses.Add(uiClass);

                this.RaisePropertyChanged(() => ShowOperationPanel);
            }
        }
Beispiel #33
0
        //Handles the selected class
        public int HandleSelectedClass(UIClass uiClass, int currentTableColumn)
        {
            switch (uiClass)
            {
                case UIClass.FirstClass:
                    cls = new FirstClass();
                    break;
                case UIClass.SecondClass:
                    cls = new SecondClass();
                    break;
            }

               return cls.SelectTableColumn( currentTableColumn);
        }
Beispiel #34
0
    void Start()
    {
        uiClass = GameObject.Find("GameController").GetComponent <UIClass> ();
        transform.FindChild("Projector").gameObject.SetActive(true);
        mesh = GetComponent <MeshFilter>().mesh;
        Spheriphy();

        oneProps   = Resources.LoadAll("Prefabs/Props/" + uiClass.propOne_Str, typeof(GameObject)).Cast <GameObject>().ToList();
        twoProps   = Resources.LoadAll("Prefabs/Props/" + uiClass.propTwo_Str, typeof(GameObject)).Cast <GameObject>().ToList();
        threeProps = Resources.LoadAll("Prefabs/Props/" + uiClass.propThree_Str, typeof(GameObject)).Cast <GameObject>().ToList();
        fourProps  = Resources.LoadAll("Prefabs/Props/" + uiClass.propFour_Str, typeof(GameObject)).Cast <GameObject>().ToList();

        playerSpawn = GameObject.Find("PlayerSpawn");
        playerSpawn.SetActive(false);
    }
Beispiel #35
0
        [TestCase("nesto", "nesto", "5")] //no ,
        public void UIClassBadException(string database, string deltacontent, string lines)
        {
            Mock <IController> controllerDouble = new Mock <IController>();

            controllerDouble.Setup(controller => controller.DatabaseContent).Returns(database);
            controllerDouble.Setup(controller => controller.DeltaContent).Returns(deltacontent);
            controllerDouble.Setup(controller => controller.LineRange).Returns(lines);

            controller = controllerDouble.Object;

            Assert.Throws <ArgumentException>(() =>
            {
                UIClass ui = new UIClass(controller);
            }
                                              );
        }
Beispiel #36
0
        public static float Calculate(string departure, string destination, UIClass type, UIDiscount discount, bool singleFare)
        {
            float ret = 0;
            int tariefeenheden = Tariefeenheden.getTariefeenheden(departure, destination);
            switch (type)
            {
                case UIClass.FirstClass:
                    ret = FirstClassCalculator.Calculate(tariefeenheden, discount);
                    break;
                case UIClass.SecondClass:
                    ret = SecondClassCalculator.Calculate(tariefeenheden, discount);
                    break;
            }

            if (singleFare) { return ret; }
            else { return ret * 2; }
        }
Beispiel #37
0
 public void CreateTicket(string dep, string dest, UIClass type, UIDiscount disc, bool single)
 {
     t = new Ticket(dep, dest, type, disc, single);
 }
Beispiel #38
0
 public Ticket(string dep, string dest, UIClass type, UIDiscount disc, bool single)
 {
     departure = dep;
     destination = dest;
     ticketType = type;
     discount = disc;
     singleFare = single;
     price = PriceCalculator.Calculate(departure, destination, ticketType, discount, singleFare);
 }