예제 #1
0
        internal void ShowPreviewGame(Game game)
        {
            //AppController.GetController().SetCurrentGame(0); // todo
            // AppController.GetController().SetCurrentArea(game.GetArea());
            ViewController.GetController().SetCanvasScaler(1f);
            AppController.GetController().SetCurrentGame(game.GetId());
            gamePreview.SetGameDescription(game.GetDescriptions()[SettingsController.GetController().GetLanguage()]);
            gamePreview.SetPossibleLevels(game.GetLevels());
            gamePreview.SetImages(game.GetIcon(), areaColors[game.GetArea()]);
            gamePreview.gameObject.SetActive(true);
            menuView.gameObject.SetActive(false);

            foreach (Animator animator in InstructionController.GetController().Animators)
            {
                Destroy(animator.gameObject);
            }
            InstructionController.GetController().Animators.Clear();
            foreach (GameObject instruction in game.InstructionsSequence)
            {
                GameObject instantiate = Instantiate(instruction);
                ViewController.GetController().FitObjectTo(instantiate, gamePreview.InstructionPanel);
                InstructionController.GetController().Animators.Add(instantiate.GetComponent<Animator>());
            }

            foreach (Instruction instruction in gamePreview.InstructionPanel.GetComponentsInChildren<Instruction>(true))
            {
                instruction.gameObject.SetActive(false);
            }

            //Animator[] componentsInChildren = gamePreview.InstructionPanel.GetComponentsInChildren<Animator>(true);
            /* for (int i = 0; i < componentsInChildren.Length ; i++)
             {
                 InstructionController.GetController().Animators.Add(componentsInChildren[i]);
             }*/
        }