static HealthModList() {
		mods = new Desk();
		string str = DataF.Load("HealthMods");
		if (str == "") { str = DataF.Load("BaseHealthMods"); }
		mods.LoadCSV(str);
		
	}
        public DeskEditorPresenter(IDeskEditorView view)
        {
            if (view == null)
                throw new ArgumentNullException("View can't be null");

            __view = view;
            __desk = new Desk();
        }
示例#3
0
    void Awake()
    {
        button = GetComponent<Button>();
        business = FindObjectOfType<Business>();
        d = deskObj.GetComponent<Desk>();

        business.MoneyChanged += m => UpdateRow(m);

        UpdateRow(business.Money);
    }
        public DeskEditorPresenter(IDeskEditorView view, Desk desk)
        {
            if (view == null)
                throw new ArgumentNullException("View can't be null");

            if (desk == null)
                throw new ArgumentNullException("Desk can't be null");

            __view = view;
            __desk = desk;
        }
        public CardEditorPresenter(ICardEditorView view, Desk desk, Card card)
        {
            if (view == null)
                throw new ArgumentNullException("The view can't be null");

            if (desk == null)
                throw new ArgumentNullException("The desk can't be null");

            __view = view;
            __desk = desk;
            __card = card;

            __frontElements = new List<CardRelation>(__card.FrontElements);
            __backElements = new List<CardRelation>(__card.BackElements);
            __currentFrontTemplate = __desk.GetCardFrontTemplate();
            __currentBackTemplate = __desk.GetCardBackTemplate();
            __isNewCard = false;
        }
        public DeskViewerPresenter(IDeskViewerView view, Desk desk)
        {
            if (view == null)
                throw new ArgumentNullException("View can't be null");

            __view = view;
            __desk = desk;

            __desk.LoadCards();

            __sequencialNavigator = new SequencialNavigator(__desk.Cards.Count);
            __randomNavigator = new RandomNavigator(__desk.Cards.Count);
            this.IsShuffle = false;
            this.IsCiclic = false;

            this.CurrentIndex = __navigator.CurrentIndex;
            __initialized = true;
        }
示例#7
0
        static void Main(string[] args)
        {
            Complex t1 = new Complex(1, 1);
            Complex t2 = new Complex(2, 3), t3;

            t3 = Complex.sum(t1, t2);
            Console.WriteLine("Комплексные числа:");
            Console.WriteLine(Complex.ToString(t1));
            Console.WriteLine(Complex.ToString(t2));
            Console.WriteLine(Complex.ToString(t3));
            Console.WriteLine("Работа с шахматной доской:");
            Desk desk1 = new Desk(4, 1, 1, 4, 4, 4);

            Console.WriteLine("Размер доски:");
            Console.WriteLine(Desk.Count(desk1));
            Console.WriteLine("Цвет клекти:");
            Console.WriteLine(Desk.Color(desk1));
            Console.WriteLine("Одинаковый цвет клеток, на которых стоят фигуры:");
            Console.WriteLine(Desk.SameSquare(desk1));
            Console.WriteLine("Бьет ли фигура другую фигуру?");
            Desk.Eating(desk1);
            // Задание с датой
            Console.WriteLine("Работа с датой:");
            DateTime d1 = new DateTime(2020, 04, 10);


            DateTime nowDate    = DateTime.Now;
            string   passedDays = Date.daysFromStart(d1);

            Console.WriteLine(passedDays);

            string remainDays = Date.daysToEnd(d1);

            Console.WriteLine(remainDays);

            Console.WriteLine("Вчера - {0}.{1}.{2}", (d1.AddDays(-1)).Year, (d1.AddDays(-1)).Month, (d1.AddDays(-1)).Day);
            Console.WriteLine("Завтра - {0}.{1}.{2}", (d1.AddDays(1)).Year, (d1.AddDays(1)).Month, (d1.AddDays(1)).Day);

            Console.WriteLine();
            // Числа Армстронга
            Homework.Armstrong();


            // Кол-во квадратов
            Console.WriteLine("Стороны прямоугольника");
            int firstSide  = Int32.Parse(Console.ReadLine());
            int secondSide = Int32.Parse(Console.ReadLine());

            Console.WriteLine($"Кол-во квадратов = {Homework.Squares(firstSide, secondSide)}");
            Console.WriteLine($"Кол-во маленьких квадратов = {firstSide * secondSide}");

            //-----------------------------Самостоятельная работа--------------------------------------------------------
            // Радиус вписанной окружности
            Console.WriteLine("Радиус вписанной окружности");
            double firstNum = double.Parse(Console.ReadLine());

            Console.WriteLine($"Радиус = {Homework.Radius(firstNum)}");

            // Cуществование треугольника
            Console.WriteLine("Треугольник?");
            int a = Int32.Parse(Console.ReadLine());
            int b = Int32.Parse(Console.ReadLine());
            int c = Int32.Parse(Console.ReadLine());

            Homework.Task2(a, b, c);

            // Проверка условий
            Homework.Task3();

            // Мужчины и женщины
            Homework.Task4();

            // Задача 3 циклами
            Homework chk = new Homework();

            for (int i = 100; i < 1000; i++)
            {
                if (chk.Task5(i))
                {
                    Console.Write(i + " ");
                }
            }
            Console.WriteLine();

            int      ii   = 100;
            Homework chkk = new Homework();

            while (ii < 1000)
            {
                if (chkk.Task5(ii))
                {
                    Console.Write(ii + " ");
                }
                ii++;
            }
            Console.WriteLine();
            int      iii   = 100;
            Homework chkkk = new Homework();

            do
            {
                if (chkk.Task5(iii))
                {
                    Console.Write(iii + " ");
                }
                iii++;
            } while (iii < 1000);
            Console.WriteLine();
            // Пирамида чисел
            int k = 8;
            int l = 1;
            int q = 1;
            {
                for (q = 1; q <= 8; ++q, Console.WriteLine())
                {
                    if (q % 2 != 0)
                    {
                        for (int jj = 1; jj <= l; ++jj)
                        {
                            Console.Write($" {k}");
                        }
                        k--;
                    }
                    else
                    {
                        for (int jj = 1; jj <= l; ++jj)
                        {
                            Console.Write($" {k}");
                        }
                        l++;
                    }
                }
            }
        }
