Пример #1
0
    public static IEnumerator move(List <MazeNode> Path)
    {
        GamePlay.counterUp();
        GamePlay.scoreUp(10);
        GamePlay.updateCounters();
        MazeBuilder.ClearMaze();
        int x = Path[Path.Count - 1].x;
        int y = Path[Path.Count - 1].y;

        ColorPallet.CallRecolor();
        while (Path.Count > 1)
        {
            Vector3 last  = new Vector3(Path[0].x, Path[0].y, 0) * 10;
            Vector3 next  = new Vector3(Path[1].x, Path[1].y, 0) * 10;
            float   tween = 0;
            while (Vector3.Distance(motionControl.tr.position, next) > 0.5f)
            {
                motionControl.tr.position = Vector3.Lerp(last, next, tween);
                tween += Time.deltaTime * motionControl.s;
                yield return(new WaitForEndOfFrame());
            }
            Path.RemoveAt(0);
        }
        SaveData.saveMove(new MazeNodeData(x, y), GamePlay.getCounter(), GamePlay.getScore());
        MazeBuilder.SetClickZone(x, y);
    }
Пример #2
0
 public App()
 {
     Device.SetFlags(new[] { "Shapes_Experimental", "Brush_Experimental" });
     ColorPallet.ChangeColorTheme("Girly");
     InitializeComponent();
     MainPage = new NavigationPage(new MainPage());
 }
