예제 #1
0
        public void StartDirector(bool spawnImmediate, params object[] args)
        {
            object[] args2 = new object[args.Length + 1];
            args2[0] = this;
            Array.Copy(args, 0, args2, 1, args.Length);

            List <LuaParam> lparams = CallLuaScript("init", args2);

            if (lparams != null && lparams.Count >= 1 && lparams[0].value is string)
            {
                classPath = (string)lparams[0].value;
                className = classPath.Substring(classPath.LastIndexOf("/") + 1);
                GenerateActorName((int)directorId);
                isCreated = true;
            }

            if (isCreated && spawnImmediate)
            {
                if (contentGroup != null)
                {
                    contentGroup.Start();
                }

                foreach (Player p in GetPlayerMembers())
                {
                    p.QueuePackets(GetSpawnPackets());
                    p.QueuePackets(GetInitPackets());
                }
            }

            if (this is GuildleveDirector)
            {
                ((GuildleveDirector)this).LoadGuildleve();
            }

            CallLuaScript("main", this, contentGroup);
        }