Ejemplo n.º 1
0
        internal void SetFaction(Faction faction, bool control)
        {
            this.ShowingFaction = faction;
            this.Control        = control;
            foreach (LabelText text in this.LabelTexts)
            {
                text.Text.Text = StaticMethods.GetPropertyValue(this, text.PropertyName).ToString();
            }
            this.AllTechniques.Clear();

            Dictionary <Microsoft.Xna.Framework.Point, Technique> showTechniques = new Dictionary <Microsoft.Xna.Framework.Point, Technique>();

            foreach (Technique technique in Session.Current.Scenario.GameCommonData.AllTechniques.Techniques.Values)
            {
                Microsoft.Xna.Framework.Point p = new Microsoft.Xna.Framework.Point(technique.DisplayRow, technique.DisplayCol);
                //try
                //{

                if (showTechniques.ContainsKey(p))
                {
                    Technique existTech = showTechniques[p];
                    if (technique.PreID < 0)
                    {
                        showTechniques[p] = technique;
                    }
                    else if (technique.PreID == existTech.ID && faction.HasTechnique(existTech.ID))
                    {
                        showTechniques[p] = technique;
                    }
                }
                else
                {
                    //}
                    //catch (KeyNotFoundException ex)
                    //{
                    showTechniques[p] = technique;
                    //}
                }
            }

            foreach (Technique technique in showTechniques.Values)
            {
                TechniqueItem item = new TechniqueItem {
                    LinkedTechnique = technique,
                    Text            = new FreeText(this.ButtonTextFont, this.ButtonTextColor)
                };
                item.Text.Position = new Microsoft.Xna.Framework.Rectangle(this.ButtonSize.X * item.Col, this.ButtonSize.Y * item.Row, this.ButtonSize.X, this.ButtonSize.Y);
                item.Text.Align    = this.ButtonTextAlign;
                item.Text.Text     = technique.Name;
                this.AllTechniques.Add(item);
            }
        }
Ejemplo n.º 2
0
        internal void SetFaction(Faction faction, bool control)
        {
            this.ShowingFaction = faction;
            this.Control = control;
            foreach (LabelText text in this.LabelTexts)
            {
                text.Text.Text = StaticMethods.GetPropertyValue(this, text.PropertyName).ToString();
            }
            this.AllTechniques.Clear();

            Dictionary<Microsoft.Xna.Framework.Point, Technique> showTechniques = new Dictionary<Microsoft.Xna.Framework.Point, Technique>();
            foreach (Technique technique in faction.Scenario.GameCommonData.AllTechniques.Techniques.Values)
            {
                Microsoft.Xna.Framework.Point p = new Microsoft.Xna.Framework.Point(technique.DisplayRow, technique.DisplayCol);
                try
                {
                    Technique existTech = showTechniques[p];
                    if (technique.PreID < 0)
                    {
                        showTechniques[p] = technique;
                    }
                    else if (technique.PreID == existTech.ID && faction.HasTechnique(existTech.ID))
                    {
                        showTechniques[p] = technique;
                    }
                }
                catch (KeyNotFoundException ex)
                {
                    showTechniques[p] = technique;
                }
                
            }

            foreach (Technique technique in showTechniques.Values)
            {
                TechniqueItem item = new TechniqueItem {
                    LinkedTechnique = technique,
                    Text = new FreeText(this.graphicsDevice, this.ButtonTextFont, this.ButtonTextColor)
                };
                item.Text.Position = new Microsoft.Xna.Framework.Rectangle(this.ButtonSize.X * item.Col, this.ButtonSize.Y * item.Row, this.ButtonSize.X, this.ButtonSize.Y);
                item.Text.Align = this.ButtonTextAlign;
                item.Text.Text = technique.Name;
                this.AllTechniques.Add(item);
            }
        }