Exemplo n.º 1
0
        private bool Body_OnCollision(Fixture sender, Fixture other, Contact contact)
        {
            if (other.Tag is ColliderTags tag)
            {
                if (tag == ColliderTags.Player)
                {
                    if (Screen is MainGameScreen mgs)
                    {
                        if (MainGameScreen.LevelExists(mgs.Level + 1))
                        {
                            Screen.ScreenManager.QueueAddScreen(new MainGameScreen(mgs.Level + 1));
                            mgs.ExitScreen();
                        }
                        else
                        {
                            Screen.ScreenManager.QueueAddScreen(new VictoryScreen());
                        }
                    }
                    else
                    {
                        Debug.LogError($"Goal expected to be on a MainGameScreen, was on a {Screen.GetType()}");
                    }
                }
            }

            return(true);
        }
Exemplo n.º 2
0
        public MainGame()
        {
            base.Content.RootDirectory = "Content";
            Content       = base.Content;
            this.graphics = new GraphicsDeviceManager(this);
            this.graphics.PreferredBackBufferWidth  = this.previousWindowWidth;
            this.graphics.PreferredBackBufferHeight = this.previousWindowHeight;
            base.Window.AllowUserResizing           = true;
            DateTime buildDate = new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;

            base.Window.Title = "中华三国志威力加强版(已命名修改版 v.19-dev build-" + buildDate.Year + "-" + buildDate.Month + "-" + buildDate.Day + ")";

            System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle(base.Window.Handle);
            GameForm             = (System.Windows.Forms.Form)System.Windows.Forms.Form.FromHandle(this.Window.Handle);
            GameForm.WindowState = System.Windows.Forms.FormWindowState.Maximized;


            this.GameForm          = control as System.Windows.Forms.Form;
            this.GameForm.KeyDown += new KeyEventHandler(this.GameForm_KeyDown);
            int    uFlags        = 0x400;
            IntPtr systemMenu    = GetSystemMenu(base.Window.Handle, false);
            int    menuItemCount = GetMenuItemCount(systemMenu);

            RemoveMenu(systemMenu, menuItemCount - 1, uFlags);
            RemoveMenu(systemMenu, menuItemCount - 2, uFlags);
            Plugin.Plugins.FindPlugins(AppDomain.CurrentDomain.BaseDirectory + "GameComponents");
            Plugin.Plugins.FindPlugins(AppDomain.CurrentDomain.BaseDirectory + "GamePlugins");
            this.mainGameScreen = new MainGameScreen(this);
            base.Components.Add(this.mainGameScreen);
        }
Exemplo n.º 3
0
 public void Initialize(MainMapLayer mainMapLayer, GameScenario scenario, MainGameScreen mainGameScreen)
 {
     this.screen        = mainGameScreen;
     this.mainMapLayer  = mainMapLayer;
     this.Architectures = scenario.Architectures;
     this.gameScenario  = scenario;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // collection of players
            players = new List <Player>()
            {
                new Player(PlayerIndex.One, Content),
                new Player(PlayerIndex.Two, Content),
                new Player(PlayerIndex.Three, Content),
                new Player(PlayerIndex.Four, Content)
            };

            // collection of screens
            mainMenuScreen = new MainMenuScreen(GameState.OnMainMenu);
            mainGameScreen = new MainGameScreen(GameState.RunningGame);
            gameOverScreen = new GameOverScreen(GameState.OnGameOver);
            screens        = new Dictionary <GameState, BaseScreen>()
            {
                { mainMenuScreen.GameState, mainMenuScreen },
                { mainGameScreen.GameState, mainGameScreen },
                { gameOverScreen.GameState, gameOverScreen }
            };

            base.Initialize();

            //CREATE THE MEDIA PLAYER
            MediaPlayer.Volume = 1.0f;
            MediaPlayer.Play(mainMenuScreen.menuMusic);
        }
Exemplo n.º 5
0
        public MainGameScreen CreateMainGameScreen(string mapPathToLoad)
        {
            MainGameScreen mainGameScreen = new MainGameScreen(Renderer, content, mapPathToLoad);

            mainGameScreen.ReturnToMainMenu += (sender, e) => LoadMainMenuScreen();
            return(mainGameScreen);
        }
Exemplo n.º 6
0
        public static void StartScenario(Scenario scenario, bool save)
        {
            var players = scenario.Players.Split(',').RemoveNullOrEmpty().Select(id => int.Parse(id)).NullToEmptyList();

            Session.MainGame.loadingScreen = new LoadingScreen();
            Session.MainGame.loadingScreen.LoadScreenEvent += (sender0, e0) =>
            {
                var mainGameScreen = new MainGameScreen();
                mainGameScreen.InitializationFileName = scenario.Name;

                if (save)
                {
                    mainGameScreen.LoadScenarioInInitialization = false;
                    //CurrentScenario. scenario.ScenarioPath;Session.MainGame.mainGameScreen.InitializationFactionIDs = players;  // scenario.SelectedFactionIDs;
                }
                else
                {
                    mainGameScreen.LoadScenarioInInitialization = true;
                    mainGameScreen.InitializationFactionIDs     = players;
                    //scenario.SelectedFactionIDs;@"GameData/Scenario/" + CurrentScenario.Name + ".mdb";  // CurrentScenario. scenario.ScenarioPath;
                }

                mainGameScreen.Initialize();
                Session.MainGame.mainGameScreen = mainGameScreen;
            };
        }
        public void ChangeScreen(string newScreen)
        {
            // UnLoad();
            currentScreen = null;
            switch (newScreen)
            {
            case "StartScreen":
                currentScreen = startScreen;     //new StartScreen();
                break;

            case "MainGameScreen":
                if (gameScreen == null)
                {
                    gameScreen = new MainGameScreen();
                }
                currentScreen = gameScreen;    //new MainGameScreen();

                break;

            case "Exit": exitGame = true;
                return;
            }
            GC.Collect();
            currentScreen.Init();
            currentScreen.Load();
        }
 public void Initialize(MainMapLayer mainMapLayer, GameScenario scenario, MainGameScreen mainGameScreen)
 {
     this.mainMapLayer  = mainMapLayer;
     this.Architectures = scenario.Architectures;
     this.gameScenario  = scenario;
     //this.huangditupian = huangditupian;
 }
