Beispiel #1
0
        private void crystalReportViewer1_Load(object sender, EventArgs e)
        {
            try
            {
                DataSet st = account_Bo.getTempClientProduct();
                rd.Load(@"C:\DB\cozzyRpt.rpt");
                rd.SetDataSource(st.Tables[0]);

                crystalReportViewer1.ReportSource = rd;

                if (rd.ReportDefinition.ReportObjects["totalText"] != null)
                {
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["totalText"];
                    mytext.Text = total+" BDT";
                    //mytext = (TextObject)rd.ReportDefinition.ReportObjects["text_box_customerName"];
                    //mytext.Text = name;
                    //mytext = (TextObject)rd.ReportDefinition.ReportObjects["textbox_Customer_Phoneno"];
                    //mytext.Text = phoneNo;
                    //mytext = (TextObject)rd.ReportDefinition.ReportObjects["textbox_CustomerAddress"];
                    //mytext.Text = address;
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["Discount"];
                    mytext.Text = discount+"%";
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["Amount"];
                    mytext.Text = total1 +" BDT";

                }
            }
            catch(Exception ex)
            {
                MessageBox.Show("Bil"+ex.Message);
            }
        }
 public MovableStyle4Object(float x, float y, string text, Color color, Font font)
     : base(x, y, 0.0f, null, text, color, font)
 {
     textObject = containerObject.GetChildAt(0) as TextObject;
     baseColor = color;
     speedy = 0.0f;
     HideSpeed = 0.3f;
 }
        private void crystalReportViewer1_Load(object sender, EventArgs e)
        {
            try
            {
                DataSet st = account_Bo.getTempClientProduct(userName);
                rd.Load(@"D:\DB\CrystalReport.rpt");
                rd.SetDataSource(st.Tables[0]);

                crystalReportViewer1.ReportSource = rd;
                string totalinWords = NumberTextExtensionMethod.ToText(Convert.ToInt32(total)) + " taka only";
                totalinWords = totalinWords.ToUpper();
                if (rd.ReportDefinition.ReportObjects["totalText"] != null)
                {
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["totalText"];
                    mytext.Text = total;
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["text_box_customerName"];
                    mytext.Text = name;
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["textbox_Customer_Phoneno"];
                    mytext.Text = phoneNo;
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["textbox_CustomerAddress"];
                    mytext.Text = address;
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["Discount"];
                    mytext.Text = discount;
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["Amount"];
                    mytext.Text = total1;
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["totalinWords"];
                    mytext.Text = totalinWords;
                    //totalinWords
                    mytext = (TextObject)rd.ReportDefinition.ReportObjects["invoiceNumberTextbox"];
                    //MessageBox.Show(invoice + "");
                    mytext.Text = invoice;

                }
            }
            catch(Exception ex)
            {
                MessageBox.Show("Rp"+ex.Message);
            }
        }
        protected override void OnDrop(DragEventArgs e)
        {

            base.OnDrop(e);
            int? type = (int)(e.Data.GetData("ObjectType"));
            if (type!=null)
            {
                Grid grid = new Grid() { Background = Brushes.Azure, Width=65, Height=65 };
                TextObject ob = new TextObject() { Width = 65, Height = 65 };
                ob.Content = grid;
                Console.WriteLine("Elemento Primario:" +LogicalTreeHelper.GetChildren(ob));
                Point position = e.GetPosition(this);
                CanvasWorkspace.SetLeft(ob, Math.Max(0, position.X - ob.Width / 2));
                CanvasWorkspace.SetTop(ob, Math.Max(0, position.Y - ob.Height / 2));
                this.Children.Add(ob);
                this.DeselectAll();
                ob.IsSelected = true;
                
            }

             e.Handled = true;
            
        }
Beispiel #5
0
        public NewTaskForm(Node ownerNode)
        {
            InitializeComponent();
            owner = ownerNode;
            this.Text = "Подзадача для " + owner.name;

            TextObject<ECheckerType> pair;
            pair = new TextObject<ECheckerType>("Не требуется", ECheckerType.AUTO);
            cmbChecker.Items.Add(pair);
            pair = new TextObject<ECheckerType>(
                String.Format("Ответственный за {0} ({1})",
                owner.name, owner.responsibleName), ECheckerType.PARENT
            );
            cmbChecker.Items.Add(pair);

            foreach (User user in Users.dictionary.Values)
            {
                cmbResponsible.Items.Add(user);
                cmbChecker.Items.Add(user);
            }

            cmbResponsible.SelectedIndex = 0;
            cmbChecker.SelectedIndex = 0;
        }
Beispiel #6
0
        private void DrawTextObject(Layer layer, TextObject textObject, ChartProperty property, bool useROP)
        {
            AxisX     cAxisX = layer.AxisX;
            AxisY     cAxisY = layer.AxisY;
            Rectangle cRectY = cAxisY.AxisRectangle;

            int    iOldBackground = 0;
            IntPtr iOldFont       = IntPtr.Zero;
            bool   bUseBG         = textObject.BGColor != property.BackgroundColor;
            bool   bUseFont       = textObject.FontName != property.TextFont.Name || textObject.Size != property.TextFont.Size;

            if (bUseBG)
            {
                iOldBackground = __cGDI.SelectBackground(textObject.BGColor);
            }
            else
            {
                iOldBackground = __cGDI.SelectTransparent();
            }

            if (bUseFont)
            {
                iOldFont = __cGDI.SelectFont(new Font(textObject.FontName, textObject.Size, textObject.Style));
            }

            int        iX = 0, iY = 0;
            ChartPoint cPoint    = textObject.Location;
            bool       bAbsolute = textObject.AbsolutePosition;

            if (bAbsolute)
            {
                iY = cRectY.Y + (int)cPoint.Price;
                iX = cPoint.BarNumber.Value;
            }
            else
            {
                iY = cRectY.Y + cAxisY.ConvertValueToHeight(cPoint.Price) + 1;
                AxisXUnit cUnit = cAxisX.ConvertBarNumberToWidth(cPoint.BarNumber.Value);
                Size      cSize = __cGDI.MeasureString(textObject.Text);

                iY = CalculateYFromStyle(iY, cSize, textObject.VStyle);
                iX = CalculateXFromStyle(cUnit.CenterPoint, cSize, textObject.HStyle);
            }

            Rectangle cLayerRect = layer.LayerRectangleWithoutAxisY;

            if (useROP || bAbsolute)
            {
                __cGDI.BeginRopDraw();
                __cGDI.DrawRopString(textObject.Text, textObject.Color, iX, iY);
                __cGDI.EndRopDraw();
            }
            else
            {
                __cGDI.DrawString(textObject.Text, textObject.Color, iX, iY);
            }

            if (bUseFont)
            {
                __cGDI.RemoveObject(__cGDI.SelectFont(iOldFont));
            }

            if (bUseBG)
            {
                __cGDI.SelectBackground(iOldBackground);
            }
            else
            {
                __cGDI.ClearTransparent(iOldBackground);
            }
        }
