Ejemplo n.º 1
0
        public void Load(BinaryReader BR)
        {
            int ListScriptCount = BR.ReadInt32();

            ListScript = new List <AIScript>(ListScriptCount);

            for (int S = 0; S < ListScriptCount; ++S)
            {
                string NewScriptType = BR.ReadString();
                int    PosX          = BR.ReadInt32();
                int    PosY          = BR.ReadInt32();

                AIScript NewScript = AIScriptHolder.DicAIScripts[NewScriptType].CopyScript();
                NewScript.Owner = this;
                NewScript.Load(BR);
                OnScriptLoad(NewScript);

                for (int F = 0; F < NewScript.ArrayFollowingScript.Length; ++F)
                {
                    int ListScriptIndexCount = BR.ReadInt32();
                    for (int i = 0; i < ListScriptIndexCount; ++i)
                    {
                        NewScript.ArrayFollowingScript[F].ListScriptIndex.Add(BR.ReadInt32());
                        NewScript.ArrayFollowingScript[F].ListScript.Add(null);
                    }
                }

                for (int R = 0; R < NewScript.ArrayReferences.Length; ++R)
                {
                    NewScript.ArrayReferences[R].ReferencedScriptIndex = BR.ReadInt32();
                }

                ListScript.Add(NewScript);

                var NewEvent = NewScript as ScriptEvent;

                if (NewEvent != null)
                {
                    ListEvent.Add(NewEvent);
                }

                NewScript.ScriptSize.X = PosX;
                NewScript.ScriptSize.Y = PosY;
            }

            for (int S = 0; S < ListScript.Count; ++S)
            {
                foreach (FollowingScripts FollowingScript in ListScript[S].ArrayFollowingScript)
                {
                    //Load the Events
                    for (int E = 0; E < FollowingScript.ListScriptIndex.Count; E++)
                    {
                        FollowingScript.ListScript[E] = (ScriptEvaluator)ListScript[FollowingScript.ListScriptIndex[E]];
                    }
                }

                foreach (ReferenceToScript Reference in ListScript[S].ArrayReferences)
                {
                    if (Reference.ReferencedScriptIndex >= 0)
                    {
                        Reference.ReferencedScript = (ScriptReference)ListScript[Reference.ReferencedScriptIndex];
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public virtual void OnScriptLoad(AIScript NewScript)
 {
 }