IEnumerator CorReLoad(string sceneName)
    {
        AsyncOperation op = SceneManager.LoadSceneAsync(sceneName);

        while (!op.isDone)
        {
            yield return(null);
        }

        player      = GameObject.FindGameObjectWithTag("Player").GetComponent <DisplayPlayer>();
        textMyCoin  = GameObject.Find("TextMyCoins").GetComponent <Text>();
        textMyScore = GameObject.Find("TextMyScore").GetComponent <Text>();

        bool load = SaveData.Instance.LoadUserData();

        //Debug.Log("SAVE : " + load);
        if (load == true)
        {
            myBestScore = SaveData.Instance.LoadBestScore();
            myCoins     = SaveData.Instance.LoadCoins();
        }
        else
        {
            myBestScore = 0;
            myCoins     = 200;
        }

        textMyScore.text = "" + myBestScore;

        SaveData.Instance.SaveUserData(myCoins, myBestScore);
        SoundManager.Instance.ActiveBGM(SoundManager.Instance.bgm);
        AdManager.Instance.NewAwake();
        options.SetOptionMode(false);
    }
Esempio n. 2
0
 public void ConsumeBattleCost(int _consumeCost)
 {
     if (CheckBattleCost(_consumeCost))
     {
         BattleCost -= _consumeCost;
     }
 }
    public void ReloadSettings()
    {
        player      = GameObject.FindGameObjectWithTag("Player").GetComponent <DisplayPlayer>();
        textMyCoin  = GameObject.Find("TextMyCoins").GetComponent <Text>();
        textMyScore = GameObject.Find("TextMyScore").GetComponent <Text>();

        bool load = SaveData.Instance.LoadUserData();

        //Debug.Log("SAVE : " + load);
        if (load == true)
        {
            myBestScore = SaveData.Instance.LoadBestScore();
            myCoins     = SaveData.Instance.LoadCoins();
        }
        else
        {
            myBestScore = 0;
            myCoins     = 200;
            SaveData.Instance.SaveUserData(myCoins, myBestScore);
        }

        textMyScore.text = "" + myBestScore;

        AdManager.Instance.NewAwake();
        options.SetOptionMode(false);
    }
    private void Start()
    {
        player      = GameObject.FindGameObjectWithTag("Player").GetComponent <DisplayPlayer>();
        textMyCoin  = GameObject.Find("TextMyCoins").GetComponent <Text>();
        textMyScore = GameObject.Find("TextMyScore").GetComponent <Text>();

        bool load = SaveData.Instance.LoadUserData();

        //Debug.Log("SAVE : " + load);
        if (load == true)
        {
            myBestScore = SaveData.Instance.LoadBestScore();
            myCoins     = SaveData.Instance.LoadCoins();
        }
        else
        {
            myBestScore = 0;
            myCoins     = 200;
        }

        textMyScore.text = "" + myBestScore;

        SaveData.Instance.SaveUserData(myCoins, myBestScore);
        InvokeRepeating("RandomizeKeys", 1, 1);
    }
