示例#1
0
文件: Cache.cs 项目: dagachy/Mahjongg
    void updateScore(int addScore, Text txt)
    {
        score          = score + new SafeInt(addScore);
        scoreText.text = "Score: " + score;

        txt.text = "+" + addScore;
    }
示例#2
0
文件: Cache.cs 项目: dagachy/Mahjongg
    void Start()
    {
        if (PlayerPrefs.HasKey("muteM"))
        {
            if (PlayerPrefs.GetInt("muteM") == 1)
            {
                clickMusic();
            }
        }

        if (PlayerPrefs.HasKey("muteS"))
        {
            if (PlayerPrefs.GetInt("muteS") == 1)
            {
                clickSound();
            }
        }


        bonusMultiplier = new SafeInt(0);
        time            = new SafeFloat(540);
        highlightSelected.transform.position = new Vector3(0, 0, -100);
        highlightViewed.transform.position   = new Vector3(0, 0, -100);
        audioSource = GetComponent <AudioSource>();

        newLevel();
    }
示例#3
0
 void IStatsSetter.SaveRecordStars(SafeInt starsAmount)
 {
     if (starsAmount > playerStats.RecordCollectedStars)
     {
         playerStats.RecordCollectedStars = starsAmount;
     }
 }
示例#4
0
 void IStatsSetter.SaveRecordScoreMultiplier(SafeInt multiplierValue)
 {
     if (multiplierValue > playerStats.RecordScoreMultiplierValue)
     {
         playerStats.RecordScoreMultiplierValue = multiplierValue;
     }
 }
示例#5
0
文件: Cache.cs 项目: dagachy/Mahjongg
    void updateScore(int addScore, GameObject bts)
    {
        addScore      /= EasyModeStatic.easyMode;
        score          = score + new SafeInt(addScore);
        scoreText.text = "Score: " + score;

        bts.GetComponent <TextPopUp>().assign("+" + addScore, Color.white, 18);
    }
示例#6
0
 void IStatsSetter.SaveRecordScore(SafeInt scoreAmount)
 {
     if (scoreAmount > playerStats.RecordEarnedScore)
     {
         playerStats.RecordEarnedScore = scoreAmount;
         OnNewScoreRecord?.Invoke();
     }
 }
示例#7
0
    void IStatsSetter.SaveRecordLifeTime(SafeInt lifeTime)
    {
        playerStats.TotalLifeTime += lifeTime;

        if (lifeTime > playerStats.RecordLifeTime)
        {
            playerStats.RecordLifeTime = lifeTime;
        }
    }
示例#8
0
    void OnTriggerExit(Collider other)
    {
        if (other.tag == "Sunlight") {
            sunlight = new SafeInt(0);
        }

        else if (other.tag == "Shadow") {
            darkness = new SafeInt(0);
        }
    }
示例#9
0
    public override bool Equals(object obj)
    {
        if (obj == null)
        {
            return(false);
        }
        SafeInt safeInt = (SafeInt)obj;

        return(this.defa133ffdss == safeInt.defa133ffdss && this.bcda1ktrees == safeInt.bcda1ktrees);
    }
示例#10
0
 public void Serialize(ref SafeInt data)
 {
     if (isReading)
     {
         data = _buffer.ReadInt32LE();
     }
     else
     {
         _buffer.WriteInt32LE(data);
     }
 }
示例#11
0
 public static void GetVal(GetUserDataResult res, string key, ref SafeInt val)
 {
     if (res.Data == null || !res.Data.ContainsKey(key))
     {
         Debug.Log("Have not " + key);
     }
     else
     {
         val = int.Parse(res.Data[key].Value);
     }
 }
示例#12
0
        /// <summary>
        /// Read array of SafeInt data from stream
        /// </summary>
        /// <returns>array of SafeInt</returns>
        public SafeInt[] ReadSafeIntArray()
        {
            int length = ReadInt();

            SafeInt[] array = new SafeInt[length];
            for (int i = 0; i < length; i++)
            {
                array[i] = ReadInt();
            }
            return(array);
        }
