Наследование: MonoBehaviour
        //Word aangeroepen wanneer er op Create x event word gedrukt en roept de juiste view aan.
        public ActionResult Create(string Eventsoort)
        {
            if (Eventsoort == "Dance")
            {
                Evenement d = new Dance();

                return(View(("~/Views/CMS/Dance/Create.cshtml"), d));
            }
            else if (Eventsoort == "Jazz")
            {
                Evenement j = new Jazz();
                return(View(("~/Views/CMS/Jazz/Create.cshtml"), j));
            }
            else if (Eventsoort == "History")
            {
                Evenement h = new History();
                return(View(("~/Views/CMS/Historic/Create.cshtml"), h));
            }
            else if (Eventsoort == "Food")
            {
                Evenement f = new Food();
                return(View(("~/Views/CMS/Food/Create.cshtml"), f));
            }


            return(View("~/Views/CMS/Index.cshtml"));
        }
Пример #2
0
        private string Promenade(int target)
        {
            // Create the dance
            Dance dance = new Dance(16);

            string[] moves = Aoc.Framework.Input.GetStringVector(this, ",");

            // Build an history of positions
            Dictionary <string, int> positions = new Dictionary <string, int>
            {
                [dance.ToString()] = 0
            };

            // Repeat dance until exhaustion
            int counter = 0;

            while (counter < target)
            {
                // Dance ~
                counter++;
                DanceSingle(dance, moves);

                // Look for a cycle
                string hash = dance.ToString();
                if (positions.ContainsKey(hash))
                {
                    // Found a cycle, skip forward
                    int length = counter - positions[hash];

                    // Skip the cycle as many times as possible
                    counter = target - ((target - counter) % length);
                }
            }
            return(dance.ToString());
        }
Пример #3
0
        public BookingHandler()
        {
            col         = new Collector();
            _fitness    = new ObservableCollection <Event>();
            _dance      = new ObservableCollection <Event>();
            _yoga       = new ObservableCollection <Event>();
            _unhandeled = new ObservableCollection <Event>();

            foreach (var Event in col.Events)
            {
                if (Event.Type == "Fitness")
                {
                    Fitness.Add(Event);
                }
                if (Event.Type == "Yoga")
                {
                    Yoga.Add(Event);
                }
                if (Event.Type == "Dance")
                {
                    Dance.Add(Event);
                }
                if (Event.Type != "Fitness" && Event.Type != "Fitness" && Event.Type != "Dance")
                {
                    Unhandeled.Add(Event);
                }
            }
        }
Пример #4
0
        private void DanceSingle(Dance dance, string[] moves)
        {
            foreach (string move in moves)
            {
                switch (move[0])
                {
                case 's':
                {
                    dance.Spin(int.Parse(move.Substring(1)));
                    break;
                }

                case 'x':
                {
                    string[] p = move.Substring(1).Split("/");
                    dance.Exchange(int.Parse(p[0]), int.Parse(p[1]));
                    break;
                }

                case 'p':
                {
                    string[] p = move.Substring(1).Split("/");
                    dance.Partner(p[0][0], p[1][0]);
                    break;
                }
                }
            }
        }
 public Dance Post([FromBody] Dance value)
 {
     value.Id = _nextId;
     _nextId++;
     _dances.Add(value);
     return(value);
 }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        Application.targetFrameRate = 60;
        godDeath = GetComponent<GodDeath>();
        dance = GetComponent<Dance>();
        time = 0;
        firstUI.SetActive(false);
        secondUI.SetActive(false);
        thirdUI.SetActive(false);
        fourthUI.SetActive(false);
        nowStopThem.SetActive(false);
        goParty.SetActive(false);
        pause = pauseObject.GetComponent<ManualPause>();
        pausing = false;
        state = State.THIS_IS_YOU;
        rewind = false;
        spawn = spawner.GetComponent<BunnySpawnerTutorial>();
        spawn.inputEnabled = false;
        endingTimer = 0;
        dance.movable = false;
        songLength = source.clip.length;

        tutToMenu = GetComponent<TutorialToMenu>();
        freq = 1.0f / source.clip.frequency;
    }
Пример #7
0
 private void ForFun(object sender, RoutedEventArgs e)
 {
     clipCake.Visibility = Visibility.Visible;
     clipCake.Play();
     Dance.Play();
     Relax.Visibility = Visibility.Hidden;
 }