Beispiel #7
0
        private void armory_on_consequence(MenuCallbackArgs args)
        {
            Clan OwnerClan = Settlement.CurrentSettlement.OwnerClan;

            string sDisplayMessageTitle = "",
                   sDisplayMessageBody  = "";

            float fCostOfAdmissionGold      = 0f,
                  fCostOfAdmissionInfluence = 0f;

            bool bPlayerRulesTown   = false,
                 bPlayerIsVassal    = false,
                 bPlayerIsMercenary = false,
                 bShowEntryOption   = true;

            if (OwnerClan.Leader == Hero.MainHero)
            {
                bPlayerRulesTown = true;
            }
            else if (OwnerClan.Kingdom == Clan.PlayerClan.Kingdom && Clan.PlayerClan.Kingdom != null)
            {
                if (Hero.MainHero == OwnerClan.Kingdom.Leader) //Player is the ruler of the kingdom
                {
                    bPlayerRulesTown = true;
                }
                else
                {
                    if (Clan.PlayerClan.IsUnderMercenaryService)
                    {
                        bPlayerIsMercenary = true;
                    }
                    else
                    {
                        bPlayerIsVassal = true;
                    }
                }
            }

            // Influence fee calculation
            if ((bPlayerIsVassal && !Settings.Instance.bVassalPaysWithGoldToo) || (bPlayerRulesTown &&
                                                                                   Settings.Instance.bEvenRulersShouldPay && !Settings.Instance.bRulersPayGold))
            {
                fCostOfAdmissionInfluence = Settings.Instance.bIgnoreTownProsperityForAdmission
                    ? Settings.Instance.iFlatAdmissionCostInfluence
                    : Settlement.CurrentSettlement.Prosperity / 100;

                if (bPlayerRulesTown)
                {
                    fCostOfAdmissionInfluence *= Settings.Instance.fPercentageOfCostForRuler;
                }
            }

            // Gold fee calculation
            if ((!bPlayerRulesTown && !bPlayerIsVassal) ||
                (bPlayerIsVassal && Settings.Instance.bVassalPaysWithGoldToo) || (bPlayerRulesTown &&
                                                                                  Settings.Instance.bEvenRulersShouldPay && Settings.Instance.bRulersPayGold))
            {
                fCostOfAdmissionGold = Settings.Instance.bIgnoreTownProsperityForAdmission
                    ? Settings.Instance.iFlatAdmissionCostGold
                    : Settlement.CurrentSettlement.Prosperity;

                if (bPlayerIsMercenary)
                {
                    fCostOfAdmissionGold *= Settings.Instance.fPercentageOfGoldForMercenary;
                }

                if (bPlayerIsVassal)
                {
                    fCostOfAdmissionGold *= Settings.Instance.fPercentageOfGoldForVassal;
                }

                if (bPlayerRulesTown)
                {
                    fCostOfAdmissionGold *= Settings.Instance.fPercentageOfCostForRuler;
                }
            }


            if (Settings.Instance.bRelationshipModifiesAdmissionCost && OwnerClan.Leader != Hero.MainHero)
            {
                fCostOfAdmissionGold      -= fCostOfAdmissionGold * (int)OwnerClan.Leader.GetRelationWithPlayer() / 100;
                fCostOfAdmissionInfluence -=
                    fCostOfAdmissionInfluence * (int)OwnerClan.Leader.GetRelationWithPlayer() / 100;
            }

            fCostOfAdmissionGold -= fCostOfAdmissionGold % 100; // Clean up the entry fee in gold cost to be in hundreds

            int iCostOfAdmissionGold = fCostOfAdmissionGold > 0
                ? (int)Math.Min(Settings.Instance.iMaxCostOfAdmissionGold,
                                Math.Max(fCostOfAdmissionGold, Settings.Instance.iMinCostOfAdmissionGold))
                : 0;
            int iCostOfAdmissionInfluence = fCostOfAdmissionInfluence > 0
                ? (int)Math.Min(Settings.Instance.iMaxCostOfAdmissionInfluence,
                                Math.Max(fCostOfAdmissionInfluence, Settings.Instance.iMinCostOfAdmissionInfluence))
                : 0;


            if (bPlayerRulesTown)
            {
                sDisplayMessageTitle += new TextObject("{=kRA_welcome_ruler}Welcome to The Royal Armoury, Mylord!\n")
                                        .ToString();

                if (!Settings.Instance.bEvenRulersShouldPay)
                {
                    iCostOfAdmissionGold      = 0;
                    iCostOfAdmissionInfluence = 0;
                }
            }

            if (Settings.Instance.bProsperityAffectsItemSelection && (!Settings.Instance.bUnlimitedSelectionIfFree ||
                                                                      iCostOfAdmissionGold > 0 ||
                                                                      iCostOfAdmissionInfluence > 0))
            {
                var selection =
                    new TextObject(
                        "{=kRA_selection}The item selection variety is expected to be {SEL} ({PERCENT}).\n \n");

                int iSelectionPercentage =
                    (int)((Settlement.CurrentSettlement.Prosperity - Settings.Instance.iMinProsperityForAnyItem) /
                          (Settings.Instance.iProsperityForGuaranteedItem -
                           Settings.Instance.iMinProsperityForAnyItem) *
                          100);
                iSelectionPercentage = Math.Min(100, Math.Max(0, iSelectionPercentage));

                var sel = new TextObject(
                    "{=kRA_sel_none}non existent, as besides some scrawny mice, the Armory is mostly empty");
                switch (iSelectionPercentage)
                {
                case int i when i >= 100:
                    sel = new TextObject("{=kRA_sel_100}Impeccable");
                    break;

                case int i when(i >= 80 && i < 100):
                    sel = new TextObject("{=kRA_sel_80}Excellent");

                    break;

                case int i when(i >= 60 && i < 80):
                    sel = new TextObject("{=kRA_sel_60}Above Average");

                    break;

                case int i when(i >= 40 && i < 60):
                    sel = new TextObject("{=kRA_sel_40}Average");

                    break;

                case int i when(i >= 20 && i < 40):
                    sel = new TextObject("{=kRA_sel_20}Below Average");

                    break;

                case int i when(i >= 10 && i < 20):
                    sel = new TextObject("{=kRA_sel_10}Poor");

                    break;

                case int i when(i > 0 && i < 10):
                    sel = new TextObject("{=kRA_sel_0}Abysmal");

                    break;

                case int i when(i <= 0):
                    break;
                }

                selection.SetTextVariable("SEL", sel);
                selection.SetTextVariable("PERCENT", iSelectionPercentage);
                sDisplayMessageBody += selection.ToString();
            }

            if (iCostOfAdmissionGold == 0 && iCostOfAdmissionInfluence == 0)
            {
                if (!bPlayerRulesTown)
                {
                    sDisplayMessageTitle += new TextObject("{=kRA_access_free}You can freely enter, sir.");
                }
            }
            else
            {
                if (bPlayerIsMercenary)
                {
                    sDisplayMessageTitle += new TextObject("{=kRA_access_merc}You are a mercenary for the kingdom.\n");
                }

                if (bPlayerIsVassal)
                {
                    sDisplayMessageTitle += new TextObject("{=kRA_access_vassal}You are a vassal of the kingdom.\n");
                }

                sDisplayMessageTitle += new TextObject("{=kRA_access_cost}Accessing The Royal Armoury costs ");

                if (iCostOfAdmissionGold > 0)
                {
                    sDisplayMessageTitle +=
                        iCostOfAdmissionGold.ToString() + new TextObject("{=kRA_access_cost_g} gold");
                }

                if (iCostOfAdmissionInfluence > 0)
                {
                    sDisplayMessageTitle += iCostOfAdmissionInfluence.ToString() +
                                            new TextObject("{=kRA_access_cost_i} influence");
                }

                if ((Hero.MainHero.Gold < iCostOfAdmissionGold && iCostOfAdmissionGold > 0) ||
                    (Hero.MainHero.Clan.Influence < iCostOfAdmissionInfluence && iCostOfAdmissionInfluence > 0))
                {
                    if (bPlayerRulesTown)
                    {
                        sDisplayMessageBody +=
                            new TextObject(
                                "{=kRA_cannot_enter_ruler}This is really embarassing, Sire, alas I cannot let You in.\n \n");
                    }
                    else
                    {
                        sDisplayMessageBody +=
                            new TextObject("{=kRA_cannot_enter}You cannot afford to enter now.\n \n");
                    }

                    bShowEntryOption = false;
                }

                if (Settings.Instance.bRelationshipModifiesAdmissionCost && OwnerClan.Leader != Hero.MainHero)
                {
                    var text = new TextObject(
                        "{=kRA_cost_info}To lower the costs (gold or influence) improve your relations with {CLAN_LEADER_NAME} of clan {CLAN_NAME} (currently at {CLAN_LEADER_RELATION}). \n");
                    text.SetTextVariable("CLAN_NAME", OwnerClan.Name);
                    text.SetTextVariable("CLAN_LEADER_NAME", OwnerClan.Leader.Name);
                    text.SetTextVariable("CLAN_LEADER_GENDER", OwnerClan.Leader.IsFemale ? 1 : 0);
                    text.SetTextVariable("CLAN_LEADER_RELATION", OwnerClan.Leader.GetRelationWithPlayer().ToString());
                    text.SetTextVariable("INFLUENCE_ICON", "{=!}<img src=\"Icons\\Influence@2x\">");
                    sDisplayMessageBody += text;
                }

                TextObject discount;
                if (Settings.Instance.fPercentageOfGoldForMercenary < 1)
                {
                    discount = new TextObject(
                        "{=kRA_disc_merc_yes}Discounts are available to mercenaries (pay only {COST} %). ");
                }
                else
                {
                    discount = new TextObject("{=kRA_disc_merc_no}Mercenaries pay {COST} %. ");
                }

                discount.SetTextVariable("COST", Settings.Instance.fPercentageOfGoldForMercenary * 100);
                sDisplayMessageBody += discount;


                if (!Settings.Instance.bVassalPaysWithGoldToo)
                {
                    sDisplayMessageBody +=
                        new TextObject("{=kRA_vassal_pay_i}As a vassal, you would pay with influence. ");
                }
                else
                {
                    sDisplayMessageBody += new TextObject("{=kRA_vassal_pay_g}As a vassal, you would pay with gold. ");

                    if (Settings.Instance.fPercentageOfGoldForVassal < 1)
                    {
                        discount = new TextObject(
                            "{=kRA_disc_vassal_yes}Discounts are available to vassals (pay only {COST} %). ");
                    }
                    else
                    {
                        discount = new TextObject("{=kRA_disc_vassal_no}Vassals pay {COST} %. ");
                    }

                    discount.SetTextVariable("COST", Settings.Instance.fPercentageOfGoldForVassal * 100);
                    sDisplayMessageBody += discount;
                }


                int prosperity = 0;
                if (Settings.Instance.bIgnoreTownProsperityForAdmission)
                {
                    sDisplayMessageBody +=
                        new TextObject("{=kRA_pros_fee_no}Town prosperity has NO effect on the entry fee, ");
                }
                else
                {
                    sDisplayMessageBody += new TextObject("{=kRA_pros_fee_yes}Town prosperity affects the entry fee, ");
                    prosperity           = 1;
                }

                var variety =
                    new TextObject("{=kRA_pros_sel}and does {EFFECTS_VAR_TEXT}affect item selection variety. ");
                variety.SetTextVariable("EFFECTS_ENTRY", prosperity);

                if (Settings.Instance.bProsperityAffectsItemSelection)
                {
                    variety.SetTextVariable("EFFECTS_VAR", 1);
                    variety.SetTextVariable("EFFECTS_VAR_TEXT", "");
                }
                else
                {
                    variety.SetTextVariable("EFFECTS_VAR", 0);
                    variety.SetTextVariable("EFFECTS_VAR_TEXT", new TextObject("{=kRA_pros_sel_not}NOT ").ToString());
                }

                sDisplayMessageBody += variety;

                if (!Settings.Instance.bEvenRulersShouldPay)
                {
                    sDisplayMessageBody +=
                        new TextObject("{=kRA_fee_ruler}\nUltimately, ruling the town grants free entry. ");
                }
            }

            InformationManager.ShowInquiry(
                new InquiryData(
                    sDisplayMessageTitle,
                    sDisplayMessageBody,
                    bShowEntryOption, true,
                    new TextObject("{=kRA_enter}Enter").ToString(),
                    new TextObject("{=kRA_leave}Leave").ToString(),
                    () =>
            {
                Hero.MainHero.ChangeHeroGold(-iCostOfAdmissionGold);
                Hero.MainHero.Clan.Influence -= iCostOfAdmissionInfluence;

                ItemRoster armoury = new ItemRoster();

                MD5 md5Hasher = MD5.Create();
                var hashed    =
                    md5Hasher.ComputeHash(
                        System.Text.Encoding.UTF8.GetBytes(Settlement.CurrentSettlement.Name.ToString()));
                var iRandSeed = BitConverter.ToInt32(hashed, 0);
                iRandSeed    += (int)(Settlement.CurrentSettlement.Prosperity /
                                      Settings.Instance.iProsperityChangeNeededForNewStock);

                Random random = new Random(Settings.Instance.bPreserveRandomSeedForStock
                            ? iRandSeed
                            : (int)DateTime.Now.Ticks);

                foreach (ItemObject item in ItemObject.All)
                {
                    if (!item.IsCraftedByPlayer || Settings.Instance.bShowCraftedItems)
                    {
                        if ((item.Culture == Settlement.CurrentSettlement.Culture ||
                             !Settings.Instance.bFilterByCulture ||
                             (item.Culture == null &&
                              Settings.Instance.bShowCultureMissingItems))         // Culture filters
                            &&
                            (
                                (Settings.Instance.bCostOrValueForItemEnough &&
                                 (item.Value >= Settings.Instance.iLowestValueItemInArmory || item.Appearance >=
                                  Settings.Instance
                                  .fLowestAppearanceItemInArmory))                // Cost OR Value is enough?
                                ||
                                (!Settings.Instance.bCostOrValueForItemEnough &&
                                 (item.Value >= Settings.Instance.iLowestValueItemInArmory && item.Appearance >=
                                  Settings.Instance
                                  .fLowestAppearanceItemInArmory))                // Cost AND value is needed?
                            )
                            )
                        {
                            if ((Settings.Instance.bUnlimitedSelectionIfFree && iCostOfAdmissionGold == 0 &&
                                 iCostOfAdmissionInfluence == 0) ||
                                !Settings.Instance.bProsperityAffectsItemSelection)
                            {
                                armoury.AddToCounts(item, 99);
                            }
                            else
                            {
                                float fItemChanceToAppearBasedOnValueAndRarity = Math.Max(1,
                                                                                          Math.Min(
                                                                                              (item.Appearance - Settings.Instance.fLowestAppearanceItemInArmory) *
                                                                                              (item.Value - Settings.Instance.iLowestValueItemInArmory), 500000) /
                                                                                          1000); // normalize to a number between 1 to 500
                                int iHalfOfProsperityDifference =
                                    (Settings.Instance.iProsperityForGuaranteedItem -
                                     Settings.Instance.iMinProsperityForAnyItem) / 2;
                                fItemChanceToAppearBasedOnValueAndRarity *= iHalfOfProsperityDifference / 500;

                                int iRandMax = Settings.Instance.iProsperityForGuaranteedItem -
                                               (Settings.Instance.bItemValueAndRarityAffectsChanceToShow
                                                           ? iHalfOfProsperityDifference
                                                           : 0);

                                int iItemChanceToAppear =
                                    random.Next(Settings.Instance.iMinProsperityForAnyItem, iRandMax);

                                if (Settings.Instance.bItemValueAndRarityAffectsChanceToShow)
                                {
                                    iItemChanceToAppear += (int)fItemChanceToAppearBasedOnValueAndRarity;
                                }

                                if (Settlement.CurrentSettlement.Prosperity >= iItemChanceToAppear)
                                {
                                    float fMaxItemsPossible =
                                        Settings.Instance.bRandomizeQuantityBasedOnProsperity
                                                    ? (Settlement.CurrentSettlement.Prosperity / 1000)
                                                    : Settings.Instance.iItemAvailableQuantity;
                                    float fItemsToAdd = Settings.Instance.bRandomizeItemAvailableQuantity
                                                ? random.Next(1, (int)fMaxItemsPossible + 1)
                                                : Settings.Instance.iItemAvailableQuantity;
                                    fItemsToAdd += Settings.Instance.bRandomizeQuantityBasedOnProsperity
                                                ? (Settlement.CurrentSettlement.Prosperity / 4000)
                                                : 0;

                                    if (Settings.Instance.bItemValueAndRarityAffectsChanceToShow)
                                    {
                                        fItemsToAdd = Math.Max(1,
                                                               fItemsToAdd / Math.Max(1, item.Appearance * item.Value / 100000));
                                    }

                                    armoury.AddToCounts(item, (int)fItemsToAdd);
                                }
                            }
                        }
                    }
                }

                InventoryManager.OpenScreenAsTrade(armoury, Settlement.CurrentSettlement.Town);
            },
                    null,
                    ""),
                true);
        }
Beispiel #8
0
        public void SpawnStats()
        {
            var order  = 11;
            var lvl    = Player.Instance.Level;
            var attack = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = order,
                Text         = "Attack: " + lvl.Attack,
                X            = HudPadding,
                IgnoreCamera = true
            };
            var fontHeight = attack.Measure().Y;

            attack.Y = padding + xpBarContainer.Y + fontHeight;
            var spellCd = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = order,
                Text         = "Spell CD: " + lvl.SpellCd,
                X            = HudPadding,
                Y            = padding + attack.Y + fontHeight,
                IgnoreCamera = true
            };
            var spellSpeed = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = order,
                Text         = "Spell speed: " + lvl.SpellSpeed,
                X            = HudPadding,
                Y            = padding + spellCd.Y + fontHeight,
                IgnoreCamera = true
            };
            var spellSize = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = order,
                Text         = "Spell size: " + lvl.SpellSize,
                X            = HudPadding,
                Y            = padding + spellSpeed.Y + fontHeight,
                IgnoreCamera = true
            };
            var spellRange = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = order,
                Text         = "Spell range: " + lvl.SpellRange,
                X            = HudPadding,
                Y            = padding + spellSize.Y + fontHeight,
                IgnoreCamera = true
            };
            var spellEnergyModifier = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = order,
                Text         = "Spell energy mod: " + lvl.SpellEnergyModifier,
                X            = HudPadding,
                Y            = padding + spellRange.Y + fontHeight,
                IgnoreCamera = true
            };
            var spellKnockBack = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = order,
                Text         = "Spell knockback: " + lvl.SpellKnockBack,
                X            = HudPadding,
                Y            = padding + spellEnergyModifier.Y + fontHeight,
                IgnoreCamera = true
            };
            var luck = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = order,
                Text         = "Luck: " + lvl.Luck,
                X            = HudPadding,
                Y            = padding + spellKnockBack.Y + fontHeight,
                IgnoreCamera = true
            };
            var speed = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = order,
                Text         = "Speed: " + lvl.Speed,
                X            = HudPadding,
                Y            = padding + luck.Y + fontHeight,
                IgnoreCamera = true
            };
            var size = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = order,
                Text         = "Size: " + lvl.Size,
                X            = HudPadding,
                Y            = padding + speed.Y + fontHeight,
                IgnoreCamera = true
            };

            Engine.SpawnObject("stats_attack", attack);
            Engine.SpawnObject("stats_spellCd", spellCd);
            Engine.SpawnObject("stats_spellSpeed", spellSpeed);
            Engine.SpawnObject("stats_spellSize", spellSize);
            Engine.SpawnObject("stats_spellRange", spellRange);
            Engine.SpawnObject("stats_spellEnergyModifier", spellEnergyModifier);
            Engine.SpawnObject("stats_spellKnockBack", spellKnockBack);
            Engine.SpawnObject("stats_luck", luck);
            Engine.SpawnObject("stats_speed", speed);
            Engine.SpawnObject("stats_size", size);
        }
        private static void CalculateLearning2Limit(int attributeValue, int focusValue, TextObject attributeName, ref StatExplainer explainer)
        {
            if (explainer == null)
            {
                return;
            }

            // frame 0 is current, 1 is patch thunk, 2 is caller
            var sf = new StackFrame(2, false);

            if (sf.GetMethod().Name == nameof(DefaultCharacterDevelopmentModel.CalculateLearningRate))
            {
                explainer = null;
            }
        }
Beispiel #10
0
 public ProcessInfo(TextObject obj, XmlItem item)
 {
     textObject = obj;
     xmlItem    = item;
 }
