示例#1
0
        public void Init(GamesPanel _manager, MainMiniGame _MainMiniGame)
        {
            mainGameInfo = _MainMiniGame;
            panelManager = _manager;

            var icoPath = mainGameInfo.GetIconResourcePath();

            //// @note: we get the minigame saved score, which should be the maximum score achieved
            //// @note: I'm leaving the average-based method commented if we want to return to that logic
            //var score = info.score;
            //var score = GenericHelper.GetAverage(TeacherAI.I.ScoreHelper.GetLatestScoresForMiniGame(info.data.Code, -1));

            //if (score < 0.1f) {
            //    // disabled
            //    //GetComponent<Button>().interactable = false;
            //    //GetComponent<Image>().color = Color.grey;
            //}

            Icon.sprite = Resources.Load <Sprite>(icoPath);

            isLocked = true;
            foreach (var gameVariation in mainGameInfo.variations)
            {
                if (gameVariation.unlocked)
                {
                    isLocked = false;
                }
                //Debug.Log("gameVariation() main game " + mainGameInfo.MainId + " / " + gameVariation.data.Code + "(" + isLocked + ")");
            }
            LockIcon.enabled = isLocked;
        }
示例#2
0
 public void Select(MainMiniGame gameInfo = null)
 {
     if (gameInfo != null)
     {
         isSelected = (gameInfo.MainId == mainGameInfo.MainId);
     }
     else
     {
         isSelected = false;
     }
     hightlight(isSelected);
 }
示例#3
0
        public void DetailMainMiniGame(MainMiniGame selectedMainMiniGame)
        {
            emptyContainer(VariationsContainer);

            if (selectedMainMiniGame == null)
            {
                return;
            }

            //Debug.Log("DetailMainMiniGame(): " + selectedMainMiniGame.MainId);
            foreach (var gameVariation in selectedMainMiniGame.variations)
            {
                btnGO = Instantiate(MiniGameItemPrefab);
                btnGO.transform.SetParent(VariationsContainer.transform, false);
                btnGO.GetComponent <ItemMiniGame>().Init(this, gameVariation);
            }

            ElementsContainer.BroadcastMessage("Select", selectedMainMiniGame, SendMessageOptions.DontRequireReceiver);
            DetailMiniGame(selectedMainMiniGame.variations[0]);
        }
示例#4
0
 public void DetailMiniGame(MainMiniGame mainMiniGameInfo)
 {
     panelManager.DetailMainMiniGame(mainMiniGameInfo);
 }