示例#8
0
        public void PlaceObject()
        {
            Object temp;

            switch (ObjectListBox.SelectedItem.ToString())
            {
            case "Key":
                temp = new Key();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Ammo":
                temp = new Ammo();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Health":
                temp = new Health();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Adrenaline":
                temp = new Adrenaline();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Barrel":
                temp = new Barrel();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Pipe":
                temp = new Pipe();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Couch":
                temp = new Couch();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Wardrobe":
                temp = new Wardrobe();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Lamp":
                temp = new Lamp();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Desk":
                temp = new Desk();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Tree":
                temp = new Tree();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "China":
                temp = new China();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Table":
                temp = new Table();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Chair":
                temp = new Chair();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Pistol":
                temp = new Pistol();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Door":
                temp = new Door();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Assault Rifle":
                temp = new AssaultRifle();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Shotgun":
                temp = new Shotgun();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Rocket Launcher":
                temp = new RocketLauncher();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Laser Cannon":
                temp = new LaserCannon();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Player":
                temp = new Player();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Enemy":
                temp = new Enemy();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Civilian":
                temp = new Civilian();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Boss":
                temp = new Boss();
                PlacedObjectListBox.Items.Add(temp);
                break;

            case "Cop":
                temp = new Cop();
                PlacedObjectListBox.Items.Add(temp);
                break;
            }
            ;
        }
示例#9
0
 public void Prepare(Desk desk)
 {
     desk.AddMessage($"请{desk.CurrentPlayer.ToAtCodeWithRole()}出牌");
     RunHostedCheck(desk);
 }
示例#10
0
 public Command(Desk desk)
 {
     this.desk = desk;
 }
示例#11
0
        private void UnderlyingAsset_OnSecuritySelected()
        {
            var security = UnderlyingAsset.SelectedSecurity;

            if (_currentSecurity == security)
            {
                return;
            }

            if (_currentSecurity != null)
            {
                foreach (var option in _options.Cache)
                {
                    new RefuseMarketDataCommand(option, MarketDataTypes.Level1).Process(this);
                }

                new RefuseMarketDataCommand(_currentSecurity, MarketDataTypes.Level1).Process(this);

                _currentSecurity = null;

                _options.Clear();

                Desk.Options = Enumerable.Empty <Security>();
                Desk.RefreshOptions();

                _minAssetPrice = _maxAssetPrice = 0;
                //_minDate = _maxDate = default(DateTime);

                Process(() =>
                {
                    CurrentDate.Minimum = null;
                    CurrentDate.Maximum = null;

                    AssetPriceModified.Value  = 0;
                    AssetPriceReset.IsEnabled = false;

                    CurrentDateModified.Value  = 0;
                    CurrentDateReset.IsEnabled = false;
                });
            }

            _currentSecurity = security;

            if (_currentSecurity != null)
            {
                _options.AddRange(GetOptions());

                foreach (var option in _options.Cache)
                {
                    new RequestMarketDataCommand(option, MarketDataTypes.Level1).Process(this);
                }

                new RequestMarketDataCommand(_currentSecurity, MarketDataTypes.Level1).Process(this);

                Desk.Options = _options.Cache;
                Desk.RefreshOptions();

                SetPriceLimits();
                SetDateLimits();
            }

            Title = LocalizedStrings.Str3265 + " " + _currentSecurity;
        }
示例#12
0
        public void AddCommentToStoryBoard(string comment, string authorName, DateTime commentDate, Desk desk, DeskRoleUser user, DeskDocumentVersion docVersion, DeskStoryBoardType commentType = DeskStoryBoardType.TextComment)
        {
            DeskStoryBoard storyBoardComment = new DeskStoryBoard(_userName)
            {
                Author              = authorName,
                BoardType           = commentType,
                DateBoard           = commentDate.ToLocalTime(),
                Comment             = comment,
                Desk                = desk,
                DeskDocumentVersion = docVersion
            };

            if (user != null)
            {
                storyBoardComment.DeskRoleUser = user;
            }


            Save(ref storyBoardComment);
        }
 // Get the desk object's surface material depending on what radio button is checked
 public void getSurfaceMaterial(Desk desk)
 {
     Desk.SurfaceMaterial material = (Desk.SurfaceMaterial)Enum.ToObject(typeof(Desk.SurfaceMaterial), ddlSurfaceMaterials.SelectedIndex);
     desk.Material = material;
 }
示例#14
0
 public FakePlayer(string nick, Desk desk) : base(Rng.Next(300000).ToString(), desk)
 {
 }
示例#15
0
 public Vanga(Desk desk)
 {
     _desk          = desk;
     _vangaMadeTurn = false;
 }
 public ChangeStateClick(ListTable listTable, Desk d)
 {
     this.listTable = listTable;
     this.d         = d;
 }