示例#13
0
        private IEnumerator Start()
        {
            Debug.Log("My Secured Text:  " + MySecuredText);

            while (Application.isPlaying)
            {
                // You can assig de type directly like you assing normally :)
                MySecuredInt = Random.Range(0, 100);

                yield return(new WaitForSeconds(2f));
            }
        }
示例#14
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Sunlight") {
            darkness = new SafeInt(0);
            //if(w.isNightTime == false) sunlight = w.lightMax;
            if(!lightLevels.w.isNightTime) sunlight = lightLevels.w.lightMax;
        }

        else if (other.tag == "Shadow") {
            sunlight = new SafeInt(0);
            darkness = lightLevels.w.lightMax;
        }
    }
示例#15
0
    void OnTriggerStay(Collider other)
    {
        if (other.tag == "Sunlight") {
            darkness = new SafeInt(0);
            //if(w.isNightTime == false) sunlight = w.lightMax;
            sunlight = w.lightMax;
        }

        else if (other.tag == "Shadow") {
            sunlight = new SafeInt(0);
            darkness = w.lightMax;
        }
    }
示例#16
0
        /// <summary>
        /// Read data of given XmlElement as array of SafeInt
        /// </summary>
        /// <param name="e">XmlElement contains data</param>
        /// <returns>array of int</returns>
        public SafeInt[] ReadSafeIntArray(XmlElement e)
        {
            string lenghtStr = e.GetAttribute("Lenght");
            int    length    = 0;

            if (!int.TryParse(lenghtStr, out length))
            {
                length = 0;
            }
            SafeInt[] array = new SafeInt[length];

            XmlElement element = e.FirstChild as XmlElement;
            int        index   = 0;

            while (element != null)
            {
                array[index++] = ReadInt(element);
                element        = e.GetNextSibling(element);
            }
            return(array);
        }
示例#17
0
文件: Cache.cs 项目: dagachy/Mahjongg
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape) && !anyScreenActive())
        {
            clickPause();
        }

        if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.A))
        {
            rotMe(true);
        }
        if (Input.GetKeyDown(KeyCode.RightArrow) || Input.GetKeyDown(KeyCode.D))
        {
            rotMe(false);
        }

        if (bonusTimer > 0)
        {
            bonusTimer -= Time.deltaTime * 1;
            if (bonusTimer <= 0)
            {
                bonusTimer      = 0;
                bonusMultiplier = new SafeInt(0);
            }
        }

        if (time.GetValue() > 0 && allowTimer)
        {
            time = time - Time.deltaTime * 1;
            int normalTime = (int)time.GetValue();
            timeText.text = "Time: " + (normalTime / 60) + ":" + (normalTime % 60 < 10?"0" : "") + normalTime % 60;
        }
        else if (time.GetValue() <= 0)
        {
            StartCoroutine(gameOver());
        }
    }
