Ejemplo n.º 1
0
        void GeneralSettings()
        {
            _levelName = EditorGUILayout.TextField("Level Name", _levelName);
            _levelNum  = EditorGUILayout.IntField("Level Number", _levelNum);
            // _settingsView.__shouldClone = EditorGUILayout.Toggle("Clone Type", _settingsView.__shouldClone);
            _moves           = EditorGUILayout.IntSlider("Moves", _moves, 0, 99);
            _companionType   = (CompanionTypeId)EditorGUILayout.Popup("Companion Type", (int)(_companionType), Enum.GetNames(typeof(CompanionTypeId)));
            _companionCharge = EditorGUILayout.IntSlider("Companion Charge", _companionCharge, 0, 99);
            // _level.__energyCosts = EditorGUILayout.IntSlider("Energy Costs", _settingsView.__energyCosts, 0, 50);

            _acsMin = EditorGUILayout.IntSlider("ACS min", _acsMin, -50, 50);
            _acsMax = EditorGUILayout.IntSlider("ACS max", _acsMax, -50, 50);


            if (_mastery != null && _mastery.Length >= 3)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Mastery");

                _mastery[0] = EditorGUILayout.IntField(_mastery[0]);
                _mastery[1] = EditorGUILayout.IntField(_mastery[1]);
                _mastery[2] = EditorGUILayout.IntField(_mastery[2]);

                //if (GUILayout.Button("Calculate"))
                //{
                //    GUIUtility.hotControl = 0;
                //    GUIUtility.keyboardControl = 0;
                //    _settingsView.OnCalculateMasteryValues();
                //}

                EditorGUILayout.EndHorizontal();
            }
        }