Esempio n. 5
0
        private void ObscuredIntExample()
        {
            this.logBuilder.Length = 0;
            this.logBuilder.AppendLine("[ACTk] <b>[ ObscuredInt test ]</b>");
            ObscuredInt.SetNewCryptoKey(434523);
            int num = 5;

            this.logBuilder.AppendLine("Original lives count: " + num);
            ObscuredInt obscuredInt = num;

            this.logBuilder.AppendLine("How your lives count is stored in memory when obscured: " + obscuredInt.GetEncrypted());
            ObscuredInt.SetNewCryptoKey(666);
            num          = obscuredInt;
            obscuredInt -= 2;
            obscuredInt  = obscuredInt + num + 10;
            obscuredInt /= 2;
            obscuredInt  = ++obscuredInt;
            ObscuredInt.SetNewCryptoKey(999);
            obscuredInt = ++obscuredInt;
            obscuredInt = --obscuredInt;
            this.logBuilder.AppendLine(string.Concat(new object[]
            {
                "Lives count after few usual operations: ",
                obscuredInt,
                " (",
                obscuredInt.ToString("X"),
                "h)"
            }));
            Debug.Log(this.logBuilder);
        }
        public ObscuredValueConverter()
        {
            list.Add(typeof(ObscuredInt), new Conv(
                         typeof(int),
                         o => { return((int)(ObscuredInt)o); },
                         o => { ObscuredInt value = Convert.ToInt32(o); return(value); }
                         ));
            list.Add(typeof(ObscuredFloat), new Conv(
                         typeof(float),
                         o => { return((float)(ObscuredFloat)o); },
                         o => { ObscuredFloat value = Convert.ToSingle(o); return(value); }
                         ));
            list.Add(typeof(ObscuredDouble), new Conv(
                         typeof(double),
                         o => { return((double)(ObscuredDouble)o); },
                         o => { ObscuredDouble value = Convert.ToSingle(o); return(value); }
                         ));

            list.Add(typeof(ObscuredBool), new Conv(
                         typeof(bool),
                         o => { return((bool)(ObscuredBool)o); },
                         o => { ObscuredBool value = Convert.ToBoolean(o); return(value); }
                         ));

            list.Add(typeof(ObscuredString), new Conv(
                         typeof(string),
                         o => { return((string)(ObscuredString)o); },
                         o => { ObscuredString value = o + ""; return(value); }
                         ));
        }
Esempio n. 7
0
 public static void SetMaxFeverSuccess(ObscuredInt maxFeverSuccess)
 {
     if (mMaxFeverSuccess < maxFeverSuccess)
     {
         mMaxFeverSuccess = maxFeverSuccess;
     }
 }
Esempio n. 8
0
 public void UseObscured()
 {
     useRegular          = false;
     obscuredLivesCount += Random.Range(-10, 50);
     cleanLivesCount     = 11;
     Debug.Log("Try to change this int in memory:\n" + obscuredLivesCount);
 }
Esempio n. 9
0
 public static void SetMaxCombo(ObscuredInt maxCombo)
 {
     if (mMaxCombo < maxCombo)
     {
         mMaxCombo = maxCombo;
     }
 }
Esempio n. 10
0
 public static void SetMaxChange(ObscuredInt maxChange)
 {
     if (mMaxChange < maxChange)
     {
         mMaxChange = maxChange;
     }
 }
    private void SetEarnedCoinBox(int value, int effectValue)
    {
        CoinBox box;
        int     earnCoin = value * Random.Range(1, effectValue + 1);

        if (coinBoxes.Count == 0)
        {
            box = Instantiate(coinBoxPrefab, coinPacker);
            box.SetDisplayEarnCoin(earnCoin);
            myEarnedCoin += earnCoin;
            coinBoxes.Add(box);
        }
        else
        {
            box = coinBoxes.Find(obj => obj.gameObject.activeSelf == false);
            // Found any deactive object
            if (box != null)
            {
                box.SetDisplayEarnCoin(earnCoin);
                myEarnedCoin += earnCoin;
            }
            else
            {
                box = Instantiate(coinBoxPrefab, coinPacker);
                box.SetDisplayEarnCoin(earnCoin);
                coinBoxes.Add(box);
                myEarnedCoin += earnCoin;
            }
        }
    }
Esempio n. 12
0
 void Start()
 {
     ObscuredCheatingDetector.StartDetection(OnCheaterDetected);
     gameController = GameObject.FindWithTag("GameController").GetComponent <GameController>();
     playerHealth   = GameObject.FindWithTag("Player").GetComponent <PlayerHealth>();
     currentHealth  = health;
 }