Exemplo n.º 9
0
    void Awake()
    {
        MainGameScreen ms = FindObjectOfType <MainGameScreen>();

        if (ms != null && tag == "AIPlayer")
        {
            AIControlled = ms.SetAI;
        }
    }
Exemplo n.º 10
0
        public void Initialize(MainGameScreen screen)
        {
            //this.Conment = new FreeText(screen.GraphicsDevice, new System.Drawing.Font("宋体", 10f), Color.White);
            this.Conment       = new FreeText(new Font("宋体", 10f, ""), Color.White);
            this.Conment.Align = TextAlign.Middle;

            this.currentPositionTexture = screen.Textures.TileFrameTextures[0];
            this.EffectingAreaTexture   = screen.Textures.TileFrameTextures[4];
        }
Exemplo n.º 11
0
 public void Initialize(GameScenario scenario, MainGameScreen screen, GraphicsDevice device)
 {
     this.gameScenario = scenario;
     this.mainMap      = scenario.ScenarioMap;
     this.screen       = screen;
     this.device       = device;
     this.TerrainList.Clear();
     for (int i = 0; i < Enum.GetValues(typeof(TerrainKind)).Length; i++)
     {
         this.TerrainList.Add(0);
     }
 }
Exemplo n.º 12
0
        public static void StartScenario(Scenario scenario, bool save)
        {
            //再加载commondata防止切换mod红字
            if (!save)
            {
                CommonData.Current = Tools.SimpleSerializer.DeserializeJsonFile <CommonData>(@"Content\Data\Common\CommonData.json", false, false);
                GameScenario.ProcessCommonData(CommonData.Current);
            }

            var players = scenario.Players.Split(',').RemoveNullOrEmpty().Select(id => int.Parse(id)).NullToEmptyList();

            Session.MainGame.loadingScreen = new LoadingScreen(save  ? "" : "Start", scenario.Name);

            Session.MainGame.loadingScreen.LoadScreenEvent += (sender0, e0) =>
            {
                var mainGameScreen = new MainGameScreen();
                mainGameScreen.InitializationFileName = scenario.Name;

                if (save)
                {
                    mainGameScreen.LoadScenarioInInitialization = false;
                    //CurrentScenario. scenario.ScenarioPath;Session.MainGame.mainGameScreen.InitializationFactionIDs = players;  // scenario.SelectedFactionIDs;
                }
                else
                {
                    mainGameScreen.LoadScenarioInInitialization = true;
                    mainGameScreen.InitializationFactionIDs     = players;
                    //scenario.SelectedFactionIDs;@"GameData/Scenario/" + CurrentScenario.Name + ".mdb";  // CurrentScenario. scenario.ScenarioPath;
                }

                mainGameScreen.Initialize();
                Session.MainGame.mainGameScreen = mainGameScreen;

                mainGameScreen.cloudLayer.Start();

                Session.Current.Scenario.AfterInit();
            };
        }
Exemplo n.º 13
0
 public void Initialize(MainMapLayer mainMapLayer, GameScenario scenario, MainGameScreen screen)
 {
     this.mainMapLayer = mainMapLayer;
     this.gameScenario = scenario;
     this.screen       = screen;
 }
Exemplo n.º 14
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // collection of players
            players = new List<Player>()
            {
                new Player(PlayerIndex.One, Content),
                new Player(PlayerIndex.Two, Content),
                new Player(PlayerIndex.Three, Content),
                new Player(PlayerIndex.Four, Content)
            };

            // collection of screens
            mainMenuScreen = new MainMenuScreen(GameState.OnMainMenu);
            mainGameScreen = new MainGameScreen(GameState.RunningGame);
            gameOverScreen = new GameOverScreen(GameState.OnGameOver);
            screens = new Dictionary<GameState, BaseScreen>()
            {
                {mainMenuScreen.GameState, mainMenuScreen},
                {mainGameScreen.GameState, mainGameScreen},
                {gameOverScreen.GameState, gameOverScreen}
            };

            base.Initialize();

            //CREATE THE MEDIA PLAYER
            MediaPlayer.Volume = 1.0f;
            MediaPlayer.Play(mainMenuScreen.menuMusic);
        }
Exemplo n.º 15
0
 public void Initialize(MainGameScreen screen)
 {
     this.veilTexture = screen.Textures.MapVeilTextures[0];
 }
