private void SaveFile() { // Save Data m_DifficultyControlData = new DifficultyControlData(); m_DifficultyControlData.DifficultyConfig = new Dictionary <string, DifficultyConfig>(); if (m_lstDifficultyInfo == null) { m_lstDifficultyInfo = new List <DifficultyInfo>(); } for (int i = 0; i < m_lstDifficultyInfo.Count; i++) { if (m_lstDifficultyInfo[i].Name == null || m_lstDifficultyInfo[i].Name == "") { EditorUtility.DisplayDialog("保存失败", "难度名称不能为空", "确定"); return; } DifficultyConfig diffConfig = new DifficultyConfig(); diffConfig.DifficultyOffset = AdaptiveDifficultyManager.ConvertInt(m_lstDifficultyInfo[i].Offset); diffConfig.DifficultyRange = AdaptiveDifficultyManager.ConvertInt(m_lstDifficultyInfo[i].Range); diffConfig.TalentEffect = new Dictionary <string, int>(); foreach (string talent in m_lstDifficultyInfo[i].TalentEffects.Keys) { diffConfig.TalentEffect.Add(talent, AdaptiveDifficultyManager.ConvertInt(m_lstDifficultyInfo[i].TalentEffects[talent])); } m_DifficultyControlData.DifficultyConfig.Add(m_lstDifficultyInfo[i].Name, diffConfig); } //Save File EditorUtility.DisplayDialog("保存成功", "保存成功", "确定"); ADE_Helper.SaveDifficultyControlDataMap(m_DifficultyControlDataMap, m_GameID, m_DifficultyControlData); }
public override void InstallBindings() { DifficultyConfig difficultyConfig = GetSavedDifficultyConfig(); Container.BindInstance(difficultyConfig.PlayerConfig); Container.BindInstance(difficultyConfig.SpawnerConfig); }
public DifficultySpawner(DifficultyConfig config, ISpawner spawner) { _difficultyConfig = config; _spawner = spawner; _spawner.Init(GetNewPattern); ResetObjects(); Enable(true); }
public LevelController( DifficultyConfig difficultyConfig, LinesCounter linesCounter, IUpgradable[] upgradableObjects, IUiUpdater uiUpdater) { _difficultyConfig = difficultyConfig; _linesCounter = linesCounter; _upgradableObjects = upgradableObjects; _uiUpdater = uiUpdater; }
public void Construct( MovementController movementController, TetrominoConfig tetrominoConfig, DifficultyConfig difficultyConfig, ITetrominoLoader tetrominoLoader, IGrid grid) { _movementController = movementController; _tetrominoConfig = tetrominoConfig; _difficultyConfig = difficultyConfig; _tetrominoLoader = tetrominoLoader; _grid = grid; }
// Difficulty Control private void CalculateGameDifficulty(string difficultyName, DifficultyControlData currentDifficultyControlData, ref float minDiff, ref float maxDiff) { if (m_CharTalentMap == null) { ResetUserTalent(); } if (currentDifficultyControlData.DifficultyConfig.ContainsKey(difficultyName)) { DifficultyConfig difficultyConfig = currentDifficultyControlData.DifficultyConfig[difficultyName]; float diff = ConvertFloat(difficultyConfig.DifficultyOffset); foreach (string talentName in difficultyConfig.TalentEffect.Keys) { if (m_CharTalentMap.ContainsKey(talentName)) { float score = ConvertFloat(m_CharTalentMap[talentName]); float effect = ConvertFloat(difficultyConfig.TalentEffect[talentName]); diff += score * effect; } else { Debuger.LogWarning("Wrong Talent Name in DifficultyConfig : " + talentName + ", it does not Exist in UserTalent"); } } minDiff = diff - ConvertFloat(difficultyConfig.DifficultyRange); maxDiff = diff + ConvertFloat(difficultyConfig.DifficultyRange); //check if (minDiff < 0.0f) { minDiff = 0.0f; } if (maxDiff > 1.0f) { maxDiff = 1.0f; } if (minDiff > maxDiff) { minDiff = maxDiff; } } else { Debuger.LogWarning("Wrong Difficulty Name : " + difficultyName + ", it does not Exist in DifficultyControlData"); } }
public void SetDifficulty(int difficulty) { difficultyConfig = difficultyConfigs[difficulty]; }