コード例 #1
0
ファイル: BattlegroundMgr.cs プロジェクト: uvbs/Asda2-Server
        public static void SetCreator(BattlegroundId id, string typeName)
        {
            Type type = ServerApp <WCell.RealmServer.RealmServer> .GetType(typeName);

            BattlegroundTemplate template = BattlegroundMgr.GetTemplate(id);

            if (type == (Type)null || template == null)
            {
                object obj1;
                object obj2;
                if (type == (Type)null)
                {
                    obj1 = (object)"type";
                    obj2 = (object)string.Format("({0}) - Please correct it in the Battleground-config file: {1}",
                                                 (object)typeName, (object)InstanceConfigBase <BattlegroundConfig, BattlegroundId> .Filename);
                }
                else
                {
                    obj1 = (object)"Template";
                    obj2 = (object)"<not in DB>";
                }

                BattlegroundMgr.log.Warn("Battleground {0} has invalid {1} {2}", (object)id, obj1, obj2);
            }
            else
            {
                IProducer producer = AccessorMgr.GetOrCreateDefaultProducer(type);
                template.Creator = (BattlegroundCreator)(() => (Battleground)producer.Produce());
            }
        }
コード例 #2
0
        public static void SetCreator(MapId id, string typeName)
        {
            Type type = ServerApp <RealmServer> .GetType(typeName);

            if (type == null)
            {
                log.Warn("Invalid Creator for Instance \"" + id + "\": " + typeName +
                         "  - Please correct it in the Instance-config file: " +
                         InstanceConfigBase <InstanceConfig, MapId> .Filename);
            }
            else
            {
                IProducer producer = AccessorMgr.GetOrCreateDefaultProducer(type);
                SetCreator(id, () => (BaseInstance)producer.Produce());
            }
        }