public PersonGenerateParam(GameScenario scenario, Architecture foundLocation, Person finder, bool inGame, PersonGeneratorType preferredType, bool isAI) { this.scenario = scenario; this.foundLocation = foundLocation; this.finder = finder; this.inGame = inGame; this.preferredType = preferredType; this.isAI = isAI; }
public MainWindow() { InitializeComponent(); CommonData.Current = Tools.SimpleSerializer.DeserializeJsonFile <CommonData>(@"Content\Data\Common\CommonData.json", false, false); scen = new GameScenario(); scen.GameCommonData = CommonData.Current; populateTables(false); }
public bool IsEnd(GameScenario scenario) { Condition cend = scenario.GameCommonData.AllConditions.GetCondition(9999); if (cend == null) { return(false); } return(this.architectureCond.Contains(cend) || this.factionCond.Contains(cend)); }
public bool IsStart(GameScenario scenario) { Condition cstart = scenario.GameCommonData.AllConditions.GetCondition(9998); if (cstart == null) { return(false); } return(this.architectureCond.Contains(cstart) || this.factionCond.Contains(cstart)); }
public void Initialize(formMapEditor form) { this.MainForm = form; this.Scenario = form.Scenario; this.mtbYear.Text = this.Scenario.Date.Year.ToString(); this.cbMonth.SelectedIndex = this.cbMonth.Items.IndexOf(this.Scenario.Date.Month.ToString()); this.cbDay.SelectedIndex = this.cbDay.Items.IndexOf(this.Scenario.Date.Day.ToString()); this.tbScenarioTitle.Text = this.Scenario.ScenarioTitle; this.rtbScenarioBrief.Text = this.Scenario.ScenarioDescription; }
public void SetScenario(GameScenario scen) { foreach (GameObjects.TroopDetail.CombatMethod m in scen.GameCommonData.AllCombatMethods.CombatMethods.Values) { if (!this.help.TextTree.HasItem("TroopCombatMethod_" + m.ID)) { GameObjectTextBranch branch = new GameObjectTextBranch(); branch.AddLeaf("战法", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf(m.Name, this.help.RichText.TitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); foreach (GameObjects.Influences.Influence i in m.Influences.Influences.Values) { branch.AddLeaf(i.Description, this.help.RichText.SubTitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); } this.help.TextTree.AddItem("TroopCombatMethod_" + m.ID, branch); } } foreach (GameObjects.TroopDetail.Stratagem m in scen.GameCommonData.AllStratagems.Stratagems.Values) { if (!this.help.TextTree.HasItem("TroopStratagem_" + m.ID)) { GameObjectTextBranch branch = new GameObjectTextBranch(); branch.AddLeaf("计略", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf(m.Name, this.help.RichText.TitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); foreach (GameObjects.Influences.Influence i in m.Influences.Influences.Values) { branch.AddLeaf(i.Description, this.help.RichText.SubTitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); } this.help.TextTree.AddItem("TroopStratagem_" + m.ID, branch); } } foreach (GameObjects.PersonDetail.Stunt m in scen.GameCommonData.AllStunts.Stunts.Values) { if (!this.help.TextTree.HasItem("TroopStunt_" + m.ID)) { GameObjectTextBranch branch = new GameObjectTextBranch(); branch.AddLeaf("特技", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf(m.Name, this.help.RichText.TitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); foreach (GameObjects.Influences.Influence i in m.Influences.Influences.Values) { branch.AddLeaf(i.Description, this.help.RichText.SubTitleColor.PackedValue); branch.AddLeaf("\\n", this.help.RichText.DefaultColor.PackedValue); } this.help.TextTree.AddItem("TroopStunt_" + m.ID, branch); } } }
public SceWindow(GameScenario scen) { this.scen = scen; InitializeComponent(); tbYear.Text = scen.Date.Year.ToString(); tbMonth.Text = scen.Date.Month.ToString(); tbDay.Text = scen.Date.Day.ToString(); tbName.Text = scen.ScenarioTitle; tbScenarioDescription.Text = scen.ScenarioDescription; }
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); } }
public bool AddDiplomaticRelation(GameScenario scenario, int faction1ID, int faction2ID, int relation) { int hashCode = this.GetHashCode(faction1ID, faction2ID); int key = this.GetHashCode(faction2ID, faction1ID); if (this.DiplomaticRelations.ContainsKey(hashCode) || this.DiplomaticRelations.ContainsKey(key)) { return(false); } this.DiplomaticRelations.Add(hashCode, new DiplomaticRelation(scenario, faction1ID, faction2ID, relation)); return(true); }
private void LoadGameFromPosition(string id) { var saves = GameScenario.LoadScenarioSaves(); var sce = saves[int.Parse(id)]; if (!String.IsNullOrEmpty(sce.Title)) { mainMapLayer.StopThreads(); Session.StartScenario(sce, true); } }
private void SetScenarioDisplayText(string filename) { OleDbConnectionStringBuilder builder = new OleDbConnectionStringBuilder { DataSource = filename, Provider = "Microsoft.Jet.OLEDB.4.0" }; OleDbConnection dbConnection = new OleDbConnection(builder.ConnectionString); string gameScenarioSurveyText = GameScenario.GetGameScenarioSurveyText(dbConnection); this.lbScenarios.Items.Add(gameScenarioSurveyText); }
void Start() { _instance = this; timerLabel.text = "Preparing level..."; riseCostLabel.text = riseCost.ToString(); bombCostLabel.text = bombCost.ToString(); attackCostLabel.text = attackCost.ToString(); GameStart(); HideTimeLeftLabel(); }
public void Update(GameTime gameTime) { float seconds = Convert.ToSingle(gameTime.ElapsedGameTime.TotalSeconds); elapsedTime += seconds; if (elapsedTime >= 0.2f) { if (IsLoading) { } else { if (LoadScreenEvent == null) { } else { IsLoading = true; if (Session.MainGame.mainGameScreen != null) { Session.MainGame.mainGameScreen.mainMapLayer.StopThreads(); Session.MainGame.mainGameScreen.DisposeMapTileMemory(false, true); Session.MainGame.mainGameScreen.Dispose(); Session.MainGame.mainGameScreen = null; GameScenario.ProcessCommonData(CommonData.Current); } Session.Current.Clear(); CacheManager.Clear(CacheType.Live); GC.Collect(); new Platforms.PlatformTask(() => { LoadScreenEvent.Invoke(null, null); ClearEvent(); IsComplete = true; Session.MainGame.loadingScreen = null; }).Start(); } } } }
private void LoadGameFromPosition(string id) { var saves = GameScenario.LoadScenarioSaves(); var sce = saves[int.Parse(id)]; if (!String.IsNullOrEmpty(sce.Title)) { mainMapLayer.StopThreads(); Session.StartScenario(sce, true); CommonData.Current = Tools.SimpleSerializer.DeserializeJsonFile <CommonData>(@"Content\Data\Common\CommonData.json", false, false); GameScenario.ProcessCommonData(CommonData.Current); } }
public bool RemoveMilitaryKind(GameScenario scenario, int kind) { if (!this.MilitaryKinds.ContainsKey(kind)) { return(false); } MilitaryKind militaryKind = scenario.GameCommonData.AllMilitaryKinds.GetMilitaryKind(kind); if (militaryKind != null) { this.MilitaryKinds.Remove(militaryKind.ID); } return(true); }
public static IInitStrategy StrategyFromScenario(GameScenario scenario) { switch (scenario) { case GameScenario.Standard: return(new StandardInitStrategy()); case GameScenario.BallRandom: return(new BallRandomStrategy()); case GameScenario.EnemyAmongUs: return(new EnemyAmongUsStrategy()); default: throw new ArgumentOutOfRangeException(nameof(scenario), scenario, null); } }
public static Dictionary <TitleKind, List <Title> > GetKindTitleDictionary(GameScenario scen) { GameObjectList rawTitles = scen.GameCommonData.AllTitles.GetTitleList().GetRandomList(); Dictionary <TitleKind, List <Title> > titles = new Dictionary <TitleKind, List <Title> >(); foreach (Title t in rawTitles) { if (!titles.ContainsKey(t.Kind)) { titles[t.Kind] = new List <Title>(); } titles[t.Kind].Add(t); } return(titles); }
public static Military SimCreate(GameScenario scenario, Architecture architecture, MilitaryKind kind) { Military military = new Military(); military.Scenario = scenario; military.KindID = kind.ID; military.ID = scenario.Militaries.GetFreeGameObjectID(); if (kind.Unique) { military.Name = kind.Name; return(military); } military.Name = kind.Name + "队"; return(military); }
private void ReadSaveFile(string fileName) { string str = "GameData/Save/"; if (File.Exists(str + fileName)) { OleDbConnectionStringBuilder builder = new OleDbConnectionStringBuilder { DataSource = str + fileName, Provider = "Microsoft.Jet.OLEDB.4.0" }; this.lbSaveFiles.Items.Add(fileName + " " + GameScenario.GetGameSaveFileSurveyText(builder.ConnectionString)); this.SaveFilePaths.Add(fileName); } }
public void BuyDef() { if (GameScenario.IS_TUTORIAL) { GameScenario.GetInstance().ReachState(GameScenario.COST_BLUE); } else { if (Buy(Resources.ResourcesType.D)) { Add(Resources.ResourcesType.D); defOnTurn += 1; } } }
protected override void Start(GameScenario scenario) { base.Start(scenario); if (Scenario.SpawnBarriers != null) { foreach (var bar in Scenario.SpawnBarriers) { if (!bar.AddAfterEvent) { spawnBarriers.Add(CreateBarrier(bar)); } } } foreach (var hi in Scenario.Items) { ItemInst item = new ItemInst(ItemDef.Get(hi.ItemDef)); item.Spawn(World, hi.Position, hi.Angles); } for (int i = 0; i < Scenario.Stands.Length; i++) { var stand = Scenario.Stands[i]; StandInst inst = new StandInst() { Index = i, Stand = stand, }; if (stand.Boss != null) { inst.Boss = SpawnNPC(stand.Boss, stand.Position); inst.Boss.AllowHitTarget.Add(BossProtection); } inst.Barriers = new List <VobInst>(stand.Barriers.Length); foreach (var bar in stand.Barriers) { if (!bar.AddAfterEvent) { inst.Barriers.Add(CreateBarrier(bar)); } } Stands.Add(inst); } }
private void btnLoad_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "劇本檔 (*.json)|*.json"; openFileDialog.InitialDirectory = @"Content\Data\Scenario"; if (openFileDialog.ShowDialog() == true) { String filename = openFileDialog.FileName; scen = WorldOfTheThreeKingdoms.GameScreens.MainGameScreen.LoadScenarioData(filename, true, null); populateTables(); lblFilename.Content = filename; } }
private void OpenCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "劇本檔 (*.json)|*.json"; openFileDialog.InitialDirectory = @"Content\Data\Scenario"; if (openFileDialog.ShowDialog() == true) { String filename = openFileDialog.FileName; scen = WorldOfTheThreeKingdoms.GameScreens.MainGameScreen.LoadScenarioData(filename, true, null, true); scen.GameCommonData = CommonData.Current; populateTables(); Title = "中華三國志劇本編輯器 - " + filename; } }
public DiplomaticRelation GetDiplomaticRelation(GameScenario scenario, int faction1ID, int faction2ID) { int hashCode = this.GetHashCode(faction1ID, faction2ID); DiplomaticRelation relation = null; this.DiplomaticRelations.TryGetValue(hashCode, out relation); if (relation == null) { hashCode = this.GetHashCode(faction2ID, faction1ID); this.DiplomaticRelations.TryGetValue(hashCode, out relation); } if (relation == null) { relation = new DiplomaticRelation(scenario, faction1ID, faction2ID, 0); } return(relation); }
private void SetCurrentScenario(string filename) { OleDbConnectionStringBuilder builder = new OleDbConnectionStringBuilder { DataSource = filename, Provider = "Microsoft.Jet.OLEDB.4.0" }; OleDbConnection dbConnection = new OleDbConnection(builder.ConnectionString); string gameScenarioDescription = GameScenario.GetGameScenarioDescription(dbConnection); this.tbScenarioDescription.Text = gameScenarioDescription; this.currentFactions = GameScenario.GetGameScenarioFactions(dbConnection); this.clbFactions.Items.Clear(); foreach (Faction faction in this.currentFactions) { this.clbFactions.Items.Add(faction.Name); } }
private void Scenario_OnAfterLoadScenario(GameScenario scenario) { if (this.mainMapLayer.mainMap != null) { this.mainMapLayer.PrepareMap(); this.UpdateViewport(); this.ResetScreenEdge(); this.mainMapLayer.ReCalculateTileDestination(base.spriteBatch.GraphicsDevice); this.JumpTo(this.mainMapLayer.mainMap.JumpPosition); } if (this.Plugins.GameRecordPlugin.IsRecordShowing) { this.Plugins.GameRecordPlugin.AddDisableRects(); } this.Plugins.AirViewPlugin.ResetMapPosition(); this.Plugins.AirViewPlugin.ResetFramePosition(base.viewportSize, this.mainMapLayer.LeftEdge, this.mainMapLayer.TopEdge, this.mainMapLayer.TotalMapSize); this.Plugins.AirViewPlugin.ReloadAirView(base.Scenario.ScenarioMap.MapName + ".jpg"); if (this.Plugins.AirViewPlugin.IsMapShowing) { this.Plugins.AirViewPlugin.AddDisableRects(); } }
public static Captive Create(GameScenario scenario, Person person, Faction faction) { if (person.BelongedFaction == null) { return(null); } if (person.BelongedFaction == faction) { return(null); } Captive captive = new Captive(); captive.Scenario = scenario; captive.ID = scenario.Captives.GetFreeGameObjectID(); captive.CaptivePerson = person; person.BelongedCaptive = captive; captive.CaptiveFaction = person.BelongedFaction; scenario.Captives.AddCaptiveWithEvent(captive); captive.CaptiveFaction.AddSelfCaptive(captive); faction.AddCaptive(captive); return(captive); }
public static Captive Create(GameScenario scenario, Person person, Faction faction) { if (person.BelongedFaction == null) { return(null); } if (person.BelongedFaction == faction) { return(null); } Captive captive = new Captive(); captive.Scenario = scenario; captive.ID = scenario.Captives.GetFreeGameObjectID(); captive.CaptivePerson = person; captive.CaptiveFaction = person.BelongedFaction; person.BelongedCaptive = captive; person.Status = GameObjects.PersonDetail.PersonStatus.Captive; person.HeldCaptiveCount++; scenario.Captives.AddCaptiveWithEvent(captive); return(captive); }
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(); }; }
private void saveGameCommonData(String commonPath) { GameScenario.SaveGameCommonData(scen); string ss1 = ""; System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(typeof(CommonData)); using (MemoryStream stream = new MemoryStream()) { //lock (Platform.SerializerLock) { serializer.WriteObject(stream, scen.GameCommonData); } var array = stream.ToArray(); ss1 = Encoding.UTF8.GetString(array, 0, array.Length); } ss1 = ss1.Replace("{\"", "{\r\n\""); ss1 = ss1.Replace("[{", "[\r\n{"); ss1 = ss1.Replace(",\"", ",\r\n\""); ss1 = ss1.Replace("}", "\r\n}"); ss1 = ss1.Replace("},{", "},\r\n{"); ss1 = ss1.Replace("}]", "}\r\n]"); File.WriteAllText(commonPath, ss1); }
protected override void Start(GameScenario scenario) { if (!(scenario is TDMScenario)) { throw new ArgumentException("Scenario is no TDMScenario!"); } base.Start(scenario); TDMScenario tdmScen = (TDMScenario)scenario; foreach (var teamDef in tdmScen.Teams) { teams.Add(new TDMTeamInst() { Definition = teamDef }); } respawnTimer.SetCallback(RespawnWave); respawnTimer.Start(); NPCInst.sOnHit += OnHit; }