Exemplo n.º 16
0
        /// Starting a New Session
        /// Start a new session based on the data provided.
        public static void StartNewSession(GameStartDescription gameStartDescription, ScreenManager screenManager, MainGameScreen introScreen)
        {
            // check the parameters
            if (gameStartDescription == null)
            {
                throw new ArgumentNullException("gameStartDescripton");
            }
            if (screenManager == null)
            {
                throw new ArgumentNullException("screenManager");
            }
            if (introScreen == null)
            {
                throw new ArgumentNullException("gameplayScreen");
            }

            // end any existing session
            EndSession();

            // create a new singleton
            singleton = new Session(screenManager);

            ContentManager sessionContent = screenManager.SessionContent;

            singleton.player = new Player(gameStartDescription.SaveSlotNumber);

            PuzzleSet puzzleSet = sessionContent.Load <PuzzleSet>(Path.Combine(@"PuzzleSets", gameStartDescription.PuzzleSetContentName)).Clone() as PuzzleSet;

            puzzleSet.LoadContent(sessionContent);

            puzzleSet.ResetPuzzleLocks();

            PuzzleEngine.LoadContent(sessionContent, puzzleSet);
            PuzzleEngine.MainScreen.CreditsPanel.LoadContent(sessionContent);

            foreach (Puzzle puzzle in puzzleSet.Puzzles)
            {
                puzzle.IsRenderPortrait = true;
            }
            PuzzleEngine.IsCheckRender = true;

//            gamer = SignedInGamer.SignedInGamers[InputManager.PlayerIndex];
        }
Exemplo n.º 17
0
        // session load/save stuff
        /// Start a new session, using the data in the given save game.
        /// <param name="saveGameDescription">The description of the save game.</param>
        /// <param name="screenManager">The ScreenManager for the new session.</param>
        public static void LoadSession(SaveGameDescription saveGameDescription, ScreenManager screenManager, MainGameScreen introScreen)
        {
            // check the parameters
            if (saveGameDescription == null)
            {
                throw new ArgumentNullException("saveGameDescription");
            }
            if (screenManager == null)
            {
                throw new ArgumentNullException("screenManager");
            }
            if (introScreen == null)
            {
                throw new ArgumentNullException("gameplayScreen");
            }

            // end any existing session
            EndSession();

            // create the new session
            singleton = new Session(screenManager);

            PuzzleEngine.MainScreen.CreditsPanel.LoadContent(screenManager.SessionContent);
            StorageManager.Instance.LoadSession(saveGameDescription.FileName);
        }
Exemplo n.º 18
0
 public void Initialize(MainMapLayer mainMapLayer, GameScenario scenario, MainGameScreen screen)
 {
     this.mainMapLayer = mainMapLayer;
     this.gameScenario = scenario;
     this.screen = screen;
 }
Exemplo n.º 19
0
 public void RegisterMainGameScreen(MainGameScreen mgs)
 {
     mainGameScreen = mgs;
 }
Exemplo n.º 20
0
 public void LoadContent(ContentManager content, MainGameScreen parentScreen)
 {
     sdIndicator.LoadContent(content);
     this.parentScreen = parentScreen;
 }
Exemplo n.º 21
0
 internal void Initialize(MainGameScreen screen)
 {
     screen.OnMouseMove += new Screen.MouseMove(this.screen_OnMouseMove);
 }