Esempio n. 13
0
    private void SetCreatureData(CreatureIcon selectIcon, PvPCreatureInfo info)
    {
        DATA_CREATURE_NEWVER creatureTable = CDATA_CREATURE_NEWVER.Get(info.enID);

        int level = info.Level;

        CCreatureAbility creatureStat = BattleRule.CreatureAbilityUI(
            creatureTable,
            BattleRule.AddCreatureStatAbility(level, info.forceCount, creatureTable),
            BattleRule.PvPCreatureItemAbility(info.items));

        CCreatureAbilityUI.SetValues(creatureStat, _statValueTitle);

        CreateItemIcon(info.items);

        _passiveSkill = creatureTable.m_PassiveSkill_0;
        _skill0       = creatureTable.m_Skill_0;
        _activeSkill  = creatureTable.m_Skill_1;

        SetSkillInfo();

        foreach (CreatureIcon icon in _creatureIconList)
        {
            icon.SetActiveSelect(false);
        }

        selectIcon.SetActiveSelect(true);
    }
    IEnumerator CorEarnCoinBoard()
    {
        WaitForFixedUpdate wait     = new WaitForFixedUpdate();
        WaitForSeconds     waitLong = new WaitForSeconds(1.0f);

        StartCoroutine(CorRefreshMultifly());
        while (true)
        {
            if (myEarnedCoin != myDisplayCoin)
            {
                myDisplayCoin += 11 * refreshMultifly;

                if (myDisplayCoin >= myEarnedCoin)
                {
                    myDisplayCoin = myEarnedCoin;
                }

                earnedCoinText.text = "" + myDisplayCoin;
                yield return(wait);
            }
            else
            {
                yield return(waitLong);
            }
        }
    }
Esempio n. 15
0
    public void CheckEnergyGot()
    {
        string lastTimeInGameStr = ObscuredPrefs.GetString("lastTimeInGame", "");

        if (lastTimeInGameStr == "")
        {
            Energy = MaxEnergy;
        }
        else
        {
            int lastTimeRemaining = ObscuredPrefs.GetInt("lastTimeRemainingEnergy", 0);

            DateTime lastTimeInGame  = DateTime.ParseExact(lastTimeInGameStr, "yyyy-MM-dd HH:mm:ss", null);
            DateTime currentDateTime = DateTime.Now;
            int      totalSeconds    = (int)(currentDateTime - lastTimeInGame).TotalSeconds;
            int      minute          = totalSeconds / 60;
            int      second          = totalSeconds % 60;
            int      minuteReduntant = 0;
            int      energyGot       = 0;
            if (minute > 0)
            {
                energyGot       = minute / minuteFillPerEnergy;
                minuteReduntant = minute % minuteFillPerEnergy;
            }
            Energy += energyGot;
            timeRemainingCountdownEnergy = (minuteFillPerEnergy * 60) - (minuteReduntant * 60 + second) - ((minuteFillPerEnergy * 60) - lastTimeRemaining);
        }
    }
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            var hiddenValue = prop.FindPropertyRelative("hiddenValue");

            SetBoldIfValueOverridePrefab(prop, hiddenValue);

            var cryptoKey = prop.FindPropertyRelative("currentCryptoKey");
            var inited    = prop.FindPropertyRelative("inited");

            var currentCryptoKey = cryptoKey.intValue;
            var val = 0;

            if (!inited.boolValue)
            {
                if (currentCryptoKey == 0)
                {
                    currentCryptoKey = cryptoKey.intValue = ObscuredInt.cryptoKeyEditor;
                }
                hiddenValue.intValue = ObscuredInt.Encrypt(0, currentCryptoKey);
                inited.boolValue     = true;
            }
            else
            {
                val = ObscuredInt.Decrypt(hiddenValue.intValue, currentCryptoKey);
            }

            EditorGUI.BeginChangeCheck();
            val = EditorGUI.IntField(position, label, val);
            if (EditorGUI.EndChangeCheck())
            {
                hiddenValue.intValue = ObscuredInt.Encrypt(val, currentCryptoKey);
            }

            ResetBoldFont();
        }