Beispiel #11
0
        public override void InitializeFromXml(XmlNode node)
        {
            XmlNode text = Util.SelectSingleNode(node, "Text");

            TextObject = TextObject.FromXml(Util.SelectSingleNode(text, "TextObject"));
        }
Beispiel #12
0
        private void btnNestedGroups_Click(object sender, EventArgs e)
        {
            Report report = new Report();

            // load nwind database
            DataSet dataSet = new DataSet();

            dataSet.ReadXml(GetReportsFolder() + "nwind.xml");

            // register all data tables and relations
            report.RegisterData(dataSet);

            // enable the "Products" table to use it in the report
            report.GetDataSource("Products").Enabled = true;

            // add report page
            ReportPage page = new ReportPage();

            report.Pages.Add(page);
            // always give names to objects you create. You can use CreateUniqueName method to do this;
            // call it after the object is added to a report.
            page.CreateUniqueName();

            // create group header
            GroupHeaderBand groupHeaderBand = new GroupHeaderBand();

            page.Bands.Add(groupHeaderBand);
            groupHeaderBand.Height    = Units.Centimeters * 1;
            groupHeaderBand.Condition = "[Products.ProductName].Substring(0,1)";

            // create group text
            TextObject groupText = new TextObject();

            groupText.Parent = groupHeaderBand;
            groupText.CreateUniqueName();
            groupText.Bounds    = new RectangleF(0, 0, Units.Centimeters * 10, Units.Centimeters * 1);
            groupText.Font      = new Font("Arial", 14, FontStyle.Bold);
            groupText.Text      = "[[Products.ProductName].Substring(0,1)]";
            groupText.VertAlign = VertAlign.Center;
            groupText.Fill      = new LinearGradientFill(Color.OldLace, Color.Moccasin, 90, 0.5f, 1);

            // create nested group header
            GroupHeaderBand nestedGroupBand = new GroupHeaderBand();

            groupHeaderBand.NestedGroup = nestedGroupBand;
            nestedGroupBand.Height      = Units.Centimeters * 0.5f;
            nestedGroupBand.Condition   = "[Products.ProductName].Substring(0,2)";

            // create nested group text
            TextObject nestedText = new TextObject();

            nestedText.Parent = nestedGroupBand;
            nestedText.CreateUniqueName();
            nestedText.Bounds = new RectangleF(0, 0, Units.Centimeters * 10, Units.Centimeters * 0.5f);
            nestedText.Font   = new Font("Arial", 10, FontStyle.Bold);
            nestedText.Text   = "[[Products.ProductName].Substring(0,2)]";

            // create data band
            DataBand dataBand = new DataBand();

            // connect it to inner group
            nestedGroupBand.Data = dataBand;
            dataBand.CreateUniqueName();
            dataBand.DataSource = report.GetDataSource("Products");
            dataBand.Height     = Units.Centimeters * 0.5f;
            // set sort by product name
            dataBand.Sort.Add(new Sort("[Products.ProductName]"));

            // create product name text
            TextObject productText = new TextObject();

            productText.Parent = dataBand;
            productText.CreateUniqueName();
            productText.Bounds = new RectangleF(Units.Centimeters * 0.5f, 0, Units.Centimeters * 9.5f, Units.Centimeters * 0.5f);
            productText.Text   = "[Products.ProductName]";

            // create group footer for outer group
            groupHeaderBand.GroupFooter = new GroupFooterBand();
            groupHeaderBand.GroupFooter.CreateUniqueName();
            groupHeaderBand.GroupFooter.Height = Units.Centimeters * 1;

            // create total
            Total groupTotal = new Total();

            groupTotal.Name      = "TotalRows";
            groupTotal.TotalType = TotalType.Count;
            groupTotal.Evaluator = dataBand;
            groupTotal.PrintOn   = groupHeaderBand.GroupFooter;
            report.Dictionary.Totals.Add(groupTotal);

            // show total in the group footer
            TextObject totalText = new TextObject();

            totalText.Parent = groupHeaderBand.GroupFooter;
            totalText.CreateUniqueName();
            totalText.Bounds       = new RectangleF(0, 0, Units.Centimeters * 10, Units.Centimeters * 0.5f);
            totalText.Text         = "Rows: [TotalRows]";
            totalText.HorzAlign    = HorzAlign.Right;
            totalText.Border.Lines = BorderLines.Top;

            // run report designer
            report.Design();
        }
Beispiel #13
0
        private void btnMasterDetail_Click(object sender, EventArgs e)
        {
            Report report = new Report();

            // load nwind database
            DataSet dataSet = new DataSet();

            dataSet.ReadXml(GetReportsFolder() + "nwind.xml");

            // register all data tables and relations
            report.RegisterData(dataSet);

            // enable the "Categories" and "Products" tables to use it in the report
            report.GetDataSource("Categories").Enabled = true;
            report.GetDataSource("Products").Enabled   = true;
            // enable relation between two tables
            report.Dictionary.UpdateRelations();

            // add report page
            ReportPage page = new ReportPage();

            report.Pages.Add(page);
            // always give names to objects you create. You can use CreateUniqueName method to do this;
            // call it after the object is added to a report.
            page.CreateUniqueName();

            // create master data band
            DataBand masterDataBand = new DataBand();

            page.Bands.Add(masterDataBand);
            masterDataBand.CreateUniqueName();
            masterDataBand.DataSource = report.GetDataSource("Categories");
            masterDataBand.Height     = Units.Centimeters * 0.5f;

            // create category name text
            TextObject categoryText = new TextObject();

            categoryText.Parent = masterDataBand;
            categoryText.CreateUniqueName();
            categoryText.Bounds = new RectangleF(0, 0, Units.Centimeters * 5, Units.Centimeters * 0.5f);
            categoryText.Font   = new Font("Arial", 10, FontStyle.Bold);
            categoryText.Text   = "[Categories.CategoryName]";

            // create detail data band
            DataBand detailDataBand = new DataBand();

            masterDataBand.Bands.Add(detailDataBand);
            detailDataBand.CreateUniqueName();
            detailDataBand.DataSource = report.GetDataSource("Products");
            detailDataBand.Height     = Units.Centimeters * 0.5f;
            // set sort by product name
            detailDataBand.Sort.Add(new Sort("[Products.ProductName]"));

            // create product name text
            TextObject productText = new TextObject();

            productText.Parent = detailDataBand;
            productText.CreateUniqueName();
            productText.Bounds = new RectangleF(Units.Centimeters * 1, 0, Units.Centimeters * 10, Units.Centimeters * 0.5f);
            productText.Text   = "[Products.ProductName]";

            // run report designer
            report.Design();
        }
 public FixedPartySizeLimitModel()
 {
     this._quarterMasterText = GameTexts.FindText("str_clan_role", "quartermaster");
 }
 internal override string EvaluateString(TextProcessingContext context, TextObject parent) => this._innerExpression.EvaluateString(context, parent);
        public void addTrinhKy_OnFormLoad()
        {
            //Ham nay XuanDT them vao
            try
            {
                //doan gan cac bien: doan nay co the phai thay doi ten bien cho phu hop
                mv_oRptDoc = RptDoc;
                mv_oViewDoc = crptViewer;
                //ket thuc doan gan bien
                mv_oRptFieldObj = mv_oRptDoc.ReportDefinition.ReportObjects["Field150181"] as FieldObject;
                mv_oNguoiKy = new cls_SignInfor(mv_oRptDoc.ToString(), "", ReportSourceTable);

                //chkPrint_CheckedChanged(chkPrint, New System.EventArgs)
                if (mv_oNguoiKy._TonTai)
                {
                    mv_oNguoiKy.setValueToRPT(ref mv_oRptFieldObj);
                    if (mv_bSetContent)
                    {
                        mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = Strings.Chr(34) + mv_oNguoiKy.mv_NOI_DUNG.Replace("&NHANVIEN", globalVariables.UserName).Replace("\t", Strings.Chr(34) + "&Chr(13)&" + Strings.Chr(34)) + Strings.Chr(34);
                        //mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = string.Format("'{0}'", mv_oNguoiKy.mv_NOI_DUNG);
                    }
                    else
                    {
                        mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text = "";
                    }
                    mv_oViewDoc.ReportSource = RptDoc;
                }
                else
                {
                    mv_oNguoiKy = new cls_SignInfor(mv_oRptFieldObj, "", RptDoc.ToString(),
                                                    mv_oRptDoc.DataDefinition.FormulaFields["Formula_1"].Text);
                }
            }
            catch (Exception ex)
            {
                mv_oRptText = null;
                //an nut tuy chon di
                cmdTrinhKy.Visible = false;
            }
        }
Beispiel #17
0
 public MPHeroClassGroup(string stringId)
 {
     this.StringId = stringId;
     this.Name     = GameTexts.FindText("str_troop_type_name", this.StringId);
 }
Beispiel #18
0
        private void btnSubreport_Click(object sender, EventArgs e)
        {
            Report report = new Report();

            // load nwind database
            DataSet dataSet = new DataSet();

            dataSet.ReadXml(GetReportsFolder() + "nwind.xml");

            // register all data tables and relations
            report.RegisterData(dataSet);

            // enable the "Products" and "Suppliers" tables to use it in the report
            report.GetDataSource("Products").Enabled  = true;
            report.GetDataSource("Suppliers").Enabled = true;

            // add report page
            ReportPage page = new ReportPage();

            report.Pages.Add(page);
            // always give names to objects you create. You can use CreateUniqueName method to do this;
            // call it after the object is added to a report.
            page.CreateUniqueName();

            // create title band
            page.ReportTitle = new ReportTitleBand();
            // native FastReport unit is screen pixel, use conversion
            page.ReportTitle.Height = Units.Centimeters * 1;
            page.ReportTitle.CreateUniqueName();

            // create two title text objects
            TextObject titleText1 = new TextObject();

            titleText1.Parent = page.ReportTitle;
            titleText1.CreateUniqueName();
            titleText1.Bounds    = new RectangleF(0, 0, Units.Centimeters * 8, Units.Centimeters * 1);
            titleText1.Font      = new Font("Arial", 14, FontStyle.Bold);
            titleText1.Text      = "Products";
            titleText1.HorzAlign = HorzAlign.Center;

            TextObject titleText2 = new TextObject();

            titleText2.Parent = page.ReportTitle;
            titleText2.CreateUniqueName();
            titleText2.Bounds    = new RectangleF(Units.Centimeters * 9, 0, Units.Centimeters * 8, Units.Centimeters * 1);
            titleText2.Font      = new Font("Arial", 14, FontStyle.Bold);
            titleText2.Text      = "Suppliers";
            titleText2.HorzAlign = HorzAlign.Center;

            // create report title's child band that will contain subreports
            ChildBand childBand = new ChildBand();

            page.ReportTitle.Child = childBand;
            childBand.CreateUniqueName();
            childBand.Height = Units.Centimeters * 0.5f;

            // create the first subreport
            SubreportObject subreport1 = new SubreportObject();

            subreport1.Parent = childBand;
            subreport1.CreateUniqueName();
            subreport1.Bounds = new RectangleF(0, 0, Units.Centimeters * 8, Units.Centimeters * 0.5f);

            // create subreport's page
            ReportPage subreportPage1 = new ReportPage();

            report.Pages.Add(subreportPage1);
            // connect subreport to page
            subreport1.ReportPage = subreportPage1;

            // create report on the subreport's page
            DataBand dataBand = new DataBand();

            subreportPage1.Bands.Add(dataBand);
            dataBand.CreateUniqueName();
            dataBand.DataSource = report.GetDataSource("Products");
            dataBand.Height     = Units.Centimeters * 0.5f;

            TextObject productText = new TextObject();

            productText.Parent = dataBand;
            productText.CreateUniqueName();
            productText.Bounds = new RectangleF(0, 0, Units.Centimeters * 8, Units.Centimeters * 0.5f);
            productText.Text   = "[Products.ProductName]";


            // create the second subreport
            SubreportObject subreport2 = new SubreportObject();

            subreport2.Parent = childBand;
            subreport2.CreateUniqueName();
            subreport2.Bounds = new RectangleF(Units.Centimeters * 9, 0, Units.Centimeters * 8, Units.Centimeters * 0.5f);

            // create subreport's page
            ReportPage subreportPage2 = new ReportPage();

            report.Pages.Add(subreportPage2);
            // connect subreport to page
            subreport2.ReportPage = subreportPage2;

            // create report on the subreport's page
            DataBand dataBand2 = new DataBand();

            subreportPage2.Bands.Add(dataBand2);
            dataBand2.CreateUniqueName();
            dataBand2.DataSource = report.GetDataSource("Suppliers");
            dataBand2.Height     = Units.Centimeters * 0.5f;

            // create supplier name text
            TextObject supplierText = new TextObject();

            supplierText.Parent = dataBand2;
            supplierText.CreateUniqueName();
            supplierText.Bounds = new RectangleF(0, 0, Units.Centimeters * 8, Units.Centimeters * 0.5f);
            supplierText.Text   = "[Suppliers.CompanyName]";

            // run report designer
            report.Design();
        }