示例#17
0
        public decimal getDeskCost(Desk desk)
        {
            decimal cost      = 0;
            decimal basePrice = 200;

            cost += basePrice;
            decimal surfaceArea = desk.Width * desk.Height;

            if (surfaceArea > 1000)
            {
                cost += surfaceArea - 1000;
            }
            decimal drawersCost = desk.NumberOfDrawer * 50;

            cost += drawersCost;
            cost += desk.SurfaceMaterial.Cost;
            if (desk.ProductionTime.Days < 14)
            {
                switch (desk.ProductionTime.Days)
                {
                case 3:
                    if (surfaceArea < 1000)
                    {
                        cost += 60;
                    }
                    if (surfaceArea < 2000)
                    {
                        cost += 70;
                    }
                    if (surfaceArea > 2000)
                    {
                        cost += 80;
                    }
                    break;

                case 5:
                    if (surfaceArea < 1000)
                    {
                        cost += 40;
                    }
                    if (surfaceArea < 2000)
                    {
                        cost += 50;
                    }
                    if (surfaceArea > 2000)
                    {
                        cost += 60;
                    }
                    break;

                case 7:
                    if (surfaceArea < 1000)
                    {
                        cost += 30;
                    }
                    if (surfaceArea < 2000)
                    {
                        cost += 35;
                    }
                    if (surfaceArea > 2000)
                    {
                        cost += 40;
                    }
                    break;

                default:
                    break;
                }
            }
            return(cost);
        }
示例#18
0
 public DeleteDeskHandle(ListTable listTable, Desk d)
 {
     this.listTable = listTable;
     this.d         = d;
 }
示例#19
0
 public FakePlayer(Desk desk) : base(GenerateName(desk))
 {
     HostedEnabled = true;
 }
示例#20
0
        public KitchenModel()
        {
            personnel = new List <Sprite>();
            objects   = new List <Sprite>();

            Desk                 kitchenDesk            = new Desk();
            Sink                 kitchenSink            = new Sink();
            HeatingPlate         plaque1                = new HeatingPlate();
            HeatingPlate         plaque2                = new HeatingPlate();
            HeatingPlate         plaque3                = new HeatingPlate();
            Dishwasher           laveVaisselle          = new Dishwasher();
            LaundryMachine       laveLinge              = new LaundryMachine();
            DishesStock          stockVaisselle         = new DishesStock();
            DirtyDishesStock     stockVaiselleSale      = new DirtyDishesStock();
            Fridge               kitchenFridge          = new Fridge();
            KitchenMaterialStock kitchenMaterialStock   = new KitchenMaterialStock();
            IngredientStock      kitchenIngredientStock = new IngredientStock();

            objects.Add(kitchenDesk.Sprite);
            objects.Add(kitchenSink.Sprite);
            objects.Add(plaque1.Sprite);
            objects.Add(plaque2.Sprite);
            objects.Add(plaque3.Sprite);
            objects.Add(laveVaisselle.Sprite);
            objects.Add(laveLinge.Sprite);
            objects.Add(stockVaisselle.Sprite);
            objects.Add(stockVaiselleSale.Sprite);
            objects.Add(kitchenFridge.Sprite);
            objects.Add(kitchenMaterialStock.Sprite);
            objects.Add(kitchenIngredientStock.Sprite);


            Plunger plongeur   = new Plunger(kitchenDesk, stockVaiselleSale, stockVaisselle, laveVaisselle, laveLinge, kitchenSink);
            Clerk   commis1    = new Clerk(kitchenMaterialStock, kitchenIngredientStock, kitchenFridge, kitchenSink, "GabinCuisto");
            Clerk   commis2    = new Clerk(kitchenMaterialStock, kitchenIngredientStock, kitchenFridge, kitchenSink, "MaxCuisto");
            Cooker  cuisinier1 = new Cooker(commis1, commis2, kitchenMaterialStock, kitchenIngredientStock, kitchenFridge, "BenjaminCuisto");
            Cooker  cuisinier2 = new Cooker(commis1, commis2, kitchenMaterialStock, kitchenIngredientStock, kitchenFridge, "PirminCuisto");
            Chef    chef       = new Chef(cuisinier1, cuisinier2, kitchenDesk);


            personnel.Add(chef.Sprite);
            personnel.Add(cuisinier1.Sprite);
            personnel.Add(cuisinier2.Sprite);
            personnel.Add(commis1.Sprite);
            personnel.Add(commis2.Sprite);
            personnel.Add(plongeur.Sprite);


            socket = new SocketApp();

            SocketListener.kitchenDesk = kitchenDesk;

            // Ajouter des abonnés observer à l'observable Comptoir
            kitchenDesk.AttachChef(chef);
            kitchenDesk.AttachPlunger(plongeur);
            kitchenDesk.AttachSocket(socket);



            //// Créations des Ingrédients
            //Ingredient steak = new Ingredient("Steak", "Viande");
            //Ingredient poulet = new Ingredient("Poulet", "Viande");
            //Ingredient poisson = new Ingredient("Poisson", "Poisson");
            //Ingredient pain = new Ingredient("Pain", "Pain");
            //Ingredient salade = new Ingredient("Salade", "Vegetables");
            //Ingredient tomate = new Ingredient("Tomate", "Vegetables");
            //Ingredient oignon = new Ingredient("Oignon", "Vegetables");
            //Ingredient cheddar = new Ingredient("Cheddar", "Frommage");
            //Ingredient raclette = new Ingredient("Raclette", "Fromage");
            //Ingredient sauce = new Ingredient("Sauce", "Sauce");

            //// Instanciation Object Cuisine Material
            //KitchenKnife kitchenKnife = new KitchenKnife();
            //Pans kitchenCasserolle = new Pans();
            //Stove kitchenPoêle = new Stove();
            //WoodenSpoon kitchenCuillière = new WoodenSpoon();
            //SaladBowl kitchenBolSalade = new SaladBowl();


            //// Creation des etapes des recettes
            //RecipeStep prepareSteak = new RecipeStep("Cuire le Steak", 10);
            //prepareSteak.IngredientQuantities.Add(new IngredientQuantity(1, steak));
            //prepareSteak.ListUstencils.Add(kitchenPoêle);

            //RecipeStep preparePoulet = new RecipeStep("Cuire le Poulet", 10);
            //preparePoulet.IngredientQuantities.Add(new IngredientQuantity(1, poulet));
            //preparePoulet.ListUstencils.Add(kitchenPoêle);

            //RecipeStep preparePoisson = new RecipeStep("Cuire le Poisson", 10);
            //preparePoisson.IngredientQuantities.Add(new IngredientQuantity(1, poisson));
            //preparePoisson.ListUstencils.Add(kitchenPoêle);

            //RecipeStep prepareVegetables = new RecipeStep("Preparer les légumes", 5);
            //prepareVegetables.IngredientQuantities.Add(new IngredientQuantity(1, salade));
            //prepareVegetables.IngredientQuantities.Add(new IngredientQuantity(2, tomate));
            //prepareVegetables.IngredientQuantities.Add(new IngredientQuantity(1, oignon));
            //prepareVegetables.ListUstencils.Add(kitchenBolSalade);
            //prepareVegetables.ListUstencils.Add(kitchenCuillière);
            //prepareVegetables.ListUstencils.Add(kitchenKnife);

            //RecipeStep prepareRaclette = new RecipeStep("Préparer le frommage à Raclette", 5);
            //prepareRaclette.IngredientQuantities.Add(new IngredientQuantity(2, raclette));
            //prepareRaclette.ListUstencils.Add(kitchenKnife);

            //RecipeStep prepareCheddar = new RecipeStep("Préparer le Cheddar", 5);
            //prepareCheddar.IngredientQuantities.Add(new IngredientQuantity(2, cheddar));
            //prepareCheddar.ListUstencils.Add(kitchenKnife);

            //RecipeStep assemblerBurger = new RecipeStep("Assembler le Burger", 5);
            //assemblerBurger.IngredientQuantities.Add(new IngredientQuantity(1, pain));
            //assemblerBurger.IngredientQuantities.Add(new IngredientQuantity(1, sauce));


            //// Creations des plats
            //Dish burgerClassic = new Dish(1, "Burger Classique");
            //burgerClassic.Recipe.Add(prepareSteak);
            //burgerClassic.Recipe.Add(prepareVegetables);
            //burgerClassic.Recipe.Add(prepareCheddar);
            //burgerClassic.Recipe.Add(assemblerBurger);

            //Dish burgerChicken = new Dish(2, "Burger Poulet");
            //burgerChicken.Recipe.Add(preparePoulet);
            //burgerChicken.Recipe.Add(prepareVegetables);
            //burgerChicken.Recipe.Add(prepareCheddar);
            //burgerChicken.Recipe.Add(assemblerBurger);

            //Dish burgerMountain = new Dish(3, "Burger Montagnard");
            //burgerMountain.Recipe.Add(prepareSteak);
            //burgerMountain.Recipe.Add(prepareVegetables);
            //burgerMountain.Recipe.Add(prepareCheddar);
            //burgerMountain.Recipe.Add(assemblerBurger);

            //Dish burgerVegan = new Dish(4, "Burger Vegan");
            //burgerVegan.Recipe.Add(preparePoisson);
            //burgerVegan.Recipe.Add(prepareVegetables);
            //burgerVegan.Recipe.Add(prepareCheddar);
            //burgerVegan.Recipe.Add(prepareRaclette);
            //burgerVegan.Recipe.Add(assemblerBurger);

            DomainApp domainApp = new DomainApp();

            Console.WriteLine("Instanciation du Controller sans problèmes");
        }
