コード例 #1
0
ファイル: GameButton.cs プロジェクト: NashIlli/calculandox
 internal void SetAttributes(Game game, Color color)
 {
     this.data = game;
     gameName.text = game.GetNames()[SettingsController.GetController().GetLanguage()];
     areaImage.sprite = game.GetIcon();
     gameObject.GetComponent<Image>().color = color;
 }
コード例 #2
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]);
             }*/
        }
コード例 #3
0
ファイル: ResultsView.cs プロジェクト: NashIlli/calculandox
        private void AddMetricRow(Game game, int level)
        {
            GameMetrics gameMetric = MetricsController.GetController().GetBestMetric(game.GetArea(), game.GetId(), level);
            if(gameMetric == null) return;
            GameObject row = Instantiate(metricsRowPrefab);
            viewRows.Add(row.GetComponent<MetricsRow>());

            if (gameMetric == null)
            {
                row.GetComponent<MetricsRow>().SetScore(0);
                row.GetComponent<MetricsRow>().SetStars(0);
                row.GetComponent<MetricsRow>().SetArea(game.GetArea());
                row.GetComponent<MetricsRow>().SetIndex(game.GetId());
                row.GetComponent<MetricsRow>().DisableViewDetails();

            } else
            {
                row.GetComponent<MetricsRow>().SetScore(gameMetric.GetScore());
                row.GetComponent<MetricsRow>().SetStars(gameMetric.GetStars());
                row.GetComponent<MetricsRow>().SetArea(gameMetric.GetArea());
                row.GetComponent<MetricsRow>().SetIndex(gameMetric.GetIndex());
            }
               // row.GetComponent<MetricsRow>().SetActivity(AppController.GetController().GetActivityName(area, game));
            row.GetComponent<MetricsRow>().SetActivity(game.GetNames()[SettingsController.GetController().GetLanguage()]);

            row.GetComponent<MetricsRow>().SetLevel(level);
            row.GetComponent<MetricsRow>().SetIcon(game.GetIcon());

            FitRowToPanel(row);
        }