Esempio n. 17
0
    public void DealDamage(int damage)
    {
        if (gameController.ShieldsUp() == true && currentShield > 0)
        {
            currentShield -= damage;
            gameController.UpdateShield(currentShield);
        }
        else if (currentShield <= 0)
        {
            gameController.DisengageShield();
            currentHealth -= damage;
            gameController.UpdateHealth(currentHealth);
        }
        else
        {
            currentHealth -= damage;
            gameController.UpdateHealth(currentHealth);
        }

        if (currentHealth <= 0 && !exploding)
        {
            StartCoroutine(Explode());
            if (scoreValue > 0)
            {
                gameController.IncreaseScore(scoreValue);
            }
        }
    }
Esempio n. 18
0
    public void EndGameFromPauseToRestart()      //3) case.
    {
        continueOnce = false;

        if (GS == GameState.Pause)
        {
            GS = GameState.End;
            GAManager.Instance.GAPauseBtnEvent("RestartClick");

            if (onFeverMode)
            {
                FeverModeOff();
            }

            pauseMenu.SetActive(false);

            if (combo > maxCombo)
            {
                maxCombo = combo;
            }

            if (onCombo)
            {
                comboCtrl.ComboOff();
            }
            wallet.EndPlaying(3);
            //	wallet.StopCoroutine("GetTouchOnWallet");

            ResultOnShutter.Instance.WhetherToShowResult(false);
        }
    }
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            SerializedProperty hiddenValue = prop.FindPropertyRelative("hiddenValue");
            SerializedProperty cryptoKey   = prop.FindPropertyRelative("currentCryptoKey");
            SerializedProperty fakeValue   = prop.FindPropertyRelative("fakeValue");
            SerializedProperty inited      = prop.FindPropertyRelative("inited");

            int currentCryptoKey = cryptoKey.intValue;
            int val = 0;

            if (!inited.boolValue)
            {
                if (currentCryptoKey == 0)
                {
                    currentCryptoKey = cryptoKey.intValue = 444444;
                }
                hiddenValue.intValue = ObscuredInt.Encrypt(0, currentCryptoKey);
                inited.boolValue     = true;
            }
            else
            {
                val = ObscuredInt.Decrypt(hiddenValue.intValue, currentCryptoKey);
            }

            EditorGUI.BeginChangeCheck();
            val = EditorGUI.IntField(position, label, val);
            if (EditorGUI.EndChangeCheck())
            {
                hiddenValue.intValue = ObscuredInt.Encrypt(val, currentCryptoKey);
            }

            fakeValue.intValue = val;
        }
    void Start()
    {
        Debug.Log("===== ObscuredIntTest =====\n");

        // example of custom crypto key using
        // this is not necessary! key is 44444444 by default
        ObscuredInt.SetNewCryptoKey(401001001);

        // just a small self-test here
        cleanLivesCount = 5;
        Debug.Log("Original lives count:\n" + cleanLivesCount);

        obscuredLivesCount = cleanLivesCount;
        Debug.Log("How your lives count is stored in memory when obscured:\n" + obscuredLivesCount.GetEncrypted());

        int totalCoins = 500;
        ObscuredInt collectedCoins = 100;
        ObscuredInt.SetNewCryptoKey(666); // you can change crypto key at any time!
        int coinsLeft = totalCoins - collectedCoins;
        Debug.Log("Coins collected: " + collectedCoins + ", left: " + coinsLeft);
        obscuredLivesCount = cleanLivesCount = 0;

        // unprotected
        int livesCount = 100;

        // protected!
        ObscuredInt livesCountSecure = 100;

        // all usual operations supported
        livesCountSecure -= 10;
        livesCountSecure = livesCountSecure + livesCount;
        livesCountSecure = livesCountSecure / 10;
        Debug.Log("Lives count: " + livesCountSecure); // will print 19
    }
	public void UseObscured()
	{
		useRegular = false;
		obscuredLivesCount += Random.Range(-10, 50);
		cleanLivesCount = 11;
		Debug.Log("Try to change this int in memory:\n" + obscuredLivesCount);
	}