示例#21
0
 public void AddCommentToStoryBoard(string comment, Desk desk, DeskRoleUser user, DeskDocumentVersion docVersion, DeskStoryBoardType commentType = DeskStoryBoardType.TextComment)
 {
     AddCommentToStoryBoard(comment, CommonUtil.GetInstance().UserDescription, desk, user, docVersion, commentType);
 }
示例#22
0
        private int GetScore(Desk loadedDesk, CellPosition loadedCheckerCellPosition, CellPosition loadedNextCellPosition, int currentScore)
        {
            var score = currentScore;
            var desk  = new Desk(loadedDesk.ReturnDeskAsRawText());

            if (desk.IsGameFinished)
            {
                return(score);
            }
            desk.StartBotSimulation();
            var side        = desk.CurrentWhiteTurn;
            var checkerCell = desk.GetCell(loadedCheckerCellPosition);
            var nextCell    = desk.GetCell(loadedNextCellPosition);

            checkerCell.Click(false);
            if (desk.IsGameFinished)
            {
                return(score);
            }
            nextCell.Click(false);
            if (desk.IsGameFinished)
            {
                return(score);
            }
            var lastShotDownCell = desk.Get_lastShotDownCheckerCell();

            if (lastShotDownCell == null) //debug
            {
                throw new Exception("Muuuuu!");
            }
            score += GetCeckerScore(lastShotDownCell.Checker, side);
            Cell currentShotDownCell;

            while (side == desk.CurrentWhiteTurn)
            {
                var cellPosition = SelectBestBeatCombination(desk);
                desk.GetCell(cellPosition).Click(false);
                if (desk.IsGameFinished)
                {
                    return(score);
                }
                currentShotDownCell = desk.Get_lastShotDownCheckerCell();
                if (!lastShotDownCell.GetCellPosition().Equals(currentShotDownCell.GetCellPosition()))
                {
                    score += GetCeckerScore(currentShotDownCell.Checker, side);
                }
            }

            // beat if need and compute score
            desk.CheckIfNeedBeate();
            if (!desk.NeedBeat)
            {
                return(score);
            }


            var anotherSideDesk = new Desk(desk.ReturnDeskAsRawText());

            anotherSideDesk.StartBotSimulation();
            anotherSideDesk.CheckIfNeedBeate();
            if (!anotherSideDesk.NeedBeat)
            {
                return(score);
            }
            while (side != anotherSideDesk.CurrentWhiteTurn)
            {
                var cellPosition = SelectBestBeatCombination(anotherSideDesk);
                anotherSideDesk.GetCell(cellPosition).Click(false);
                if (desk.IsGameFinished)
                {
                    return(score);
                }
                currentShotDownCell = anotherSideDesk.Get_lastShotDownCheckerCell();
                if (currentShotDownCell != null && !lastShotDownCell.GetCellPosition().Equals(currentShotDownCell.GetCellPosition()))
                {
                    score += GetCeckerScore(currentShotDownCell.Checker, side);
                }
            }

            currentShotDownCell = anotherSideDesk.Get_lastShotDownCheckerCell();
            if (!lastShotDownCell.GetCellPosition().Equals(currentShotDownCell.GetCellPosition()))
            {
                score += GetCeckerScore(currentShotDownCell.Checker, side);
            }
            return(score);
        }
