示例#1
0
 private static void ProcessEndTrigger(ScriptTrigger trigger, ActiveScript script, int? id)
 {
   int? nullable = id;
   int? identifier = trigger.Object.Identifier;
   if ((nullable.GetValueOrDefault() != identifier.GetValueOrDefault() ? 0 : (nullable.HasValue == identifier.HasValue ? 1 : 0)) == 0)
     return;
   script.Dispose();
 }
示例#2
0
 private static void ProcessEndTrigger(ScriptTrigger trigger, ActiveScript script)
 {
   ScriptingHost.ProcessEndTrigger(trigger, script, new int?());
 }
示例#3
0
 private void ProcessTrigger(ScriptTrigger trigger, Script script, int? id)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   ScriptingHost.\u003C\u003Ec__DisplayClass11 cDisplayClass11 = new ScriptingHost.\u003C\u003Ec__DisplayClass11();
   // ISSUE: reference to a compiler-generated field
   cDisplayClass11.trigger = trigger;
   // ISSUE: reference to a compiler-generated field
   cDisplayClass11.script = script;
   // ISSUE: reference to a compiler-generated field
   cDisplayClass11.\u003C\u003E4__this = this;
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   if (this.GameState.Loading && cDisplayClass11.trigger.Object.Type != "Level" && cDisplayClass11.trigger.Event != "Start" || cDisplayClass11.script.Disabled)
     return;
   int? nullable = id;
   // ISSUE: reference to a compiler-generated field
   int? identifier = cDisplayClass11.trigger.Object.Identifier;
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated method
   if ((nullable.GetValueOrDefault() != identifier.GetValueOrDefault() ? 1 : (nullable.HasValue != identifier.HasValue ? 1 : 0)) != 0 || cDisplayClass11.script.Conditions != null && Enumerable.Any<ScriptCondition>((IEnumerable<ScriptCondition>) cDisplayClass11.script.Conditions, (Func<ScriptCondition, bool>) (c => !c.Check(this.services[c.Object.Type]))) || cDisplayClass11.script.OneTime && Enumerable.Any<ActiveScript>((IEnumerable<ActiveScript>) this.activeScripts, new Func<ActiveScript, bool>(cDisplayClass11.\u003CProcessTrigger\u003Eb__a)))
     return;
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   cDisplayClass11.activeScript = new ActiveScript(cDisplayClass11.script, cDisplayClass11.trigger);
   // ISSUE: reference to a compiler-generated field
   this.activeScripts.Add(cDisplayClass11.activeScript);
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   if (cDisplayClass11.script.IsWinCondition && !this.GameState.SaveData.ThisLevel.FilledConditions.ScriptIds.Contains(cDisplayClass11.script.Id))
   {
     // ISSUE: reference to a compiler-generated field
     this.GameState.SaveData.ThisLevel.FilledConditions.ScriptIds.Add(cDisplayClass11.script.Id);
     this.GameState.SaveData.ThisLevel.FilledConditions.ScriptIds.Sort();
   }
   // ISSUE: reference to a compiler-generated field
   foreach (ScriptAction scriptAction in cDisplayClass11.script.Actions)
   {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     ScriptingHost.\u003C\u003Ec__DisplayClass13 cDisplayClass13 = new ScriptingHost.\u003C\u003Ec__DisplayClass13();
     // ISSUE: reference to a compiler-generated field
     cDisplayClass13.CS\u0024\u003C\u003E8__locals12 = cDisplayClass11;
     // ISSUE: reference to a compiler-generated field
     cDisplayClass13.runnableAction = new RunnableAction()
     {
       Action = scriptAction
     };
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated method
     cDisplayClass13.runnableAction.Invocation = new Func<object>(cDisplayClass13.\u003CProcessTrigger\u003Eb__b);
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     cDisplayClass11.activeScript.EnqueueAction(cDisplayClass13.runnableAction);
   }
   // ISSUE: reference to a compiler-generated field
   if (!cDisplayClass11.script.IgnoreEndTriggers)
   {
     // ISSUE: reference to a compiler-generated field
     foreach (ScriptTrigger scriptTrigger in cDisplayClass11.script.Triggers)
     {
       EntityTypeDescriptor entityTypeDescriptor = EntityTypes.Types[scriptTrigger.Object.Type];
       DynamicMethodDelegate dynamicMethodDelegate = entityTypeDescriptor.Events[scriptTrigger.Event].AddEndTriggerHandler;
       if (dynamicMethodDelegate != null)
       {
         if (entityTypeDescriptor.Static)
         {
           // ISSUE: reference to a compiler-generated method
           Action action = new Action(cDisplayClass11.\u003CProcessTrigger\u003Eb__c);
           // ISSUE: reference to a compiler-generated field
           object obj = dynamicMethodDelegate((object) this.services[cDisplayClass11.trigger.Object.Type], new object[1]
           {
             (object) action
           });
         }
         else
         {
           // ISSUE: reference to a compiler-generated method
           Action<int> action = new Action<int>(cDisplayClass11.\u003CProcessTrigger\u003Eb__d);
           // ISSUE: reference to a compiler-generated field
           object obj = dynamicMethodDelegate((object) this.services[cDisplayClass11.trigger.Object.Type], new object[1]
           {
             (object) action
           });
         }
       }
     }
   }
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated method
   cDisplayClass11.activeScript.Disposed += new Action(cDisplayClass11.\u003CProcessTrigger\u003Eb__e);
 }
