| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 | 
							- using System;
 
- using System.Collections.Generic;
 
- using UnityEngine;
 
- using wf;
 
- public class WindowPartsEffectGlobalFog : WindowPartsEffectBase
 
- {
 
- 	public override void Awake()
 
- 	{
 
- 		base.Awake();
 
- 		this.fog_ = GameMain.Instance.MainCamera.GetComponent<GlobalFog>();
 
- 		if (this.fog_ == null)
 
- 		{
 
- 			this.fog_ = GameMain.Instance.MainCamera.gameObject.AddComponent<GlobalFog>();
 
- 			if (this.fog_.fogShader == null)
 
- 			{
 
- 				this.fog_.fogShader = Shader.Find("Hidden/GlobalFog");
 
- 			}
 
- 			this.fog_.enabled = false;
 
- 		}
 
- 		this.fog_.startDistance = 5f;
 
- 		this.fog_.globalDensity = 1f;
 
- 		this.fog_.heightScale = 1f;
 
- 		this.fog_.globalFogColor = Color.white;
 
- 		this.backup_value_data_.startDistance = this.fog_.startDistance;
 
- 		this.backup_value_data_.globalDensity = this.fog_.globalDensity;
 
- 		this.backup_value_data_.heightScale = this.fog_.heightScale;
 
- 		this.backup_value_data_.height = this.fog_.height;
 
- 		this.backup_value_data_.globalFogColor = this.fog_.globalFogColor;
 
- 		string[] array = new string[]
 
- 		{
 
- 			"startDistance",
 
- 			"globalDensity",
 
- 			"heightScale",
 
- 			"height",
 
- 			"r",
 
- 			"g",
 
- 			"b"
 
- 		};
 
- 		for (int i = 0; i < array.Length; i++)
 
- 		{
 
- 			PhotoSliderAndInput sliderAndInput = this.SettingInput.GetSliderAndInput(array[i]);
 
- 			if (sliderAndInput != null)
 
- 			{
 
- 				this.slider_dic_.Add(array[i], sliderAndInput);
 
- 			}
 
- 		}
 
- 		this.SettingInput.onChangeValue.Add(new Action<WindowPartsInputSliderSet.SliderAndInputSet, float>(this.OnChangetValue));
 
- 		this.ColorPaletteInput.onChangeValue.Add(new Action<WindowPartsInputColorrPalette, Color>(this.OnChangetValue2));
 
- 		this.OnChangeEffectEnabled(false);
 
- 	}
 
- 	public override void OnDestroy()
 
- 	{
 
- 		if (GameMain.Instance == null || GameMain.Instance.MainCamera == null || this.effect_object == null)
 
- 		{
 
- 			return;
 
- 		}
 
- 		UnityEngine.Object.Destroy(this.fog_);
 
- 		this.fog_ = null;
 
- 	}
 
- 	public override void OnChangeEffectEnabled(bool enabled)
 
- 	{
 
- 		WindowPartsInputSliderSet settingInput = this.SettingInput;
 
- 		this.ColorPaletteInput.enabled = enabled;
 
- 		settingInput.enabled = enabled;
 
- 	}
 
- 	public override void Init()
 
- 	{
 
- 		this.value_data_ = this.backup_value_data_;
 
- 		this.slider_dic_["startDistance"].ResetNum = this.backup_value_data_.startDistance;
 
- 		this.slider_dic_["globalDensity"].ResetNum = this.backup_value_data_.globalDensity;
 
- 		this.slider_dic_["heightScale"].ResetNum = this.backup_value_data_.heightScale;
 
- 		this.slider_dic_["height"].ResetNum = this.backup_value_data_.height;
 
- 		this.ColorPaletteInput.ResetNum = this.backup_value_data_.globalFogColor;
 
- 		this.EnabledCheckBox.check = false;
 
- 		this.UpdateGui();
 
- 	}
 
- 	public void OnChangetValue(WindowPartsInputSliderSet.SliderAndInputSet input_object, float val)
 
- 	{
 
- 		if (input_object.Name == "startDistance")
 
- 		{
 
- 			this.value_data_.startDistance = val;
 
- 		}
 
- 		else if (input_object.Name == "globalDensity")
 
- 		{
 
- 			this.value_data_.globalDensity = val;
 
- 		}
 
- 		else if (input_object.Name == "heightScale")
 
- 		{
 
- 			this.value_data_.heightScale = val;
 
- 		}
 
- 		else if (input_object.Name == "height")
 
- 		{
 
- 			this.value_data_.height = val;
 
- 		}
 
- 		this.ApplyValue();
 
- 	}
 
- 	public void OnChangetValue2(WindowPartsInputColorrPalette palette, Color color)
 
- 	{
 
- 		this.value_data_.globalFogColor = color;
 
- 		this.ApplyValue();
 
- 	}
 
- 	public override void OnSerializeEvent()
 
- 	{
 
- 		Dictionary<string, Dictionary<string, string>> woldStoreData = this.effect_window_.GetWoldStoreData();
 
- 		woldStoreData["GlobalFog"] = new Dictionary<string, string>();
 
- 		Dictionary<string, string> dictionary = woldStoreData["GlobalFog"];
 
- 		this.value_data_.OnSerializeEvent(dictionary);
 
- 		dictionary.Add("enabled", base.effect_enabled.ToString());
 
- 	}
 
- 	public override void OnDeserializeEvent()
 
- 	{
 
- 		Dictionary<string, Dictionary<string, string>> woldStoreData = this.effect_window_.GetWoldStoreData();
 
- 		if (!woldStoreData.ContainsKey("GlobalFog"))
 
- 		{
 
- 			this.ResetValue();
 
- 			this.value_data_ = this.backup_value_data_;
 
- 			this.EnabledCheckBox.check = base.effect_enabled;
 
- 		}
 
- 		else
 
- 		{
 
- 			Dictionary<string, string> dictionary = woldStoreData["GlobalFog"];
 
- 			this.value_data_.OnDeserializeEvent(dictionary);
 
- 			base.effect_enabled = bool.Parse(dictionary["enabled"]);
 
- 			this.ApplyValue();
 
- 		}
 
- 		this.UpdateGui();
 
- 	}
 
- 	private void ApplyValue()
 
- 	{
 
- 		this.fog_.startDistance = this.value_data_.startDistance;
 
- 		this.fog_.globalDensity = this.value_data_.globalDensity;
 
- 		this.fog_.heightScale = this.value_data_.heightScale;
 
- 		this.fog_.height = this.value_data_.height;
 
- 		this.fog_.globalFogColor = this.value_data_.globalFogColor;
 
- 	}
 
- 	public void ResetValue()
 
- 	{
 
- 		this.fog_.startDistance = this.backup_value_data_.startDistance;
 
- 		this.fog_.globalDensity = this.backup_value_data_.globalDensity;
 
- 		this.fog_.heightScale = this.backup_value_data_.heightScale;
 
- 		this.fog_.height = this.backup_value_data_.height;
 
- 		this.fog_.globalFogColor = this.backup_value_data_.globalFogColor;
 
- 		base.effect_enabled = false;
 
- 	}
 
- 	public void UpdateGui()
 
- 	{
 
- 		this.slider_dic_["startDistance"].value = this.value_data_.startDistance;
 
- 		this.slider_dic_["globalDensity"].value = this.value_data_.globalDensity;
 
- 		this.slider_dic_["heightScale"].value = this.value_data_.heightScale;
 
- 		this.slider_dic_["height"].value = this.value_data_.height;
 
- 		this.ColorPaletteInput.value = this.value_data_.globalFogColor;
 
- 		this.EnabledCheckBox.check = base.effect_enabled;
 
- 		this.OnChangeEffectEnabled(this.EnabledCheckBox.check);
 
- 	}
 
- 	protected override MonoBehaviour effect_object
 
- 	{
 
- 		get
 
- 		{
 
- 			return this.fog_;
 
- 		}
 
- 	}
 
- 	private const string kStoreName = "GlobalFog";
 
- 	public WindowPartsInputSliderSet SettingInput;
 
- 	public WindowPartsInputColorrPalette ColorPaletteInput;
 
- 	private Dictionary<string, PhotoSliderAndInput> slider_dic_ = new Dictionary<string, PhotoSliderAndInput>();
 
- 	private GlobalFog fog_;
 
- 	private WindowPartsEffectGlobalFog.Data backup_value_data_;
 
- 	private WindowPartsEffectGlobalFog.Data value_data_;
 
- 	private struct Data
 
- 	{
 
- 		public void OnSerializeEvent(Dictionary<string, string> effect_store_data)
 
- 		{
 
- 			effect_store_data.Add("startDistance", this.startDistance.ToString("G9"));
 
- 			effect_store_data.Add("globalDensity", this.globalDensity.ToString("G9"));
 
- 			effect_store_data.Add("heightScale", this.heightScale.ToString("G9"));
 
- 			effect_store_data.Add("height", this.height.ToString("G9"));
 
- 			effect_store_data.Add("globalFogColor", this.globalFogColor.ToString("G9"));
 
- 		}
 
- 		public void OnDeserializeEvent(Dictionary<string, string> effect_restore_data)
 
- 		{
 
- 			this.startDistance = float.Parse(effect_restore_data["startDistance"]);
 
- 			this.globalDensity = float.Parse(effect_restore_data["globalDensity"]);
 
- 			this.heightScale = float.Parse(effect_restore_data["heightScale"]);
 
- 			this.height = float.Parse(effect_restore_data["height"]);
 
- 			this.globalFogColor = Parse.Color(effect_restore_data["globalFogColor"]);
 
- 		}
 
- 		public float startDistance;
 
- 		public float globalDensity;
 
- 		public float heightScale;
 
- 		public float height;
 
- 		public Color globalFogColor;
 
- 	}
 
- }
 
 
  |