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.21-dev build-" + buildDate.Year + "-" + buildDate.Month + "-" + buildDate.Day + ")"; //System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle(base.Window.Handle); this.GameForm = (System.Windows.Forms.Form)System.Windows.Forms.Form.FromHandle(this.Window.Handle); this.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); }
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; base.Window.Title = "中华三国志"; 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); }
public ScreenManager(MainGameScreen mainGameScreen) { this.mainGameScreen = mainGameScreen; }
public ScreenManager(MainGameScreen mainGameScreen) { this.mainGameScreen = mainGameScreen; }
public void LoadScenario(string filename, List <int> playerFactions, bool fromScenario, MainGameScreen mainGameScreen) { List <string> errorMsg = new List <string>(); while (CommonData.CurrentReady == false) { Platform.Sleep(100); } string scenarioName = ""; if (fromScenario) { scenarioName = String.Format(@"Content\Data\Scenario\{0}.json", filename); } else { if (!Platform.Current.UserDirectoryExist("Save")) { Platform.Current.UserDirectoryCreate("Save"); } scenarioName = String.Format(@"Save\{0}.json", filename); } LoadScenarioData(scenarioName, fromScenario, mainGameScreen); var scenario = Session.Current.Scenario; if (fromScenario) { scenario.PlayerList = playerFactions; } if (String.IsNullOrEmpty(scenario.CurrentPlayerID) && scenario.PlayerList.Count > 0) { scenario.CurrentPlayerID = scenario.PlayerList[0].ToString(); } if (scenario.PlayerList.Count > 0) { foreach (int i in scenario.PlayerList) { scenario.PlayerFactions.Add(scenario.Factions.GetGameObject(i)); } if (!String.IsNullOrEmpty(scenario.CurrentPlayerID)) { scenario.CurrentPlayer = scenario.Factions.GetGameObject(int.Parse(scenario.CurrentPlayerID)) as Faction; scenario.CurrentFaction = scenario.CurrentPlayer; scenario.Factions.RunningFaction = scenario.CurrentPlayer; } } if (scenario.PlayerList.Count == 0) { Session.Current.Scenario.ForceOptionsOnAutoplay(); } //this.Clear(); //this.Factions.LoadQueueFromString(reader["FactionQueue"].ToString()); }
public static GameScenario LoadScenarioData(string scenarioName, bool fromScenario, MainGameScreen mainGameScreen) { //Stopwatch stopwatch = new Stopwatch(); //stopwatch.Start(); GameScenario scenario = null; Session.Current.IsWorking = true; if (fromScenario) { scenario = Tools.SimpleSerializer.DeserializeJsonFile <GameScenario>(scenarioName, false, true); } else { scenario = Tools.SimpleSerializer.DeserializeJsonFile <GameScenario>(scenarioName, true, true); } Session.Current.IsWorking = false; scenario.LoadedFileName = scenarioName; //stopwatch.Stop(); scenario.UsingOwnCommonData = true; if (scenario.GameCommonData == null) { scenario.GameCommonData = CommonData.Current; scenario.UsingOwnCommonData = false; } else { GameScenario.ProcessCommonData(scenario.GameCommonData); if (scenario.GameCommonData.AllArchitectureKinds == null || scenario.GameCommonData.AllArchitectureKinds.ArchitectureKinds == null || scenario.GameCommonData.AllArchitectureKinds.ArchitectureKinds.Count == 0) { scenario.GameCommonData.AllArchitectureKinds = CommonData.Current.AllArchitectureKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllAttackDefaultKinds == null || scenario.GameCommonData.AllAttackDefaultKinds.Count == 0) { scenario.GameCommonData.AllAttackDefaultKinds = CommonData.Current.AllAttackDefaultKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllAttackTargetKinds == null || scenario.GameCommonData.AllAttackTargetKinds.Count == 0) { scenario.GameCommonData.AllAttackTargetKinds = CommonData.Current.AllAttackTargetKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllCastDefaultKinds == null || scenario.GameCommonData.AllCastDefaultKinds.Count == 0) { scenario.GameCommonData.AllCastDefaultKinds = CommonData.Current.AllCastDefaultKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllCastTargetKinds == null || scenario.GameCommonData.AllCastTargetKinds.Count == 0) { scenario.GameCommonData.AllCastTargetKinds = CommonData.Current.AllCastTargetKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllCharacterKinds == null || scenario.GameCommonData.AllCharacterKinds.Count == 0) { scenario.GameCommonData.AllCharacterKinds = CommonData.Current.AllCharacterKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllColors == null || scenario.GameCommonData.AllColors.Count == 0) { scenario.GameCommonData.AllColors = CommonData.Current.AllColors; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllCombatMethods == null || scenario.GameCommonData.AllCombatMethods.Count == 0) { scenario.GameCommonData.AllCombatMethods = CommonData.Current.AllCombatMethods; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllConditionKinds == null || scenario.GameCommonData.AllConditionKinds.Count == 0) { scenario.GameCommonData.AllConditionKinds = CommonData.Current.AllConditionKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllConditions == null || scenario.GameCommonData.AllConditions.Count == 0) { scenario.GameCommonData.AllConditions = CommonData.Current.AllConditions; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllFacilityKinds == null || scenario.GameCommonData.AllFacilityKinds.Count == 0) { scenario.GameCommonData.AllFacilityKinds = CommonData.Current.AllFacilityKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.suoyouzainanzhonglei == null || scenario.GameCommonData.suoyouzainanzhonglei.Count == 0) { scenario.GameCommonData.suoyouzainanzhonglei = CommonData.Current.suoyouzainanzhonglei; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.suoyouguanjuezhonglei == null || scenario.GameCommonData.suoyouguanjuezhonglei.Count == 0) { scenario.GameCommonData.suoyouguanjuezhonglei = CommonData.Current.suoyouguanjuezhonglei; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllIdealTendencyKinds == null || scenario.GameCommonData.AllIdealTendencyKinds.Count == 0) { scenario.GameCommonData.AllIdealTendencyKinds = CommonData.Current.AllIdealTendencyKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllInfluenceKinds == null || scenario.GameCommonData.AllInfluenceKinds.Count == 0) { scenario.GameCommonData.AllInfluenceKinds = CommonData.Current.AllInfluenceKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllInfluences == null || scenario.GameCommonData.AllInfluences.Count == 0) { scenario.GameCommonData.AllInfluences = CommonData.Current.AllInfluences; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllInformationKinds == null || scenario.GameCommonData.AllInformationKinds.Count == 0) { scenario.GameCommonData.AllInformationKinds = CommonData.Current.AllInformationKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllMilitaryKinds == null || scenario.GameCommonData.AllMilitaryKinds.MilitaryKinds == null || scenario.GameCommonData.AllMilitaryKinds.MilitaryKinds.Count == 0) { scenario.GameCommonData.AllMilitaryKinds = CommonData.Current.AllMilitaryKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllSectionAIDetails == null || scenario.GameCommonData.AllSectionAIDetails.Count == 0) { scenario.GameCommonData.AllSectionAIDetails = CommonData.Current.AllSectionAIDetails; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllSkills == null || scenario.GameCommonData.AllSkills.Count == 0) { scenario.GameCommonData.AllSkills = CommonData.Current.AllSkills; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllStratagems == null || scenario.GameCommonData.AllStratagems.Stratagems == null || scenario.GameCommonData.AllStratagems.Stratagems.Count == 0) { scenario.GameCommonData.AllStratagems = CommonData.Current.AllStratagems; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllStunts == null || scenario.GameCommonData.AllStunts.Count == 0) { scenario.GameCommonData.AllStunts = CommonData.Current.AllStunts; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllTechniques == null || scenario.GameCommonData.AllTechniques.Count == 0) { scenario.GameCommonData.AllTechniques = CommonData.Current.AllTechniques; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllTerrainDetails == null || scenario.GameCommonData.AllTerrainDetails.Count == 0) { scenario.GameCommonData.AllTerrainDetails = CommonData.Current.AllTerrainDetails; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllTextMessages == null || scenario.GameCommonData.AllTextMessages.Count == 0) { scenario.GameCommonData.AllTextMessages = CommonData.Current.AllTextMessages; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllTileAnimations == null || scenario.GameCommonData.AllTileAnimations.Animations == null || scenario.GameCommonData.AllTileAnimations.Animations.Count == 0) { scenario.GameCommonData.AllTileAnimations = CommonData.Current.AllTileAnimations; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllTitles == null || scenario.GameCommonData.AllTitles.Count == 0) { scenario.GameCommonData.AllTitles = CommonData.Current.AllTitles; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllTitleKinds == null || scenario.GameCommonData.AllTitleKinds.Count == 0) { scenario.GameCommonData.AllTitleKinds = CommonData.Current.AllTitleKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllTroopAnimations == null || scenario.GameCommonData.AllTroopAnimations == null || scenario.GameCommonData.AllTroopAnimations.Animations.Count == 0) { scenario.GameCommonData.AllTroopAnimations = CommonData.Current.AllTroopAnimations; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllTroopEventEffectKinds == null || scenario.GameCommonData.AllTroopEventEffectKinds.Count == 0) { scenario.GameCommonData.AllTroopEventEffectKinds = CommonData.Current.AllTroopEventEffectKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllTroopEventEffects == null || scenario.GameCommonData.AllTroopEventEffects.Count == 0) { scenario.GameCommonData.AllTroopEventEffects = CommonData.Current.AllTroopEventEffects; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllEventEffectKinds == null || scenario.GameCommonData.AllEventEffectKinds.Count == 0) { scenario.GameCommonData.AllEventEffectKinds = CommonData.Current.AllEventEffectKinds; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllEventEffects == null || scenario.GameCommonData.AllEventEffects.Count == 0) { scenario.GameCommonData.AllEventEffects = CommonData.Current.AllEventEffects; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllBiographyAdjectives == null || scenario.GameCommonData.AllBiographyAdjectives.Count == 0) { scenario.GameCommonData.AllBiographyAdjectives = CommonData.Current.AllBiographyAdjectives; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.PersonGeneratorSetting == null) { scenario.GameCommonData.PersonGeneratorSetting = CommonData.Current.PersonGeneratorSetting; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllPersonGeneratorTypes == null) { scenario.GameCommonData.AllPersonGeneratorTypes = CommonData.Current.AllPersonGeneratorTypes; scenario.UsingOwnCommonData = false; } if (scenario.GameCommonData.AllTrainPolicies == null || scenario.GameCommonData.AllTrainPolicies.Count == 0) { scenario.GameCommonData.AllTrainPolicies = CommonData.Current.AllTrainPolicies; scenario.UsingOwnCommonData = false; } } Session.Current.Scenario = scenario; scenario.ProcessScenarioData(fromScenario); return(scenario); }