Exemplo n.º 22
0
        /// <summary>
        /// Main loop to recieve messages from the server
        /// </summary>
        public static void RecieveLoop()
        {
            NetIncomingMessage inc;

            while (!_shouldStop)
            {
                while ((inc = NetClient.ReadMessage()) != null)
                {
                    switch (inc.MessageType)
                    {
                    case NetIncomingMessageType.Error:
                        Console.WriteLine(inc.ToString());
                        break;

                    case NetIncomingMessageType.StatusChanged:
                        Console.WriteLine("Status changed: " + inc.SenderConnection.Status);
                        if (inc.SenderConnection.Status == NetConnectionStatus.Disconnected)
                        {
                            NetClient.Shutdown("Closed");
                            //ends the receive loop
                            _shouldStop = true;
                            Conn        = "";
                        }
                        break;

                    case NetIncomingMessageType.Data:
                        var type = inc.ReadByte();
                        if (type == (byte)PacketTypes.Start)
                        {
                            var end = inc.ReadInt32();
                            MonsterPackets = new MonsterDataPacket[end];
                            for (var i = 0; i < end; i++)
                            {
                                var json = inc.ReadString();
                                MonsterPackets[i] = JsonConvert.DeserializeObject <MonsterDataPacket>(json);
                            }

                            LobbyController.StartGame(MonsterPackets);
                            //Makes this thread a STAThread, not sure if necessary...
                            GameLoop = new Thread(Program.Run);
                            GameLoop.SetApartmentState(ApartmentState.STA);
                            GameLoop.Start();
                        }
                        else if (type == (byte)PacketTypes.Spectate)    //The initial message to catch the new spectator up
                        {
                            var end = inc.ReadInt32();
                            MonsterPackets = new MonsterDataPacket[end];
                            for (var i = 0; i < end; i++)
                            {
                                var json = inc.ReadString();
                                MonsterPackets[i] = JsonConvert.DeserializeObject <MonsterDataPacket>(json);
                            }

                            LobbyController.StartGame(MonsterPackets);
                            //Makes this thread a STAThread, not sure if necessary...
                            GameLoop = new Thread(Program.Run);
                            GameLoop.SetApartmentState(ApartmentState.STA);
                            GameLoop.Start();
                        }
                        else if (type == (byte)PacketTypes.Update)
                        {
                            var end = inc.ReadInt32();
                            MonsterPackets = new MonsterDataPacket[end];
                            for (var i = 0; i < end; i++)
                            {
                                var json = inc.ReadString();
                                MonsterPackets[i] = JsonConvert.DeserializeObject <MonsterDataPacket>(json);
                            }

                            MonsterController.AcceptDataPackets(MonsterPackets);

                            if (inc.ReadByte() == (byte)PacketTypes.Dice)
                            {
                                var diceJson = inc.ReadString();
                                var dice     = JsonConvert.DeserializeObject <DiceDataPacket>(diceJson);
                                DiceController.AcceptDataPacket(dice);
                            }
                            else
                            {
                                Console.Error.WriteLine("No Dice! (╯°□°)╯︵ ┻━┻");
                            }

                            if (inc.ReadByte() == (byte)PacketTypes.Cards)
                            {
                                var cardJson         = inc.ReadString();
                                var cardsDataPackets = JsonConvert.DeserializeObject <CardDataPacket[]>(cardJson);
                                CardController.SetCardsForSale(cardsDataPackets.ToList()
                                                               .Select(CardController.AcceptDataPacket)
                                                               .ToList());
                            }
                            else
                            {
                                Console.Error.WriteLine("No Cards! (╯°□°)╯︵ ┻━┻");
                            }

                            CanContinue = true;
                        }
                        else if (type == (byte)PacketTypes.Closed)
                        {
                            NetClient.Shutdown("Closed");
                            isSpectator = false;
                            Conn        = "";
                            break;
                        }
                        else if (type == (byte)PacketTypes.GameOver)
                        {
                            Console.WriteLine("Game Over!");
                            MainGameScreen.gameOver = true;
                            var winnerName = inc.ReadString();
                            if (winnerName == NetworkClasses.GetUserValue("_Character").ToString())
                            {
                                NetworkClasses.AddWin(User.PlayerId);
                            }
                            MainGameScreen.EndGame(winnerName);
                        }
                        else if (type == (byte)PacketTypes.Message)
                        {
                            var message = inc.ReadString();
                            MessageHistory.Add(message);
                        }
                        else if (type == (byte)PacketTypes.Chat)
                        {
                            ChatHistory.Add(inc.ReadString());
                        }
                        break;

                    case NetIncomingMessageType.WarningMessage:
                        Console.WriteLine("WARNING");
                        break;

                    default:    //TODO catch attempts to connect non-existing servers
                        Console.WriteLine("Unhandled message of type: " + inc.MessageType);
                        //throw new ArgumentOutOfRangeException();
                        break;
                    }
                    NetClient.Recycle(inc);
                }
                Thread.Sleep(50);
            }
        }
Exemplo n.º 23
0
 public void Initialize(GameScenario scenario, MainGameScreen screen, GraphicsDevice device)
 {
     this.gameScenario = scenario;
     this.mainMap = scenario.ScenarioMap;
     this.screen = screen;
     this.device = device;
     this.TerrainList.Clear();
     for (int i = 0; i < Enum.GetValues(typeof(TerrainKind)).Length; i++)
     {
         this.TerrainList.Add(0);
     }
 }