示例#23
0
 public void AddCommentToStoryBoard(string comment, string authorName, Desk desk, DeskRoleUser user, DeskDocumentVersion docVersion, DeskStoryBoardType commentType = DeskStoryBoardType.TextComment)
 {
     AddCommentToStoryBoard(comment, authorName, DateTime.Now, desk, user, docVersion, commentType);
 }
示例#24
0
        private CellPosition SelectBestBeatCombination(Desk desk)
        {
            var          selectedCell = desk.Get_selectedCell();
            CellPosition currentCellPosition;
            int          currentScore;

            if (selectedCell != null)
            {
                Console.WriteLine("Vanga nselectedCell != null");
                var selectedCellPosition = selectedCell.GetCellPosition();
                var allowedPositions     = desk.AllowedPositions;
                currentScore        = 0;
                currentCellPosition = null;
                foreach (var position in allowedPositions)
                {
                    var score = GetScore(desk, selectedCellPosition, position, 0);
                    if (currentCellPosition == null)
                    {
                        currentScore        = score;
                        currentCellPosition = position;
                    }
                    else
                    {
                        if (score <= currentScore)
                        {
                            continue;
                        }
                        currentScore        = score;
                        currentCellPosition = position;
                    }
                }

                Console.WriteLine($@"Vanga nextCellPosition = {(currentCellPosition == null ? "null" : $"r:{currentCellPosition.Get_row()} c:{currentCellPosition.Get_column()}")}");
                return(currentCellPosition);
            }

            var battleCheckersPositions = desk.BattleCheckersPositions;
            var battleCeckersCells      = new List <Cell>();

            foreach (var battleCheckerPosition in battleCheckersPositions)
            {
                var cell = desk.GetCell(battleCheckerPosition);
                battleCeckersCells.Add(cell);
            }

            currentScore        = 0;
            currentCellPosition = null;
            foreach (var battleCeckersCell in battleCeckersCells)
            {
                var score = GetScore(desk, battleCeckersCell.GetCellPosition());
                if (currentCellPosition == null)
                {
                    currentScore        = score;
                    currentCellPosition = battleCeckersCell.GetCellPosition();
                }
                else
                {
                    if (score <= currentScore)
                    {
                        continue;
                    }
                    currentScore        = score;
                    currentCellPosition = battleCeckersCell.GetCellPosition();
                }
            }

            return(currentCellPosition);
        }
        /********************
        * 3. btnSubmit      *
        ********************/
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (ValidateRequirements())
            {
                StreamReader  reader         = new StreamReader("quotes.txt");
                List <string> previousQuotes = new List <string>();
                string        line           = "";
                while (!(reader.EndOfStream))
                {
                    line = reader.ReadLine();
                    previousQuotes.Add(line);
                }

                reader.Close();

                Desk      desk      = createDesk();
                DeskQuote deskQuote = createDeskQuote(desk);

                // Requirement 5
                StreamWriter writer = new StreamWriter("quotes.txt");

                foreach (string s in previousQuotes)
                {
                    writer.WriteLine(s);
                }

                writer.WriteLine("Creation Date: " + DateTime.Today.ToString("yyyy-MM-dd") + ", " +
                                 "Customer Name: " + desk.CustomerFirstName + " " + desk.CustomerLastName + ", " +
                                 //"Base Price: $" + DeskQuote.BASE_PRICE.ToString() + ", " +
                                 "Total Surface Area: " + (desk.Width * desk.Depth).ToString() + " sq. inches, " +
                                 "Number of Drawers: " + desk.NoOfDrawers.ToString() + ", " +
                                 "Surface Material: " + desk.Material.ToString() + ", " +
                                 "Rush Order Days: " + desk.Days.ToString() + ", " +
                                 "Total Price: $" + deskQuote.GetTotalPrice(DeskQuote.BASE_PRICE,
                                                                            deskQuote.SurfaceAreaPrice,
                                                                            deskQuote.DrawerPrice,
                                                                            deskQuote.SurfaceMaterialPrice,
                                                                            deskQuote.RushOrderPrice).ToString());
                writer.Close();

                MessageBox.Show("Quote successfully created", "Quote Added");

                foreach (Control c in this.Controls)
                {
                    if (c is TextBox)
                    {
                        TextBox tb = (TextBox)c;
                        tb.Text = string.Empty;
                    }
                    else if (c is RadioButton)
                    {
                        RadioButton rb = (RadioButton)c;
                        rb.Checked = false;
                    }
                    else if (c is Label)
                    {
                        Label lbl = (Label)c;
                        if (lbl.Name.Contains("Error"))
                        {
                            lbl.Text = string.Empty;
                        }
                    }
                }
            }
            else
            {
                lblSubmitError.Text = "Could not calculate quote. Please fill in all fields.";
            }
        }