示例#18
0
文件: Cache.cs 项目: dagachy/Mahjongg
    void matchBlocks()
    {
        int bonusint = bonusMultiplier.GetValue();

        GameObject btextScore = Instantiate(bonusText, Input.mousePosition + new Vector3(0, 30, 0), Quaternion.identity);


        if (bonusint >= 6)
        {
            GameObject btext = Instantiate(bonusText, Input.mousePosition, Quaternion.identity);
            if (bonusint >= 4 && bonusint <= 10)
            {
                btext.GetComponent <TextPopUp>().assign("Good", Color.yellow, 20);
                updateScore(10 + bonusMultiplier.GetValue() * 2, btextScore);
            }
            else if (bonusint >= 11 && bonusint <= 18)
            {
                btext.GetComponent <TextPopUp>().assign("Great", Color.blue, 25);
                updateScore(10 + bonusMultiplier.GetValue() * 3, btextScore);
            }
            else if (bonusint >= 19 && bonusint <= 28)
            {
                btext.GetComponent <TextPopUp>().assign("Splendid", Color.green, 30);
                updateScore(10 + bonusMultiplier.GetValue() * 4, btextScore);
            }
            else if (bonusint + 1 == allPairs)
            {
                audioSource.PlayOneShot(sound[1], 1);
                Instantiate(boomEffect, block2.gameObject.transform.position, transform.rotation);

                btext.GetComponent <TextPopUp>().assign("FLAWLESS", Color.white, 50);
                updateScore(100 + bonusMultiplier.GetValue() * 6, btextScore);
            }
            else
            {
                btext.GetComponent <TextPopUp>().assign("Excellent", Color.magenta, 35);
                updateScore(10 + bonusMultiplier.GetValue() * 5, btextScore);
            }
        }
        else
        {
            updateScore(10 + bonusMultiplier.GetValue(), btextScore);
        }


        bonusTimer       = 3f;
        bonusMultiplier += new SafeInt(1);

        audioSource.PlayOneShot(sound[0], 1);

        Instantiate(effect, block1.gameObject.transform.position, transform.rotation);
        Instantiate(effect, block2.gameObject.transform.position, transform.rotation);

        blockScript.Remove(block1);
        blockScript.Remove(block2);

        /*
         * NOTE:
         *      since Destroy(gameObject) driven me crazy, I decided
         *      just to throw blocks out of screen and change their tag.
         *
         *      //Destroy(block1.gameObject)
         *      //Destroy(block2.gameObject)
         *
         *      Here lies two hours of sorrow and madness
         */

        block1.gameObject.transform.position = new Vector3(999, 999, 999);
        block2.gameObject.transform.position = new Vector3(999, 999, 999);
        block1.gameObject.tag = "defeated";
        block2.gameObject.tag = "defeated";


        UI_selected.texture = emptyTexture;
        UI_viewed.texture   = emptyTexture;

        highlightSelected.transform.position = new Vector3(0, 0, -100);
        highlightViewed.transform.position   = new Vector3(0, 0, -100);

        block1 = null;
        block2 = null;

        //any blocks left?
        if (anyBlocks())
        {
            //check possible moves
            checkMoves();
        }
    }
示例#19
0
 IEnumerator getLiveWeather()
 {
     WWW weatherRequest = new WWW("http://api.openweathermap.org/data/2.5/weather?q=" + currentLocation + "&units=metric" + "&APPID=" + APIKEY); //get our weather
     //Debug.Log (weatherRequest.url);
     yield return weatherRequest;
     if (weatherRequest.error == null || weatherRequest.error == "")
     {
         var N = JSON.Parse(weatherRequest.text);
         conditionName = N["weather"][0]["main"].Value;
         conditionID = new SafeInt(ParseUtil.numberParse(N["weather"][0]["id"].Value));
         //Debug.Log(Mathf.RoundToInt(ParseUtil.numberParse(N["main"]["temp"].Value)));
         temperature = new SafeInt(Mathf.RoundToInt(ParseUtil.numberParse(N["main"]["temp"].Value)));
         cloudiness = new SafeInt(ParseUtil.numberParse(N["clouds"]["all"].Value));
         humidity = new SafeInt(ParseUtil.numberParse(N["main"]["humidity"].Value));
         sunrise = UnixTimeStampToDateTime(ParseUtil.numberParse(N["sys"]["sunrise"]));
         sunset = UnixTimeStampToDateTime(ParseUtil.numberParse(N["sys"]["sunset"]));
     }
     else {
         currentError = "Weather error: " + weatherRequest.error;
     }
 }
示例#20
0
 void IInGamePurchasesSetter.AddTotalStars(SafeInt starsAmount)
 {
     inGamePurchases.TotalStars           += starsAmount;
     inGamePurchases.EstimatedCostInStars += starsAmount;
 }
示例#21
0
 public SafeIntTag(string id, string displayName, SafeInt safeInt)
 {
     Id          = id;
     DisplayName = displayName;
     SafeInt     = safeInt;
 }
示例#22
0
 //public SpriteRenderer lightOverlay;
 void Awake()
 {
     //Get LightMax From WeatherSync
     upperBound = w.lightMax;
 }
示例#23
0
 void OnLevelWasLoaded(int level)
 {
     upperBound = w.lightMax;
     sunlight = new SafeInt(0);
     darkness = new SafeInt(0);
 }