Beispiel #19
0
        /// <summary>
        /// 生成默认报表
        /// </summary>
        /// <returns></returns>
        public FastReport.Report DefaultReport()
        {

            FastReport.Report report = new FastReport.Report();
            //判断有报表数据,则注册数据
            if (dt != null && dt.Rows.Count > 0)
            {
                report.RegisterData(dt, styleObject);
            }
            else
            {
                return null;
            }
            //查询报表设置
            DataTable dtReportSet = DBHelper.GetTable("", "tb_report_set", "*", string.Format("set_object='{0}' and set_user='******'", styleObject, GlobalStaticObj.UserID), "", "order by set_num");
            if (dtReportSet == null || dtReportSet.Rows.Count == 0)
            {
                return null;
            }
            // enable the "Employees" table to use it in the report
            report.GetDataSource(styleObject).Enabled = true;

            // add report page
            ReportPage page = new ReportPage();
            if (paperSize != null)
            {
                page.PaperWidth = paperSize.Width;
                page.PaperHeight = paperSize.Height;
            }
            report.Pages.Add(page);
            // always give names to objects you create. You can use CreateUniqueName method to do this;
            // call it after the object is added to a report.
            page.CreateUniqueName();

            // create title band
            page.ReportTitle = new ReportTitleBand();
            // native FastReport unit is screen pixel, use conversion 
            page.ReportTitle.Height = Units.Centimeters * 1;
            page.ReportTitle.CreateUniqueName();

            // create title text
            TextObject titleText = new TextObject();
            titleText.Parent = page.ReportTitle;
            titleText.CreateUniqueName();
            //titleText.Bounds = new RectangleF(Units.Centimeters * 5, 0, Units.Centimeters * 10, Units.Centimeters * 1);
            titleText.Bounds = new RectangleF(0, 0, Units.Millimeters * page.PaperWidth, Units.Centimeters * 1);
            titleText.Font = new Font("Arial", 14, FontStyle.Bold);
            titleText.Text = styleTitle;
            titleText.HorzAlign = HorzAlign.Center;
            titleText.VertAlign = VertAlign.Center;
            //内容行高
            float rowHeight = Units.Centimeters * 1F;
            //标题行高,如果有合并列,怎行高价高
            float rowHeaderHeight = rowHeight;
            if (dicSpanRows != null && dicSpanRows.Count > 0)
            {
                rowHeaderHeight = Units.Centimeters * 1.5f;
            }
            page.PageHeader = new PageHeaderBand();
            page.PageHeader.Height = rowHeaderHeight;
            page.PageHeader.CreateUniqueName();
            #region 生成报表内容
            // create data band
            DataBand dataBand = new DataBand();
            page.Bands.Add(dataBand);
            dataBand.CreateUniqueName();
            dataBand.DataSource = report.GetDataSource(styleObject);
            dataBand.Height = rowHeight;
            float x = 0F;//x坐标

            foreach (DataRow dr in dtReportSet.Rows)
            {
                //判断是否要打印
                if (CommonCtrl.IsNullToString(dr["is_print"]) != "1")
                {
                    continue;
                }
                //列宽
                float columnWidth = Units.Centimeters * 2;
                //标题
                string headerName = string.Empty;
                //获取设置的列宽和标题
                float.TryParse(dr["set_width"].ToString(), out columnWidth);
                //columnWidth = columnWidth * 0.9f;
                headerName = dr["set_name"].ToString();
                //生成标题
                TextObject txtHeader = new TextObject();
                txtHeader.Parent = page.PageHeader;
                txtHeader.CreateUniqueName();
                txtHeader.Text = headerName;
                txtHeader.HorzAlign = HorzAlign.Center;
                txtHeader.VertAlign = VertAlign.Center;
                //生成标题竖线
                LineObject lineHeaderVer = new LineObject();
                lineHeaderVer.Parent = page.PageHeader;
                //生成标题横线
                LineObject lineHeaderHor = new LineObject();
                lineHeaderHor.Parent = page.PageHeader;
                lineHeaderHor.Bounds = new RectangleF(x, 0, columnWidth, 1f);

                //数据源列名称
                string dataName = dr["set_data_name"].ToString();
                string spanName = IsContainDataColumn(dataName);
                //判断列是否是合并列
                if (spanName.Length > 0)
                {
                    #region 合并列标题
                    txtHeader.Bounds = new RectangleF(x, rowHeaderHeight / 2, columnWidth, rowHeaderHeight / 2);
                    lineHeaderVer.Bounds = new RectangleF(x, rowHeaderHeight / 2, 1F, rowHeaderHeight / 2);
                    //生成合并列的短竖线
                    LineObject lineHeaderHorSpan = new LineObject();
                    lineHeaderHorSpan.Parent = page.PageHeader;
                    lineHeaderHorSpan.Bounds = new RectangleF(x, rowHeaderHeight / 2, columnWidth, 1F);
                    //判断是否包含合并列头
                    if (dicSpanWidth.ContainsKey(spanName))
                    {
                        //增加合并列头的列宽
                        RectangleF rf = dicSpanWidth[spanName];
                        rf.Width += columnWidth;
                        dicSpanWidth[spanName] = rf;
                    }
                    else
                    {
                        //记录合并列头
                        RectangleF rf = new RectangleF();
                        rf.X = x;
                        rf.Y = 0;
                        rf.Width = columnWidth;
                        rf.Height = rowHeaderHeight / 2;
                        dicSpanWidth.Add(spanName, rf);
                    }
                    #endregion
                }
                else
                {
                    lineHeaderVer.Bounds = new RectangleF(x, 0, 1F, rowHeaderHeight);
                    txtHeader.Bounds = new RectangleF(x, 0, columnWidth, rowHeaderHeight);
                }
                // create two text objects with employee's name and birth date
                //生成内容
                TextObject empNameText = new TextObject();
                empNameText.Parent = dataBand;
                empNameText.CreateUniqueName();
                empNameText.Bounds = new RectangleF(x, 0, columnWidth, rowHeight);
                DataColumn dc = dt.Columns[dataName];
                empNameText.Text = string.Format("[{0}.{1}]", styleObject, dataName);
                //empNameText.HideZeros = true;
                if (dc != null && dc.DataType != typeof(string))
                {
                    empNameText.HorzAlign = HorzAlign.Right;
                }
                else
                {
                    empNameText.HorzAlign = HorzAlign.Center;
                }
                empNameText.VertAlign = VertAlign.Center;
                //生成内容列的竖线
                LineObject lineVertical = new LineObject();
                lineVertical.Parent = dataBand;
                lineVertical.Bounds = new RectangleF(x, 0, 1F, rowHeight);
                //生成内容列顶部的横线
                LineObject lineHorizontal = new LineObject();
                lineHorizontal.Parent = dataBand;
                lineHorizontal.Bounds = new RectangleF(x, 0, columnWidth, 1f);
                //生成内荣列底部的横线
                LineObject lineHorizontalD = new LineObject();
                lineHorizontalD.Parent = dataBand;
                lineHorizontalD.Bounds = new RectangleF(x, rowHeight, columnWidth, 1f);

                //x坐标增加当前列
                x += columnWidth;
            }

            //生成标题右边的竖线
            LineObject lineHeaderRightVer = new LineObject();
            lineHeaderRightVer.Parent = page.PageHeader;
            lineHeaderRightVer.Bounds = new RectangleF(x, 0, 1f, rowHeight);
            //生成内容右边的竖线
            LineObject lineRightVer = new LineObject();
            lineRightVer.Parent = dataBand;
            lineRightVer.Bounds = new RectangleF(x, 0, 1f, rowHeight);
            //生成合并列头
            foreach (string span in dicSpanWidth.Keys)
            {
                //合并列头
                TextObject txtSpan = new TextObject();
                txtSpan.Parent = page.PageHeader;
                txtSpan.CreateUniqueName();
                txtSpan.Bounds = dicSpanWidth[span];
                txtSpan.Text = span;
                txtSpan.HorzAlign = HorzAlign.Center;
                txtSpan.VertAlign = VertAlign.Center;
                //合并列头的竖线
                LineObject lineHeaderVer = new LineObject();
                lineHeaderVer.Parent = page.PageHeader;
                lineHeaderVer.Bounds = new RectangleF(txtSpan.Bounds.X, txtSpan.Bounds.Y, 1f, txtSpan.Bounds.Height);
            }
            #endregion
            #region 生成页脚
            page.PageFooter = new PageFooterBand();
            page.PageFooter.Height = rowHeaderHeight;
            page.PageHeader.CreateUniqueName();
            TextObject txtPageN = new TextObject();
            txtPageN.Parent = page.PageFooter;
            txtPageN.CreateUniqueName();
            txtPageN.Text = "[PageNofM]";
            txtPageN.Bounds = new RectangleF(100, 0, 200, rowHeaderHeight);

            //TextObject txtTotalPages = new TextObject();
            //txtTotalPages.Parent = page.PageFooter;
            //txtTotalPages.CreateUniqueName();
            //txtTotalPages.Text = "[TotalPages]";
            //txtTotalPages.Bounds = new RectangleF(350, 0, 200, rowHeaderHeight);
            #endregion
            return report;

        }
Beispiel #20
0
        private void btnSimpleList_Click(object sender, EventArgs e)
        {
            Report report = new Report();

            // load nwind database
            DataSet dataSet = new DataSet();

            dataSet.ReadXml(GetReportsFolder() + "nwind.xml");

            // register all data tables and relations
            report.RegisterData(dataSet);

            // enable the "Employees" table to use it in the report
            report.GetDataSource("Employees").Enabled = true;

            // add report page
            ReportPage page = new ReportPage();

            report.Pages.Add(page);
            // always give names to objects you create. You can use CreateUniqueName method to do this;
            // call it after the object is added to a report.
            page.CreateUniqueName();

            // create title band
            page.ReportTitle = new ReportTitleBand();
            // native FastReport unit is screen pixel, use conversion
            page.ReportTitle.Height = Units.Centimeters * 1;
            page.ReportTitle.CreateUniqueName();

            // create title text
            TextObject titleText = new TextObject();

            titleText.Parent = page.ReportTitle;
            titleText.CreateUniqueName();
            titleText.Bounds    = new RectangleF(Units.Centimeters * 5, 0, Units.Centimeters * 10, Units.Centimeters * 1);
            titleText.Font      = new Font("Arial", 14, FontStyle.Bold);
            titleText.Text      = "Employees";
            titleText.HorzAlign = HorzAlign.Center;

            // create data band
            DataBand dataBand = new DataBand();

            page.Bands.Add(dataBand);
            dataBand.CreateUniqueName();
            dataBand.DataSource = report.GetDataSource("Employees");
            dataBand.Height     = Units.Centimeters * 0.5f;

            // create two text objects with employee's name and birth date
            TextObject empNameText = new TextObject();

            empNameText.Parent = dataBand;
            empNameText.CreateUniqueName();
            empNameText.Bounds = new RectangleF(0, 0, Units.Centimeters * 5, Units.Centimeters * 0.5f);
            empNameText.Text   = "[Employees.FirstName] [Employees.LastName]";

            TextObject empBirthDateText = new TextObject();

            empBirthDateText.Parent = dataBand;
            empBirthDateText.CreateUniqueName();
            empBirthDateText.Bounds = new RectangleF(Units.Centimeters * 5.5f, 0, Units.Centimeters * 3, Units.Centimeters * 0.5f);
            empBirthDateText.Text   = "[Employees.BirthDate]";
            // format value as date
            DateFormat format = new DateFormat();

            format.Format           = "MM/dd/yyyy";
            empBirthDateText.Format = format;

            // run report designer
            report.Design();
        }
Beispiel #21
0
        public static bool Prefix(ref bool __result, MapEvent __instance, int ____mapEventUpdateCount)
        {
            if (____mapEventUpdateCount <= 1)
            {
                __result = false;
                return(false);
            }

            bool AttackerRunaway = false;
            bool DefenderRunaway = false;

            // __instance.SimulateBattleSetup();
            MapEventSide attackerSide          = __instance.AttackerSide;
            MapEventSide defenderSide          = __instance.DefenderSide;
            float        attackerTotalStrength = attackerSide.RecalculateStrengthOfSide();
            float        defenderTotalStrength = defenderSide.RecalculateStrengthOfSide();

            if (__instance.IsSiegeAssault)
            {
                attackerTotalStrength *= 0.6666667f;
            }
            float powerRatio = defenderTotalStrength / attackerTotalStrength;

            if (__instance.AttackerSide.LeaderParty.LeaderHero == null)
            {
                AttackerRunaway = false;
            }
            else
            {
                // Attacker Runaway
                if (powerRatio > 1.2)
                {
                    float baseChance = (powerRatio - 1.2f) * 1.5f * SubModule.Settings.Strategy_LearnToQuit_RetreatChance;
                    float bonus      = -(float)__instance.AttackerSide.LeaderParty.LeaderHero.GetTraitLevel(DefaultTraits.Valor) * 0.2f;
                    AttackerRunaway = MBRandom.RandomFloat < baseChance + bonus;
                }
            }
            if (AttackerRunaway)
            {
                if (SubModule.Settings.Strategy_LearnToQuit_Verbose)
                {
                    Dictionary <string, TextObject> attributes = new Dictionary <string, TextObject>
                    {
                        { "ATTACKER", __instance.AttackerSide.LeaderParty.Name },
                        { "DEFENDER", __instance.DefenderSide.LeaderParty.Name },
                    };
                    TextObject information = new TextObject("{=dJhAtk}{ATTACKER} withdrew from battle against {DEFENDER}.", attributes);
                    InformationManager.DisplayMessage(new InformationMessage(information.ToString()));
                }

                __result = true;
                return(false);
            }

            float sacrificeRatio = 0f;

            if (__instance.DefenderSide.LeaderParty.LeaderHero == null)
            {
                DefenderRunaway = false;
            }
            else
            {
                // Defender Runaway
                if (powerRatio <= 0.8f)
                {
                    int ofRegularMembers = 0;
                    foreach (PartyBase party in __instance.DefenderSide.Parties)
                    {
                        ofRegularMembers += party.NumberOfRegularMembers;
                    }
                    int forTryingToGetAway = TroopSacrificeModel.GetNumberOfTroopsSacrificedForTryingToGetAway(__instance.DefenderSide, __instance.AttackerSide, 1 / powerRatio, ofRegularMembers);
                    if (forTryingToGetAway < 0 || ofRegularMembers < forTryingToGetAway)
                    {
                        // Not enough man
                        DefenderRunaway = false;
                    }
                    else
                    {
                        sacrificeRatio = (float)forTryingToGetAway / (float)ofRegularMembers;
                        float baseChance = (1f - 1.25f * powerRatio) * 1.5f * SubModule.Settings.Strategy_LearnToQuit_RetreatChance;
                        float bonus      = -(float)__instance.DefenderSide.LeaderParty.LeaderHero.GetTraitLevel(DefaultTraits.Valor) * 0.2f;
                        DefenderRunaway = MBRandom.RandomFloat < baseChance + bonus;
                    }
                }
            }
            if (DefenderRunaway)
            {
                MapEventCustomMembers.DefendersRanAway[__instance.Id] = true;
                if (SubModule.Settings.Strategy_LearnToQuit_Verbose)
                {
                    Dictionary <string, TextObject> attributes = new Dictionary <string, TextObject>
                    {
                        { "ATTACKER", __instance.AttackerSide.LeaderParty.Name },
                        { "DEFENDER", __instance.DefenderSide.LeaderParty.Name },
                    };
                    TextObject information = new TextObject("{=LLIPq6}{DEFENDER} was forced to retreat against {ATTACKER}.", attributes);
                    InformationManager.DisplayMessage(new InformationMessage(information.ToString()));
                }
                TroopSacrificeModel.SacrificeTroops(sacrificeRatio, __instance.DefenderSide, __instance);

                __result = true;
                return(false);
            }

            __result = false;
            return(false);
        }
 public OptionClass(string id, TextObject name)
 {
     Id   = id;
     Name = new TextViewModel(name);
 }