Esempio n. 22
0
    public override bool TryLoadTable(string[] str)
    {
        int arrayIdx = 0;

        try
        {
            unqIdx           = int.Parse(str[arrayIdx++]);
            nameIdx          = int.Parse(str[arrayIdx++]);
            levelType        = int.Parse(str[arrayIdx++]);
            passiveSkillType = (Define.SkillType) int.Parse(str[arrayIdx++]);
            activeSkillType  = (Define.SkillType) int.Parse(str[arrayIdx++]);
            cost             = int.Parse(str[arrayIdx++]);

            if (str.Length != arrayIdx)
            {
                Debug.Log(str.Length + " : " + arrayIdx);
            }
        }
        catch (System.Exception e)
        {
            Debug.Log(arrayIdx);
            Debug.LogError(e.ToString());
            return(false);
        }

        return(true);
    }
Esempio n. 23
0
 void GoldController()
 {
     if (Master.isGameStart)
     {
         gold += 1;
     }
 }
Esempio n. 24
0
    void Start()
    {
        Time.timeScale = currentTimeScale;
        //Master.Ad.Admob.HideBanner();
        SetUnitSelect();
        SetSkillSelect();
        gold = Master.Level.currentLevelData.InitialGold;
        Master.Stats.Energy--;
        Master.Stats.TimesPlay++;
        Master.isLevelComplete = false;
        Master.isGameStart     = false;
        GetOutOfScreenPos();

        if (FindObjectOfType <Transition> () != null)
        {
            FindObjectOfType <Transition> ().tempOnComplete = FirstLoadLevel;
        }
        else
        {
            FirstLoadLevel();
        }

        InvokeRepeating("GoldController", StatsController.timePerGold, StatsController.timePerGold);
        InvokeRepeating("CheckLevelComplete", 1, 1);
        SetExpOfUnit();
    }
Esempio n. 25
0
        private void ObscuredIntExample()
        {
            logBuilder.Length = 0;
            logBuilder.AppendLine(Constants.LOG_PREFIX + "<b>[ ObscuredInt test ]</b>");

            // example of custom crypto key using
            ObscuredInt.SetNewCryptoKey(434523);

            // just a small self-test here
            int regular = 5;

            logBuilder.AppendLine("Original lives count: " + regular);

            ObscuredInt obscured = regular;

            regular = obscured;
            logBuilder.AppendLine("How your lives count is stored in memory when obscured: " + obscured.GetEncrypted());

            ObscuredInt.SetNewCryptoKey(666);             // you can change crypto key at any time!

            // all usual operations are supported
            obscured -= 2;
            obscured  = obscured + regular + 10;
            obscured  = obscured / 2;
            obscured++;
            ObscuredInt.SetNewCryptoKey(999);             // you can change crypto key at any time!
            obscured++;
            obscured--;

            logBuilder.AppendLine("Lives count after few usual operations: " + obscured + " (" + obscured.ToString("X") + "h)");

            Debug.Log(logBuilder);
        }
Esempio n. 26
0
    public override bool TryLoadTable(string[] str, out int key)
    {
        int arrayIdx = 0;

        try
        {
            key = int.Parse(str[arrayIdx++]);

            type     = (Define.RewardType)key;
            level    = int.Parse(str[arrayIdx++]);
            infoIdx  = int.Parse(str[arrayIdx++]);
            maxValue = int.Parse(str[arrayIdx++]);
            reward   = int.Parse(str[arrayIdx++]);
            arrayIdx++; //note.

            if (str.Length != arrayIdx)
            {
                Debug.Log(str.Length + " : " + arrayIdx);
            }
        }
        catch (System.Exception e)
        {
            key = -1;
            Debug.Log(arrayIdx);
            Debug.LogError(e.ToString());
            return(false);
        }
        return(true);
    }
