public CJVariable AddVariable() { CJVariable cjvariable = new CJVariable(); this.m_Variables.Add(cjvariable); return(cjvariable); }
public void Save(Key key) { CJVariable cjvariable = key.AddVariable(); cjvariable.SValue = this.m_WavName; foreach (MSCurveData mscurveData in this.m_Curves.Keys) { Key key2 = key.AddKey("Curve"); cjvariable = key2.AddVariable(); cjvariable.SValue = mscurveData.m_Name; cjvariable = key2.AddVariable(); cjvariable.SValue = this.m_Curves[mscurveData].preWrapMode.ToString(); cjvariable = key2.AddVariable(); cjvariable.SValue = this.m_Curves[mscurveData].postWrapMode.ToString(); foreach (Keyframe keyframe in this.m_Curves[mscurveData].keys) { Key key3 = key2.AddKey("Key"); cjvariable = key3.AddVariable(); cjvariable.FValue = keyframe.time; cjvariable = key3.AddVariable(); cjvariable.FValue = keyframe.value; cjvariable = key3.AddVariable(); cjvariable.FValue = keyframe.inTangent; cjvariable = key3.AddVariable(); cjvariable.FValue = keyframe.outTangent; } } }
public bool StatisticGreater(string stat_name, string level) { Enums.Event stat_type = (Enums.Event)Enum.Parse(typeof(Enums.Event), stat_name); CJVariable statistic = this.GetStatistic(stat_type); if (statistic == null) { return(false); } CJVariable.TYPE variableType = statistic.GetVariableType(); if (variableType != CJVariable.TYPE.Int) { if (variableType == CJVariable.TYPE.Float) { float num = 0f; if (float.TryParse(level, out num)) { return(statistic.FValue > num); } } } else { int num2 = 0; if (int.TryParse(level, out num2)) { return(statistic.IValue > num2); } } return(false); }
public void Save() { CJVariable cjvariable = null; for (int i = 0; i < 18; i++) { Enums.Event key = (Enums.Event)i; if (this.m_Stats.TryGetValue((int)key, out cjvariable)) { switch (cjvariable.GetVariableType()) { case CJVariable.TYPE.String: SaveGame.SaveVal("Stat" + key.ToString(), cjvariable.SValue); break; case CJVariable.TYPE.Int: SaveGame.SaveVal("Stat" + key.ToString(), cjvariable.IValue); break; case CJVariable.TYPE.Float: SaveGame.SaveVal("Stat" + key.ToString(), cjvariable.FValue); break; case CJVariable.TYPE.Bool: SaveGame.SaveVal("Stat" + key.ToString(), cjvariable.BValue); break; } } } }
public void Load() { this.Reset(); int ivalue = 0; float fvalue = 0f; string empty = string.Empty; bool bvalue = false; for (int i = 0; i < 18; i++) { Enums.Event stat_type = (Enums.Event)i; CJVariable statistic = this.GetStatistic(stat_type); if (statistic != null) { if (SaveGame.LoadVal("Stat" + stat_type.ToString(), out fvalue, false)) { statistic.FValue = fvalue; } else if (SaveGame.LoadVal("Stat" + stat_type.ToString(), out ivalue, false)) { statistic.IValue = ivalue; } else if (SaveGame.LoadVal("Stat" + stat_type.ToString(), out empty, false)) { statistic.SValue = empty; } else if (SaveGame.LoadVal("Stat" + stat_type.ToString(), out bvalue, false)) { statistic.BValue = bvalue; } } } this.m_PrevDayCheck = MainLevel.Instance.m_TODSky.Cycle.Day; }
private void ParseSoundFile() { ScriptParser scriptParser = new ScriptParser(); scriptParser.Parse("AI/" + this.m_AI.m_ID.ToString() + "Sounds", true); this.s_IdleClips[(int)this.m_AI.m_ID] = new List <AudioClip>(); this.s_PanicClips[(int)this.m_AI.m_ID] = new List <AudioClip>(); for (int i = 0; i < scriptParser.GetKeysCount(); i++) { Key key = scriptParser.GetKey(i); if (key.GetName() == "Idle") { for (int j = 0; j < key.GetVariablesCount(); j++) { CJVariable variable = key.GetVariable(j); AudioClip item = Resources.Load("Sounds/AI/" + this.m_AI.m_ID.ToString() + "/" + variable.SValue) as AudioClip; this.s_IdleClips[(int)this.m_AI.m_ID].Add(item); } } else if (key.GetName() == "Panic") { for (int k = 0; k < key.GetVariablesCount(); k++) { CJVariable variable2 = key.GetVariable(k); AudioClip item2 = Resources.Load("Sounds/AI/" + this.m_AI.m_ID.ToString() + "/" + variable2.SValue) as AudioClip; this.s_PanicClips[(int)this.m_AI.m_ID].Add(item2); } } } this.s_Status[(int)this.m_AI.m_ID] = true; }
public CJVariable GetStatistic(Enums.Event stat_type) { CJVariable cjvariable = null; this.m_Stats.TryGetValue((int)stat_type, out cjvariable); DebugUtils.Assert(cjvariable != null, true); return(cjvariable); }
private void Setup() { this.m_Content.text = string.Empty; for (int i = 0; i < 18; i++) { Enums.Event stat_type = (Enums.Event)i; CJVariable statistic = StatsManager.Get().GetStatistic(stat_type); Text content = this.m_Content; content.text = content.text + stat_type.ToString() + ": "; CJVariable.TYPE variableType = statistic.GetVariableType(); if (variableType == CJVariable.TYPE.Unknown) { Text content2 = this.m_Content; content2.text += "-\n"; } else { switch (variableType) { case CJVariable.TYPE.String: { Text content3 = this.m_Content; content3.text += statistic.SValue; break; } case CJVariable.TYPE.Int: { Text content4 = this.m_Content; content4.text += statistic.IValue.ToString(); break; } case CJVariable.TYPE.Float: { Text content5 = this.m_Content; content5.text += statistic.FValue.ToString("F1"); break; } case CJVariable.TYPE.Bool: { Text content6 = this.m_Content; content6.text += statistic.BValue.ToString(); break; } } Text content7 = this.m_Content; content7.text += "\n"; } } }
public void Write(StreamWriter stream, int tabs) { for (int i = 0; i < tabs; i++) { stream.Write("\t"); } stream.Write(this.GetName().ToCharArray()); stream.Write("("); for (int j = 0; j < this.m_Variables.Count; j++) { CJVariable cjvariable = this.m_Variables[j]; cjvariable.Write(stream); if (j < this.m_Variables.Count - 1) { stream.Write(", "); } } stream.Write(")"); if (this.GetKeysCount() > 0) { stream.Write("\n"); for (int k = 0; k < tabs; k++) { stream.Write("\t"); } stream.Write("{\n"); tabs++; } for (int l = 0; l < this.GetKeysCount(); l++) { Key key = this.GetKey(l); key.Write(stream, tabs); if (l < this.GetKeysCount() - 1) { stream.Write("\n"); } } if (this.GetKeysCount() > 0) { stream.Write("\n"); tabs--; for (int m = 0; m < tabs; m++) { stream.Write("\t"); } stream.Write("}"); } }
public void Save(Key key) { CJVariable cjvariable = key.AddVariable(); cjvariable.SValue = this.m_Name; for (int i = 0; i < this.m_Params.Count; i++) { Key key2 = key.AddKey("Param"); cjvariable = key2.AddVariable(); cjvariable.SValue = this.m_Params[i].m_Name; } for (int j = 0; j < this.m_Samples.Count; j++) { Key key3 = key.AddKey("Sample"); this.m_Samples[j].Save(key3); } }
public void Load(Key key, StateMachine machine) { this.m_Name = key.GetVariable(0).SValue; int num = 1; string text = key.GetVariable(num).SValue; while (text.Length > 0) { State stateByName = machine.GetStateByName(text); if (stateByName != null) { this.m_States.Add(stateByName); } num++; CJVariable variable = key.GetVariable(num); text = ((variable == null) ? string.Empty : variable.SValue); } }
private static void ParseSoundFile(AI.AIID ai_id) { ScriptParser scriptParser = new ScriptParser(); scriptParser.Parse("AI/" + ai_id.ToString() + "Sounds", true); AISoundModule.s_IdleClips[(int)ai_id] = new List <AudioClip>(); AISoundModule.s_PanicClips[(int)ai_id] = new List <AudioClip>(); AISoundModule.s_DeathClips[(int)ai_id] = new List <AudioClip>(); for (int i = 0; i < scriptParser.GetKeysCount(); i++) { Key key = scriptParser.GetKey(i); if (key.GetName() == "Idle") { for (int j = 0; j < key.GetVariablesCount(); j++) { CJVariable variable = key.GetVariable(j); AudioClip item = Resources.Load("Sounds/AI/" + ai_id.ToString() + "/" + variable.SValue) as AudioClip; AISoundModule.s_IdleClips[(int)ai_id].Add(item); } } else if (key.GetName() == "Panic") { for (int k = 0; k < key.GetVariablesCount(); k++) { CJVariable variable2 = key.GetVariable(k); AudioClip item2 = Resources.Load("Sounds/AI/" + ai_id.ToString() + "/" + variable2.SValue) as AudioClip; AISoundModule.s_PanicClips[(int)ai_id].Add(item2); } } else if (key.GetName() == "Death") { for (int l = 0; l < key.GetVariablesCount(); l++) { CJVariable variable3 = key.GetVariable(l); AudioClip item3 = Resources.Load("Sounds/AI/" + ai_id.ToString() + "/" + variable3.SValue) as AudioClip; AISoundModule.s_DeathClips[(int)ai_id].Add(item3); } } } AISoundModule.s_Status[(int)ai_id] = true; }
public void OnEvent(Enums.Event event_type, string val, int data) { CJVariable statistic = this.GetStatistic(event_type); statistic.SValue = val; }
public void OnEvent(Enums.Event event_type, int val, int data, int data2) { CJVariable statistic = this.GetStatistic(event_type); statistic.IValue += val; }
public void AddVariable(CJVariable variable) { this.m_Variables.Add(variable); }
public Condition(CJVariable var, Condition.TYPE type) { this.m_Variable = var; this.m_Type = type; }
public void SetVariable(CJVariable var) { this.m_Variable = var; }