Ejemplo n.º 2
0
        void ParseConditions(JSONObject conditions)
        {
            typeWinningConditions.Clear();
            colorWinningConditions.Clear();
            skillWinningConditions.Clear();
            var keys = conditions.Keys;

            foreach (string key in keys)
            {
                if (key == SCORE)
                {
                    minScoreWinningCondition = (int)conditions[key];
                }
                else if (key == MOVESOVER)
                {
                    movesOver = (int)conditions[key] > 0?true:false;
                }
                else
                {
                    if (LevelEditorInfo.Instance.levelSettingConfig.ObjectiveCollection.Contains(key))
                    {
                        int amount = (int)conditions[key];
                        typeWinningConditions.Add(key, amount);
                    }
                    else
                    {
                        try
                        {
                            string[] colorsStrings = key.Split(',');

                            var colorIds = new List <ColorId>();

                            foreach (string colorString in colorsStrings)
                            {
                                ColorId colorId = LevelEditorUtils.ParseEnum <ColorId>(colorString.UppercaseFirst());
                                colorIds.Add(colorId);
                            }

                            int amount = (int)conditions[key];

                            var colorWinningCondition = new ColorWinningCondition();
                            colorWinningCondition.amount = amount;
                            colorWinningCondition.colors = colorIds;

                            colorWinningConditions.Add(colorWinningCondition);
                        }
                        catch
                        {
                            try
                            {
                                CompanionTypeId skillType = LevelEditorUtils.ParseEnum <CompanionTypeId>(key);
                                int             amount    = (int)conditions[key];
                                skillWinningConditions.Add(skillType, amount);
                            }
                            catch
                            {
                                Debug.LogWarning("Could not parse winning condition for key = " + key + ", levelNum = " + levelNum);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        //从levelData 中读取settings 数据
        public void LoadFromLevelData(LevelData levelData)
        {
            _level = levelData;

            //单个数据
            _levelName       = _level.name;
            _levelNum        = _level.levelNum;
            _moves           = _level.maxMoves;
            _companionType   = _level.companionType;
            _companionCharge = _level.companionRequiredCharge;
            _acsMin          = _level.acsMin;
            _acsMax          = _level.acsMax;

            _mastery = _level.starThresholds.ToArray();

            //supergem
            _superMergingEnabled = _level.superMergingEnabled;
            _preventItems        = new List <string>(_level.preventItems.ToArray());

            //Items
            _colorOrder = new List <LevelSettingsIcon>();
            for (int i = 0; i < 6; i++)
            {
                ColorId color = (ColorId)i;

                _colorOrder.Add(new LevelSettingsIcon(color.ToString(), -1));
            }
            int sequence = 0;

            foreach (var color in _level.colorSpawningOrder)
            {
                _colorOrder[(int)color].amount = sequence;
                sequence++;
            }

            _itemSpawnChance = new List <LevelSettingsIcon>();
            foreach (var name in LevelEditorInfo.Instance.levelSettingConfig.SpawnChanceCollection)
            {
                int value;
                if (_level.itemSpawnPercentages.TryGetValue(name, out value))
                {
                    _itemSpawnChance.Add(new LevelSettingsIcon(name, value));
                }
            }

            _itemSpawnMin = new List <LevelSettingsIcon>();
            foreach (var name in LevelEditorInfo.Instance.levelSettingConfig.SpawnChanceCollection)
            {
                int value = 0;
                _level.itemSpawnMin.TryGetValue(name, out value);

                _itemSpawnMin.Add(new LevelSettingsIcon(name, value));
            }

            _itemSpawnMax = new List <LevelSettingsIcon>();
            foreach (var name in LevelEditorInfo.Instance.levelSettingConfig.SpawnChanceCollection)
            {
                int value = 0;
                _level.itemSpawnMax.TryGetValue(name, out value);
                _itemSpawnMax.Add(new LevelSettingsIcon(name, value));
            }

            _totalMin = new List <LevelSettingsIcon>();
            foreach (var name in LevelEditorInfo.Instance.levelSettingConfig.TotalChanceCollection)
            {
                int value = 0;
                _level.itemTotalSpawnMin.TryGetValue(name, out value);

                _totalMin.Add(new LevelSettingsIcon(name, value));
            }

            _totalMax = new List <LevelSettingsIcon>();
            foreach (var name in LevelEditorInfo.Instance.levelSettingConfig.TotalChanceCollection)
            {
                int value = 0;
                _level.itemTotalSpawnMax.TryGetValue(name, out value);

                _totalMax.Add(new LevelSettingsIcon(name, value));
            }

            _ensureItems = new List <LevelSettingsIcon>();
            foreach (var name in LevelEditorInfo.Instance.levelSettingConfig.EnsureItemCollection)
            {
                int value = 0;
                _level.ensureItems.TryGetValue(name, out value);
                _ensureItems.Add(new LevelSettingsIcon(name, value));
            }

            _objectiveColor = new List <LevelSettingsIcon>();
            foreach (var item in ColorUtils.allColors)
            {
                _objectiveColor.Add(new LevelSettingsIcon((item).ToString(), 0));
            }

            foreach (var condition in _level.colorWinningConditions)
            {
                var condColors = condition.colors;
                if (condColors.Count > 1)
                {
                    _combineObjective = true;
                    foreach (var color in condColors)
                    {
                        int idx = ColorUtils.allColors.IndexOf(color);
                        _objectiveColor[idx].amount = 1;
                    }
                    _combineTotal = condition.amount;
                    break;
                }
                else
                {
                    int idx = ColorUtils.allColors.IndexOf(condColors[0]);
                    _objectiveColor[idx].amount = condition.amount;
                }
            }

            _objectives = new List <LevelSettingsIcon>();
            foreach (var name in LevelEditorInfo.Instance.levelSettingConfig.ObjectiveCollection)
            {
                int value;
                _level.typeWinningConditions.TryGetValue(name, out value);

                _objectives.Add(new LevelSettingsIcon(name, value));
            }

            _moveOver = _level.movesOver;


            //boss
            List <string> tempboss = new List <string>()
            {
                NO_BOSS_STRING
            };

            foreach (var boss in LevelEditorInfo.Instance.gameConfig.bossNames)
            {
                tempboss.Add(boss);
            }

            if (!String.IsNullOrEmpty(_level.bossName))
            {
                _bossIndex = tempboss.IndexOf(_level.bossName);
                if (_bossIndex == -1)
                {
                    _bossIndex = 0;
                }
            }
            else
            {
                _bossIndex = 0;
            }


            _bossNames        = tempboss.ToArray();
            _spawningSets     = LevelEditorInfo.Instance.gameConfig.availableSpawningSets.ToArray();
            _spawningSetIndex = -1;
            if (!String.IsNullOrEmpty(_level.spawningSetName))
            {
                _spawningSetIndex = LevelEditorInfo.Instance.gameConfig.availableSpawningSets.IndexOf(_level.spawningSetName);
            }
        }