Пример #3
0
 public ThemePage()
 {
     InitializeComponent();
     Title = "Theme Page";
     BoxView.Background = ColorPallet.GetBackground();
     Task.Run(() => ColorPallet.AnimateBackground(BoxView));
 }
        public async Task <IActionResult> Edit(Guid id, [Bind("Id,UId,Name,Description,Pallet,IsPublic,IsCopy")] ColorPallet colorPallet)
        {
            if (id != colorPallet.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(colorPallet);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ColorPalletExists(colorPallet.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(colorPallet));
        }
Пример #5
0
 public SearchPageXama(ObservableCollection <SavedMovie> listOfSavedMovies)
 {
     InitializeComponent();
     BoxView.Background = ColorPallet.GetBackground();
     Task.Run(() => ColorPallet.AnimateBackground(BoxView));
     CollectionViewSearchPage.ItemsSource = listOfSavedMovies;
     BindingContext = this;
 }
Пример #6
0
 public static void CallVictory(bool b)
 {
     if (victory != null)
     {
         ColorPallet.CallRecolor();
         victory(b);
     }
 }
Пример #7
0
 public void ChangeColor(int i)
 {
     if (i >= -1 && i <= 7)
     {
         ColorPallet.SetIndex(i);
         ColorPallet.CallRecolor();
     }
 }
Пример #8
0
 public void ResetGame()
 {
     ColorPallet.Clear();
     GamePlay.ClearCounters();
     GamePlay.ZeroCounter();
     GamePlay.ClearVictory();
     SaveData.reset();
     data.CallReset();
     Application.LoadLevel(Application.loadedLevel);
 }
Пример #9
0
    public static void counterUp()
    {
        counter++;
        int output = remaining - counter;

        if (output < 0 && gameOver != null)
        {
            ColorPallet.CallRecolor();
            gameOver();
        }
    }
Пример #10
0
        public RatedMovie(SavedMovie movie)
        {
            InitializeComponent();
            MovieStack.BindingContext = movie;
            this.movie = movie;
            Genres     = new ObservableCollection <Genre>(movie.genres);
            Title      = movie.title;

            BoxView.Background = ColorPallet.GetBackground();
            Task.Run(() => ColorPallet.AnimateBackground(BoxView));
            Carousel.ItemsSource = Genres;
        }
        public async Task <IActionResult> Create([Bind("Id,UId,Name,Description,Pallet,IsPublic,IsCopy")] ColorPallet colorPallet)
        {
            if (ModelState.IsValid)
            {
                colorPallet.Id = Guid.NewGuid();
                _context.Add(colorPallet);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(colorPallet));
        }
Пример #12
0
    IEnumerator Reload()
    {
        data.IncrementData();
        ColorPallet.Clear();
        GamePlay.ClearCounters();
        GamePlay.scoreUp(GamePlay.getCounter() * 50);
        async = Application.LoadLevelAsync(Application.loadedLevel);
        async.allowSceneActivation = false;
        yield return(new WaitForSeconds(5.0f));

        async.allowSceneActivation = true;
//		yield return async;
//		GamePlay.CallVictory (false);
        GamePlay.ClearVictory();
//		yield return async;
    }
Пример #13
0
        // Gegeven de coordinaten reken de mandelbrot uit en geef de kleuren terug
        private Color[,] GetMandelbrotColorArray(Size size, PointD[,] coordinates, uint iterations)
        {
            ColorPallet pallet = new ColorPallet(this.ColorScheme);

            Color[,] colorResults = new Color[size.Width, size.Height];
            // Een array is een reference-type en hiermee thread-safe zolang je niet naar dezelfde waarden in de array schrijft.
            // Parallel.for is een for loop die de verzameling verdeelt over meerdere threads
            Parallel.For(0, size.Width, x =>
            {
                for (int y = 0; y < size.Height; y++)
                {
                    double c_result = 0;
                    // Reken voor dit coordinaat het aantal iteraties en het eindresultaat uit
                    uint it_result = coordinates[x, y].GetMandelBrotNumber(iterations, out c_result);
                    // Geef de kleur terug gegeven het aantal iteraties en het eindresultaat
                    colorResults[x, y] = pallet.GetColor(it_result, c_result);
                }
            });
            return(colorResults);
        }
Пример #14
0
        static void Display(string header, ColorPallet color)
        {
            WriteLine(header, ConsoleColor.Green);

            for (int shift = 0, order = 0; shift < sizeof(short) * 8; shift++)
            {
                var value = (short)(0x1 << shift);

                if (((short)color & value) == value)
                {
                    Write((++order).ToString(), ConsoleColor.Yellow);
                    Write(" has byte position", ConsoleColor.White);
                    Write($" {shift}", ConsoleColor.Red);
                    Write(" and byte binary value", ConsoleColor.White);
                    Write($" {Convert.ToString(value, 2).PadLeft(16, '0')}", ConsoleColor.Red);
                    Write(" and pallet color is", ConsoleColor.White);
                    WriteLine($" {(ColorPallet) value}", ConsoleColor.Red);
                }
            }
        }
Пример #15
0
        public ProfilePage()
        {
            InitializeComponent();

            GoodMovies = User.GetInstance().GoodMovies;
            ListGoodMovies.ItemsSource = GoodMovies;

            BadMovies = User.GetInstance().BadMovies;
            ListBadMovies.ItemsSource = BadMovies;

            ICommand refreshCommand = new Command(() =>
            {
                RefreshGood.IsRefreshing = false;
                RefreshBad.IsRefreshing  = false;
            });

            RefreshGood.Command = refreshCommand;
            RefreshBad.Command  = refreshCommand;

            Task.Run(() => ColorPallet.AnimateBackground(BoxView));
        }
Пример #16
0
    public void BuildTheMaze(Save saveData)
    {
        data.LoadSavedData(saveData);
        setValues();

        maze        = new List <MazeNode>();
        solution    = new List <MazeNode>();
        toBeginning = new List <MazeNode>();
        toEnd       = new List <MazeNode>();
        ground      = new List <List <GameObject> > ();
        vertWalls   = new List <List <GameObject> > ();
        horiWalls   = new List <List <GameObject> > ();
        cam         = _camera.GetComponent <CameraControl> ();

        // ******************** Size Camera **********************

        _camera.transform.position = new Vector3((width - 1) * 5, (((17F / 3F) * height) - 6), -10);
        cam.setMax(((17f / 3f) * height) + 1);

        // ******************** Full Grid Build *************************

        if (width > 0 && height > 0)
        {
            o = Instantiate(goal, new Vector3((width - 1) * 10, (height - 1) * 10, -1), Quaternion.identity) as GameObject;
            o = Instantiate(baseFloor, new Vector3((width - 1) * 5, (height - 1) * 5, 3), Quaternion.Euler(270, 0, 0)) as GameObject;
            o.transform.localScale = new Vector3(width, 1, height);
            o.transform.parent     = floorParent.transform;

            for (int i = 0; i <= width; i++)
            {
                List <GameObject> column = new List <GameObject>();
                List <GameObject> vert   = new List <GameObject>();
                List <GameObject> hori   = new List <GameObject>();
                for (int j = 0; j < height; j++)
                {
                    if (i < width)
                    {
                        // Floors
                        o = Instantiate(floor,
                                        new Vector3(i * 10, j * 10, 1),
                                        Quaternion.Euler(270, 0, 0)) as GameObject;
                        o.GetComponent <FloorController>().x = i;
                        o.GetComponent <FloorController>().y = j;
                        o.transform.parent = floorParent.transform;
                        column.Add(o);
                        maze.Add(new MazeNode(i, j));

                        // Horizontal Walls
                        o = Instantiate(wall,
                                        new Vector3((i * 10) + 1, (j * 10) - 5, 0),
                                        Quaternion.Euler(0, -90, 90)) as GameObject;
                        o.transform.parent = wallParent.transform;
                        hori.Add(o);
                    }
                    // Vertical Walls
                    o = Instantiate(wall,
                                    new Vector3((i * 10) - 5, (j * 10) - 1, 0),
                                    Quaternion.Euler(-90, 0, 0)) as GameObject;
                    o.transform.parent = wallParent.transform;
                    vert.Add(o);
                }
                // Top Horizontal Walls
                if (i < width)
                {
                    o = Instantiate(wall,
                                    new Vector3((i * 10) + 1, (height * 10) - 5, 0),
                                    Quaternion.Euler(0, -90, 90)) as GameObject;
                }
                ground.Add(column);
                vertWalls.Add(vert);
                horiWalls.Add(hori);
            }
        }

        foreach (MazeNode node in maze)
        {
            node.FindAdjacentNodes(maze);
        }

        // ***************** Create Maze *******************

        for (int i = 0; i < maze.Count; i++)
        {
            foreach (direction dir in saveData.CurrentMaze[i].dir)
            {
                maze[i].forwards.Add(maze[i].AdjacentNodes[(int)dir]);
            }
        }

        foreach (MazeNodeData node in saveData.CurrentSolution)
        {
            solution.Add(new MazeNode(node.x, node.y));
        }

        // **************** Delete Walls to Form Maze *******************

        foreach (MazeNode node in maze)
        {
            if (node.forwards.Count > 0)
            {
                foreach (MazeNode forward in node.forwards)
                {
                    if (node.x != forward.x)
                    {
                        int x = Mathf.Max(node.x, forward.x);
                        if (vertWalls[x][node.y] != null)
                        {
                            vertWalls[x][node.y].transform.parent = null;
                            vertWalls[x][node.y].GetComponent <CustomColoring>().removeMe();
                            Destroy(vertWalls[x][node.y]);
                        }
                    }
                    if (node.y != forward.y)
                    {
                        int y = Mathf.Max(node.y, forward.y);
                        if (horiWalls[node.x][y] != null)
                        {
                            horiWalls[node.x][y].transform.parent = null;
                            horiWalls[node.x][y].GetComponent <CustomColoring>().removeMe();
                            Destroy(horiWalls[node.x][y]);
                        }
                    }
                }
            }
        }

        // ***************** Set Remaining Object to Maze Parent Object ***************

        current = maze[(saveData.CurrentPosition.x * height) + saveData.CurrentPosition.y];
        ClearMaze();
        SetClickZone(saveData.CurrentPosition.x, saveData.CurrentPosition.y);

        ColorPallet.SetIndex(SaveData.GetSave().ColorIndex);
        ColorPallet.CallRecolor();
        GamePlay.setRemainingFromSave(SaveData.GetSave().CurrentRemainingMoves);
        GamePlay.setScore(SaveData.GetSave().CurrentScore);

        MeshFilter[]      meshFilters = wallParent.GetComponentsInChildren <MeshFilter>();
        CombineInstance[] combine     = new CombineInstance[meshFilters.Length - 1];
        int z = 0;

        for (int n = 0; n < meshFilters.Length; n++)
        {
            if (meshFilters[n].sharedMesh == null)
            {
                continue;
            }
            combine[z].mesh        = meshFilters[n].sharedMesh;
            combine[z++].transform = meshFilters[n].transform.localToWorldMatrix;
            meshFilters[n].gameObject.SetActive(false);
        }
        wallParent.GetComponent <MeshFilter>().mesh = new Mesh();
        wallParent.GetComponent <MeshFilter>().mesh.CombineMeshes(combine);
        wallParent.gameObject.SetActive(true);

        // **************** Set Player Starting Position ******************************

        hero.transform.position = new Vector3(current.x, current.y, 0) * 10;
    }
Пример #17
0
 public SearchPageXama()
 {
     InitializeComponent();
     BoxView.Background = ColorPallet.GetBackground();
     Task.Run(() => ColorPallet.AnimateBackground(BoxView));
 }
Пример #18
0
 public static void Read(ColorPallet pallet)
 {
     _fillColors   = pallet.FillColors;
     _lineColors   = pallet.LineColors;
     _vertexColors = pallet.VertexColors;
 }
Пример #19
0
 protected override void OnAppearing()
 {
     AnimationView.Animation = "Movie.json";
     BoxView.Background      = ColorPallet.GetBackground();
 }
Пример #20
0
 public MainPage()
 {
     Task.Run(MakePopularMovies);
     InitializeComponent();
     Task.Run(() => ColorPallet.AnimateBackground(BoxView));
 }
Пример #21
0
    public void BuildTheMaze()
    {
        setValues();

        maze        = new List <MazeNode>();
        solution    = new List <MazeNode>();
        toBeginning = new List <MazeNode>();
        toEnd       = new List <MazeNode>();
        ground      = new List <List <GameObject> > ();
        vertWalls   = new List <List <GameObject> > ();
        horiWalls   = new List <List <GameObject> > ();
        cam         = _camera.GetComponent <CameraControl> ();

        // ******************** Size Camera **********************

        _camera.transform.position = new Vector3((width - 1) * 5, (((17F / 3F) * height) - 6), -10);
        cam.setMax(((17f / 3f) * height) + 1);

        // ******************** Full Grid Build *************************

        if (width > 0 && height > 0)
        {
            o = Instantiate(goal, new Vector3((width - 1) * 10, (height - 1) * 10, -1), Quaternion.identity) as GameObject;
            o = Instantiate(baseFloor, new Vector3((width - 1) * 5, (height - 1) * 5, 3), Quaternion.Euler(270, 0, 0)) as GameObject;
            o.transform.localScale = new Vector3(width, 1, height);
            o.transform.parent     = floorParent.transform;

            for (int i = 0; i <= width; i++)
            {
                List <GameObject> column = new List <GameObject>();
                List <GameObject> vert   = new List <GameObject>();
                List <GameObject> hori   = new List <GameObject>();
                for (int j = 0; j < height; j++)
                {
                    if (i < width)
                    {
                        // Floors
                        o = Instantiate(floor,
                                        new Vector3(i * 10, j * 10, 1),
                                        Quaternion.Euler(270, 0, 0)) as GameObject;
                        o.GetComponent <FloorController>().x = i;
                        o.GetComponent <FloorController>().y = j;
                        o.transform.parent = floorParent.transform;
                        column.Add(o);
                        maze.Add(new MazeNode(i, j));

                        // Horizontal Walls
                        o = Instantiate(wall,
                                        new Vector3((i * 10) + 1, (j * 10) - 5, 0),
                                        Quaternion.Euler(0, -90, 90)) as GameObject;
                        o.transform.parent = wallParent.transform;
                        hori.Add(o);
                    }
                    // Vertical Walls
                    o = Instantiate(wall,
                                    new Vector3((i * 10) - 5, (j * 10) - 1, 0),
                                    Quaternion.Euler(-90, 0, 0)) as GameObject;
                    o.transform.parent = wallParent.transform;
                    vert.Add(o);
                }
                // Top Horizontal Walls
                if (i < width)
                {
                    o = Instantiate(wall,
                                    new Vector3((i * 10) + 1, (height * 10) - 5, 0),
                                    Quaternion.Euler(0, -90, 90)) as GameObject;
                    o.transform.parent = wallParent.transform;
                }
                ground.Add(column);
                vertWalls.Add(vert);
                horiWalls.Add(hori);
            }
        }

        foreach (MazeNode node in maze)
        {
            node.FindAdjacentNodes(maze);
        }

        // ***************** Create Maze *******************

        start       = maze[Random.Range(0, maze.Count)];
        start.start = true;
        start.makeMaze();
        solution = GetSolution(toBeginning, toEnd);

        // **************** Delete Walls to Form Maze *******************

        foreach (MazeNode node in maze)
        {
            if (node.back != null)
            {
                if (node.back.x != node.x)
                {
                    vertWalls[Mathf.Max(node.x, node.back.x)][node.y].transform.parent = null;
                    vertWalls[Mathf.Max(node.x, node.back.x)][node.y].GetComponent <CustomColoring>().removeMe();
                    Destroy(vertWalls[Mathf.Max(node.x, node.back.x)][node.y]);
                }
                if (node.back.y != node.y)
                {
                    horiWalls[node.x][Mathf.Max(node.y, node.back.y)].transform.parent = null;
                    horiWalls[node.x][Mathf.Max(node.y, node.back.y)].GetComponent <CustomColoring>().removeMe();
                    Destroy(horiWalls[node.x][Mathf.Max(node.y, node.back.y)]);
                }
            }
        }

        // ***************** Set Remaining Object to Maze Parent Object ***************

        current = maze[0];
        ClearMaze();
        SetClickZone(0, 0);

        ColorPallet.SetIndex(SaveData.GetSave().ColorIndex);
        ColorPallet.CallRecolor();
        GamePlay.setRemaining(solution.Count);

        MeshFilter[]      meshFilters = wallParent.GetComponentsInChildren <MeshFilter>();
        CombineInstance[] combine     = new CombineInstance[meshFilters.Length - 1];
        int z = 0;

        for (int n = 0; n < meshFilters.Length; n++)
        {
            if (meshFilters[n].sharedMesh == null)
            {
                continue;
            }
            combine[z].mesh        = meshFilters[n].sharedMesh;
            combine[z++].transform = meshFilters[n].transform.localToWorldMatrix;
            meshFilters[n].gameObject.SetActive(false);
        }
        wallParent.GetComponent <MeshFilter>().mesh = new Mesh();
        wallParent.GetComponent <MeshFilter>().mesh.CombineMeshes(combine);
        wallParent.gameObject.SetActive(true);

        // ****************** Save Maze ***********************************************

        List <MazeNodeData> mazeData = new List <MazeNodeData>();

        foreach (MazeNode node in maze)
        {
            mazeData.Add(node.convertToMazeNodeData());
        }
        List <MazeNodeData> solutionData = new List <MazeNodeData>();

        foreach (MazeNode node in solution)
        {
            solutionData.Add(node.convertToMazeNodeData());
        }
        SaveData.savePuzzle(mazeData, level, solutionData, width, height);
        SaveData.saveMove(new MazeNodeData(0, 0), GamePlay.getCounter(), GamePlay.getScore());
    }
Пример #22
0
 private void CollectionView_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     ColorPallet.ChangeColorTheme(e.CurrentSelection.FirstOrDefault() as string);
     BoxView.Background = ColorPallet.GetBackground();
 }
Пример #23
0
 protected override void OnAppearing()
 {
     BoxView.Background = ColorPallet.GetBackground();
 }
Пример #24
0
 public void CallRecolor()
 {
     ColorPallet.CallRecolor();
 }