public void StartGame(GameStartupParameters parameters, Agents.BaseAgent[] agents) { if (parameters == null) { throw new ArgumentNullException("parameters"); } else if (agents == null) { throw new ArgumentNullException("agents"); } else if (parameters.PlayerDecks.Count != agents.Length) { throw new InvalidOperationException("PlayerDecks and agents shall have the same length."); } Agents = agents.ToIndexable(); m_game = new Game(parameters.PlayerIds, new XnaUIController(agents, parameters.Seed)); m_game.Initialize(parameters.PlayerDecks); GameApp.Service<GameUI>().GameCreated(m_game); GameApp.Service<Graphics.Scene>().GameCreated(); m_game.StartGameFlowThread(); GameApp.Service<Sound>().PlayMusic(Sound.MusicEnum.kagamiM); }
private void PrepareGameStartupParam() { var cardDb = GameApp.Service<CardDatabase>(); Deck deck1 = new Deck(); deck1.Add(cardDb.GetModel("hatate")); deck1.Add(cardDb.GetModel("hatate")); deck1.Add(cardDb.GetModel("hatate")); deck1.Add(cardDb.GetModel("koakuma")); deck1.Add(cardDb.GetModel("koakuma")); deck1.Add(cardDb.GetModel("koakuma")); deck1.Add(cardDb.GetModel("mokou")); deck1.Add(cardDb.GetModel("mokou")); deck1.Add(cardDb.GetModel("mokou")); deck1.Add(cardDb.GetModel("remilia")); deck1.Add(cardDb.GetModel("remilia")); deck1.Add(cardDb.GetModel("remilia")); deck1.Add(cardDb.GetModel("yuyuko")); deck1.Add(cardDb.GetModel("yuyuko")); deck1.Add(cardDb.GetModel("yuyuko")); deck1.Add(cardDb.GetModel("reimu")); deck1.Add(cardDb.GetModel("reimu")); deck1.Add(cardDb.GetModel("reimu")); deck1.Add(cardDb.GetModel("suika")); deck1.Add(cardDb.GetModel("suika")); deck1.Add(cardDb.GetModel("suika")); deck1.Add(cardDb.GetModel("youmu")); deck1.Add(cardDb.GetModel("youmu")); deck1.Add(cardDb.GetModel("youmu")); deck1.Add(cardDb.GetModel("kaguya")); deck1.Add(cardDb.GetModel("kaguya")); deck1.Add(cardDb.GetModel("kaguya")); deck1.Add(cardDb.GetModel("alice_2")); deck1.Add(cardDb.GetModel("alice_2")); deck1.Add(cardDb.GetModel("alice_2")); deck1.Assists.Add(cardDb.GetModel("eirin")); deck1.Assists.Add(cardDb.GetModel("patchouli")); Deck deck2 = new Deck(); deck2.Add(cardDb.GetModel("lunar")); deck2.Add(cardDb.GetModel("lunar")); deck2.Add(cardDb.GetModel("lunar")); deck2.Add(cardDb.GetModel("komachi")); deck2.Add(cardDb.GetModel("komachi")); deck2.Add(cardDb.GetModel("komachi")); deck2.Add(cardDb.GetModel("sakuya")); deck2.Add(cardDb.GetModel("sakuya")); deck2.Add(cardDb.GetModel("sakuya")); deck2.Add(cardDb.GetModel("meirin")); deck2.Add(cardDb.GetModel("meirin")); deck2.Add(cardDb.GetModel("meirin")); deck2.Add(cardDb.GetModel("sanae")); deck2.Add(cardDb.GetModel("sanae")); deck2.Add(cardDb.GetModel("sanae")); deck2.Add(cardDb.GetModel("kanako")); deck2.Add(cardDb.GetModel("kanako")); deck2.Add(cardDb.GetModel("kanako")); deck2.Add(cardDb.GetModel("cirno")); deck2.Add(cardDb.GetModel("cirno")); deck2.Add(cardDb.GetModel("cirno")); deck2.Add(cardDb.GetModel("keine")); deck2.Add(cardDb.GetModel("keine")); deck2.Add(cardDb.GetModel("keine")); deck2.Add(cardDb.GetModel("nightbug")); deck2.Add(cardDb.GetModel("nightbug")); deck2.Add(cardDb.GetModel("nightbug")); //deck2.Add(cardDb.GetModel("marisa")); //deck2.Add(cardDb.GetModel("marisa")); //deck2.Add(cardDb.GetModel("marisa")); deck2.Add(cardDb.GetModel("alice_2")); deck2.Add(cardDb.GetModel("alice_2")); deck2.Add(cardDb.GetModel("alice_2")); deck2.Assists.Add(cardDb.GetModel("yakumo")); deck2.Assists.Add(cardDb.GetModel("tenshi")); param = new GameStartupParameters(); param.PlayerDecks.Add(deck1); param.PlayerDecks.Add(deck2); param.PlayerIds.Add("真凉"); param.PlayerIds.Add("爱衣"); }
private void PrepareGameStartupParam() { var cardDb = GameApp.Service<CardDatabase>(); int deck1Id = Settings.Instance.MyAppSettings.Profiles.CurrentProfile.Deck1Id; int deck2Id = Settings.Instance.MyAppSettings.Profiles.CurrentProfile.Deck2Id; Deck deck1 = (from deck in Settings.Instance.MyAppSettings.Profiles.CurrentProfile.Decks.MyDecks where deck.Id == deck1Id select deck).FirstOrDefault(); foreach (var cardModelId in deck1.DeckCardIdList.Model) { deck1.Add(cardDb.GetModel(cardModelId)); } foreach (var assistModelId in deck1.DeckAssistIdList.Model) { deck1.Assists.Add(cardDb.GetModel(assistModelId)); } Deck deck2 = (from deck in Settings.Instance.MyAppSettings.Profiles.CurrentProfile.Decks.MyDecks where deck.Id == deck2Id select deck).FirstOrDefault(); foreach (var cardModelId in deck2.DeckCardIdList.Model) { deck2.Add(cardDb.GetModel(cardModelId)); } foreach (var assistModelId in deck2.DeckAssistIdList.Model) { deck2.Assists.Add(cardDb.GetModel(assistModelId)); } param = new GameStartupParameters(); param.PlayerDecks.Add(deck1); param.PlayerDecks.Add(deck2); param.PlayerIds.Add("真凉"); param.PlayerIds.Add("爱衣"); }