private void DrawPriceSettings(UpgradePriceSettings priceSettings)
        {
            SerializedObject serializedObject = new SerializedObject(priceSettings);

            serializedObject.Update();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("pricePrefix"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("priceSuffix"));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            var existingType = priceSettings.PriceProgression.GetType() == typeof(ArithmeticProgression) ? ProgressionType.Arithmetic : ProgressionType.Geometric;

            progressionType = existingType;

            SerializedObject serializedProgression = new SerializedObject(priceSettings.PriceProgression);

            serializedProgression.Update();
            DrawDefaultInspector(serializedProgression);

            serializedProgression.ApplyModifiedProperties();

            progressionType = (ProgressionType)EditorGUILayout.EnumPopup(progressionType);
            if (existingType != progressionType)
            {
                UpgradesUtility.ChangeProgressionType(priceSettings, progressionType);
            }

            EditorGUILayout.EndHorizontal();

            serializedObject.ApplyModifiedProperties();
        }
        public void SendProgression(ProgressionType type, ulong attemptNum, long score, string levelName, string subWorldName = null, string worldName = null)
        {
            if (subWorldName == string.Empty)
            {
                subWorldName = null;
            }
            if (worldName == string.Empty)
            {
                subWorldName = null;
            }
            if (levelName == null || levelName == string.Empty)
            {
                throw new ArgumentNullException("worldName");
            }

            if (worldName != null && subWorldName == null)
            {
                subWorldName = worldName;
                worldName    = null;
            }

            byte[] postData = compress(getJsonString(new ProgressionData {
                category    = "resource",
                event_id    = ((type == ProgressionType.Start) ? "Start:" : (type == ProgressionType.Complete) ? "Complete:" : "Fail:") + ((worldName != null) ? worldName + ":" : "") + ((subWorldName != null) ? subWorldName + ":" : "") + levelName,
                attempt_num = attemptNum,
                score       = score
            }));

            sendEvent(postData);
        }
Example #3
0
        private int SaveCalculator(int joblevel, ProgressionType type)
        {
            if (type == ProgressionType.Bad)
            {
                return(Formulas.BadSave(joblevel));
            }

            return(Formulas.GoodSave(joblevel));
        }
Example #4
0
        private ProgressionCalculator GetProgressionCalculator(ProgressionType progressionType)
        {
            switch (progressionType)
            {
            case ProgressionType.Arithmetic:
                return(new ArithmeticCalculator());

            case ProgressionType.Geometric:
                return(new GeometricCalculator());

            default:
                return(null);
            }
        }
        private void DrawValueSettings(UpgradeValueSettings valueSettings, int index)
        {
            if (valueSettings == null)
            {
                return;
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(index.ToString());
            if (GUILayout.Button("X", GUILayout.MaxWidth(24)))
            {
                UpgradesUtility.RemoveValueSettings(valueSettings);
                UpgradesUtility.RemoveMissingValueSettings();
                return;
            }

            EditorGUILayout.EndHorizontal();

            SerializedObject serializedObject = new SerializedObject(valueSettings);

            serializedObject.Update();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PropertyField(serializedObject.FindProperty("valueName"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("prefix"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("suffix"));
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            var existingType = valueSettings.ValueProgression.GetType() == typeof(ArithmeticProgression) ? ProgressionType.Arithmetic : ProgressionType.Geometric;

            progressionType = existingType;

            SerializedObject serializedProgression = new SerializedObject(valueSettings.ValueProgression);

            serializedProgression.Update();
            DrawDefaultInspector(serializedProgression);

            serializedProgression.ApplyModifiedProperties();

            progressionType = (ProgressionType)EditorGUILayout.EnumPopup(progressionType);
            if (existingType != progressionType)
            {
                UpgradesUtility.ChangeProgressionType(valueSettings, progressionType);
            }

            EditorGUILayout.EndHorizontal();
            serializedObject.ApplyModifiedProperties();
        }
Example #6
0
        private int AttackCalculator(int joblevel, ProgressionType type)
        {
            switch (type)
            {
            case ProgressionType.Bad:
                return(Formulas.BadAttack(joblevel));

                break;

            case ProgressionType.Good:
                return(Formulas.GoodAttack(joblevel));

                break;

            case ProgressionType.Great:
                return(Formulas.GreatAtttack(joblevel));

                break;

            case ProgressionType.Epic:
            default:
                throw new ArgumentOutOfRangeException("type", type, null);
            }
        }
Example #7
0
        private int SaveCalculator(int joblevel, ProgressionType type)
        {
            if (type == ProgressionType.Bad)
            {
                return Formulas.BadSave(joblevel);
            }

            return Formulas.GoodSave(joblevel);
        }
Example #8
0
 private int AttackCalculator(int joblevel, ProgressionType type)
 {
     switch (type)
     {
         case ProgressionType.Bad:
             return Formulas.BadAttack(joblevel);
             break;
         case ProgressionType.Good:
             return Formulas.GoodAttack(joblevel);
             break;
         case ProgressionType.Great:
             return Formulas.GreatAtttack(joblevel);
             break;
         case ProgressionType.Epic:
         default:
             throw new ArgumentOutOfRangeException("type", type, null);
     }
 }