private void InitializeBloodFXData() { string path = "Scripts/AI/BloodFXData"; TextAsset textAsset = Resources.Load(path) as TextAsset; if (!textAsset) { DebugUtils.Assert("Can't load BloodFXData script!", true, DebugUtils.AssertType.Info); return; } TextAssetParser textAssetParser = new TextAssetParser(textAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Blunt") { List <string> value = new List <string>(key.GetVariable(0).SValue.Split(new char[] { ';' })); this.m_BloodFXNames.Add(0, value); } else if (key.GetName() == "Sharp") { List <string> value2 = new List <string>(key.GetVariable(0).SValue.Split(new char[] { ';' })); this.m_BloodFXNames.Add(1, value2); } } Resources.UnloadAsset(textAsset); }
public override void Initialize() { base.Initialize(); this.m_WantedBlend = this.DEFAULT_BLEND; this.m_WantedAttackBlend = this.DEFAULT_BLEND; TextAssetParser textAssetParser = AIManager.Get().m_AnimatorDataParsers[this.GetStatesDataScript()]; for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "State") { StateData stateData = new StateData(); stateData.m_ClipName = key.GetVariable(1).SValue; stateData.m_Duration = key.GetVariable(2).FValue; stateData.m_Loop = (key.GetVariable(3).IValue != 0); this.m_StatesData.Add(key.GetVariable(0).SValue, stateData); this.m_StateNames.Add(key.GetVariable(0).SValue); if (!this.m_HasSpecificIdle) { this.m_HasSpecificIdle = key.GetVariable(0).SValue.Contains("SpecificIdle"); } } } }
private void ParseScript(TextAsset script) { TextAssetParser textAssetParser = new TextAssetParser(script); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "PropFloat") { this.m_ReplicatedAnimatorParams.Add(new ReplicatedAnimator.AnimParam(key.GetVariable(0).SValue, typeof(float))); } else if (key.GetName() == "PropInt") { this.m_ReplicatedAnimatorParams.Add(new ReplicatedAnimator.AnimParam(key.GetVariable(0).SValue, typeof(int))); } else if (key.GetName() == "PropBool") { this.m_ReplicatedAnimatorParams.Add(new ReplicatedAnimator.AnimParam(key.GetVariable(0).SValue, typeof(bool))); } else if (key.GetName() == "DontInterruptState") { int key2 = Animator.StringToHash(key.GetVariable(0).SValue); if (!this.m_NonInterruptableStateSets.ContainsKey(key2)) { this.m_NonInterruptableStateSets.Add(key2, new HashSet <int>()); } this.m_NonInterruptableStateSets[key2].Add(Animator.StringToHash(key.GetVariable(1).SValue)); } } }
public static void LoadInfos(out Dictionary <int, ItemInfo> infos) { infos = new Dictionary <int, ItemInfo>(); TextAsset textAsset = Resources.Load("Scripts/Items/Items") as TextAsset; DebugUtils.Assert(textAsset, true); TextAssetParser textAssetParser = new TextAssetParser(textAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); Type type = Type.GetType(key.GetVariable(1).SValue + "Info"); if (type == null) { DebugUtils.Assert(DebugUtils.AssertType.Info); } else { ItemInfo itemInfo = Activator.CreateInstance(type) as ItemInfo; itemInfo.Load(key); infos.Add((int)itemInfo.m_ID, itemInfo); } } Resources.UnloadAsset(textAsset); }
private void Load(TextAsset asset) { TextAssetParser textAssetParser = new TextAssetParser(); textAssetParser.Parse(asset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "State") { this.CreateState(key, false); } else if (key.GetName() == "DefaultState") { this.CreateState(key, true); } else if (key.GetName() == "StateGroup") { this.CreateStateGroup(key); } else if (key.GetName() == "Transition") { this.CreateTransition(key); } } }
private void LoadScript() { this.m_PocketPosition = new Vector3[5]; this.m_PocketRotation = new Quaternion[5]; string str = (Mathf.Floor(Camera.main.aspect * 10f) / 10f).ToString(); TextAsset textAsset = Resources.Load("Scripts/Backpack" + str) as TextAsset; if (!textAsset) { textAsset = (Resources.Load("Scripts/Backpack") as TextAsset); } TextAssetParser textAssetParser = new TextAssetParser(textAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Transform") { int num = (int)Enum.Parse(typeof(BackpackPocket), key.GetVariable(0).SValue); this.m_PocketPosition[num].x = key.GetVariable(1).FValue; this.m_PocketPosition[num].y = key.GetVariable(2).FValue; this.m_PocketPosition[num].z = key.GetVariable(3).FValue; this.m_PocketRotation[num].x = key.GetVariable(4).FValue; this.m_PocketRotation[num].y = key.GetVariable(5).FValue; this.m_PocketRotation[num].z = key.GetVariable(6).FValue; this.m_PocketRotation[num].w = key.GetVariable(7).FValue; } } }
public override void Initialize(Being being) { base.Initialize(being); if (this.m_ActiveGoal != null) { this.m_ActiveGoal.Deactivate(); } this.m_Goals.Clear(); if (!AIManager.Get().m_GoalParsers.ContainsKey((int)this.m_AI.m_ID)) { DebugUtils.Assert("[GoalsModule:Initialize] ERROR, missing goals parser of ai " + this.m_AI.m_ID.ToString(), true, DebugUtils.AssertType.Info); return; } TextAssetParser textAssetParser = null; if (this.m_AI.m_PresetName != string.Empty) { textAssetParser = AIManager.Get().GetGoalParser(this.m_AI.m_PresetName); } if (textAssetParser == null) { textAssetParser = AIManager.Get().GetRandomGoalsParser(this.m_AI.m_ID); } for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Goal") { AIGoal aigoal = this.CreateGoal(key.GetVariable(0).SValue); aigoal.m_Priority = key.GetVariable(1).IValue; aigoal.m_Probability = ((key.GetVariablesCount() > 2) ? key.GetVariable(2).FValue : 1f); if (aigoal.m_Type == AIGoalType.HumanJumpBack || aigoal.m_Type == AIGoalType.JumpBack) { this.m_JumpBackGoal = aigoal; } else if (aigoal.m_Type == AIGoalType.HumanPunchBack || aigoal.m_Type == AIGoalType.PunchBack) { this.m_PunchBackGoal = aigoal; } else if (aigoal.m_Type == AIGoalType.HumanTaunt) { this.m_TauntGoal = aigoal; } this.m_Goals.Add(aigoal); } else { DebugUtils.Assert("[GoalsModule::Initialize] Unknown keyword - " + key.GetName(), true, DebugUtils.AssertType.Info); } } if (this.m_GoalToActivate != AIGoalType.None) { this.ActivateGoal(this.m_GoalToActivate); this.m_GoalToActivate = AIGoalType.None; } }
private void InitFootstepsData() { for (int i = 0; i < 16; i++) { this.m_FootstepDatas.Add(i, new AIFootstepData()); } TextAssetParser textAssetParser = new TextAssetParser(this.m_FootstepDataScript); for (int j = 0; j < textAssetParser.GetKeysCount(); j++) { Key key = textAssetParser.GetKey(j); EObjectMaterial key2 = (EObjectMaterial)Enum.Parse(typeof(EObjectMaterial), key.GetName()); for (int k = 0; k < key.GetKeysCount(); k++) { AIFootstepData aifootstepData = this.m_FootstepDatas[(int)key2]; Key key3 = key.GetKey(k); if (key3.GetName() == "FX") { string[] array = key3.GetVariable(0).SValue.Split(new char[] { ';' }); for (int l = 0; l < array.Length; l++) { aifootstepData.m_FXNames.Add(array[l]); } } else if (key3.GetName() == "Sound") { string svalue = key3.GetVariable(0).SValue; string[] array2 = key3.GetVariable(1).SValue.Split(new char[] { ';' }); for (int m = 0; m < array2.Length; m++) { aifootstepData.m_WalkSounds.Add(Resources.Load <AudioClip>(svalue + array2[m])); } if (key3.GetVariablesCount() > 2) { array2 = key3.GetVariable(2).SValue.Split(new char[] { ';' }); for (int n = 0; n < array2.Length; n++) { aifootstepData.m_RunSounds.Add(Resources.Load <AudioClip>(svalue + array2[n])); } } } } } }
private void LoadScript() { TextAsset textAsset = Resources.Load(this.m_CocaineScript) as TextAsset; if (!textAsset) { DebugUtils.Assert("Can't load Sanity script - " + this.m_CocaineScript, true, DebugUtils.AssertType.Info); return; } TextAssetParser textAssetParser = new TextAssetParser(textAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Duartion") { this.m_Duration = key.GetVariable(0).FValue; } else if (key.GetName() == "StaminaConsumptionMul") { this.m_StaminaConsumptionMul = key.GetVariable(0).FValue; } else if (key.GetName() == "HPConsumptionMul") { this.m_HPConsumptionMul = key.GetVariable(0).FValue; } else if (key.GetName() == "FatConsumptionMul") { this.m_FatConsumptionMul = key.GetVariable(0).FValue; } else if (key.GetName() == "CarboConsumptionMul") { this.m_CarboConsumptionMul = key.GetVariable(0).FValue; } else if (key.GetName() == "ProteinsConsumptionMul") { this.m_ProteinsConsumptionMul = key.GetVariable(0).FValue; } else if (key.GetName() == "HydrationConsumptionMul") { this.m_HydrationConsumptionMul = key.GetVariable(0).FValue; } else if (key.GetName() == "IncreaseEnergyPerSec") { this.m_IncreaseEnergyPerSec = key.GetVariable(0).FValue; } } Resources.UnloadAsset(textAsset); }
private void LoadSyntaxScript() { this.m_ScenarioSyntax.Clear(); TextAsset asset = Resources.Load("Scripts/Scenario/ScenarioSyntax") as TextAsset; TextAssetParser textAssetParser = new TextAssetParser(asset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Syntax") { ScenarioSyntaxData scenarioSyntaxData = new ScenarioSyntaxData(); scenarioSyntaxData.m_Encoded = key.GetVariable(1).SValue; this.m_ScenarioSyntax.Add(key.GetVariable(0).SValue, scenarioSyntaxData); } } }
public void LoadScript() { string text = "Scripts/Player/Player_Sounds"; TextAsset textAsset = Resources.Load(text) as TextAsset; if (DebugUtils.Assert(textAsset != null, "[PlayerAudioModule::LoadScript] ERROR - can't load script " + text, true, DebugUtils.AssertType.Info)) { return; } TextAssetParser textAssetParser = new TextAssetParser(textAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); string text2 = "m_" + key.GetName() + "Sounds"; FieldInfo field = base.GetType().GetField(text2); if (!DebugUtils.Assert(field != null, "[PlayerAudioModule::LoadScript] ERROR - can't find member - " + text2, true, DebugUtils.AssertType.Info)) { List <AudioClip> list = new List <AudioClip>(); for (int j = 0; j < key.GetVariablesCount(); j++) { string svalue = key.GetVariable(j).SValue; AudioClip audioClip = Resources.Load <AudioClip>("Sounds/Player/" + svalue); if (!audioClip) { audioClip = Resources.Load <AudioClip>("Sounds/TempSounds/Player/" + svalue); } if (!audioClip) { audioClip = Resources.Load <AudioClip>("Sounds/PlayerVO/" + svalue); } if (!audioClip) { DebugUtils.Assert("[PlayerAudioModule::LoadScript] Can't load audio clip - " + svalue, true, DebugUtils.AssertType.Info); } else { list.Add(audioClip); } } field.SetValue(this, list); } } }
public void LoadScript(string script_name) { if (MainLevel.Instance.m_GameMode == GameMode.Debug) { return; } TextAssetParser textAssetParser = new TextAssetParser(Resources.Load(Scenario.s_ScriptPath + script_name) as TextAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Node") { ScenarioNode scenarioNode = new ScenarioNode(); scenarioNode.Load(key); this.AddNode(scenarioNode); } } }
private void LoadTextures() { TextAsset textAsset = Resources.Load("Scripts/Cursors") as TextAsset; DebugUtils.Assert(textAsset, "ERROR - Missing Cursors script.", true, DebugUtils.AssertType.Info); TextAssetParser textAssetParser = new TextAssetParser(textAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Cursor") { CursorManager.TYPE key2 = (CursorManager.TYPE)Enum.Parse(typeof(CursorManager.TYPE), key.GetVariable(0).SValue); Texture2D texture2D = Resources.Load <Texture2D>("Cursors/" + key.GetVariable(1).SValue); DebugUtils.Assert(texture2D != null, "ERROR - Missing cursor texture. TYPE = " + key2.ToString(), true, DebugUtils.AssertType.Info); this.m_TexturesMap.Add(key2, texture2D); } } Resources.UnloadAsset(textAsset); }
public void LoadScript() { Skill.s_Instances.Clear(); TextAssetParser textAssetParser = new TextAssetParser(this.m_SkillsScript); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Skill") { string svalue = key.GetVariable(0).SValue; Type type = Type.GetType(svalue + "Skill"); Skill skill = Activator.CreateInstance(type) as Skill; skill.Initialize(svalue); for (int j = 0; j < key.GetKeysCount(); j++) { skill.Load(key.GetKey(j)); } this.m_Skills.Add(skill); } } }
private void InitializeAIParams() { TextAsset textAsset = Resources.Load("Scripts/AI/AIData") as TextAsset; if (!textAsset) { DebugUtils.Assert("Can't load AIData script!", true, DebugUtils.AssertType.Info); return; } TextAssetParser textAssetParser = new TextAssetParser(textAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "AI") { AIParams aiparams = new AIParams(); aiparams.Load(key); this.m_AIParamsMap.Add((int)Enum.Parse(typeof(AI.AIID), key.GetVariable(0).SValue), aiparams); } } Resources.UnloadAsset(textAsset); }
private void ParseClipsReplaceScript() { string text = base.GetType().ToString(); text += "_ClipsReplace"; TextAsset textAsset = Resources.Load("Scripts/Player/ClipsReplace/" + text) as TextAsset; if (!textAsset) { return; } TextAssetParser textAssetParser = new TextAssetParser(textAsset); if (this.m_ClipReplaceMap == null) { this.m_ClipReplaceMap = new Dictionary <string, List <KeyValuePair <string, string> > >(); } for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Item") { string svalue = key.GetVariable(0).SValue; this.m_ClipReplaceMap[svalue] = new List <KeyValuePair <string, string> >(); for (int j = 0; j < key.GetKeysCount(); j++) { Key key2 = key.GetKey(j); if (key2.GetName() == "Clip") { KeyValuePair <string, string> item = new KeyValuePair <string, string>(key2.GetVariable(0).SValue, key2.GetVariable(1).SValue); this.m_ClipReplaceMap[svalue].Add(item); } } } } }
private void SetupEvents() { AI ai = null; if (this.m_Being && this.m_Being.IsAI()) { ai = base.GetComponent <AI>(); if (ai.IsHuman()) { this.m_HumanAI = (HumanAI)ai; } this.m_AudioSource.spatialize = true; } TextAssetParser parser = this.GetParser(); AnimationClip animationClip = null; AnimationClip[] animationClips = this.m_Animator.runtimeAnimatorController.animationClips; for (int i = 0; i < parser.GetKeysCount(); i++) { Key key = parser.GetKey(i); if (key.GetName() == "Anim") { string svalue = key.GetVariable(0).SValue; foreach (AnimationClip animationClip2 in animationClips) { if (animationClip2.name == svalue) { animationClip = animationClip2; break; } } if (!animationClip) { DebugUtils.Assert(false, "Can't find player anim clip " + svalue, true, DebugUtils.AssertType.Info); } else { AnimationEvent[] events = animationClip.events; float length = animationClip.length; for (int k = 0; k < key.GetKeysCount(); k++) { Key key2 = key.GetKey(k); if (key2.GetName() == "Event") { AnimEventID value = EnumUtils <AnimEventID> .GetValue(key2.GetVariable(0).SValue); bool flag = false; for (int l = 0; l < events.Length; l++) { if (events[l].intParameter == (int)value) { flag = true; break; } } if (!flag) { float fvalue = key2.GetVariable(1).FValue; AnimationEvent animationEvent = new AnimationEvent(); animationEvent.intParameter = (int)value; animationEvent.time = length * fvalue; animationEvent.functionName = "AnimEvent"; animationClip.AddEvent(animationEvent); List <AnimationEvent> list = null; if (!this.m_Events.TryGetValue(Animator.StringToHash(svalue), out list)) { this.m_Events[Animator.StringToHash(svalue)] = new List <AnimationEvent>(); } this.m_Events[Animator.StringToHash(svalue)].Add(animationEvent); } } else if (key2.GetName() == "Sound") { string svalue2 = key2.GetVariable(0).SValue; if (!this.m_Sounds.ContainsKey(svalue2)) { this.m_Sounds[svalue2] = new List <AudioClip>(); string text = (ai && ai.m_SoundPreset != AI.SoundPreset.None) ? (ai.m_SoundPreset.ToString() + "/") : ""; AudioClip audioClip = Resources.Load <AudioClip>(string.Concat(new string[] { "Sounds/", key2.GetVariable(1).SValue, "/", text, svalue2 })); if (audioClip) { this.m_Sounds[svalue2].Add(audioClip); } else { for (int m = 1; m < 99; m++) { audioClip = Resources.Load <AudioClip>(string.Concat(new string[] { "Sounds/", key2.GetVariable(1).SValue, "/", text, svalue2, (m < 10) ? "0" : "", m.ToString() })); if (!audioClip) { break; } this.m_Sounds[svalue2].Add(audioClip); } } } if (this.m_Sounds[svalue2].Count == 0) { DebugUtils.Assert("Missing clips of sound - " + svalue2, true, DebugUtils.AssertType.Info); } float num = length * key2.GetVariable(2).FValue; bool flag2 = false; for (int n = 0; n < events.Length; n++) { if (!(events[n].functionName != "SoundEvent") && events[n].stringParameter == svalue2 && events[n].time == num) { flag2 = true; break; } } if (!flag2) { animationClip.AddEvent(new AnimationEvent { stringParameter = svalue2, time = num, functionName = "SoundEvent" }); } } else if (key2.GetName() == "Footstep") { float num2 = length * key2.GetVariable(0).FValue; string svalue3 = key2.GetVariable(1).SValue; if (!this.m_TransformsForFXesMap.ContainsKey(svalue3)) { Transform transform = base.transform.FindDeepChild(svalue3); DebugUtils.Assert(transform != null, "Can't find objects - " + svalue3, true, DebugUtils.AssertType.Info); this.m_TransformsForFXesMap.Add(svalue3, transform); } bool flag3 = false; for (int num3 = 0; num3 < events.Length; num3++) { if (!(events[num3].functionName != "FootstepEvent") && events[num3].stringParameter == svalue3 && events[num3].time == num2) { flag3 = true; break; } } if (!flag3) { animationClip.AddEvent(new AnimationEvent { stringParameter = svalue3, time = num2, functionName = "FootstepEvent" }); } } } } } } }
private void LoadScript() { TextAsset textAsset = Resources.Load(this.m_SanityScript) as TextAsset; if (!textAsset) { DebugUtils.Assert("Can't load Sanity script - " + this.m_SanityScript, true, DebugUtils.AssertType.Info); return; } TextAssetParser textAssetParser = new TextAssetParser(textAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "ItemHallucinationsSanityLevel") { this.m_ItemHallucinationsSanityLevel = key.GetVariable(0).IValue; } else if (key.GetName() == "ItemHallucinationMinInterval") { this.m_ItemHallucinationMinInterval = key.GetVariable(0).FValue; } else if (key.GetName() == "ItemHallucinationMaxInterval") { this.m_ItemHallucinationMaxInterval = key.GetVariable(0).FValue; } else if (key.GetName() == "ItemHallucinationsMinCount") { this.m_ItemHallucinationsMinCount = key.GetVariable(0).IValue; } else if (key.GetName() == "ItemHallucinationsMaxCount") { this.m_ItemHallucinationsMaxCount = key.GetVariable(0).IValue; } else if (key.GetName() == "AIHallucinationsSanityLevel") { this.m_AIHallucinationsSanityLevel = key.GetVariable(0).IValue; } else if (key.GetName() == "AIHallucinationMinInterval") { this.m_AIHallucinationMinInterval = key.GetVariable(0).FValue; } else if (key.GetName() == "AIHallucinationMaxInterval") { this.m_AIHallucinationMaxInterval = key.GetVariable(0).FValue; } else if (key.GetName() == "AIHallucinationsMinCount") { this.m_AIHallucinationsMinCount = key.GetVariable(0).IValue; } else if (key.GetName() == "AIHallucinationsMaxCount") { this.m_AIHallucinationsMaxCount = key.GetVariable(0).IValue; } else if (key.GetName() == "StartEffectSanityLevel") { this.m_StartEffectSanityLevel = key.GetVariable(0).IValue; } else if (key.GetName() == "DisappearChatterChance") { this.m_DisappearChatterChance = key.GetVariable(0).FValue; } else if (key.GetName() == "MinSpawnStalkerInterval") { this.m_MinSpawnStalkerInterval = key.GetVariable(0).FValue; } else if (key.GetName() == "MaxSpawnStalkerInterval") { this.m_MaxSpawnStalkerInterval = key.GetVariable(0).FValue; } else if (key.GetName() == "WhispersSanityLevel") { this.m_WhispersSanityLevel = key.GetVariable(0).IValue; } else if (key.GetName() == "MinWhispersInterval") { this.m_MinWhispersInterval = key.GetVariable(0).FValue; } else if (key.GetName() == "MaxWhispersInterval") { this.m_MaxWhispersInterval = key.GetVariable(0).FValue; } else if (key.GetName() == "MinRandomWhispersInterval") { this.m_MinRandomWhispersInterval = key.GetVariable(0).FValue; } else if (key.GetName() == "MaxRandomWhispersInterval") { this.m_MaxRandomWhispersInterval = key.GetVariable(0).FValue; } else if (key.GetName() == "MaxWhispersQueue") { this.m_MaxWhispersQueue = key.GetVariable(0).IValue; } else if (key.GetName() == "Event") { string svalue = key.GetVariable(0).SValue; if (Enum.IsDefined(typeof(PlayerSanityModule.SanityEventType), svalue)) { PlayerSanityModule.SanityEventType key2 = (PlayerSanityModule.SanityEventType)Enum.Parse(typeof(PlayerSanityModule.SanityEventType), svalue); this.m_EventsMap[(int)key2].m_SanityChange[0] = key.GetVariable(1).IValue; this.m_EventsMap[(int)key2].m_SanityChange[1] = key.GetVariable(2).IValue; this.m_EventsMap[(int)key2].m_SanityChange[2] = key.GetVariable(3).IValue; this.m_EventsMap[(int)key2].m_Interval = key.GetVariable(4).FValue; this.m_EventsMap[(int)key2].m_TextID = key.GetVariable(5).SValue; } } else if (key.GetName() == "StalkerStalkingSanityLevel") { this.m_StalkerStalkingSanityLevel = key.GetVariable(0).IValue; } else if (key.GetName() == "StalkerAttackSanityLevel") { this.m_StalkerAttackSanityLevel = key.GetVariable(0).IValue; } else if (key.GetName() == "Whisper") { PlayerSanityModule.WhisperType key3 = (PlayerSanityModule.WhisperType)Enum.Parse(typeof(PlayerSanityModule.WhisperType), key.GetVariable(0).SValue); for (int j = 0; j < key.GetKeysCount(); j++) { Key key4 = key.GetKey(j); if (key4.GetName() == "Clip") { AudioClip audioClip = Resources.Load <AudioClip>("Sounds/Chatters/Whispers/" + key4.GetVariable(0).SValue); if (!audioClip) { audioClip = Resources.Load <AudioClip>("Sounds/Chatters/Temp_Whispers/" + key4.GetVariable(0).SValue); } if (!audioClip) { DebugUtils.Assert("Can't find clip - " + key4.GetVariable(0).SValue, true, DebugUtils.AssertType.Info); } if (!this.m_WhispersMap.ContainsKey((int)key3)) { List <AudioClip> value = new List <AudioClip>(); this.m_WhispersMap.Add((int)key3, value); } this.m_WhispersMap[(int)key3].Add(audioClip); } } } else if (key.GetName() == "DisappearItemSounds") { for (int k = 0; k < key.GetKeysCount(); k++) { Key key5 = key.GetKey(k); if (key5.GetName() == "Clip") { AudioClip audioClip2 = Resources.Load <AudioClip>("Sounds/Chatters/Whispers/" + key5.GetVariable(0).SValue); if (!audioClip2) { audioClip2 = Resources.Load <AudioClip>("Sounds/Chatters/Temp_Whispers/" + key5.GetVariable(0).SValue); } if (!audioClip2) { DebugUtils.Assert("Can't find clip - " + key5.GetVariable(0).SValue, true, DebugUtils.AssertType.Info); } if (!this.m_DisappearItem.Contains(audioClip2)) { this.m_DisappearItem.Add(audioClip2); } } } } else if (key.GetName() == "DisappearAISounds") { for (int l = 0; l < key.GetKeysCount(); l++) { Key key6 = key.GetKey(l); if (key6.GetName() == "Clip") { AudioClip audioClip3 = Resources.Load <AudioClip>("Sounds/Chatters/Whispers/" + key6.GetVariable(0).SValue); if (!audioClip3) { audioClip3 = Resources.Load <AudioClip>("Sounds/Chatters/Temp_Whispers/" + key6.GetVariable(0).SValue); } if (!audioClip3) { DebugUtils.Assert("Can't find clip - " + key6.GetVariable(0).SValue, true, DebugUtils.AssertType.Info); } if (!this.m_DisappearAI.Contains(audioClip3)) { this.m_DisappearAI.Add(audioClip3); } } } } else if (key.GetName() == "LowEnegryWhispersLevel") { this.m_LowEnegryWhispersLevel = key.GetVariable(0).FValue; } } Resources.UnloadAsset(textAsset); }
private void LoadScript() { TextAssetParser textAssetParser = new TextAssetParser(Resources.Load(LiquidManager.s_ScriptName) as TextAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Liquid") { LiquidData liquidData = new LiquidData(); liquidData.m_LiquidType = (LiquidType)Enum.Parse(typeof(LiquidType), key.GetVariable(0).SValue); for (int j = 0; j < key.GetKeysCount(); j++) { Key key2 = key.GetKey(j); if (key2.GetName() == "Components") { liquidData.m_LiquidComponent = (LiquidType)Enum.Parse(typeof(LiquidType), key2.GetVariable(0).SValue); liquidData.m_ItemComponent = (ItemID)Enum.Parse(typeof(ItemID), key2.GetVariable(1).SValue); } else if (key2.GetName() == "Fat") { liquidData.m_Fat = key2.GetVariable(0).FValue; } else if (key2.GetName() == "Carbohydrates") { liquidData.m_Carbohydrates = key2.GetVariable(0).FValue; } else if (key2.GetName() == "Proteins") { liquidData.m_Proteins = key2.GetVariable(0).FValue; } else if (key2.GetName() == "Water") { liquidData.m_Water = key2.GetVariable(0).FValue; } else if (key2.GetName() == "SanityChange") { liquidData.m_SanityChange = key2.GetVariable(0).IValue; } else if (key2.GetName() == "CookingResult") { liquidData.m_CookingResult = (LiquidType)Enum.Parse(typeof(LiquidType), key2.GetVariable(0).SValue); } else if (key2.GetName() == "DrinkEffect") { LiquidConsumeEffectData liquidConsumeEffectData = new LiquidConsumeEffectData(); liquidConsumeEffectData.m_ConsumeEffect = (ConsumeEffect)Enum.Parse(typeof(ConsumeEffect), key2.GetVariable(0).SValue); liquidConsumeEffectData.m_ConsumeEffectChance = key2.GetVariable(1).FValue; liquidConsumeEffectData.m_ConsumeEffectDelay = key2.GetVariable(2).FValue; liquidConsumeEffectData.m_ConsumeEffectLevel = key2.GetVariable(3).IValue; liquidData.m_ConsumeEffects.Add(liquidConsumeEffectData); } else if (key2.GetName() == "Energy") { liquidData.m_Energy = key2.GetVariable(0).FValue; } else if (key2.GetName() == "PoisonDebuff") { liquidData.m_PoisonDebuff = key2.GetVariable(0).IValue; } else if (key2.GetName() == "Disgusting") { liquidData.m_Disgusting = (key2.GetVariable(0).IValue != 0); } } this.m_LiquidDatas.Add(liquidData); } } }
private void ParseClipsReplaceScript() { string text = base.GetType().ToString(); text += "_ClipsReplace"; TextAsset textAsset = Resources.Load("Scripts/Player/ClipsReplace/" + text) as TextAsset; if (!textAsset) { return; } TextAssetParser textAssetParser = new TextAssetParser(textAsset); if (PlayerController.NEW_ANIM_OVERRIDES) { AnimatorOverrideController animatorOverrideController = this.m_Animator.runtimeAnimatorController as AnimatorOverrideController; if (animatorOverrideController == null) { animatorOverrideController = new AnimatorOverrideController(this.m_Animator.runtimeAnimatorController); this.m_Animator.runtimeAnimatorController = animatorOverrideController; } if (this.m_ClipOverrides == null) { this.m_ClipOverrides = new Dictionary <string, List <KeyValuePair <AnimationClip, AnimationClip> > >(); } for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Item") { string svalue = key.GetVariable(0).SValue; this.m_ClipOverrides[svalue] = new List <KeyValuePair <AnimationClip, AnimationClip> >(); for (int j = 0; j < key.GetKeysCount(); j++) { Key key2 = key.GetKey(j); if (key2.GetName() == "Clip") { AnimationClip key3 = animatorOverrideController[key2.GetVariable(0).SValue]; AnimationClip value = animatorOverrideController[key2.GetVariable(1).SValue]; this.m_ClipOverrides[svalue].Add(new KeyValuePair <AnimationClip, AnimationClip>(key3, value)); } } } } return; } if (this.m_ClipReplaceMap == null) { this.m_ClipReplaceMap = new Dictionary <string, List <KeyValuePair <string, string> > >(); } for (int k = 0; k < textAssetParser.GetKeysCount(); k++) { Key key4 = textAssetParser.GetKey(k); if (key4.GetName() == "Item") { string svalue2 = key4.GetVariable(0).SValue; this.m_ClipReplaceMap[svalue2] = new List <KeyValuePair <string, string> >(); for (int l = 0; l < key4.GetKeysCount(); l++) { Key key5 = key4.GetKey(l); if (key5.GetName() == "Clip") { KeyValuePair <string, string> item = new KeyValuePair <string, string>(key5.GetVariable(0).SValue, key5.GetVariable(1).SValue); this.m_ClipReplaceMap[svalue2].Add(item); } } } } }
private void InitHumanSoundsParser() { TextAsset textAsset = Resources.Load("Scripts/AI/HumanSounds") as TextAsset; if (textAsset) { TextAssetParser textAssetParser = new TextAssetParser(textAsset); for (int i = 0; i < textAssetParser.GetKeysCount(); i++) { Key key = textAssetParser.GetKey(i); if (key.GetName() == "Sound") { HumanAISoundModule.SoundType key2 = (HumanAISoundModule.SoundType)Enum.Parse(typeof(HumanAISoundModule.SoundType), key.GetVariable(0).SValue); this.m_Tribe0Sounds[(int)key2] = new List <AudioClip>(); this.m_Tribe1Sounds[(int)key2] = new List <AudioClip>(); this.m_Tribe2Sounds[(int)key2] = new List <AudioClip>(); string svalue = key.GetVariable(1).SValue; string path = "Sounds/" + key.GetVariable(2).SValue + "/Tribe0/" + svalue; AudioClip audioClip = Resources.Load <AudioClip>(path); if (audioClip) { this.m_Tribe0Sounds[(int)key2].Add(audioClip); } else { for (int j = 1; j < 99; j++) { path = string.Concat(new string[] { "Sounds/", key.GetVariable(2).SValue, "/Tribe0/", svalue, (j >= 10) ? string.Empty : "0", j.ToString() }); audioClip = Resources.Load <AudioClip>(path); if (!audioClip) { break; } this.m_Tribe0Sounds[(int)key2].Add(audioClip); } } path = "Sounds/" + key.GetVariable(2).SValue + "/Tribe1/" + svalue; audioClip = Resources.Load <AudioClip>(path); if (audioClip) { this.m_Tribe1Sounds[(int)key2].Add(audioClip); } else { for (int k = 1; k < 99; k++) { path = string.Concat(new string[] { "Sounds/", key.GetVariable(2).SValue, "/Tribe1/", svalue, (k >= 10) ? string.Empty : "0", k.ToString() }); audioClip = Resources.Load <AudioClip>(path); if (!audioClip) { break; } this.m_Tribe1Sounds[(int)key2].Add(audioClip); } } path = "Sounds/" + key.GetVariable(2).SValue + "/Tribe2/" + svalue; audioClip = Resources.Load <AudioClip>(path); if (audioClip) { this.m_Tribe2Sounds[(int)key2].Add(audioClip); } else { for (int l = 1; l < 99; l++) { path = string.Concat(new string[] { "Sounds/", key.GetVariable(2).SValue, "/Tribe2/", svalue, (l >= 10) ? string.Empty : "0", l.ToString() }); audioClip = Resources.Load <AudioClip>(path); if (!audioClip) { break; } this.m_Tribe2Sounds[(int)key2].Add(audioClip); } } } } Resources.UnloadAsset(textAsset); } else { DebugUtils.Assert("Missing HumanSounds script!", true, DebugUtils.AssertType.Info); } }