Пример #8
0
        public async Task <IActionResult> Edit(int id, [Bind("DanceId,Title,Price")] Dance dance)
        {
            if (id != dance.DanceId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(dance);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DanceExists(dance.DanceId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(dance));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Dance dance = db.Dances.Find(id);

            db.Evenements.Remove(dance);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #10
0
 public static DanceViewModel GetOrAdd(Dance dance)
 {
     if (!AllDances.ContainsKey(dance))
     {
         AllDances[dance] = new DanceViewModel(dance);
     }
     return(AllDances[dance]);
 }
Пример #11
0
    public static Dance getInstance()
    {
        if (instance == null)
        {
            instance = new Dance();
        }

        return(instance);
    }
Пример #12
0
 // TODO Create enum for Dances
 // TODO Replace entityId with RoomEntity EVERYWHERE!
 public override void Compose(Yupi.Protocol.ISender room, int entityId, Dance dance)
 {
     using (ServerMessage message = Pool.GetMessageBuffer(Id))
     {
         message.AppendInteger(entityId);
         message.AppendInteger(dance.Value);
         room.Send(message);
     }
 }
 public ActionResult Edit([Bind(Include = "EvenementID,Locatie,BeginTijd,EindTijd,TicketsTotaal,TicketsVerkocht,EvenementPrijs,Session,Artiest")] Dance dance)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dance).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(dance));
 }
Пример #14
0
        public async Task <IActionResult> Create([Bind("DanceId,Title,Price")] Dance dance)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dance);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(dance));
        }
Пример #15
0
        public void TestGet()
        {
            IEnumerable <Dance> dances = _controller.Get();

            Assert.AreEqual(3, dances.Count());

            Dance dance = _controller.Get(1);

            Assert.AreEqual("Salsa", dance.DName);

            dance = _controller.Get(100);
            Assert.IsNull(dance);
        }
        public void TestGetAllMethod()
        {
            IEnumerable <Dance> dancesList = _controller.Get();

            Assert.AreEqual(3, dancesList.Count());

            Dance dance = _controller.Get(8);

            Assert.AreEqual("Bachata", dance.DName);

            dance = _controller.Get(1);
            Assert.IsNull(dance);
        }
        // GET: Dances/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Dance dance = db.Dances.Find(id);

            if (dance == null)
            {
                return(HttpNotFound());
            }
            return(View(dance));
        }
Пример #18
0
        static async Task RunAsync()
        {
            var list = await GetStudentsAsync();

            ShowListObjects(list);
            Console.WriteLine();

            Console.WriteLine("To get a dance, write an id: ");
            string id = Console.ReadLine();

            Dance dObj = await GetDancesIdAsync(id);

            ShowListObject(dObj);
        }
Пример #19
0
        public string Partner(ReadOnlySpan <char> input, string baseLine)
        {
            var target = new Dance(baseLine);

            if (input.Length > 0)
            {
                target.Partner(input.Slice(1));
            }
            else
            {
                target.Partner(input);
            }
            return(target.Result());
        }
Пример #20
0
 private void Awake()
 {
     danceScript = this;
     bodyParts.Add(head);
     bodyParts.Add(torso);
     bodyParts.Add(upperLeg);
     bodyParts.Add(lowerLeg);
     //bodyParts.Add(contactLeg);
     bodyParts.Add(leftUpperArm);
     bodyParts.Add(leftLowerArm);
     bodyParts.Add(leftHand);
     bodyParts.Add(rightUpperArm);
     bodyParts.Add(rightLowerArm);
     bodyParts.Add(rightHand);
 }
Пример #21
0
    public void Update()
    {
        if (PlayerData.getInstance().isChange)
        {
            PlayerData.getInstance().isChange = false;
            animator.SetInteger("dancePlay", 0);
        }
        else
        {
            dance = PlayerData.getInstance().danceNum;
            animator.SetInteger("dancePlay", dance);
        }

        Dance.getInstance();
    }
        public void TestPutMethod()
        {
            Dance updatedDance = new Dance
            {
                DName        = "Waltz",
                DDescription = "A slow dance, perfomrmed normally in closed position.",
                Photo        = "",
                Country      = "Austria",
                TimeAppeared = 1600,
                DType        = "Ballroom"
            };
            int dancesCount = _controller.Put(11, updatedDance);

            Assert.AreEqual(1600, updatedDance.TimeAppeared);
        }
Пример #23
0
        public void Test1()
        {
            var d = new Dance(5, "s1,x3/4,pe/b");
            var s = Stopwatch.StartNew();

            d.Execute();
            s.Stop();
            System.Console.WriteLine(s.Elapsed);
            Assert.AreEqual("baedc", d.CurrentState);
            s.Reset();
            s.Start();
            d.Execute();
            s.Stop();
            System.Console.WriteLine(s.Elapsed);
            Assert.AreEqual("ceadb", d.CurrentState);
        }
Пример #24
0
        public void TestPost()
        {
            Dance newDance = new Dance
            {
                DName        = "Samba",
                DDescription = "...",
                Photo        = "",
                Country      = "Unknown",
                TimeAppeared = 1800,
                DType        = "Latino",
                AddedDate    = new System.DateTime()
            };
            Dance newD = _controller.Post(newDance);

            Assert.AreEqual(4, newD.Id);
        }