Beispiel #23
0
        // LOL NOT RIGHT - BERB - Elobuddy doesn't have a dispose/remove function for Sprites

        /// <summary>
        ///     Removes the render objects.
        /// </summary>
        public void RemoveRenderObjects()
        {
            TextObject.Dispose();
            MinimapSpriteObject.Dispose();
        }
Beispiel #24
0
 public void TriggerText(TextObject textObject)
 {
     textManager.StartText(textObject);
 }
        public SettingsPropertyDefinition(IEnumerable <IPropertyDefinitionBase> propertyDefinitions, IPropertyGroupDefinition propertyGroupDefinition, IRef propertyReference)
        {
            GroupName    = propertyGroupDefinition.GroupName;
            IsMainToggle = propertyGroupDefinition.IsMainToggle;
            GroupOrder   = propertyGroupDefinition.GroupOrder;

            PropertyReference = propertyReference;

            if (PropertyReference.Type == typeof(bool))
            {
                SettingType = SettingType.Bool;
            }
            else if (PropertyReference.Type == typeof(int))
            {
                SettingType = SettingType.Int;
            }
            else if (PropertyReference.Type == typeof(float))
            {
                SettingType = SettingType.Float;
            }
            else if (PropertyReference.Type == typeof(string))
            {
                SettingType = SettingType.String;
            }
            else if (SettingsUtils.IsDropdown(PropertyReference.Type))
            {
                SettingType = SettingType.Dropdown;
            }

            foreach (var propertyDefinition in propertyDefinitions)
            {
                if (propertyDefinition is IPropertyDefinitionBase propertyBase)
                {
                    DisplayName    = new TextObject(propertyBase.DisplayName, null).ToString();
                    Order          = propertyBase.Order;
                    RequireRestart = propertyBase.RequireRestart;
                    HintText       = new TextObject(propertyBase.HintText, null).ToString();
                }
                if (propertyDefinition is SettingPropertyAttribute settingPropertyAttribute) // v1
                {
                    MinValue         = settingPropertyAttribute.MinValue;
                    MaxValue         = settingPropertyAttribute.MaxValue;
                    EditableMinValue = settingPropertyAttribute.MinValue;
                    EditableMaxValue = settingPropertyAttribute.MaxValue;
                }
                if (propertyDefinition is IPropertyDefinitionBool propertyDefinitionBool) // v2
                {
                }
                if (propertyDefinition is IPropertyDefinitionWithMinMax propertyDefinitionWithMinMax)
                {
                    MinValue         = propertyDefinitionWithMinMax.MinValue;
                    MaxValue         = propertyDefinitionWithMinMax.MaxValue;
                    EditableMinValue = propertyDefinitionWithMinMax.MinValue;
                    EditableMaxValue = propertyDefinitionWithMinMax.MaxValue;
                }
                if (propertyDefinition is IPropertyDefinitionWithEditableMinMax propertyDefinitionWithEditableMinMax)
                {
                    EditableMinValue = propertyDefinitionWithEditableMinMax.EditableMinValue;
                    EditableMaxValue = propertyDefinitionWithEditableMinMax.EditableMaxValue;
                }
                if (propertyDefinition is IPropertyDefinitionWithFormat propertyDefinitionWithFormat)
                {
                    ValueFormat = propertyDefinitionWithFormat.ValueFormat;
                }
                if (propertyDefinition is IPropertyDefinitionText propertyDefinitionText)
                {
                }
                if (propertyDefinition is IPropertyDefinitionDropdown propertyDefinitionDropdown)
                {
                    SelectedIndex = propertyDefinitionDropdown.SelectedIndex;
                }
            }
        }
        public static void EconomyTweak_h_CalculateProsperityChange(Town fortification, StatExplainer explanation, ref float __result)
        {
            int             gold             = fortification.Gold;
            float           num              = fortification.Prosperity;
            float           foodChange       = fortification.FoodChange;
            float           foodStocks       = fortification.FoodStocks;
            float           value            = 0f;
            float           num2             = 0f;
            int             num3             = 0;
            float           value2           = 0f;
            ExplainedNumber explainedNumber  = new ExplainedNumber(0f, explanation, null);
            ExplainedNumber explainedNumber2 = new ExplainedNumber(0f, explanation, null);
            ExplainedNumber explainedNumber3 = new ExplainedNumber(0f, explanation, null);
            bool            flag             = !fortification.IsCastle;

            if (flag)
            {
                bool flag2 = EconomyTweak_h_Dictionaries.EconomyTweak_h_TownDemandFulfilledDictionary.ContainsKey(fortification);
                if (flag2)
                {
                    TextObject desription = new TextObject("Demands Fulfilled", null);
                    bool       flag3      = EconomyTweak_h_Dictionaries.EconomyTweak_h_TownDemandFulfilledDictionary[fortification] < 0f;
                    if (flag3)
                    {
                        value = MathF.Pow(-EconomyTweak_h_Dictionaries.EconomyTweak_h_TownDemandFulfilledDictionary[fortification], EconomyTweak_h_globalConstants.EconomyTweak_h_TownDemandFulfilledProsperityExpValue);
                    }
                    else
                    {
                        value = MathF.Pow(EconomyTweak_h_Dictionaries.EconomyTweak_h_TownDemandFulfilledDictionary[fortification], EconomyTweak_h_globalConstants.EconomyTweak_h_TownDemandFulfilledProsperityExpValue);
                    }
                    value = MathF.Clamp(value, -num * 0.05f, num * 0.05f);
                    explainedNumber.Add(value, desription, null);
                    __result += explainedNumber.ResultNumber;
                }
                num2 = (float)gold * 0.95f + num * EconomyTweak_h_globalConstants.EconomyTweak_h_MarketGoldProsperityRatio * EconomyTweak_h_globalConstants.EconomyTweak_h_ValueOfProsperity * 0.05f;
                num3 = MBRandom.RoundRandomized(num2 - (float)gold);
                num2 = (float)(gold - num3) * 0.95f + num * EconomyTweak_h_globalConstants.EconomyTweak_h_MarketGoldProsperityRatio * EconomyTweak_h_globalConstants.EconomyTweak_h_ValueOfProsperity * 0.05f;
                num3 = MBRandom.RoundRandomized(num2 - (float)gold);
                bool   flag4 = num3 < 0;
                string value3;
                if (flag4)
                {
                    value3 = "Currency Investment";
                }
                else
                {
                    value3 = "Currency Withdrawal";
                }
                TextObject desription2 = new TextObject(value3, null);
                explainedNumber2.Add((float)(-(float)num3) / EconomyTweak_h_globalConstants.EconomyTweak_h_ValueOfProsperity, desription2, null);
                __result += explainedNumber2.ResultNumber;
            }
            float num4  = foodStocks + foodChange * (float)EconomyTweak_h_globalConstants.EconomyTweak_h_OptimalStockPeriodFood - num / 50f;
            bool  flag5 = foodChange < 0f || num4 < 0f;

            if (flag5)
            {
                TextObject desription3 = new TextObject("Food Supply Shortage", null);
                value2 = MathF.Clamp(foodChange - MathF.Pow(-Math.Min(0f, num4), EconomyTweak_h_globalConstants.EconomyTweak_h_FoodShortageProsperityExpValue), -num * 0.05f, 0f);
                explainedNumber3.Add(value2, desription3, null);
                __result += explainedNumber3.ResultNumber;
            }
            bool flag6 = EconomyTweak_h_globalConstants.EconomyTweak_h_DebugLevel > 0;

            if (flag6)
            {
                using (StreamWriter streamWriter = File.AppendText(EconomyTweak_h_globalConstants.EconomyTweak_h_path + "EconomyTweak_h_log.txt"))
                {
                    streamWriter.WriteLine("EconomyTweak_h_CalculateProsperityChange");
                }
                bool economyTweak_h_DebugDisplay = EconomyTweak_h_globalConstants.EconomyTweak_h_DebugDisplay;
                if (economyTweak_h_DebugDisplay)
                {
                    InformationManager.DisplayMessage(new InformationMessage("EconomyTweak_h_CalculateProsperityChange"));
                }
                bool flag7 = EconomyTweak_h_globalConstants.EconomyTweak_h_DebugLevel > 1;
                if (flag7)
                {
                    using (StreamWriter streamWriter2 = File.AppendText(EconomyTweak_h_globalConstants.EconomyTweak_h_path + "EconomyTweak_h_log.txt"))
                    {
                        streamWriter2.WriteLine(string.Concat(new string[]
                        {
                            "fortification = ",
                            fortification.ToString(),
                            ", EconomyTweak_h_TownProsperity = ",
                            num.ToString(),
                            ", EconomyTweak_h_TownGold = ",
                            gold.ToString(),
                            ", EconomyTweak_h_TownDemandFulfilledValue = ",
                            value.ToString(),
                            ", explainedNumber_TownDemandFulfilled = ",
                            explainedNumber.ResultNumber.ToString(),
                            ", EconomyTweak_h_TargetGold = ",
                            num2.ToString(),
                            ", EconomyTweak_h_TargetGoldChange = ",
                            num3.ToString(),
                            ", explainedNumber_TargetGoldChange = ",
                            explainedNumber2.ResultNumber.ToString(),
                            ", EconomyTweak_h_FoodChange = ",
                            foodChange.ToString(),
                            ", EconomyTweak_h_FoodStocks = ",
                            foodStocks.ToString(),
                            ", EconomyTweak_h_FoodShortageProsperity = ",
                            value2.ToString(),
                            ", explainedNumber_FoodShortageProsperity = ",
                            explainedNumber3.ResultNumber.ToString(),
                            ", EconomyTweak_h_CalculateProsperityChange(result) = ",
                            __result.ToString()
                        }));
                    }
                }
            }
        }