Esempio n. 27
0
 public static void SetMaxProgressStage(int maxStage)
 {
     if (maxStage > maxProgressStage)
     {
         maxProgressStage = maxStage;
         ObscuredPrefs.SetInt(GameStatics.PREFS_MaxProgressStage, maxProgressStage);
     }
 }
Esempio n. 28
0
 void calm()
 {
     GameManager.Instance.ChangeCoin(amount);
     amount = 0;
     GameManager.Instance.stateData.GoldGet = DateTime.Now;
     GameManager.Instance.saveState();
     StartCoroutine(check());
 }
Esempio n. 29
0
 public static void SetCurrency(int amount)
 {
     CurrentCurrency = amount;
     if (OnChangeCurrency != null)
     {
         OnChangeCurrency();
     }
 }
Esempio n. 30
0
    public void EngageShield()
    {
        playerShield = player.GetComponent <PlayerHealth>().GetShield();
        shieldBar.SetMaxShield(100);
        player.GetComponent <PlayerHealth>().SetCurrentShield(100);
        shieldBar.gameObject.SetActive(true);

        areShieldsUp = true;
    }
Esempio n. 31
0
        public override void OpenPopup(UIViewRequest request)
        {
            base.OpenPopup(request);
            UnlockCarViewRequest _requestData = request as UnlockCarViewRequest;

            RewardLevel  = _requestData.RewardCarLevel;
            RewardAmount = _requestData.RewardCarAmount;
            ((UnlockCarUIView)this.View).ShowView(GameDataManager.Instance._CarNodeGroupData.GetProperties(_requestData.UnlockCarLevel), GameDataManager.Instance._CarNodeGroupData.GetIcon(RewardLevel), RewardAmount);
        }
Esempio n. 32
0
        public void Decode(BufferBuilder bb)
        {
            id           = bb.Get7BitEncodeInt();
            maxRoleCount = bb.Get7BitEncodeInt();

            if (DeserializeHelper.OnGlobalConfigDecode != null)
            {
                DeserializeHelper.OnGlobalConfigDecode(this);
            }
        }