示例#4
0
 private void ProcessTrigger(ScriptTrigger trigger, Script script)
 {
   this.ProcessTrigger(trigger, script, new int?());
 }
示例#5
0
 private void TryInitialize()
 {
   if (this.isHooked)
   {
     this.Gomez.EnteredDoor -= new Action(this.CheckWinCondition);
     this.isHooked = false;
   }
   if (this.LevelManager.Name != "CRYPT")
   {
     this.TraversedVolumes.Clear();
   }
   else
   {
     if (this.LevelManager.LastLevelName == "CRYPT")
     {
       this.TraversedVolumes.Add(this.PlayerManager.DoorVolume.Value);
       if (this.TraversedVolumes.Count > 4)
         this.TraversedVolumes.RemoveAt(0);
       for (int index = 0; index < this.TraversedVolumes.Count; ++index)
       {
         if (CryptHost.VolumeSequence[this.TraversedVolumes.Count - 1 - index] != this.TraversedVolumes[this.TraversedVolumes.Count - 1 - index])
         {
           this.TraversedVolumes.Clear();
           break;
         }
       }
     }
     else
       this.TraversedVolumes.Clear();
     ICollection<int> keys = this.LevelManager.Scripts.Keys;
     int[] numArray = new int[4]
     {
       0,
       1,
       2,
       3
     };
     foreach (int key in Enumerable.ToArray<int>(Enumerable.Except<int>((IEnumerable<int>) keys, (IEnumerable<int>) numArray)))
       this.LevelManager.Scripts.Remove(key);
     foreach (Volume volume in (IEnumerable<Volume>) this.LevelManager.Volumes.Values)
     {
       if (volume.Id > 1 && (volume.Id != 14 || this.TraversedVolumes.Count != 3))
       {
         int key = IdentifierPool.FirstAvailable<Script>(this.LevelManager.Scripts);
         int num = RandomHelper.InList<int>(Enumerable.Except<int>((IEnumerable<int>) this.LevelManager.Volumes.Keys, (IEnumerable<int>) new int[3]
         {
           0,
           1,
           volume.Id
         }));
         Script script1 = new Script();
         script1.Id = key;
         List<ScriptTrigger> triggers = script1.Triggers;
         ScriptTrigger scriptTrigger1 = new ScriptTrigger();
         scriptTrigger1.Event = "Enter";
         scriptTrigger1.Object = new Entity()
         {
           Type = "Volume",
           Identifier = new int?(volume.Id)
         };
         ScriptTrigger scriptTrigger2 = scriptTrigger1;
         triggers.Add(scriptTrigger2);
         List<ScriptAction> actions = script1.Actions;
         ScriptAction scriptAction1 = new ScriptAction();
         scriptAction1.Operation = "ChangeLevelToVolume";
         scriptAction1.Arguments = new string[4]
         {
           "CRYPT",
           num.ToString(),
           "True",
           "False"
         };
         scriptAction1.Object = new Entity()
         {
           Type = "Level"
         };
         ScriptAction scriptAction2 = scriptAction1;
         actions.Add(scriptAction2);
         Script script2 = script1;
         foreach (ScriptAction scriptAction3 in script2.Actions)
           scriptAction3.Process();
         this.LevelManager.Scripts.Add(key, script2);
       }
     }
     this.LevelManager.Scripts[2].Disabled = this.TraversedVolumes.Count != 3;
   }
 }
示例#6
0
 public ActiveScript(Script script, ScriptTrigger initiatingTrigger)
 {
   ServiceHelper.InjectServices((object) this);
   this.Script = script;
   this.InitiatingTrigger = initiatingTrigger;
 }