Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        public void Init(GamesPanel _manager, MiniGameInfo _MiniGameInfo)
        {
            miniGameInfo = _MiniGameInfo;
            myManager    = _manager;

            if (miniGameInfo.unlocked || AppManager.I.Player.IsDemoUser)
            {
                isLocked = false;
            }
            else
            {
                isLocked = true;
            }
            LockIcon.enabled = isLocked;
            ////Title.text = data.Title_Ar;

            //var icoPath = miniGameInfo.data.GetIconResourcePath();
            //Debug.Log("resource icon for " + miniGameInfo.data.GetId() + ":" + icoPath);
            var badge = AppManager.I.AssetManager.GetBadgeIcon(miniGameInfo.data);

            //// @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 = miniGameInfo.score;

            //var score = GenericHelper.GetAverage(TeacherAI.I.ScoreHelper.GetLatestScoresForMiniGame(miniGameInfo.data.Code, -1));

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

            //Icon.sprite = Resources.Load<Sprite>(icoPath);
            if (badge != null)
            {
                BadgeIcon.sprite = badge;
            }
        }