private void ApplyStageEffectSetting(ConfigStageEffectSetting setting) { BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); this.AddEntityEffectPredicates(localAvatar, setting.LocalAvatarEffectPredicates); this._localAvatarPredicates = setting.LocalAvatarEffectPredicates; if (setting.AvatarColorOverrides.Length > 0) { List <BaseMonoAvatar> allPlayerAvatars = Singleton <AvatarManager> .Instance.GetAllPlayerAvatars(); for (int i = 0; i < allPlayerAvatars.Count; i++) { BaseMonoAvatar avatar2 = allPlayerAvatars[i]; MonoEffectOverride component = avatar2.GetComponent <MonoEffectOverride>(); if (component == null) { component = avatar2.gameObject.AddComponent <MonoEffectOverride>(); } for (int j = 0; j < setting.AvatarColorOverrides.Length; j++) { ColorOverrideEntry entry = setting.AvatarColorOverrides[j]; component.colorOverrides.Add(entry.colorOverrideKey, entry.color); } } } }
private void UnApplyStageEffectSettings(ConfigStageEffectSetting setting) { BaseMonoAvatar localAvatar = Singleton <AvatarManager> .Instance.GetLocalAvatar(); this.RemoveEntityEffectPredicates(localAvatar, setting.LocalAvatarEffectPredicates); this._localAvatarPredicates = Miscs.EMPTY_STRINGS; List <BaseMonoAvatar> allPlayerAvatars = Singleton <AvatarManager> .Instance.GetAllPlayerAvatars(); for (int i = 0; i < allPlayerAvatars.Count; i++) { MonoEffectOverride component = allPlayerAvatars[i].GetComponent <MonoEffectOverride>(); if (component != null) { for (int j = 0; j < setting.AvatarColorOverrides.Length; j++) { ColorOverrideEntry entry = setting.AvatarColorOverrides[j]; component.colorOverrides.Remove(entry.colorOverrideKey); } } } }