示例#26
0
    // Update is called once per frame
    void Update()
    {
        if (Game != null && Game.Active)
        {
            CurrentTimer += Time.deltaTime;

            if (CurrentTimer >= Interval)
            {
                Process();
            }


            TimeLeft -= Time.deltaTime;



            if (TimeLeft <= 0f)
            {
                TimeLeft    = 0f;
                Game.Active = false;
                LevelFail();
            }

            TimeBar.sizeDelta = new Vector2(WidthOfBar / (CurrentLevel.seconds - AdjustTimeBy)
                                            * TimeLeft, TimeBar.sizeDelta.y);


            if (Input.GetMouseButton(0))
            {
                RaycastHit [] hits;
                Ray           ray = Camera.main.ScreenPointToRay(Input.mousePosition);

                hits = Physics.RaycastAll(ray);

                SelectedDesk = null;

                foreach (RaycastHit hit in hits)
                {
                    if (hit.transform.gameObject.tag == "Monitor")
                    {
                        SelectedDesk = hit.transform.GetComponentInParent <Desk> ();
                        break;
                    }
                }

                if (SelectedDesk != null)
                {
                    SelectedDesk.Fix();

                    if (SelectedDesk.ComputerStatus != ComputerStatus.Normal)
                    {
                        FixBar.parent.parent.gameObject.SetActive(true);
                        FixBar.sizeDelta = new Vector2(WidthOfBar / GameController.Instance.MaximumFixTime * SelectedDesk.TimeToFix, FixBar.sizeDelta.y);
                    }
                    else
                    {
                        FixBar.parent.parent.gameObject.SetActive(false);
                    }
                }
                else
                {
                    FixBar.parent.parent.gameObject.SetActive(false);
                }
            }
            else
            {
                FixBar.parent.parent.gameObject.SetActive(false);
            }
        }
        else
        {
            Delay -= Time.deltaTime;

            if (Delay <= 0f && Input.GetMouseButtonDown(0))
            {
                if (Game == null)
                {
                    ResetGame();
                }
                else
                {
                    NewLevel();
                }
            }
        }
    }
示例#27
0
 public MoveLeftCommand(Desk desk) : base(desk)
 {
 }
示例#28
0
 public int insertDesk(Desk desk)
 {
     return(new DeskService().InsertDesk(desk));
 }
示例#29
0
 public static int CalcResult(Desk desk)
 {
     return((int)Math.Pow(2, desk.Multiplier) * Constants.BaseScore);
 }
示例#30
0
        public async Task <FunctionResult> CreateDine(Cart cart, CartAddition addition)
        {
            // 主要支付方式判断
            DinePaidDetail mainPaidDetail = new DinePaidDetail {
                PayKind = await ctx.PayKinds.FirstOrDefaultAsync(p => p.Id == cart.PayKindId),
                Price   = 0,
            };

            if (mainPaidDetail.PayKind == null)
            {
                return(new FunctionResult(false, "未找到该支付方式", $"No PayKind {cart.PayKindId}"));
            }
            if (addition.From == DineFrom.CustomerBrowser && !mainPaidDetail.PayKind.Usable)
            {
                return(new FunctionResult(false, $"{mainPaidDetail.PayKind.Name}不可用", $"PayKind Disabled {mainPaidDetail.PayKind.Id}"));
            }

            // 桌号判断
            Desk Desk = await ctx.Desks.FirstOrDefaultAsync(p => p.Id == cart.DeskId);

            if (Desk == null)
            {
                return(new FunctionResult(false, "未找到当前桌号", $"No Desk {cart.DeskId}"));
            }
            if (!Desk.Usable)
            {
                return(new FunctionResult(false, $"{Desk.Name}不可用", $"Desk Disabled {Desk.Id}"));
            }

            Dine dine = new Dine {
                Type      = addition.DineType,
                HeadCount = cart.HeadCount,
                IsOnline  = mainPaidDetail.PayKind.Type == PayKindType.Online,
                IsPaid    = false,
                Desk      = Desk,

                UserId   = addition.UserId,
                WaiterId = addition.WaiterId,

                DineMenus       = new List <DineMenu>(),
                Remarks         = new List <Remark>(),
                DinePaidDetails = new List <DinePaidDetail>(),

                BeginTime = addition.BeginTime ?? DateTime.Now,
                From      = addition.From
            };

            // 订单备注
            foreach (int remarkId in cart.Remarks)
            {
                Remark remark = ctx.Remarks.FirstOrDefault(p => p.Id == remarkId);
                if (remark == null)
                {
                    return(new FunctionResult(false, "未找到备注信息", $"No Remark {remarkId}"));
                }

                dine.Price    += remark.Price;
                dine.OriPrice += remark.Price;
                dine.Remarks.Add(remark);
            }

            // 是否有自定义折扣方案
            if (addition.Discount.HasValue)
            {
                dine.Discount     = addition.Discount.Value;
                dine.DiscountName = addition.DiscountName;
                dine.DiscountType = DiscountType.Custom;
            }
            else
            {
                await handleDiscount(mainPaidDetail.PayKind, dine);
            }

            List <MenuExtensionWithGift> menuExtensionWithGifts = new List <MenuExtensionWithGift>();

            foreach (MenuExtension menuExtension in addition.GiftMenus)
            {
                menuExtensionWithGifts.Add(new MenuExtensionWithGift {
                    MenuExtension = menuExtension,
                    IsGift        = true
                });
            }
            foreach (MenuExtension menuExtension in cart.OrderedMenus)
            {
                menuExtensionWithGifts.Add(new MenuExtensionWithGift {
                    MenuExtension = menuExtension,
                    IsGift        = false
                });
            }
            // 处理每个点过的菜品
            FunctionResult result = await handleDineMenu(menuExtensionWithGifts, dine);

            if (!result.Succeeded)
            {
                return(result);
            }
            // 处理最后生成的价格并比较前端传输的价格数据
            result = await handleDinePrice(dine, cart.Price);

            if (!result.Succeeded)
            {
                return(result);
            }

            mainPaidDetail.Price = dine.Price;

            // 如果是线上支付并且使用了积分抵扣
            if (mainPaidDetail.PayKind.Type == PayKindType.Online && cart.PriceInPoints.HasValue)
            {
                result = await handlePoints(cart.PriceInPoints.Value, mainPaidDetail, dine);

                if (!result.Succeeded)
                {
                    return(result);
                }
            }

            // 随机立减
            if (mainPaidDetail.PayKind.Type == PayKindType.Online)
            {
                HotelConfig hotelConfig = await ctx.HotelConfigs.FirstOrDefaultAsync();

                // 如果饭店支持随机立减
                if (hotelConfig.NeedRandomPreference)
                {
                    await handleRandomPreference(hotelConfig.Id, dine, mainPaidDetail);
                }
            }

            // 如果是线上支付,则添加DinePaidDetail信息,否则不添加,交给收银系统处理
            if (mainPaidDetail.PayKind.Type == PayKindType.Online)
            {
                dine.DinePaidDetails.Add(mainPaidDetail);
            }


            // 订单发票
            if (cart.Invoice != null)
            {
                dine.Invoices.Add(new Invoice {
                    Price = dine.Price,
                    Title = cart.Invoice
                });
            }

            ctx.Dines.Add(dine);

            await ctx.SaveChangesAsync();

            return(new FunctionResult(true, dine));
        }