Esempio n. 33
0
    void Start()
    {
        Screen.orientation = ScreenOrientation.Landscape;
        #region StatusInitialization
        lastScore = ObscuredPrefs.GetInt("LastScore");
        highestScore = ObscuredPrefs.GetInt("HighestScore");
        totalTime = (ObscuredPrefs.GetString("TotalTime") == "")? "00:00:000": ObscuredPrefs.GetString("TotalTime");

        lastScoreHolder.text = "Last Score: " + lastScore.ToString();
        highestScoreHolder.text = "Highest Score: " + highestScore.ToString();
        totalTimeHolder.text = "Total Time: " + totalTime;
        #endregion
    }
    public static void CalculaPontos()
    {
        ObscuredInt ponto;
        if(nrAcertos >= 2 && nrAcertos < 4) {
            ponto = valorPontos * 2;
            pontos += ponto;
            if(Pontuacao.pontos > 20000) {
                fatorProvavel = 95;
            } else {
                fatorProvavel = 85;
            }

        } else if(nrAcertos >= 4 && nrAcertos < 8) {
            ponto = valorPontos * 4;
            pontos += ponto;

            if(Pontuacao.pontos > 20000) {
                fatorProvavel = 90;
            } else {
                fatorProvavel = 75;
            }
        } else if(nrAcertos > 8 && nrAcertos < 16) {
            ponto = valorPontos * 8;
            pontos += ponto;
            if(Pontuacao.pontos > 20000) {
                fatorProvavel = 85;
            } else {
                fatorProvavel = 40;
            }
        } else if(nrAcertos >= 16) {
            ponto = valorPontos * 16;
            pontos += ponto;
            if(Pontuacao.pontos > 20000) {
                fatorProvavel = 80;
            } else {
                fatorProvavel = 20;
            }
        } else {
            ponto = valorPontos;
            pontos += ponto;
            if(Pontuacao.pontos > 20000) {
                fatorProvavel = 99;
            } else {
                fatorProvavel = 90;
            }
        }
        if(Pontuacao.pontos > 30000) {
            fatorProvavel = 95;
        }
        scoreList.Add(ponto);
    }
	private void Start()
	{
		Debug.Log("===== ObscuredIntTest =====\n");

		// example of custom crypto key using
		// this is not necessary! key is 444444 by default
		//ObscuredInt.SetNewCryptoKey(434523131);

		// just a small self-test here
		cleanLivesCount = 5;
		Debug.Log("Original lives count:\n" + cleanLivesCount);

		obscuredLivesCount = cleanLivesCount;
		Debug.Log("How your lives count is stored in memory when obscured:\n" + obscuredLivesCount.GetEncrypted());

		ObscuredInt.SetNewCryptoKey(666); // you can change crypto key at any time!

		// unprotected
		const int livesCount = 100;

		// protected!
		ObscuredInt livesCountSecure = 100;

		// all usual operations supported
		livesCountSecure -= 10; 
		livesCountSecure = livesCountSecure + livesCount;
		livesCountSecure = livesCountSecure / 10;

		ObscuredInt.SetNewCryptoKey(888); // you can change crypto key at any time!

		livesCountSecure++;

		ObscuredInt.SetNewCryptoKey(999); // you can change crypto key at any time!

		livesCountSecure++;
		livesCountSecure--;

		// will print "Lives count: 20 (14h)"
		Debug.Log("Lives count: " + livesCountSecure + " (" + livesCountSecure.ToString("X") + "h)");
	}
 public static void addPontoNaLista(ObscuredInt pto)
 {
     scoreList.Add(pto);
 }
    void FixedUpdate()
    {
        if(!isPause) {

            if(!finalizado) {
                //Contador de segundos
                float now = Time.time;
                if(now > begin + delay) {
                    begin = now;
                    tempoRestante -= 1;
                }
                if(tempoRestante <= 0) {
                    textoTempo.text = "0";
                    finalizado = true;
                    placar.SetActive(true);
                    if(!Sessao.estado.Equals("inativa")) {
                        UpdatePontos();
                    }
                }
            }
        }
    }