Exemplo n.º 24
0
        public void InitializePlugins(MainGameScreen screen)
        {
            IBasePlugin plugin = new HelpPlugin.HelpPlugin(); //  Plugin.Plugins.AvailablePlugins.Find("HelpPlugin");

            if ((plugin != null) && (plugin.Instance is IHelp))
            {
                this.HelpPlugin = plugin.Instance as IHelp;
                this.HelpPlugin.SetGraphicsDevice();
                this.HelpPlugin.SetScreen(screen);
                screen.PluginList.Add(this.HelpPlugin.Instance as GameObject);
            }
            plugin = new PersonDetailPlugin.PersonDetailPlugin();  // Plugin.Plugins.AvailablePlugins.Find("PersonDetailPlugin");
            if ((plugin != null) && (plugin.Instance is IPersonDetail))
            {
                this.PersonDetailPlugin = plugin.Instance as IPersonDetail;
                this.PersonDetailPlugin.SetGraphicsDevice();
                this.PersonDetailPlugin.SetScreen(screen);
                screen.PluginList.Add(this.PersonDetailPlugin.Instance as GameObject);
            }
            plugin = new TroopDetailPlugin.TroopDetailPlugin();  // Plugin.Plugins.AvailablePlugins.Find("TroopDetailPlugin");
            if ((plugin != null) && (plugin.Instance is ITroopDetail))
            {
                this.TroopDetailPlugin = plugin.Instance as ITroopDetail;
                this.TroopDetailPlugin.SetGraphicsDevice();
                this.TroopDetailPlugin.SetScreen(screen);
                screen.PluginList.Add(this.TroopDetailPlugin.Instance as GameObject);
            }
            plugin = new ArchitectureDetail.ArchitectureDetailPlugin(); // Plugin.Plugins.AvailablePlugins.Find("ArchitectureDetailPlugin");
            if ((plugin != null) && (plugin.Instance is IArchitectureDetail))
            {
                this.ArchitectureDetailPlugin = plugin.Instance as IArchitectureDetail;
                this.ArchitectureDetailPlugin.SetGraphicsDevice();
                this.ArchitectureDetailPlugin.SetScreen(screen);
                screen.PluginList.Add(this.ArchitectureDetailPlugin.Instance as GameObject);
            }
            plugin = new FactionTechniquesPlugin.FactionTechniquesPlugin();  // Plugin.Plugins.AvailablePlugins.Find("FactionTechniquesPlugin");
            if ((plugin != null) && (plugin.Instance is IFactionTechniques))
            {
                this.FactionTechniquesPlugin = plugin.Instance as IFactionTechniques;
                this.FactionTechniquesPlugin.SetScreen(screen);
                this.FactionTechniquesPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.FactionTechniquesPlugin.Instance as GameObject);
            }
            plugin = new TreasureDetailPlugin.TreasureDetailPlugin();  // Plugin.Plugins.AvailablePlugins.Find("TreasureDetailPlugin");
            if ((plugin != null) && (plugin.Instance is ITreasureDetail))
            {
                this.TreasureDetailPlugin = plugin.Instance as ITreasureDetail;
                this.TreasureDetailPlugin.SetGraphicsDevice();
                this.TreasureDetailPlugin.SetScreen(screen);
                screen.PluginList.Add(this.TreasureDetailPlugin.Instance as GameObject);
            }
            plugin = new CommentTextPlugin.CommentTextPlugin();  // Plugin.Plugins.AvailablePlugins.Find("CommentTextPlugin");
            if ((plugin != null) && (plugin.Instance is IConmentText))
            {
                this.ConmentTextPlugin = plugin.Instance as IConmentText;
                this.ConmentTextPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.ConmentTextPlugin.Instance as GameObject);
            }
            plugin = new ArchitectureSurveyPlugin.ArchitectureSurveyPlugin();  // Plugin.Plugins.AvailablePlugins.Find("ArchitectureSurveyPlugin");
            if ((plugin != null) && (plugin.Instance is IArchitectureSurvey))
            {
                this.ArchitectureSurveyPlugin = plugin.Instance as IArchitectureSurvey;
                this.ArchitectureSurveyPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.ArchitectureSurveyPlugin.Instance as GameObject);
            }
            plugin = new TroopSurveyPlugin.TroopSurveyPlugin();  // Plugin.Plugins.AvailablePlugins.Find("TroopSurveyPlugin");
            if ((plugin != null) && (plugin.Instance is ITroopSurvey))
            {
                this.TroopSurveyPlugin = plugin.Instance as ITroopSurvey;
                this.TroopSurveyPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.TroopSurveyPlugin.Instance as GameObject);
            }
            plugin = new ContextMenuPlugin.ContextMenuPlugin();  // Plugin.Plugins.AvailablePlugins.Find("ContextMenuPlugin");
            if ((plugin != null) && (plugin.Instance is IGameContextMenu))
            {
                this.ContextMenuPlugin = plugin.Instance as IGameContextMenu;
                this.ContextMenuPlugin.SetScreen(screen);
                this.ContextMenuPlugin.SetGraphicsDevice();
                this.ContextMenuPlugin.SetIHelp(this.HelpPlugin);
                screen.PluginList.Add(this.ContextMenuPlugin.Instance as GameObject);
            }
            plugin = new GameFormFramePlugin.GameFramePlugin();  // Plugin.Plugins.AvailablePlugins.Find("GameFramePlugin");
            if ((plugin != null) && (plugin.Instance is IGameFrame))
            {
                this.GameFramePlugin = plugin.Instance as IGameFrame;
                this.GameFramePlugin.SetScreen(screen);
                this.GameFramePlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.GameFramePlugin.Instance as GameObject);
            }
            plugin = new ScreenBlindPlugin.ScreenBlindPlugin();  // Plugin.Plugins.AvailablePlugins.Find("ScreenBlindPlugin");
            if ((plugin != null) && (plugin.Instance is IScreenBlind))
            {
                this.ScreenBlindPlugin = plugin.Instance as IScreenBlind;
                this.ScreenBlindPlugin.SetScreen(screen);
                this.ScreenBlindPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.ScreenBlindPlugin.Instance as GameObject);
            }
            plugin = new MapViewSelectorPlugin.MapViewSelectorPlugin();  // Plugin.Plugins.AvailablePlugins.Find("MapViewSelectorPlugin");
            if ((plugin != null) && (plugin.Instance is IMapViewSelector))
            {
                this.MapViewSelectorPlugin = plugin.Instance as IMapViewSelector;
                this.MapViewSelectorPlugin.SetScreen(screen);
                this.MapViewSelectorPlugin.SetGraphicsDevice();
                this.MapViewSelectorPlugin.SetGameFrame(this.GameFramePlugin);
                screen.PluginList.Add(this.MapViewSelectorPlugin.Instance as GameObject);
            }
            plugin = new TabListPlugin.TabListPlugin();  // Plugin.Plugins.AvailablePlugins.Find("TabListPlugin");
            if ((plugin != null) && (plugin.Instance is ITabList))
            {
                this.TabListPlugin = plugin.Instance as ITabList;
                this.TabListPlugin.SetScreen(screen);
                this.TabListPlugin.SetGraphicsDevice();
                this.TabListPlugin.SetPersonDetailDialog(this.PersonDetailPlugin);
                this.TabListPlugin.SetTroopDetailDialog(this.TroopDetailPlugin);
                this.TabListPlugin.SetArchitectureDetailDialog(this.ArchitectureDetailPlugin);
                this.TabListPlugin.SetFactionTechniquesDialog(this.FactionTechniquesPlugin);
                this.TabListPlugin.SetTreasureDetailDialog(this.TreasureDetailPlugin);
                this.TabListPlugin.SetGameFrame(this.GameFramePlugin);
                this.TabListPlugin.SetMapViewSelector(this.MapViewSelectorPlugin);
                screen.PluginList.Add(this.TabListPlugin.Instance as GameObject);
            }
            plugin = new OptionDialogPlugin.OptionDialogPlugin();  // Plugin.Plugins.AvailablePlugins.Find("OptionDialogPlugin");
            if ((plugin != null) && (plugin.Instance is IOptionDialog))
            {
                this.OptionDialogPlugin = plugin.Instance as IOptionDialog;
                this.OptionDialogPlugin.SetScreen(screen);
                this.OptionDialogPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.OptionDialogPlugin.Instance as GameObject);
            }
            plugin = new SimpleTextDialogPlugin.SimpleTextDialogPlugin();  // Plugin.Plugins.AvailablePlugins.Find("SimpleTextDialogPlugin");
            if ((plugin != null) && (plugin.Instance is ISimpleTextDialog))
            {
                this.SimpleTextDialogPlugin = plugin.Instance as ISimpleTextDialog;
                this.SimpleTextDialogPlugin.SetScreen(screen);
                this.SimpleTextDialogPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.SimpleTextDialogPlugin.Instance as GameObject);
            }

            plugin = new tupianwenziPlugin.tupianwenziPlugin();  // Plugin.Plugins.AvailablePlugins.Find("tupianwenziPlugin");
            if ((plugin != null) && (plugin.Instance is Itupianwenzi))
            {
                this.tupianwenziPlugin = plugin.Instance as Itupianwenzi;
                this.tupianwenziPlugin.SetScreen(screen);
                this.tupianwenziPlugin.SetGraphicsDevice();
                this.tupianwenziPlugin.SetContextMenu(this.ContextMenuPlugin);
                screen.PluginList.Add(this.tupianwenziPlugin.Instance as GameObject);
            }

            plugin = new ConfirmationDialogPlugin.ConfirmationDialogPlugin();  // Plugin.Plugins.AvailablePlugins.Find("ConfirmationDialogPlugin");
            if ((plugin != null) && (plugin.Instance is IConfirmationDialog))
            {
                this.ConfirmationDialogPlugin = plugin.Instance as IConfirmationDialog;
                this.ConfirmationDialogPlugin.SetScreen(screen);
                this.ConfirmationDialogPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.ConfirmationDialogPlugin.Instance as GameObject);
            }
            plugin = new ToolBarPlugin.ToolBarPlugin();  // Plugin.Plugins.AvailablePlugins.Find("ToolBarPlugin");
            if ((plugin != null) && (plugin.Instance is IToolBar))
            {
                this.ToolBarPlugin = plugin.Instance as IToolBar;
                this.ToolBarPlugin.SetScreen(screen);
                this.ToolBarPlugin.SetGraphicsDevice();
                this.ToolBarPlugin.SetContextMenuPlugin(this.ContextMenuPlugin);
                screen.PluginList.Add(this.ToolBarPlugin.Instance as GameObject);
            }
            if (this.ToolBarPlugin != null)
            {
                plugin = new DateRunnerPlugin.DateRunnerPlugin();  // Plugin.Plugins.AvailablePlugins.Find("DateRunnerPlugin");
                if ((plugin != null) && (plugin.Instance is IDateRunner))
                {
                    this.DateRunnerPlugin = plugin.Instance as IDateRunner;
                    this.DateRunnerPlugin.SetScreen(screen);
                    this.DateRunnerPlugin.SetGraphicsDevice();
                    this.DateRunnerPlugin.SetGameDate(Session.Current.Scenario.Date);
                    this.ToolBarPlugin.AddTool(this.DateRunnerPlugin.ToolInstance);
                    screen.PluginList.Add(this.DateRunnerPlugin.Instance as GameObject);
                }
            }
            if (this.ToolBarPlugin != null)
            {
                plugin = new GameRecordPlugin.GameRecordPlugin();  // Plugin.Plugins.AvailablePlugins.Find("GameRecordPlugin");
                if ((plugin != null) && (plugin.Instance is IGameRecord))
                {
                    this.GameRecordPlugin = plugin.Instance as IGameRecord;
                    this.GameRecordPlugin.SetScreen(screen);
                    this.GameRecordPlugin.SetGraphicsDevice();
                    this.ToolBarPlugin.AddTool(this.GameRecordPlugin.ToolInstance);
                    screen.PluginList.Add(this.GameRecordPlugin.Instance as GameObject);
                }
            }
            if (this.ToolBarPlugin != null)
            {
                plugin = new MapLayerPlugin.MapLayerPlugin();  // Plugin.Plugins.AvailablePlugins.Find("MapLayerPlugin");
                if ((plugin != null) && (plugin.Instance is IMapLayer))
                {
                    this.MapLayerPlugin = plugin.Instance as IMapLayer;
                    this.MapLayerPlugin.SetScreen(screen);
                    this.MapLayerPlugin.SetGraphicsDevice();
                    this.ToolBarPlugin.AddTool(this.MapLayerPlugin.ToolInstance);
                    screen.PluginList.Add(this.MapLayerPlugin.Instance as GameObject);
                }
            }
            if (this.ToolBarPlugin != null)
            {
                plugin = new GameSystemPlugin.GameSystemPlugin();  // Plugin.Plugins.AvailablePlugins.Find("GameSystemPlugin");
                if ((plugin != null) && (plugin.Instance is IGameSystem))
                {
                    this.GameSystemPlugin = plugin.Instance as IGameSystem;
                    this.GameSystemPlugin.SetScreen(screen);
                    this.GameSystemPlugin.SetGraphicsDevice();
                    this.GameSystemPlugin.SetOptionDialog(this.OptionDialogPlugin);
                    this.ToolBarPlugin.AddTool(this.GameSystemPlugin.ToolInstance);
                    screen.PluginList.Add(this.GameSystemPlugin.Instance as GameObject);
                }
            }
            if (this.ToolBarPlugin != null)
            {
                plugin = new AirViewPlugin.AirViewPlugin();  // Plugin.Plugins.AvailablePlugins.Find("AirViewPlugin");
                if ((plugin != null) && (plugin.Instance is IAirView))
                {
                    this.AirViewPlugin = plugin.Instance as IAirView;
                    this.AirViewPlugin.SetScreen(screen);
                    this.AirViewPlugin.SetGraphicsDevice();
                    this.ToolBarPlugin.AddTool(this.AirViewPlugin.ToolInstance);
                    screen.PluginList.Add(this.AirViewPlugin.Instance as GameObject);
                }
            }

            plugin = new PersonPortraitPlugin.PersonPortraitPlugin();  // Plugin.Plugins.AvailablePlugins.Find("PersonPortraitPlugin");
            if ((plugin != null) && (plugin.Instance is IPersonPortrait))
            {
                this.PersonPortraitPlugin = plugin.Instance as IPersonPortrait;
                this.PersonPortraitPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.PersonPortraitPlugin.Instance as GameObject);
            }
            plugin = new PersonBubble.PersonBubblePlugin();  // Plugin.Plugins.AvailablePlugins.Find("PersonBubblePlugin");
            if ((plugin != null) && (plugin.Instance is IPersonBubble))
            {
                this.PersonBubblePlugin = plugin.Instance as IPersonBubble;
                this.PersonBubblePlugin.SetScreen(screen);
                this.PersonBubblePlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.PersonBubblePlugin.Instance as GameObject);
            }
            plugin = new TroopTitlePlugin.TroopTitlePlugin();  // Plugin.Plugins.AvailablePlugins.Find("TroopTitlePlugin");
            if ((plugin != null) && (plugin.Instance is ITroopTitle))
            {
                this.TroopTitlePlugin = plugin.Instance as ITroopTitle;
                this.TroopTitlePlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.TroopTitlePlugin.Instance as GameObject);
            }
            plugin = new RoutewayEditorPlugin.RoutewayEditorPlugin();  // Plugin.Plugins.AvailablePlugins.Find("RoutewayEditorPlugin");
            if ((plugin != null) && (plugin.Instance is IRoutewayEditor))
            {
                this.RoutewayEditorPlugin = plugin.Instance as IRoutewayEditor;
                this.RoutewayEditorPlugin.SetScreen(screen);
                this.RoutewayEditorPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.RoutewayEditorPlugin.Instance as GameObject);
            }
            plugin = new NumberInputerPlugin.NumberInputerPlugin();  // Plugin.Plugins.AvailablePlugins.Find("NumberInputerPlugin");
            if ((plugin != null) && (plugin.Instance is INumberInputer))
            {
                this.NumberInputerPlugin = plugin.Instance as INumberInputer;
                this.NumberInputerPlugin.SetScreen(screen);
                this.NumberInputerPlugin.SetGraphicsDevice();
                screen.PluginList.Add(this.NumberInputerPlugin.Instance as GameObject);
            }
            plugin = new TransportDialogPlugin.TransportDialogPlugin();  // Plugin.Plugins.AvailablePlugins.Find("TransportDialogPlugin");
            if ((plugin != null) && (plugin.Instance is ITransportDialog))
            {
                this.TransportDialogPlugin = plugin.Instance as ITransportDialog;
                this.TransportDialogPlugin.SetScreen(screen);
                this.TransportDialogPlugin.SetGraphicsDevice();
                this.TransportDialogPlugin.SetGameFrame(this.GameFramePlugin);
                this.TransportDialogPlugin.SetTabList(this.TabListPlugin);
                this.TransportDialogPlugin.SetNumberInputer(this.NumberInputerPlugin);
                screen.PluginList.Add(this.TransportDialogPlugin.Instance as GameObject);
            }
            plugin = new CreateTroopPlugin.CreateTroopPlugin();  // Plugin.Plugins.AvailablePlugins.Find("CreateTroopPlugin");
            if ((plugin != null) && (plugin.Instance is ICreateTroop))
            {
                this.CreateTroopPlugin = plugin.Instance as ICreateTroop;
                this.CreateTroopPlugin.SetGraphicsDevice();
                this.CreateTroopPlugin.SetScreen(screen);
                this.CreateTroopPlugin.SetGameFrame(this.GameFramePlugin);
                this.CreateTroopPlugin.SetTabList(this.TabListPlugin);
                this.CreateTroopPlugin.SetNumberInputer(this.NumberInputerPlugin);
                screen.PluginList.Add(this.CreateTroopPlugin.Instance as GameObject);
            }
            plugin = new MarshalSectionDialogPlugin.MarshalSectionDialogPlugin();  // Plugin.Plugins.AvailablePlugins.Find("MarshalSectionDialogPlugin");
            if ((plugin != null) && (plugin.Instance is IMarshalSectionDialog))
            {
                this.MarshalSectionDialogPlugin = plugin.Instance as IMarshalSectionDialog;
                this.MarshalSectionDialogPlugin.SetGraphicsDevice();
                this.MarshalSectionDialogPlugin.SetScreen(screen);
                this.MarshalSectionDialogPlugin.SetGameFrame(this.GameFramePlugin);
                this.MarshalSectionDialogPlugin.SetTabList(this.TabListPlugin);
                screen.PluginList.Add(this.MarshalSectionDialogPlugin.Instance as GameObject);
            }

            plugin = new youcelanPlugin.TabListPlugin();  // Plugin.Plugins.AvailablePlugins.Find("youcelanPlugin");
            if ((plugin != null) && (plugin.Instance is Iyoucelan))
            {
                this.youcelanPlugin = plugin.Instance as Iyoucelan;
                this.youcelanPlugin.SetScreen(screen);
                this.youcelanPlugin.SetGraphicsDevice();
                this.youcelanPlugin.SetPersonDetailDialog(this.PersonDetailPlugin);
                this.youcelanPlugin.SetTroopDetailDialog(this.TroopDetailPlugin);
                this.youcelanPlugin.SetArchitectureDetailDialog(this.ArchitectureDetailPlugin);
                this.youcelanPlugin.SetFactionTechniquesDialog(this.FactionTechniquesPlugin);
                this.youcelanPlugin.SetTreasureDetailDialog(this.TreasureDetailPlugin);
                this.youcelanPlugin.SetGameFrame(this.GameFramePlugin);
                this.youcelanPlugin.SetMapViewSelector(this.MapViewSelectorPlugin);
                screen.PluginList.Add(this.youcelanPlugin.Instance as GameObject);
            }

            plugin = new BianduiLiebiaoChajian.TabListPlugin();  // Plugin.Plugins.AvailablePlugins.Find("BianduiLiebiaoChajian");
            if ((plugin != null) && (plugin.Instance is IBianduiLiebiao))
            {
                this.BianduiLiebiao = plugin.Instance as IBianduiLiebiao;
                this.BianduiLiebiao.SetScreen(screen);
                this.BianduiLiebiao.SetGraphicsDevice();
                this.BianduiLiebiao.SetPersonDetailDialog(this.PersonDetailPlugin);
                this.BianduiLiebiao.SetTroopDetailDialog(this.TroopDetailPlugin);
                this.BianduiLiebiao.SetArchitectureDetailDialog(this.ArchitectureDetailPlugin);
                this.BianduiLiebiao.SetFactionTechniquesDialog(this.FactionTechniquesPlugin);
                this.BianduiLiebiao.SetTreasureDetailDialog(this.TreasureDetailPlugin);
                this.BianduiLiebiao.SetGameFrame(this.GameFramePlugin);
                this.BianduiLiebiao.SetMapViewSelector(this.MapViewSelectorPlugin);
                screen.PluginList.Add(this.BianduiLiebiao.Instance as GameObject);
            }
        }
 public void Initialize(MainMapLayer mainMapLayer, GameScenario scenario,MainGameScreen mainGameScreen)
 {
     this.screen  = mainGameScreen;
     this.mainMapLayer = mainMapLayer;
     this.Architectures = scenario.Architectures;
     this.gameScenario = scenario;
 }
