Пример #1
0
        public bool Start(
            System.Reflection.Assembly DatabaseAssembly, 
            Action<String> Output)
        {
            GameInfo gameInfo = null;
            foreach (var type in DatabaseAssembly.GetTypes())
                if (type.IsSubclassOf(typeof(GameInfo)))
                    gameInfo = Activator.CreateInstance(type) as GameInfo;

            if (gameInfo == null) throw new InvalidOperationException("No GameInfo defined in game assembly.");

            var assemblies = new List<ModuleAssembly>();
            assemblies.Add(new ModuleAssembly(DatabaseAssembly, new ModuleInfo { BaseNameSpace = gameInfo.DatabaseNameSpace }));
            foreach (var module in gameInfo.Modules)
                assemblies.Add(new ModuleAssembly(module));

            if (RMUD.Core.Start(StartupFlags.Silent,
                new RMUD.SinglePlayer.CompiledDatabase(DatabaseAssembly, gameInfo.DatabaseNameSpace),
                assemblies.ToArray()))
            {
                Player = RMUD.MudObject.GetObject<RMUD.Player>(RMUD.Core.SettingsObject.PlayerBaseObject);
                Player.CommandHandler = RMUD.Core.ParserCommandHandler;
                Client = new DummyClient(Output);
                RMUD.Core.TiePlayerToClient(Client, Player);
                Player.Rank = 500;

                DetectAndAssignDriver(DatabaseAssembly);
                Core.GlobalRules.ConsiderPerformRule("singleplayer game started", Player);

                return true;
            }

            return false;
        }
Пример #2
0
        public void SwitchPlayerCharacter(RMUD.Player NewCharacter)
        {
            NewCharacter.Rank           = 500;
            NewCharacter.CommandHandler = RMUD.Core.ParserCommandHandler;
            var client = Player.ConnectedClient;

            RMUD.Core.TiePlayerToClient(client, NewCharacter);
            Player = NewCharacter;
        }
Пример #3
0
Файл: Game.cs Проект: SinaC/RMUD
 public static void SwitchPlayerCharacter(RMUD.Player NewCharacter)
 {
     Driver.SwitchPlayerCharacter(NewCharacter);
 }
Пример #4
0
 public void SwitchPlayerCharacter(RMUD.Player NewCharacter)
 {
     NewCharacter.Rank = 500;
     NewCharacter.CommandHandler = RMUD.Core.ParserCommandHandler;
     var client = Player.ConnectedClient;
     RMUD.Core.TiePlayerToClient(client, NewCharacter);
     Player = NewCharacter;
 }