示例#31
0
 private void UseBlackMode_OnClick(object sender, RoutedEventArgs e)
 {
     Desk.UseBlackModel = UseBlackMode.IsChecked == true;
     Desk.RefreshOptions();
 }
示例#32
0
 public CommandParser(Desk desk)
 {
     CurrentIndex = desk.PlayerList.FindIndex(p => p.Type == PlayerType.Landlord);
 }
示例#33
0
        private static void SeedGen()
        {
            var cards = Desk.GenerateCards();

            File.Delete("seeds.txt");
            ThreadPool.SetMinThreads(16, 16);
            ThreadPool.SetMaxThreads(64, 64);
            var startTime = DateTime.Now;

            Parallel.For(0, int.MaxValue, new ParallelOptions {
                MaxDegreeOfParallelism = 64
            }, i =>
            {
                total++;
                var list = new List <Card>(cards);
                list.Shuffle(i);

                var cards1          = list.Take(17).ToListAndSort();
                var pCard1          = cards1.ExtractCardGroups();
                var cards2          = list.Skip(17).Take(17).ToListAndSort();
                var pCard2          = cards2.ExtractCardGroups();
                var cards3          = list.Skip(17 * 2).Take(17).ToListAndSort();
                var pCard3          = cards3.ExtractCardGroups();
                var count           = 0;
                var doubleKingCount = 0;
                var doubleKing      = false;
                foreach (var cardGroup in pCard1)
                {
                    if (cardGroup.Count == 4)
                    {
                        count++;
                    }
                }

                foreach (var cardGroup in pCard2)
                {
                    if (cardGroup.Count == 4)
                    {
                        count++;
                    }
                }

                foreach (var cardGroup in pCard3)
                {
                    if (cardGroup.Count == 4)
                    {
                        count++;
                    }
                }

                foreach (var card in cards1)
                {
                    if (card.Type == CardType.King)
                    {
                        doubleKingCount++;
                    }
                }
                if (doubleKingCount == 2)
                {
                    doubleKing = true;
                    goto x;
                }

                doubleKingCount = 0;
                foreach (var card in cards2)
                {
                    if (card.Type == CardType.King)
                    {
                        doubleKingCount++;
                    }
                }
                if (doubleKingCount == 2)
                {
                    doubleKing = true;
                    goto x;
                }

                doubleKingCount = 0;
                foreach (var card in cards3)
                {
                    if (card.Type == CardType.King)
                    {
                        doubleKingCount++;
                    }
                }
                if (doubleKingCount == 2)
                {
                    doubleKing = true;
                }

                x:
                if (count > 5)
                {
                    valid++;
                    Console.ForegroundColor = doubleKing ? ConsoleColor.Yellow : ConsoleColor.White;
                    var t   = (DateTime.Now - startTime).TotalMilliseconds;
                    var str = $"Bomb count: {count}, seed {i} , doubleKing {doubleKing}, TotalCount {total}, validCount{valid}, time {t/60}s, totalSpeed {total / t}/ms, validS {valid / t * 1000 * 60}/min\r\n";
                    File.AppendAllText("seeds.txt", str);
                    Console.Write(str);
                }
            });
        }
