public void SetValue(float value)
        {
            long lValue = (long)value;

            if (BarImage)
            {
                BarImage.fillAmount = Mathf.InverseLerp(StatMin, StatMax, value);
            }
            if (StatNumber)
            {
                StatNumber.text = HudHelper.ToGUIString(lValue);
            }
        }
示例#2
0
 public void HandleBrainCloudFailError(int status, int reasonCode, string jsonError, object cbObject)
 {
     GStateManager.Instance.EnableLoadingSpinner(false);
     switch (reasonCode)
     {
     case ReasonCodes.UNABLE_TO_VALIDATE_PLAYER:
     case ReasonCodes.PLAYER_SESSION_EXPIRED:
     case ReasonCodes.NO_SESSION:
     case ReasonCodes.PLAYER_SESSION_LOGGED_OUT:
     {
         HudHelper.DisplayMessageDialog("SESSION EXPIRED", "YOUR SESSION HAS EXPIRED. RE-AUTHENTICATING...", "OK", OnSessionExpiredDialogClose);
     }
     break;
     }
 }
        private void OnFindUserByUniversalIdFailure(int statusCode, int reasonCode, string in_stringData, object in_obj)
        {
            GDebug.Log(string.Format("OnFindUserByUniversalId Failed | {0}  {1}  {2}", statusCode, reasonCode, in_stringData));
            GStateManager.Instance.EnableLoadingSpinner(false);

            switch (reasonCode)
            {
            case ReasonCodes.DATABASE_ERROR:
                HudHelper.DisplayMessageDialog("ERROR", "THE SEARCH OPERATION TIMED OUT, PLEASE TRY AGAIN.", "OK");
                break;

            case ReasonCodes.MINIMUM_SEARCH_INPUT:
                HudHelper.DisplayMessageDialog("ERROR", "INVALID SEARCH CRITERIA. PLEASE ENTER A MINIMUM OF 3 CHARACTERS.", "OK");
                break;
            }
        }
 public void OnEndDrag(PointerEventData eventData)
 {
     if (Interactable)
     {
         if (m_ObjectsToUpdate.Count == 1)
         {
             m_fTargetOffset = 0.0f;
             m_Index         = 0;
         }
         else
         {
             float divisor = getDivisor();
             m_fTargetOffset = (float)(HudHelper.QuickRound(m_fTargetOffset / divisor)) * divisor;
             m_Index         = getIndex(m_fTargetOffset, divisor);
             clampTarget();
         }
     }
 }
        public IAPProduct(
            string in_bcID,
            string in_productId,

#if BUY_CURRENCY_ENABLED
            ProductType in_type,
#endif
            string in_category,
            string in_title,
            string in_description,
            string in_imageUrl,
            decimal in_referencePrice,
            decimal in_price,
            bool in_isPromotion,
            int in_currencyValue,
            Dictionary <string, object> in_currencyRewards,
            Dictionary <string, object> in_packRewards)
        {
            this.BrainCloudProductID = in_bcID;
            this.StoreProductId      = in_productId;

#if BUY_CURRENCY_ENABLED
            this.Type = in_type;
#endif
            this.Category        = in_category;
            this.Title           = in_title;
            this.Description     = in_description;
            this.ImageUrl        = in_imageUrl;
            this.ReferencePrice  = in_referencePrice;
            this.Price           = in_price;
            this.IsPromotion     = in_isPromotion;
            this.CurrencyValue   = in_currencyValue;
            this.CurrencyRewards = in_currencyRewards;
            this.ExtraRewards    = in_packRewards;

            string shortDescription = "";
            string longDescription  = "";
            HudHelper.ParseJsonDescription(in_description, ref shortDescription, ref longDescription);
            this.ShortDescription = shortDescription;
            this.LongDescription  = longDescription;

            setRewards();
        }
        public static Dictionary <string, object> DeserializeData(byte[] in_data)
        {
            if (MSG_ENCODED == 2)
            {
                Dictionary <string, object> newDict = new Dictionary <string, object>();

                try
                {
                    sTransformUpdate newObject = HudHelper.ByteArrayToStructure <sTransformUpdate>(in_data);
                    newDict = newObject.ToDict();
                }
                catch (Exception)
                {
                    try
                    {
                        sProjectileData newObject = HudHelper.ByteArrayToStructure <sProjectileData>(in_data);
                        newDict = newObject.ToDict();
                    }
                    catch (Exception)
                    {
                        string result = Encoding.ASCII.GetString(in_data);
                        if (result.Length > 0)
                        {
                            if (result[0] == '{')
                            {
                                newDict = (Dictionary <string, object>)JsonReader.Deserialize(result);
                            }
                            else
                            {
                                newDict = DeserializeString(result);
                            }
                        }
                    }
                }

                return(newDict);
            }
            return(null);
        }
 private int getIndex(float in_fNumerator, float in_fDivisor)
 {
     return(HudHelper.QuickRound(in_fNumerator / in_fDivisor) * -1 + m_ObjectsToUpdate.Count / 2);
 }
示例#8
0
        public long GetCurrencyRewardValue(string in_currencyType)
        {
            long ToReturn = HudHelper.GetLongValue(CurrencyRewards, in_currencyType);

            return(ToReturn);
        }
示例#9
0
 private void onNetworkError()
 {
     GStateManager.Instance.EnableLoadingSpinner(false);
     HudHelper.DisplayMessageDialog("ERROR", "COULD NOT CONNECT. PLEASE CHECK YOUR INTERNET CONNECTION AND TRY AGAIN.", "OKAY", retryConnection);
 }