Exemplo n.º 26
0
 internal void Initialize(MainGameScreen screen)
 {
     screen.OnMouseMove     += new Screen.MouseMove(this.screen_OnMouseMove);
     screen.OnMouseLeftDown += new Screen.MouseLeftDown(this.screen_OnMouseLeftDown);
     screen.OnMouseLeftUp   += new Screen.MouseLeftUp(this.screen_OnMouseLeftUP);
 }
Exemplo n.º 27
0
        public void Initialize(MainMapLayer mainMapLayer, MainGameScreen screen)
        {
            this.mainMapLayer = mainMapLayer;
            this.screen = screen;
            //this.Conment = new FreeText(screen.GraphicsDevice, new System.Drawing.Font("宋体", 10f), Color.White);
            this.Conment = new FreeText(screen.GraphicsDevice,new System.Drawing.Font("宋体", 10f), Color.White);
            this.Conment.Align = TextAlign.Middle;

            this.currentPositionTexture = screen.Textures.TileFrameTextures[0];
            this.EffectingAreaTexture = screen.Textures.TileFrameTextures[4];
        }
Exemplo n.º 28
0
 public void Initialize(MainMapLayer mainMapLayer, GameScenario scenario,MainGameScreen mainGameScreen)
 {
     this.mainMapLayer = mainMapLayer;
     this.Architectures = scenario.Architectures;
     this.gameScenario = scenario;
     //this.huangditupian = huangditupian;
 }