public static CCBGameTemplate GetSwordAndSorcery() { CCBGameTemplate ssTemplate = new CCBGameTemplate("Sword & Sorcery"); ssTemplate.PropertyTemplateList.Add(new CCBCharacterPropertyTemplate("Soulrank", CPType.cpt_Numeric)); return(ssTemplate); }
private void btnExportNow_Click(object sender, RoutedEventArgs e) { CCBGameData gameData = new CCBGameData(); foreach (object oEntity in lbEntities.SelectedItems) { CCBGame selectedGame = (CCBGame)oEntity; if (null == selectedGame) { CCBGameTemplate gTemplate = (CCBGameTemplate)oEntity; if (null != gTemplate) { gameData.AddSafe(gTemplate); } } else { gameData.AddSafe(selectedGame); } } if (!gameData.SaveGames(tbTarget.Text)) { tStatus.Content = "Could not save to that file."; } }
private void btnAddTemplate_Click(object sender, RoutedEventArgs e) { CCBGameTemplate newTemplate = m_templateCreateCallback(m_model, tbName.Text); GameTemplateEntry entry = new GameTemplateEntry(tbName.Text, newTemplate); AddTemplateToList(entry); }
public CCBGameTemplate AddTemplate(string name, CCBGame gameFrom) { CCBGameTemplate newTemplate = (null == gameFrom) ? new CCBGameTemplate(name) : new CCBGameTemplate(name, gameFrom); CCBDirty.kDirty = true; AddSafe(newTemplate); return(newTemplate); }
public CCBGame AddGame(string name, CCBGameTemplate template) { CCBGame newGame = (null == template) ? new CCBGame(name) : new CCBGame(name, template); CCBDirty.kDirty = true; AddSafe(newGame); return(newGame); }
private void OnCreateNewGame(CCBGameTemplate template, string name) { CCBGame newGame = m_games.AddGame(name, template); CCBTreeViewGame gameNode = new CCBTreeViewGame(newGame); tvGames.Items.Add(gameNode); AddBagsToGameNode(gameNode); AddOrMoveAdder(); }
private TStatusUpdate MergeTemplateCallback(CCBGameTemplate template) { if (m_games.MergeTemplate(template)) { tbLastError.Text = string.Format("Loaded template '{0}'", template.Name); return(TStatusUpdate.tsuFileLoaded); } tbLastError.Text = "Did not load template."; return(TStatusUpdate.tsuFileNothingLoaded); }
public bool MergeTemplate(CCBGameTemplate template) { CCBGameTemplate curTemplate = m_templates.FindTemplate(template.Name); if (null == curTemplate) { AddSafe(template); return(true); } return(false); }
public void AddSafe(CCBGameTemplate template) { CCBDirty.kDirty = true; lock (this) { if (null == m_templates) { m_templates = new CCBGameTemplateList(); } m_templates.Add(template); } }
public CCBGame(string name, CCBGameTemplate templateFrom) { m_name = name; m_characters = new CCBCharacterList(); m_groupItems = new CCBBag(m_kGroupItemLabel); m_groupBags = new CCBBags(); m_propertyTemplateList = new CharacterPropertyTemplateList(); foreach (CCBCharacterPropertyTemplate templateProperty in templateFrom.PropertyTemplateList) { m_propertyTemplateList.Add(new CCBCharacterPropertyTemplate(templateProperty)); } foreach (CCBBag bag in templateFrom.Bags) { m_groupBags.Add(new CCBBag(bag)); } }
public static CCBGameTemplate GetPlayerSelector() { CCBGameTemplate playerSelector = new CCBGameTemplate("Player Selector"); playerSelector.AddBag(AddPlayerBag("Two Players", 2)); playerSelector.AddBag(AddPlayerBag("Three Players", 3)); playerSelector.AddBag(AddPlayerBag("Four Players", 4)); playerSelector.AddBag(AddPlayerBag("Five Players", 5)); playerSelector.AddBag(AddPlayerBag("Six Players", 6)); playerSelector.AddBag(AddPlayerBag("Seven Players", 7)); playerSelector.AddBag(AddPlayerBag("Eight Players", 8)); playerSelector.AddBag(AddPlayerBag("Nine Players", 9)); playerSelector.AddBag(AddPlayerBag("Ten Players", 10)); playerSelector.AddBag(AddPlayerBag("Eleven Players", 11)); playerSelector.AddBag(AddPlayerBag("Twelve Players", 12)); return(playerSelector); }
private void InitializeTemplate() { switch (m_id) { case TemplateTypeID.tti_PlayerSelector: m_template = CCBStockTemplates.GetPlayerSelector(); break; case TemplateTypeID.tti_SwordAndSorcery: m_template = CCBStockTemplates.GetSwordAndSorcery(); break; default: System.Diagnostics.Debug.Assert(false); break; } }
private void btnMerge_Click(object sender, RoutedEventArgs e) { TStatusUpdate tsu = TStatusUpdate.tsuNone; System.Diagnostics.Debug.Assert(null != m_mergeGameCallback); System.Diagnostics.Debug.Assert(null != m_mergeTemplateCallback); if (-1 != lbGames.SelectedIndex) { if (lbGames.Items[lbGames.SelectedIndex] is CCBGame) { CCBGame game = (CCBGame)lbGames.Items[lbGames.SelectedIndex]; if (null != game) { tsu = m_mergeGameCallback(game); } } if (lbGames.Items[lbGames.SelectedIndex] is CCBGameTemplate) { CCBGameTemplate template = (CCBGameTemplate)lbGames.Items[lbGames.SelectedIndex]; if (null != template) { tsu = m_mergeTemplateCallback(template); } } if (TStatusUpdate.tsuFileLoaded == tsu) { tStatus.Content = ""; } else { tStatus.Content = "Could not load item."; } } else { tStatus.Content = "Wrong item in list."; } }
public GameTemplateEntry(string name, CCBGameTemplate template) { m_name = name; m_gameTemplate = template; }
private CCBGameTemplate OnCreateNewTemplate(CCBGame gameFrom, string name) { CCBGameTemplate newTemplate = m_games.AddTemplate(name, gameFrom); return(newTemplate); }
public CCBStockTemplate(string name, TemplateTypeID id) { m_id = id; m_name = name; m_template = null; }
private void AddTemplateToList(CCBGameTemplate template) { lbTemplates.Items.Add(new GameTemplateEntry(template.Name, template)); }