Beispiel #27
0
        public override void Start()
        {
            base.Start();

            // Top Left
            var yDiff = 2f;
            var hp    = new TextObject(FontScale, Color.White)//Color.DarkRed)
            {
                Order        = Order,
                Text         = "HP",
                X            = HudPadding,
                Y            = HudPadding,
                IgnoreCamera = true
            };
            var hpSize = hp.Measure();

            hpBarContainer = new RectangleObject(HudBarWidth, (int)hpSize.Y)
            {
                X            = hp.X + padding + hpSize.X,
                Y            = hp.Y - yDiff,
                Order        = Order,
                Color        = Color.Black,
                IgnoreCamera = true
            };
            hpBar = new RectangleObject(HudBarWidth - border * 2, (int)(hpBarContainer.Height - border * 2))
            {
                Order        = Order,
                X            = hpBarContainer.X + border,
                Y            = hpBarContainer.Y + border,
                Color        = Color.DarkRed,
                Fill         = true,
                IgnoreCamera = true
            };
            hpTextObj = new TextObject(FontScaleSecondary, Color.White)//Color.DarkRed)
            {
                Order        = Order,
                X            = hpBarContainer.X + hpBarContainer.Width + padding,
                Y            = hp.Y,
                IgnoreCamera = true
            };

            var energyText = new TextObject(FontScale, Color.White)//Color.DarkRed)
            {
                Text         = "EN",
                X            = HudPadding,
                Order        = Order,
                Y            = padding + hp.Y + hpSize.Y,
                IgnoreCamera = true
            };
            var energyTextSize = energyText.Measure();

            energyBarContainer = new RectangleObject(HudBarWidth, (int)energyTextSize.Y)
            {
                X            = energyText.X + padding + energyTextSize.X,
                Y            = energyText.Y - yDiff,
                Order        = Order,
                Color        = Color.Black,
                IgnoreCamera = true
            };
            energyBar = new RectangleObject(HudBarWidth - border * 2, (int)(energyBarContainer.Height - border * 2))
            {
                Order        = Order,
                X            = energyBarContainer.X + border,
                Y            = energyBarContainer.Y + border,
                Color        = Color.DarkBlue,
                Fill         = true,
                IgnoreCamera = true
            };
            energyTextObj = new TextObject(FontScaleSecondary, Color.White)//Color.DarkRed)
            {
                Order        = Order,
                X            = energyBarContainer.X + energyBarContainer.Width + padding,
                Y            = energyText.Y,
                IgnoreCamera = true
            };

            var xp = new TextObject(FontScale, Color.White)//Color.DarkGreen)
            {
                Order        = Order,
                Text         = "XP",
                X            = HudPadding,
                Y            = padding + energyText.Y + energyTextSize.Y,
                IgnoreCamera = true
            };
            var xpSize = xp.Measure();

            xpBarContainer = new RectangleObject(HudBarWidth, (int)xpSize.Y)
            {
                X            = xp.X + padding + xpSize.X,
                Y            = xp.Y - yDiff,
                Order        = Order,
                Color        = Color.Black,
                IgnoreCamera = true
            };
            xpBar = new RectangleObject((int)(xpBarContainer.Width - border * 2),
                                        (int)(xpBarContainer.Height - border * 2))
            {
                Order        = Order,
                X            = xpBarContainer.X + border,
                Y            = xpBarContainer.Y + border,
                Color        = Color.DarkOliveGreen,
                Fill         = true,
                IgnoreCamera = true
            };
            levelTextObj = new TextObject(FontScaleSecondary, Color.White)//Color.DarkGreen)
            {
                Order        = Order,
                Text         = "0% to 1",
                X            = xpBarContainer.X + xpBarContainer.Width + padding,
                Y            = xp.Y,
                IgnoreCamera = true
            };

            // Center
            scoreTextObject = new TextObject(FontScaleSecondary, Color.White)//Color.DarkGreen)
            {
                Order        = Order,
                Text         = " ",
                Y            = HudPadding,
                IgnoreCamera = true
            };
            scoreModTextObject = new TextObject(FontScaleSecondary * 0.8f, Color.White)//Color.DarkGreen)
            {
                Order        = Order,
                Y            = scoreTextObject.Y + padding + scoreTextObject.Measure().Y,
                IgnoreCamera = true
            };

            // Top Right
            spellCdBarContainer = new RectangleObject(HudBarWidth, (int)xpSize.Y)
            {
                X            = Engine.Width - HudBarWidth - HudPadding,
                Y            = HudPadding,
                Order        = Order,
                Color        = Color.Black,
                IgnoreCamera = true
            };
            spellCdBar = new RectangleObject((int)(spellCdBarContainer.Width - border * 2),
                                             (int)(spellCdBarContainer.Height - border * 2))
            {
                Order        = Order,
                X            = spellCdBarContainer.X + border,
                Y            = spellCdBarContainer.Y + border,
                Color        = Color.Gray,
                Fill         = true,
                IgnoreCamera = true
            };
            spellTextObj = new TextObject(FontScaleSecondary, Color.White)//Color.Black
            {
                Order        = Order,
                Text         = "",
                X            = 0,
                Y            = spellCdBarContainer.Y,
                IgnoreCamera = true
            };

            // Bottom left
            var seedTextObj = new TextObject(FontScaleSecondary * 0.66f, Color.White, alpha: 0.66f) // Color.Black
            {
                Order        = Order,
                Text         = "Seed: " + Game.Game.Instance.Random.Seed,
                X            = HudPadding,
                IgnoreCamera = true
            };

            seedTextObj.Y = Engine.Height - HudPadding - seedTextObj.Measure().Y;

            Engine.SpawnObject(Name + "_hpText", hp);
            Engine.SpawnObject(Name + "_hpBarContainer", hpBarContainer);
            Engine.SpawnObject(Name + "_hpBar", hpBar);
            Engine.SpawnObject(Name + "_hpTextObj", hpTextObj);
            Engine.SpawnObject(Name + "_energyText", energyText);
            Engine.SpawnObject(Name + "_energyBarContainer", energyBarContainer);
            Engine.SpawnObject(Name + "_energyBar", energyBar);
            Engine.SpawnObject(Name + "_energyTextObj", energyTextObj);
            Engine.SpawnObject(Name + "_xpText", xp);
            Engine.SpawnObject(Name + "_xpBarContainer", xpBarContainer);
            Engine.SpawnObject(Name + "_xpBar", xpBar);
            Engine.SpawnObject(Name + "_levelTextObj", levelTextObj);

            Engine.SpawnObject(Name + "_scoreTextObj", scoreTextObject);
            Engine.SpawnObject(Name + "_scoreModTextObj", scoreModTextObject);

            Engine.SpawnObject(Name + "_spellText", spellTextObj);
            Engine.SpawnObject(Name + "_spellCdBarContainer", spellCdBarContainer);
            Engine.SpawnObject(Name + "_spellCdBar", spellCdBar);

            Engine.SpawnObject(Name + "_seedTextObj", seedTextObj);
        }
        private static void AddToStat(ref ExplainedNumber stat, SkillEffect.EffectIncrementType effectIncrementType, float number, TextObject text)
        {
            switch (effectIncrementType)
            {
            case SkillEffect.EffectIncrementType.Add:
                stat.Add(number, text);
                break;

            case SkillEffect.EffectIncrementType.AddFactor:                     // For Way of the ..., should always be AddFactor (this is multiply)
                stat.AddFactor(number * 0.01f, text);
                break;
            }
        }
Beispiel #29
0
        public override void OnMissionTick(float dt)
        {
            if (!_initialized && Mission.Current != null && Agent.Main != null)
            {
                _initialized = true;
                Initialize();
            }

            //每支箭落地燃烧,4秒火势变弱,8秒熄灭(默认)
            if (_hitArrowFires.Count > 0)
            {
                List <ArrowFireData> _deleteitems = new List <ArrowFireData>();
                foreach (ArrowFireData item in _hitArrowFires)
                {
                    if (item.timer.Check(true))
                    {
                        if (!item.delete)
                        {
                            item.delete = true;
                            GameEntity entity = item.bigFireParticle.GetEntity();
                            if (entity != null)
                            {
                                entity.GetLight().Intensity = FireLordConfig.FireArrowLightIntensity - 35;
                                entity.RemoveComponent(item.bigFireParticle);
                            }
                        }
                        else
                        {
                            GameEntity entity = item.missile.Entity;
                            if (entity != null)
                            {
                                entity.RemoveAllParticleSystems();
                                Light light = entity.GetLight();
                                if (light != null)
                                {
                                    entity.RemoveComponent(light);
                                }
                            }
                            _deleteitems.Add(item);
                        }
                    }
                }
                foreach (ArrowFireData item in _deleteitems)
                {
                    _hitArrowFires.Remove(item);
                }
            }

            //计算每个agent的着火条,满了就点燃
            if (AgentFireDatas.Count > 0)
            {
                List <Agent> _deleteAgent = new List <Agent>();
                foreach (KeyValuePair <Agent, AgentFireData> item in AgentFireDatas)
                {
                    Agent         agent    = item.Key;
                    AgentFireData fireData = item.Value;
                    if (fireData.isBurning)
                    {
                        if (FireLordConfig.IgnitionDealDamage && fireData.damageTimer.Check(true) && agent.IsActive())
                        {
                            Blow blow = CreateBlow(fireData.attacker, agent);
                            agent.RegisterBlow(blow);
                            if (fireData.attacker == Agent.Main)
                            {
                                TextObject text = GameTexts.FindText("ui_delivered_burning_damage", null);
                                text.SetTextVariable("DAMAGE", blow.InflictedDamage);
                                InformationManager.DisplayMessage(new InformationMessage(text.ToString()));
                            }
                            else if (agent == Agent.Main)
                            {
                                TextObject text = GameTexts.FindText("ui_received_burning_damage", null);
                                text.SetTextVariable("DAMAGE", blow.InflictedDamage);
                                InformationManager.DisplayMessage(new InformationMessage(text.ToString(), Color.ConvertStringToColor("#D65252FF")));
                            }
                        }
                        if (fireData.burningTimer.Check())
                        {
                            if (fireData.fireEntity != null)
                            {
                                foreach (ParticleSystem particle in fireData.particles)
                                {
                                    fireData.fireEntity.RemoveComponent(particle);
                                }
                                if (fireData.fireLight != null)
                                {
                                    fireData.fireLight.Intensity = 0;
                                    Skeleton skeleton = agent.AgentVisuals.GetSkeleton();
                                    if (skeleton != null)
                                    {
                                        skeleton.RemoveComponent(fireData.fireLight);
                                    }
                                }
                                fireData.fireEntity = null;
                                fireData.fireLight  = null;
                            }
                            fireData.firebar   = 0;
                            fireData.isBurning = false;
                        }
                    }
                    else
                    {
                        if (fireData.firebar >= FireLordConfig.IgnitionBarMax)
                        {
                            fireData.isBurning    = true;
                            fireData.burningTimer = new MissionTimer(FireLordConfig.IgnitionDurationInSecond);
                            fireData.damageTimer  = new MissionTimer(1f);
                            EquipmentIndex index = agent.GetWieldedItemIndex(Agent.HandIndex.MainHand);
                            if (index == EquipmentIndex.None)
                            {
                                return;
                            }
                            GameEntity wieldedWeaponEntity = agent.GetWeaponEntityFromEquipmentSlot(index);
                            Skeleton   skeleton            = agent.AgentVisuals.GetSkeleton();
                            if (skeleton == null)
                            {
                                return;
                            }
                            fireData.particles = new ParticleSystem[_ignitionBoneIndexes.Length];
                            for (byte i = 0; i < _ignitionBoneIndexes.Length; i++)
                            {
                                MatrixFrame    localFrame = new MatrixFrame(Mat3.Identity, new Vec3(0, 0, 0));
                                ParticleSystem particle   = ParticleSystem.CreateParticleSystemAttachedToEntity("psys_campfire",
                                                                                                                wieldedWeaponEntity, ref localFrame);
                                skeleton.AddComponentToBone(_ignitionBoneIndexes[i], particle);
                                fireData.particles[i] = particle;
                            }

                            //只有通过扔掉再重新捡起这把武器,才能让粒子效果出现
                            FireSwordLogic.DropLock = true;
                            agent.DropItem(index);
                            SpawnedItemEntity spawnedItemEntity = wieldedWeaponEntity.GetFirstScriptOfType <SpawnedItemEntity>();
                            agent.OnItemPickup(spawnedItemEntity, EquipmentIndex.None, out bool removeItem);
                            fireData.fireEntity     = wieldedWeaponEntity;
                            FireSwordLogic.DropLock = false;

                            Light light = Light.CreatePointLight(FireLordConfig.IgnitionLightRadius);
                            light.Intensity  = FireLordConfig.IgnitionLightIntensity;
                            light.LightColor = FireLordConfig.IgnitionLightColor;
                            skeleton.AddComponentToBone(0, light);
                            fireData.fireLight = light;
                        }
                        else
                        {
                            fireData.firebar -= dt * FireLordConfig.IgnitionDropPerSecond;
                            fireData.firebar  = Math.Max(fireData.firebar, 0);

                            if (!agent.IsActive())
                            {
                                _deleteAgent.Add(agent);
                            }
                        }
                    }
                }
                foreach (Agent agent in _deleteAgent)
                {
                    AgentFireData fireData = AgentFireDatas[agent];
                    GameEntity    entity   = fireData.fireEntity;
                    if (entity != null)
                    {
                        entity.RemoveAllParticleSystems();
                    }
                    Skeleton skeleton = agent.AgentVisuals.GetSkeleton();
                    if (skeleton != null && fireData.fireLight != null)
                    {
                        skeleton.RemoveComponent(fireData.fireLight);
                    }
                    AgentFireDatas.Remove(agent);
                }
            }
        }