Пример #25
0
        public ViewResult RsvpForm(Dance dance)
        {
            if (ModelState.IsValid)
            {
                //给晚会组织者发送电子邮件
                return(View("Thanks", dance));
            }
            else
            {
                //验证错误响应
                return(View());
            }

            //TODO:对晚会的组织者发送Email响应
            //return View("Thanks", dance);
        }
Пример #26
0
        public Dance Put(int id, [FromBody] Dance value)
        {
            Dance dance = _dances.FirstOrDefault(student => student.Id == id);

            if (dance == null)
            {
                return(null);
            }
            dance.DName        = value.DName;
            dance.DDescription = value.DDescription;
            dance.Photo        = value.Photo;
            dance.Country      = value.Country;
            dance.TimeAppeared = value.TimeAppeared;
            dance.DType        = value.DType;
            dance.AddedDate    = value.AddedDate;
            return(dance);
        }
Пример #27
0
    GameObject CreateCharacter(Character character, Dance dance)
    {
        string charName  = character.ToString("g");
        string danceName = dance.ToString("g");

        GameObject instance = Instantiate(Resources.Load("Characters/" + charName)) as GameObject;
        var        spawn    = GameObject.Find("PlayerSpawnPoint").transform;

        instance.transform.position   = spawn.position;
        instance.transform.localScale = spawn.localScale;
        instance.transform.rotation   = spawn.rotation;

        instance.GetComponent <Animator>().runtimeAnimatorController =
            (RuntimeAnimatorController)Resources.Load("Dances/" + danceName,
                                                      typeof(RuntimeAnimatorController));

        return(instance);
    }
Пример #28
0
        static void Main(string[] args)
        {
            var   input       = File.ReadAllText("input.txt");
            var   foundValues = new List <string>();
            Dance dance       = new Dance(16, input);
            var   s           = Stopwatch.StartNew();
            var   bla         = (1_000_000_000 % 59);

            for (long i = 0; i < 120; i++)
            {
                dance.Execute();
                Console.WriteLine($"{i,-3} {dance.CurrentState}");
            }
            Console.WriteLine(dance.CurrentState);
            dance.Execute();
            Console.WriteLine(dance.CurrentState);
            Console.Read();
        }
Пример #29
0
    // Start is called before the first frame update
    void Start()
    {
        State2    idle      = new Idle(this.gameObject, 1);
        State2    run       = new Run(this.gameObject, 1);
        State2    dance     = new Dance(this.gameObject, 1);
        State2    befreezed = new BeFreezed(this.gameObject, 0);
        Translate tTIdle    = new Translate(idle);
        Translate tTRun     = new Translate(run);
        Translate tTDance   = new Translate(dance);
        Translate tFreezed  = new Translate(befreezed);

        stateMachines.AddTrans(nameof(idle), tTIdle);
        stateMachines.AddTrans(nameof(run), tTRun);
        stateMachines.AddTrans(nameof(dance), tTDance);
        stateMachines.AddTrans(nameof(befreezed), tFreezed);

        stateMachines.Start();
    }
Пример #30
0
        private static void Initialize()
        {
            _dances = new List <Dance>();
            Dance d1 = new Dance {
                Id = 1, DName = "Salsa", DDescription = "A popular socian dance which origins can be found in the Cuban folk dances.", Photo = "", Country = "Cuba", TimeAppeared = 1800, DType = "Latino", AddedDate = new DateTime()
            };
            Dance d2 = new Dance {
                Id = 2, DName = "Bachata", DDescription = "Slow social dance coming from the Dominican Republic.", Photo = "", Country = "Dominican Republic", TimeAppeared = 1960, DType = "Latino", AddedDate = new DateTime()
            };
            Dance d3 = new Dance {
                Id = 3, DName = "Lindy Hop", DDescription = "Lindy hop is another social dance. It's a mix of many dances such as jazz, tap, Charleston.", Photo = "", Country = "New York City", TimeAppeared = 1928, DType = "Swing", AddedDate = new DateTime()
            };

            _dances.Add(d1);
            _dances.Add(d2);
            _dances.Add(d3);
            _nextId = 4;
        }
        public void TestPostMethod()
        {
            Dance newDance = new Dance
            {
                DName        = "Waltz",
                DDescription = "A slow partner dance.",
                Photo        = "",
                Country      = "Austria",
                TimeAppeared = 1580,
                DType        = "Ballroom"
            };
            int dancesCount = _controller.Post(newDance);

            Assert.AreEqual(1, dancesCount);

            IEnumerable <Dance> dancesList = _controller.Get();

            Assert.AreEqual(4, dancesList.Count());
        }