Esempio n. 38
0
    void AddCategories(string Mode)
    {
        GameObject categoryButtonHolder;
        categoryButtonHolder = GameObject.Find("CategoryButtonsDialogLayer");

        if (Mode == "TF")
        {
            categoryNames = FindObjectOfType<ServerListQA>().QuizListServer.tf_categoryNames;
            categoryButtonList.Clear();
            foreach (Transform tr in categoryButtonHolder.transform)
            {
                if (tr.name != "Title")
                {
                    GameObject.Destroy(tr.gameObject);
                }
            }
            categories = FindObjectOfType<ServerListQA>().QuizListServer.tf_categoryNames.Count;
            for (int i = 0; i < categories; i++)
            {
                GameObject categoryButton = Instantiate(categoryButtonPrefab, Vector3.zero, Quaternion.identity) as GameObject;
                categoryButton.transform.SetParent(categoryButtonHolder.transform);
                categoryButton.transform.name = "CategoryButton" + i;
                categoryButtonList.Add(categoryButton);
                categoryButton.transform.position = new Vector3(0, 0, 0);
            }
            SetCategoryListners();
        }
        else if (Mode == "MCQS")
        {
            categoryNames = FindObjectOfType<ServerListQA>().QuizListServer.mcq_categoryNames;
            categoryButtonList.Clear();
            foreach (Transform tr in categoryButtonHolder.transform)
            {
                if (tr.name != "Title")
                {
                    GameObject.Destroy(tr.gameObject);
                }
            }
            categories = FindObjectOfType<ServerListQA>().QuizListServer.mcq_categoryNames.Count;
            for (int i = 0; i < categories; i++)
            {
                GameObject categoryButton = Instantiate(categoryButtonPrefab, Vector3.zero, Quaternion.identity) as GameObject;
                categoryButton.transform.SetParent(categoryButtonHolder.transform);
                categoryButton.transform.name = "CategoryButton" + i;
                categoryButtonList.Add(categoryButton);
            }
            SetCategoryListners();
        }
        else if (Mode == "FIB")
        {
            categoryNames = FindObjectOfType<ServerListQA>().QuizListServer.fib_categoryNames;
            categoryButtonList.Clear();
            foreach (Transform tr in categoryButtonHolder.transform)
            {
                if (tr.name != "Title")
                {
                    //GameObject.Destroy(tr.gameObject);
                }
            }
            categories = FindObjectOfType<ServerListQA>().QuizListServer.fib_categoryNames.Count;
            for (int i = 0; i < categories; i++)
            {
                GameObject categoryButton = Instantiate(categoryButtonPrefab, Vector3.zero, Quaternion.identity) as GameObject;
                categoryButton.transform.SetParent(categoryButtonHolder.transform);

                categoryButton.transform.name = "CategoryButton" + i;
                categoryButtonList.Add(categoryButton);
            }
            SetCategoryListners();
        }
    }
    // Update is called once per frame
    void Update()
    {
        if(!finalizado) {
            textoTempo.text = tempoRestante.ToString();
            textoPontos.text = Pontuacao.pontos.ToString();

            if(Input.GetMouseButtonDown(0)) {
                Ray ray = cameraGUI.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                if(Physics.Raycast(ray, out hit, 100))

                    if(hit.transform.name.Equals("Pausar")) {
                        isPause = true;
                        telaPause.SetActive(true);

                        AudioController(0.3f);
                    }

            }

        }
        if(finalizado || isPause) {
            if(Input.GetMouseButtonDown(0)) {
                if(isLiberado) {
                    Ray ray = cameraGUI.ScreenPointToRay(Input.mousePosition);
                    RaycastHit hit;
                    if(Physics.Raycast(ray, out hit, 100))

                        if(hit.transform.name.Equals("Reload")) {
                            placar.SetActive(false);
                            Pontuacao.pontos = 0;
                            Pontuacao.nrAcertos = 0;
                            finalizado = false;
                            tempoRestante = 180;
                            textoPontos.text = "0";
                            alvoTempo.SetActive(false);
                            Pontuacao.ResetScoreList();
                            ResetGame();

                            if(isPause) {
                                isPause = false;
                                telaPause.SetActive(false);
                                AudioController(0.1f);
                            }
                        }

                    if(hit.transform.name.Equals("Fechar")) {
                        isLiberado = true;
                        placar.SetActive(false);
                        Pontuacao.pontos = 0;
                        Pontuacao.nrAcertos = 0;
                        textoPontos.text = "0";
                        ResetGame();

                        Application.LoadLevel("MenuPrincipal");
                        //						NavegacaoUtil.SetLevelAtual(2);
                        //						NavegacaoUtil.SetDirecao(-1);
                        //						Application.LoadLevel("Load");
                        if(isPause) {
                            isPause = false;
                            telaPause.SetActive(false);
                        }
                    }

                    if(hit.transform.name.Equals("Voltar")) {
                        telaPause.SetActive(false);
                        isPause = false;
                        ResetGame();
                        AudioController(0.1f);
                    }

                    if(hit.transform.name.Equals("Facebook")) {
                        if(FB.IsLoggedIn) {

                            FacebookShare();
                        }
                    }

                }

            }
        }
    }