Beispiel #30
0
 public ActionOptionViewModel(TextObject name, TextObject description, Action onAction)
     : base(name, description, OptionsVM.OptionsDataType.ActionOption)
 {
     _onAction = onAction;
 }
        private void dataGridView_displayitems_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var            dt        = new DataTable();
                var            UsedClass = new BasicClass();
                var            crp       = new Reports.ItemsReport();
                var            form      = new PrintForm();
                string         itemName  = dataGridView_displayitems.Rows[e.RowIndex].Cells["ColumnItemName"].Value.ToString();
                SqlParameter[] param     = new SqlParameter[3];
                param[0] = new SqlParameter("@ItemName", SqlDbType.NVarChar, 250);
                param[1] = new SqlParameter("@InvoiceType", SqlDbType.NVarChar, 250);
                param[2] = new SqlParameter("@InvoiceSatus", SqlDbType.NVarChar, 250);
                TextObject invoiceType    = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text11"];
                TextObject itemNameHeader = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text17"];
                switch (e.ColumnIndex)
                {
                case 0:      //Purshace Invoices
                    param[0].Value = itemName;
                    param[1].Value = "شراء";
                    param[2].Value = "Run";
                    dt             = UsedClass.selectdata("Report_Select_items_using_itemName_and_InvoiceType", param);
                    if (dt.Rows.Count > 0)
                    {
                        invoiceType.Text    = "قائمة مشتريات";
                        itemNameHeader.Text = itemName;
                        crp.SetDataSource(dt);
                        form.crystalReportViewer1.ReportSource = crp;
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    break;

                case 1:     //Sale Invoices
                    param[0].Value = itemName;
                    param[1].Value = "بيع";
                    param[2].Value = "Run";
                    dt             = UsedClass.selectdata("Report_Select_items_using_itemName_and_InvoiceType", param);
                    if (dt.Rows.Count > 0)
                    {
                        invoiceType.Text    = "قائمة مبيعات";
                        itemNameHeader.Text = itemName;
                        crp.SetDataSource(dt);
                        form.crystalReportViewer1.ReportSource = crp;
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    break;

                case 2:     //Save Invoices
                    param[0].Value = itemName;
                    param[1].Value = "بيع";
                    param[2].Value = "SAVE";
                    dt             = UsedClass.selectdata("Report_Select_items_using_itemName_and_InvoiceType", param);
                    if (dt.Rows.Count > 0)
                    {
                        invoiceType.Text    = "قائمة مبيعات";
                        itemNameHeader.Text = itemName;
                        crp.SetDataSource(dt);
                        form.crystalReportViewer1.ReportSource = crp;
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    break;

                case 3:
                    param[0].Value = itemName;
                    param[1].Value = "شراء";
                    param[2].Value = "SAVE";
                    dt             = UsedClass.selectdata("Report_Select_items_using_itemName_and_InvoiceType", param);
                    if (dt.Rows.Count > 0)
                    {
                        invoiceType.Text    = "قائمة مبيعات";
                        itemNameHeader.Text = itemName;
                        crp.SetDataSource(dt);
                        form.crystalReportViewer1.ReportSource = crp;
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    break;

                default:
                    break;
                }
            }
        }
        public static void Postfix(EscapeMenuVM __instance, ref MBBindingList <EscapeMenuItemVM> ____menuItems, IEnumerable <EscapeMenuItemVM> items, TextObject title = null)
        {
            if (CommunityPatchSubModule.DontGroupThirdPartyMenuOptions)
            {
                ____menuItems.Add(new EscapeMenuItemVM(new TextObject("{=CommunityPatchOptions}Community Patch Options"),
                                                       _ => CommunityPatchSubModule.Current.ShowOptions(), _groupEscMenuOptsKey, false));
                return;
            }

            var list = ____menuItems.ToList();

            var customOptions = new List <EscapeMenuItemVM>();

            for (var i = 0; i < list.Count; i++)
            {
                var item = list[i];

                try {
                    var act        = (Action <object>)EscapeMenuItemVmOnExecute.GetValue(item);
                    var actAsm     = act.Method.DeclaringType?.Assembly;
                    var optAsmName = actAsm?.GetName().Name;

                    if (optAsmName == null ||
                        optAsmName.StartsWith("TaleWorlds.") ||
                        optAsmName.StartsWith("SandBox.") ||
                        optAsmName.StartsWith("SandBoxCore.") ||
                        optAsmName.StartsWith("StoryMode."))
                    {
                        if (PathHelpers.IsOfficialAssembly(actAsm))
                        {
                            continue;
                        }
                    }
                }
                catch {
                    // yeah, it's 3rd party.
                }

                customOptions.Add(item);
                list[i] = null;
            }

            var newList = new MBBindingList <EscapeMenuItemVM>();

            foreach (var item in list)
            {
                if (item != null)
                {
                    newList.Add(item);
                }
            }

            if (customOptions.Count <= 0)
            {
                newList.Insert(newList.Count - 2, new EscapeMenuItemVM(new TextObject("{=CommunityPatchOptions}Community Patch Options"),
                                                                       _ => CommunityPatchSubModule.Current.ShowOptions(), _groupEscMenuOptsKey, false));

                ____menuItems = newList;
                return;
            }

            newList.Insert(newList.Count - 2, new EscapeMenuItemVM(new TextObject("{=MoreOptions}More Options"), _ => {
                var options = new List <InquiryElement>();

                foreach (var item in customOptions)
                {
                    options.Add(new InquiryElement(item, item.ActionText, null, !item.IsDisabled, null));
                }

                options.Add(new InquiryElement(_groupEscMenuOptsKey, new TextObject("{=CommunityPatchOptions}Community Patch Options").ToString(), null));

                InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(
                                                                 new TextObject("{=MoreOptions}More Options").ToString(),
                                                                 null,
                                                                 options,
                                                                 true,
                                                                 true,
                                                                 new TextObject("{=Open}Open").ToString(),
                                                                 null,
                                                                 selection => {
                    var picked = selection.FirstOrDefault()?.Identifier;
                    if (picked == _groupEscMenuOptsKey)
                    {
                        CommunityPatchSubModule.Current.ShowOptions();
                        return;
                    }

                    if (picked is EscapeMenuItemVM vm)
                    {
                        SynchronizationContext.Current.Post(_ => {
                            vm.ExecuteAction();
                        }, null);
                    }
                },
                                                                 null
                                                                 ), true);
            }, "MoreOptions", false));
Beispiel #33
0
 public MercenaryContractMapNotification(Hero mercenary, TextObject descriptionText) : base(descriptionText)
 {
     Mercenary = mercenary;
     //CreationTime = mercenary.Clan.LastFactionChangeTime.ElapsedDaysUntilNow;
 }
        private static void AddToStat(ref ExplainedNumber stat, SkillEffect.EffectIncrementType effectIncrementType, float number, TextObject text, float newBorn)
        {
            bool flag = effectIncrementType == SkillEffect.EffectIncrementType.Add;

            if (flag)
            {
                stat.Add(number * LightSettlementProsperityModel._vanillaToRatio * newBorn * SubModule.Settings.ProsperityGrowthMultiplier, text, null);
            }
            else
            {
                bool flag2 = effectIncrementType != SkillEffect.EffectIncrementType.AddFactor;
                if (!flag2)
                {
                    stat.AddFactor(number * 0.01f, text);
                }
            }
        }
Beispiel #35
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            Form2          f2 = new certificate2.Form2();
            CrystalReport1 c  = new certificate2.CrystalReport1();

            t1      = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["centername"];
            t2      = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["category"];
            a       = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["text3"];
            t4      = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["time"];
            t5      = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["text17"];
            name1   = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["t1"];
            name2   = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["t2"];
            name3   = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["t3"];
            name4   = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["t4"];
            name5   = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["t5"];
            name6   = (TextObject)c.ReportDefinition.Sections["Section3"].ReportObjects["t6"];
            t1.Text = cbname.Text;
            a.Text  = tbdis.Text;
            t5.Text = dateTimePicker1.Text;

            if (comboBox2.Text == "Employee of the Month")
            {
                t2.Text = comboBox2.Text;
            }
            else if (comboBox2.Text == "Best in Attendance")
            {
                t2.Text = comboBox2.Text + " " + comboBox1.Text;
            }
            else if (comboBox2.Text == @"Most number of ""Awesome"" KUDOS")
            {
                t2.Text = comboBox2.Text + " " + comboBox1.Text;
            }
            else
            {
                t2.Text = comboBox2.Text + " " + comboBox1.Text;
            }

            //date
            if (dateTimePicker2.Value.Day == 1)
            {
                t4.Text = "Given this " + dateTimePicker2.Value.Day.ToString() + "st " + dateTimePicker2.Value.ToString("MMMM yyyy");
            }
            else if (dateTimePicker2.Value.Day == 2)
            {
                t4.Text = "Given this " + dateTimePicker2.Value.Day.ToString() + "nd " + dateTimePicker2.Value.ToString("MMMM yyyy");
            }
            else if (dateTimePicker2.Value.Day == 3)
            {
                t4.Text = "Given this " + dateTimePicker2.Value.Day.ToString() + "rd " + dateTimePicker2.Value.ToString("MMMM yyyy");
            }
            else
            {
                t4.Text = "Given this " + dateTimePicker2.Value.Day.ToString() + "th " + dateTimePicker2.Value.ToString("MMMM yyyy");
            }

            name1.Text          = tbHTS.Text;
            name2.Text          = tb1.Text;
            name3.Text          = tb2.Text;
            name4.Text          = tb3.Text;
            name5.Text          = tb4.Text;
            name6.Text          = tb5.Text;
            f2.crt.ReportSource = c;
            f2.ShowDialog();

            tbHTS.Clear();
            tb1.Clear();
            tb2.Clear();
            tb3.Clear();
            tb4.Clear();
            tb5.Clear();
        }
        private static void AddReportObjects(string prefix, ReportObjects reportObjects)
        {
            foreach (var ro in reportObjects)
            {
                ReportObject rod      = ro as ReportObject;
                string       roprefix = prefix + "ReportObject:Name:" + RemoveNumbersIfSimplified(rod.Name) + ":";
                Console.WriteLine(roprefix);
                Console.WriteLine(roprefix + "Kind:" + rod.Kind);

                if (rod.Kind == CrystalDecisions.Shared.ReportObjectKind.FieldObject)
                {
                    FieldObject fo = rod as FieldObject;
                    Console.WriteLine(roprefix + "DataSource.FormulaName:" + fo.DataSource.FormulaName);
                }

                if (rod.Kind == CrystalDecisions.Shared.ReportObjectKind.TextObject)
                {
                    TextObject txto = rod as TextObject;
                    Console.WriteLine(roprefix + "Text:" + MakeSingleLine(txto.Text));
                }

                if (rod.Kind == CrystalDecisions.Shared.ReportObjectKind.FieldHeadingObject)
                {
                    FieldHeadingObject fho = rod as FieldHeadingObject;
                    Console.WriteLine(roprefix + "FieldObjectName:" + RemoveNumbersIfSimplified(fho.FieldObjectName));
                    Console.WriteLine(roprefix + "Text:" + MakeSingleLine(fho.Text));
                }

                if (rod.Kind == CrystalDecisions.Shared.ReportObjectKind.SubreportObject)
                {
                    SubreportObject o = rod as SubreportObject;
                    Console.WriteLine(roprefix + "SubreportName:" + RemoveNumbersIfSimplified(o.SubreportName));
                }


                if (rod.Kind == CrystalDecisions.Shared.ReportObjectKind.BoxObject)
                {
                    BoxObject o = rod as BoxObject;
                    Console.WriteLine(roprefix + "EnableExtendToBottomOfSection:" + o.EnableExtendToBottomOfSection);
                    Console.WriteLine(roprefix + "EndSectionName:" + o.EndSectionName);
                    if (!Simplified)
                    {
                        Console.WriteLine(roprefix + "LineThickness:" + o.LineThickness);
                        Console.WriteLine(roprefix + "LineStyle:" + o.LineStyle);

                        Console.WriteLine(roprefix + "LineColor:IsNamedColor:" + o.LineColor.IsNamedColor);
                        if (o.LineColor.IsNamedColor)
                        {
                            Console.WriteLine(roprefix + "LineColor:Name:" + o.LineColor.Name);
                        }
                        else
                        {
                            Console.WriteLine(roprefix + "LineColor:RGB:" + o.LineColor.R.ToString() + o.LineColor.G.ToString() + o.LineColor.B.ToString());
                        }

                        Console.WriteLine(roprefix + "FillColor:IsNamedColor:" + o.FillColor.IsNamedColor);
                        if (o.LineColor.IsNamedColor)
                        {
                            Console.WriteLine(roprefix + "FillColor:Name:" + o.FillColor.Name);
                        }
                        else
                        {
                            Console.WriteLine(roprefix + "FillColor:RGB:" + o.FillColor.R.ToString() + o.FillColor.G.ToString() + o.FillColor.B.ToString());
                        }
                    }
                }

                if (!Simplified && rod.Kind == CrystalDecisions.Shared.ReportObjectKind.LineObject)
                {
                    LineObject o = rod as LineObject;
                    Console.WriteLine(roprefix + "LineThickness:" + o.LineThickness);
                    Console.WriteLine(roprefix + "LineStyle:" + o.LineStyle);
                    Console.WriteLine(roprefix + "LineColor:IsNamedColor:" + o.LineColor.IsNamedColor);
                    if (o.LineColor.IsNamedColor)
                    {
                        Console.WriteLine(roprefix + "LineColor:Name:" + o.LineColor.Name);
                    }
                    else
                    {
                        Console.WriteLine(roprefix + "LineColor:RGB:" + o.LineColor.R.ToString() + o.LineColor.G.ToString() + o.LineColor.B.ToString());
                    }
                }


                if (!Simplified)
                {
                    Console.WriteLine(roprefix + "Left:" + rod.Left);
                    Console.WriteLine(roprefix + "Top:" + rod.Top);
                    Console.WriteLine(roprefix + "Width:" + rod.Width);
                    Console.WriteLine(roprefix + "Height:" + rod.Height);
                }
            }
        }
        private void ResetGame()
        {
            _p1 = new Player(this, new Vector2(50, 50), _playerTexture);
            GameObjects.Add(_p1);

            _p2 = new Player(this, new Vector2(screenWidth*2-70, 50), _playerTexture);
            GameObjects.Add(_p2);

            _ball = new Ball(this, new Vector2(1200f, 800f), _ballTexture);
            _ball.BallSpeed = 2;
            GameObjects.Add(_ball);

            _Log = new MonoLog(this, _logFont, Color.DarkOrange);
            GameObjects.Add(_Log);

            _p1Score = new TextObject(this, _logFont, new Vector2(screenWidth / 4, 50), "0");
            GameObjects.Add(_p1Score);

            _p2Score = new TextObject(this, _logFont, new Vector2(screenWidth/4*3, 50), "0");
            GameObjects.Add(_p2Score);

            //align to screen
            _p2.PositionX = screenWidth - 70;
            _p2.PositionY = screenHeight/2-50;
            _ball.PositionY = screenHeight/2 - 10;
            _Log.Write("ScreenWidth: "+screenWidth.ToString());
            _Log.Write("ScreenHeight: "+screenHeight.ToString());
        }
        //-----------------Events
        private async void button1_Click(object sender, EventArgs e)
        {
            try
            {
                DeshabilitarButtonsYDateTimePicker();
                IniciarProgressBar();

                DateTime fechaInicio;
                DateTime fechaFin;

                if (radioButton1.Checked == true)
                {
                    fechaInicio = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month,
                                               dateTimePicker1.Value.Day, 0, 1, 0);

                    fechaFin = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month,
                                            dateTimePicker1.Value.Day, 23, 59, 58);
                }

                else
                {
                    fechaInicio = new DateTime(dateTimePicker2.Value.Year, dateTimePicker2.Value.Month,
                                               dateTimePicker2.Value.Day, 0, 1, 0);

                    fechaFin = new DateTime(dateTimePicker3.Value.Year, dateTimePicker3.Value.Month,
                                            dateTimePicker3.Value.Day, 23, 59, 58);
                }

                DataTable res = await Socio_BuscarFoliosActivosDeTodosEnReciboListaProductosControllerAsync(fechaInicio, fechaFin);

                if (res.Rows.Count == 0)
                {
                    crystalReportViewer1.ReportSource = null;
                    DetenerProgressBar();
                    HabilitarButtonsYDateTimePicker();
                    MessageBox.Show("Se encontraron cero capturas en el rango de fechas solicitado", "Resultado de operación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                else
                {
                    SqlConnectionStringBuilder sqlStrBuilder = new SqlConnectionStringBuilder(ObtenerCadenaConexionAppController());

                    CRReporteProductosEnReciboListaProductos crReporte = new CRReporteProductosEnReciboListaProductos();
                    //crReporte.SetDatabaseLogon("sa", "modomixto", "CRUZ2-THINK", "DBCajaCuentas2");
                    crReporte.SetDatabaseLogon(sqlStrBuilder.UserID, sqlStrBuilder.Password, sqlStrBuilder.DataSource, sqlStrBuilder.InitialCatalog);
                    crReporte.SetParameterValue("@fechaInicio", fechaInicio);
                    crReporte.SetParameterValue("@fechaFin", fechaFin);

                    TextObject periodoDeBusquedaTextObject = crReporte.ReportDefinition.ReportObjects["Text25"] as TextObject;
                    periodoDeBusquedaTextObject.Text  = "periodo " + MuestraFechaDeBusquedaSinLaHora(fechaInicio) + " a " + MuestraFechaDeBusquedaSinLaHora(fechaFin);
                    crystalReportViewer1.ReportSource = crReporte;

                    DetenerProgressBar();
                    HabilitarButtonsYDateTimePicker();
                }
            }


            catch (System.Data.SqlClient.SqlException ex)
            {
                ClsMyException clsMyException = new ClsMyException();
                string         res            = clsMyException.FormarTextoDeSqlException(ex);

                MessageBox.Show(res, "Reglas de operación", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            catch (Exception ex)
            {
                DetenerProgressBar();
                HabilitarButtonsYDateTimePicker();
                MessageBox.Show(ex.Message + " " + ex.Source + " " + ex.StackTrace);
            }
        }
        private void GameUpdate(GameTime gameTime)
        {
            gameover = new TextObject(this, _fontGameOver,
                new Vector2(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width/2,
                    GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height/2), "Game Over");
            for (int i = 0; i < GameObjects.Count - 1; i++)
            {
                GameObjects[i].Update(gameTime);

                if (GameObjects[i].GetType() == typeof (Apple))
                {
                    Apple apple = (Apple) GameObjects[i];
                    if (_worm.BoundingBox.Intersects(apple.BoundingBox))
                    {
                        GameObjects.Remove(GameObjects[i]);
                    }
                }

                if (GameObjects[i].GetType() == typeof (Bird))
                {
                    Bird b = (Bird) GameObjects[i];
                    if (b.BoundingBox.Intersects(_worm.BoundingBox))
                    {
                        GameObjects.Remove(_worm);
                        gameover.SpriteColor = Color.RoyalBlue;
                        GameObjects.Add(gameover);
                        gameState = GameState.GAMEOVER;
                    }
                }

            }

            //spawn apples
            if (GameHelper.RandomNext(100) == 1)
            {
                Apple a = new Apple(this);
                a.SpriteTexture = _spritesheet;
                a.PositionX = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width + 100;
                a.PositionY = GameHelper.RandomNext(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height);
                GameObjects.Add(a);
            }

            //spawn birds
            if (GameHelper.RandomNext(200) == 1)
            {
                Bird b = new Bird(this);
                b.SpriteTexture = _spritesheet;
                b.PositionX = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width + 100;
                b.PositionY = GameHelper.RandomNext(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height);
                GameObjects.Add(b);
            }

            if (gameState == GameState.GAMEOVER)
            {
                if (_gameOverTime == 0)
                {
                    _gameOverTime = gameTime.TotalGameTime.TotalSeconds;
                }
                if (_gameOverTime != 0 && _gameOverTime + 3 <= gameTime.TotalGameTime.TotalSeconds)
                {
                    gameState = GameState.INTRO;
                    _gameOverTime = 0;
                    GameObjects.Remove(gameover);
                }
            }
        }
        private async void button2_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime fechaInicio;
                DateTime fechaFin;

                if (radioButton1.Checked == true)
                {
                    fechaInicio = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month,
                                               dateTimePicker1.Value.Day, 0, 1, 0);

                    fechaFin = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month,
                                            dateTimePicker1.Value.Day, 23, 59, 58);
                }

                else
                {
                    fechaInicio = new DateTime(dateTimePicker2.Value.Year, dateTimePicker2.Value.Month,
                                               dateTimePicker2.Value.Day, 0, 1, 0);

                    fechaFin = new DateTime(dateTimePicker3.Value.Year, dateTimePicker3.Value.Month,
                                            dateTimePicker3.Value.Day, 23, 59, 58);
                }

                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    DeshabilitarButtonsYDateTimePicker();
                    IniciarProgressBar();

                    string nomArchivo = saveFileDialog1.FileName;

                    SqlConnectionStringBuilder sqlStrBuilder = new SqlConnectionStringBuilder(ObtenerCadenaConexionAppController());
                    //http://aspalliance.com/478_Exporting_to_Excel_in_Crystal_Reports_NET__Perfect_Excel_Exports.3
                    //https://www.c-sharpcorner.com/UploadFile/mahesh/savefiledialog-in-C-Sharp/
                    CRReporteProductosEnReciboListaProductosParaExportar reporte = new CRReporteProductosEnReciboListaProductosParaExportar();
                    //reporte.SetDatabaseLogon("sa", "modomixto", "CRUZ2-THINK", "DBCajaCuentas2");
                    reporte.SetDatabaseLogon(sqlStrBuilder.UserID, sqlStrBuilder.Password, sqlStrBuilder.DataSource, sqlStrBuilder.InitialCatalog);
                    reporte.SetParameterValue("@fechaInicio", fechaInicio);
                    reporte.SetParameterValue("@fechaFin", fechaFin);

                    //Ponerle las fechas de busqueda al reporte
                    TextObject periodoDeBusquedaTextObject = reporte.ReportDefinition.ReportObjects["Text24"] as TextObject;
                    periodoDeBusquedaTextObject.Text = MuestraFechaDeBusquedaSinLaHora(fechaInicio) + " a " + MuestraFechaDeBusquedaSinLaHora(fechaFin);


                    // Declare variables and get the export options.
                    ExportOptions              exportOpts      = new ExportOptions();
                    ExcelFormatOptions         excelFormatOpts = new ExcelFormatOptions();
                    DiskFileDestinationOptions diskOpts        = new DiskFileDestinationOptions();
                    exportOpts = reporte.ExportOptions;
                    // Set the excel format options.
                    excelFormatOpts.ExcelUseConstantColumnWidth = false;
                    excelFormatOpts.ShowGridLines = true;

                    //exportOpts.ExportFormatType = ExportFormatType.ExcelRecord;
                    exportOpts.ExportFormatType = ExportFormatType.Excel;
                    exportOpts.FormatOptions    = excelFormatOpts;
                    // Set the disk file options and export.
                    exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;
                    //diskOpts.DiskFileName = "miotroreporttttte.xls";
                    diskOpts.DiskFileName         = nomArchivo;
                    exportOpts.DestinationOptions = diskOpts;
                    reporte.Export();

                    await Task.Delay(10);

                    DetenerProgressBar();
                    HabilitarButtonsYDateTimePicker();
                    MessageBox.Show("Exportacion lista", "Resultado de operación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            catch (System.Data.SqlClient.SqlException ex)
            {
                ClsMyException clsMyException = new ClsMyException();
                string         res            = clsMyException.FormarTextoDeSqlException(ex);

                MessageBox.Show(res, "Reglas de operación", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            catch (Exception ex)
            {
                DetenerProgressBar();
                HabilitarButtonsYDateTimePicker();
                MessageBox.Show(ex.Message + " " + ex.Source + " " + ex.StackTrace);
            }
        }
Beispiel #41
0
        private void reportShow()
        {
            this.Invoke(new setStatusDelegate1(setStatus));
            int i = 0, j = 0;
            dbHepler db = new dbHepler();

            string sql = this.Invoke(new getsql(generatesql)) as string;
            MessageBox.Show(sql);
            // string sql = "select * from [20028] where XH='128590'";
            DataSet Student = db.LoadData(sql);
            report.Pages.Clear();
            //report.Load("Untitled.frx");
            ;

            //DataBand data = (DataBand)report.FindObject("data1");

            for (i = 0; i < Student.Tables[0].Rows.Count / 10; i++)
            {
                ReportPage page1 = new ReportPage();

                report.Pages.Add(page1);

                DataBand data = new DataBand();
                page1.Bands.Add(data);
                for (j = 0; j < 10; j++)
                {

                    TextObject text1 = new TextObject();
                    if (j % 2 == 0)
                    {
                        text1.Bounds = new RectangleF(Units.Centimeters * 4, Units.Centimeters * 3 * j, Units.Centimeters * 5, Units.Centimeters * 0.6f);
                    }
                    else
                    {
                        text1.Bounds = new RectangleF(Units.Centimeters * 9 + Units.Centimeters * 4, Units.Centimeters * 3 * (j - 1), Units.Centimeters * 5, Units.Centimeters * 0.6f);

                    }

                    text1.Text = Student.Tables[0].Rows[10 * i + j]["name"].ToString();
                    data.Objects.Add(text1);

                    PictureObject pic = new PictureObject();
                    if (j % 2 == 0)
                    {
                        pic.Bounds = new RectangleF(0, Units.Centimeters * 3 * j, Units.Centimeters * 2, Units.Centimeters * 2);
                    }
                    else
                    {
                        pic.Bounds = new RectangleF(Units.Centimeters * 9 + Units.Centimeters * 0, Units.Centimeters * 3 * (j - 1), Units.Centimeters * 2, Units.Centimeters * 2);

                    }
                    if (File.Exists("./" + "20"+Student.Tables[0].Rows[10 * i + j]["XH"].ToString().Substring(0,2) + "/" + Student.Tables[0].Rows[10 * i + j]["XH"].ToString()+ ".jpg"))
                        pic.Image = Image.FromFile("./" +"20"+ Student.Tables[0].Rows[10 * i + j]["XH"].ToString().Substring(0,2) + "/" + Student.Tables[0].Rows[10 * i + j]["XH"].ToString() + ".jpg");
                    data.Objects.Add(pic);

                    BarcodeObject bar = new BarcodeObject();
                    if (j % 2 == 0)
                    {
                        bar.Bounds = new RectangleF(0, Units.Centimeters * 3 * j + Units.Centimeters * 2.5f, Units.Centimeters * 8, Units.Centimeters * 2);
                    }
                    else
                    {
                        bar.Bounds = new RectangleF(Units.Centimeters * 9 + Units.Centimeters * 0, Units.Centimeters * 3 * (j - 1) + Units.Centimeters * 2.5f, Units.Centimeters * 8, Units.Centimeters * 2);

                    }
                    //pic.Image = Image.FromFile("100001.jpg");
                    bar.Text = Student.Tables[0].Rows[10 * i + j]["ZKZH"].ToString();
                    data.Objects.Add(bar);

                }

            }

            if (Student.Tables[0].Rows.Count % 10 != 0)
            {
                Console.WriteLine((10 * i + j).ToString());
                ReportPage page2 = new ReportPage();

                report.Pages.Add(page2);

                DataBand data2 = new DataBand();
                page2.Bands.Add(data2);

                for (int k = 10 * (i - 1) + j; k < Student.Tables[0].Rows.Count; k++)
                {

                    TextObject text1 = new TextObject();
                    if (k % 2 == 0)
                    {
                        text1.Bounds = new RectangleF(Units.Centimeters * 4, Units.Centimeters * 3 * (k % 10), Units.Centimeters * 5, Units.Centimeters * 0.6f);
                    }
                    else
                    {
                        text1.Bounds = new RectangleF(Units.Centimeters * 9 + Units.Centimeters * 4, Units.Centimeters * 3 * (k % 10 - 1), Units.Centimeters * 5, Units.Centimeters * 0.6f);

                    }

                    text1.Text = Student.Tables[0].Rows[k]["name"].ToString();
                    data2.Objects.Add(text1);

                    PictureObject pic = new PictureObject();
                    if (k % 2 == 0)
                    {
                        pic.Bounds = new RectangleF(0, Units.Centimeters * 3 * k % 10, Units.Centimeters * 2, Units.Centimeters * 2);
                    }
                    else
                    {
                        pic.Bounds = new RectangleF(Units.Centimeters * 9 + Units.Centimeters * 0, Units.Centimeters * 3 * (k % 10 - 1), Units.Centimeters * 2, Units.Centimeters * 2);

                    }
                    if (File.Exists("./" + "20" + Student.Tables[0].Rows[k]["XH"].ToString().Substring(0,2) + "/" + Student.Tables[0].Rows[k]["XH"].ToString() + ".jpg"))
                        pic.Image = Image.FromFile("./" + "20"+Student.Tables[0].Rows[k]["XH"].ToString().Substring(0,2) + "/" + Student.Tables[0].Rows[k]["XH"].ToString()+ ".jpg");
                    data2.Objects.Add(pic);

                    BarcodeObject bar = new BarcodeObject();
                    if (k % 2 == 0)
                    {
                        bar.Bounds = new RectangleF(0, Units.Centimeters * 3 * (k % 10) + Units.Centimeters * 2.5f, Units.Centimeters * 8, Units.Centimeters * 2);
                    }
                    else
                    {
                        bar.Bounds = new RectangleF(Units.Centimeters * 9 + Units.Centimeters * 0, Units.Centimeters * 3 * (k % 10 - 1) + Units.Centimeters * 2.5f, Units.Centimeters * 8, Units.Centimeters * 2);

                    }
                    //pic.Image = Image.FromFile("100001.jpg");
                    bar.Text = Student.Tables[0].Rows[k]["ZKZH"].ToString();
                    data2.Objects.Add(bar);

                }
            }
            this.Invoke(new setStatusDelegate1(setStatus2));
            this.Invoke(new setStatusDelegate1(reportShow1));
        }
Beispiel #42
0
 public TextEventArgs(TextObject obj)
 {
     TextObject = obj;
 }