示例#1
0
        public static CCBGameTemplate GetSwordAndSorcery()
        {
            CCBGameTemplate ssTemplate = new CCBGameTemplate("Sword & Sorcery");

            ssTemplate.PropertyTemplateList.Add(new CCBCharacterPropertyTemplate("Soulrank", CPType.cpt_Numeric));
            return(ssTemplate);
        }
示例#2
0
        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.";
            }
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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();
        }
示例#7
0
 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);
 }
示例#8
0
        public bool MergeTemplate(CCBGameTemplate template)
        {
            CCBGameTemplate curTemplate = m_templates.FindTemplate(template.Name);

            if (null == curTemplate)
            {
                AddSafe(template);
                return(true);
            }
            return(false);
        }
示例#9
0
 public void AddSafe(CCBGameTemplate template)
 {
     CCBDirty.kDirty = true;
     lock (this)
     {
         if (null == m_templates)
         {
             m_templates = new CCBGameTemplateList();
         }
         m_templates.Add(template);
     }
 }
示例#10
0
 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));
     }
 }
示例#11
0
        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);
        }
示例#12
0
        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;
            }
        }
示例#13
0
        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.";
            }
        }
示例#14
0
 public GameTemplateEntry(string name, CCBGameTemplate template)
 {
     m_name         = name;
     m_gameTemplate = template;
 }
示例#15
0
        private CCBGameTemplate OnCreateNewTemplate(CCBGame gameFrom, string name)
        {
            CCBGameTemplate newTemplate = m_games.AddTemplate(name, gameFrom);

            return(newTemplate);
        }
示例#16
0
 public CCBStockTemplate(string name, TemplateTypeID id)
 {
     m_id       = id;
     m_name     = name;
     m_template = null;
 }
示例#17
0
 private void AddTemplateToList(CCBGameTemplate template)
 {
     lbTemplates.Items.Add(new GameTemplateEntry(template.Name, template));
 }