示例#34
0
        private void ParsePlayerSubmitCard(Desk desk, Player player, string command)
        {
            switch (command)
            {
            case "过":

                #region Pass

            case "pass":
            case "passs":
            case "passss":
            case "passsss":
            case "passssss":
            case "passsssss":
            case "passssssss":
            case "passsssssss":
            case "passssssssss":
            case "passsssssssss":
            case "passssssssssss":     // 应LG的要求 别怪我 这里是暴力写法
            case "passsssssssssss":
            case "passssssssssssss":
            case "passsssssssssssss":
            case "passssssssssssssss":
            case "passsssssssssssssss":
            case "passssssssssssssssss":
            case "passsssssssssssssssss":
            case "passssssssssssssssssss":
            case "passsssssssssssssssssss":

                #endregion Pass

            case "不出":
            case "不要":
            case "出你妈":
            case "要你妈":
                if (desk.CurrentRule == null)
                {
                    desk.AddMessage("为什么会这样呢...为什么你不出牌呢...");
                }
                else
                {
                    AnalyzeGiveUpAndMoveNext(desk);
                    RefreshCurrentRule(desk);
                    desk.BoardcastCards();
                }

                return;
            }

            if (command.StartsWith("出"))
            {
                desk.AddMessage("出的命令已经被替换为直接出牌. 如<出34567>被替换为<34567>");
                command = command.Substring(1);
            }
            var cardsCommand = command.ToUpper();
            if (cardsCommand.IsValidCardString())
            {
                if (Rules.Rules.IsCardsMatch(cardsCommand.ToCards(), desk))
                {
                    player.SendCards(desk);
                    if (CheckPlayerWin(desk))
                    {
                        return;
                    }
                    if (player.Cards.Count <= Constants.BoardcastCardNumThreshold)
                    {
                        desk.AddMessageLine($"{player.ToAtCodeWithRole()} 只剩{player.Cards.Count}张牌啦~");
                    }

                    if (desk.SuddenDeathEnabled)
                    {
                        desk.AddMessageLine("WARNING: SUDDEN DEATH ENABLED");
                    }

                    if (player.PublicCards)
                    {
                        desk.AddMessageLine($"明牌: {player.Cards.ToFormatString()}");
                    }

                    AnalyzeGiveUpAndMoveNext(desk);
                    RefreshCurrentRule(desk);
                    desk.BoardcastCards();
                }
                else
                {
                    if (desk.CurrentRule != null)
                    {
                        var rule = Rules.Rules.FirstMatchRule(cardsCommand.ToCards());
                        if (rule != null && rule != desk.CurrentRule)
                        {
                            desk.AddMessage($"你想出的牌匹配了规则{rule},但是当前规则是{desk.CurrentRule},所以你并不能出牌哟~~");
                        }
                        else
                        {
                            desk.AddMessage("你似乎不能出这些牌哟~");
                        }
                    }
                    else
                    {
                        desk.AddMessage("你似乎不能出这些牌哟~");
                    }
                }
            }
        }
 public DrawerDecorator(Desk desk) : base(desk)
 {
     this.items = new List <string>();
 }
    //Generate level from the chosen static parameters
    void GenerateLevel()
    {
        bool overriden = false;

        if (OfficeWidthOverride == 0)
        {
            OfficeWidthOverride = OfficeWidth;
        }
        else
        {
            overriden = true;
        }
        if (OfficeLengthOverride == 0)
        {
            OfficeLengthOverride = OfficeLength;
        }
        else
        {
            overriden = true;
        }

        //Calculate number of each piece required
        int floorSpaces = OfficeWidthOverride * OfficeLengthOverride;

        GameObject[] levelObjects         = new GameObject[floorSpaces];
        int          numberOfDesks        = Mathf.RoundToInt(DeskProportion * floorSpaces);
        int          numberOfWaterCoolers = Mathf.RoundToInt(WaterCoolerProportion * floorSpaces);

        //Instantiate the pieces and randomize their order
        for (int i = 0; i < numberOfDesks; ++i)
        {
            levelObjects[i] = Instantiate(GetRandomPiece(DeskPiecePrefabs));
        }
        for (int i = numberOfDesks; i < numberOfWaterCoolers + numberOfDesks && i < levelObjects.Length; ++i)
        {
            levelObjects[i] = Instantiate(GetRandomPiece(WaterCoolePiecePrefabs));
        }
        ShuffleArray(levelObjects);

        //Place the pieces in the correct locations
        for (int j = 0; j < OfficeWidthOverride; ++j)
        {
            Vector3 position = Vector3.zero;
            for (int i = 0; i < OfficeLengthOverride; ++i)
            {
                int objectIndex = j * OfficeLengthOverride + i;
                position = new Vector3(j * PieceWidth, 0f, i * PieceLength);
                GameObject levelObject = levelObjects[objectIndex];
                if (levelObject != null)
                {
                    levelObject.transform.position = position;
                    Desk desk = levelObject.GetComponent <Desk>();
                    if (desk != null)
                    {
                        levelObject.transform.rotation = Quaternion.Euler(0f, Random.Range(160f, 200f), 0f);
                        GameObject workerObject = Instantiate(GetRandomPiece(WorkerPrefabs), desk.WorkLocation.transform.position, Quaternion.identity);
                        Worker     worker       = workerObject.GetComponent <Worker>();
                        worker.OwnDesk = desk;
                    }
                }

                Instantiate(GetRandomPiece(FloorPiecePrefabs), position, Quaternion.identity);
                if (j == 0)
                {
                    Instantiate(SideWallPrefab, position, Quaternion.Euler(new Vector3(0f, -90f, 0f)));
                }
                else if (j == OfficeWidthOverride - 1)
                {
                    Instantiate(SideWallPrefab, position, Quaternion.Euler(new Vector3(0f, 90f, 0f)));
                }
            }

            Instantiate(GetRandomPiece(WallPiecePrefabs), position, Quaternion.identity);
        }


        Camera c = Camera.main;

        //Calculate height

        float height = CameraBaseHeight * Mathf.Sqrt(Mathf.Max(OfficeLength, OfficeWidth));

        //Calculate z position

        float offset = height * Mathf.Sin(CameraAngle);

        //
        if (!overriden)
        {
            c.transform.position = new Vector3((OfficeWidth - 1) * PieceWidth / 2f, height, (OfficeLength - 1) * PieceLength / 2f - offset);
            c.transform.rotation = Quaternion.Euler(90f - CameraAngle, 0f, 0f);
        }

        if (SharesTracker.Singleton != null)
        {
            SharesTracker.Singleton.StartTracking();
        }
    }