private void Start()
 {
     _inputController  = (Joystick)StaticContainer.Get(typeof(Joystick));
     _animator         = GetComponent <IAnimator>();
     _aimingController = (AimingController)StaticContainer.Get(typeof(AimingController));
     SetState(_states.First(x => x.Name == GamePersonState.Idle));
 }
Exemple #2
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Prints the specified number of lines.</summary>
        private void PrintLines(StaticContainer cont)
        {
            Double rY    = 0;
            Double rSize = 15;
            Double rX    = rSize;
            Double rDY   = 10;
            Double rDX   = 15;

            rY += rDY + rSize;
            PrintLines(cont, "Left / Top", rX, RepObj.rAlignLeft, rY, RepObj.rAlignTop, rSize, 12);
            rX += rDX + 2 * rSize;
            PrintLines(cont, "Center / Top", rX, RepObj.rAlignCenter, rY, RepObj.rAlignTop, rSize, 12);
            rX += rDX + 2 * rSize;
            PrintLines(cont, "Right / Top", rX, RepObj.rAlignRight, rY, RepObj.rAlignTop, rSize, 12);

            rX  = rSize;
            rY += rDY + 2 * rSize;
            PrintLines(cont, "Left / Center", rX, RepObj.rAlignLeft, rY, RepObj.rAlignCenter, rSize, 12);
            rX += rDX + 2 * rSize;
            PrintLines(cont, "Center / Center", rX, RepObj.rAlignCenter, rY, RepObj.rAlignCenter, rSize, 6);
            rX += rDX + 2 * rSize;
            PrintLines(cont, "Right / Center", rX, RepObj.rAlignRight, rY, RepObj.rAlignCenter, rSize, 12);

            rX  = rSize;
            rY += rDY + 2 * rSize;
            PrintLines(cont, "Left / Bottom", rX, RepObj.rAlignLeft, rY, RepObj.rAlignBottom, rSize, 12);
            rX += rDX + 2 * rSize;
            PrintLines(cont, "Center / Bottom", rX, RepObj.rAlignCenter, rY, RepObj.rAlignBottom, rSize, 12);
            rX += rDX + 2 * rSize;
            PrintLines(cont, "Right / Bottom", rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, rSize, 12);
        }
Exemple #3
0
        private void AddCardToPage(MemoryStream s, double X, double Y, int rot = 90)
        {
            StaticContainer sc = new StaticContainer(64, 89);
            BrushProp       bp = new BrushProp(this, Color.FromArgb(21, 20, 22));
            BrushProp       bW = new BrushProp(this, Color.FromArgb(255, 255, 255));

            // Full Cover
            //page_Cur.AddAlignedMM(X, RepObj.rAlignCenter, Y, RepObj.rAlignCenter, new RepRectMM(bp, 89, 64));
            // Image
            page_Cur.AddMM(X, Y, sc);
            sc.RotateTransform(rot);
            Bitmap m = new Bitmap(Image.FromStream(s));
            Color  v = m.GetPixel(20, 20);

            sc.AddAlignedMM(0, RepObj.rAlignCenter, 0, RepObj.rAlignCenter, new RepImageMM(s, 63, 88));
            if (v.R < 40 && v.G < 40 && v.B < 40)
            {
                // Cover Corners
                // Left
                page_Cur.AddAlignedMM(X - 44.5, RepObj.rAlignLeft, Y, RepObj.rAlignCenter, new RepRectMM(bp, 1.5, 64));
                // Right
                page_Cur.AddAlignedMM(X + 44.5, RepObj.rAlignRight, Y, RepObj.rAlignCenter, new RepRectMM(bp, 1.5, 64));
                // Top
                page_Cur.AddAlignedMM(X, RepObj.rAlignCenter, Y - 32, RepObj.rAlignTop, new RepRectMM(bp, 89, 1.5));
                // Bottom
                page_Cur.AddAlignedMM(X, RepObj.rAlignCenter, Y + 32, RepObj.rAlignBottom, new RepRectMM(bp, 89, 1.5));
            }
        }
Exemple #4
0
        private void DoMarriage()
        {
            Log.Debug("Marrying " + this.SelectedNpc);
            if (this.SelectedNpc == null)
            {
                return;
            }

            foreach (var player in Game1.getAllFarmers())
            {
                if (player.spouse == this.SelectedNpc)
                {
                    Game1.addHUDMessage(new HUDMessage(I18n.SpouseTaken()));
                    this.SelectedContainer.OutlineColor = null;
                    this.SelectedContainer = null;
                    this.SelectedNpc       = null;
                    return;
                }
            }

            if (!Game1.IsMasterGame)
            {
                Mod.Instance.Helper.Multiplayer.SendMessage(new DoMarriageMessage {
                    NpcName = this.SelectedNpc
                }, nameof(DoMarriageMessage), new[] { Mod.Instance.ModManifest.UniqueID } /*, new long[] { Game1.MasterPlayer.UniqueMultiplayerID }*/);
            }

            Mod.DoMarriage(Game1.player, this.SelectedNpc, true);
            //Game1.addHUDMessage( new HUDMessage( Mod.instance.Helper.Translation.Get( "married" ) ) );

            this.SelectedContainer.OutlineColor = null;
            this.SelectedContainer = null;
            this.SelectedNpc       = null;
            Game1.exitActiveMenu();
        }
Exemple #5
0
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            BootsrapperMessageAction?.Invoke("Register Types");
            //Register TypesContainer that represent IUnityContainer
            containerRegistry.RegisterSingleton <ITypesContainer, TypesContainer>();
            containerRegistry.RegisterSingleton <IMainMenuService, MainMenuService>();
            containerRegistry.RegisterSingleton <IFlyoutService, FlyoutService>();

            StaticContainer.SetContainer(Container.Resolve <ITypesContainer>());
            containerRegistry.RegisterInstance(DialogCoordinator.Instance);
            containerRegistry.Register <IDeviceDefinitionViewModel, DeviceDefinitionViewModel>();
            containerRegistry.RegisterInstance <IApplicationSettingsService>(new ApplicationSettingsService());
            containerRegistry.RegisterInstance(new ShellSettingsViewModel(StaticContainer.Container));
            containerRegistry.Register <RecentProjectsViewModelFactory>();
            //регистрация вью-моделей
            containerRegistry.Register <Views.Shell>();
            //StaticContainer.Container.RegisterViewModel<Views.Shell, ShellViewModel>();
            StaticContainer.Container.RegisterViewModel <ShellSettingsFlyOut, ShellSettingsViewModel>();
            containerRegistry.RegisterInstance(new DynamicMainMenuViewModel());
            containerRegistry.RegisterInstance(typeof(IGlobalEventManager), new GlobalEventManager(Container.Resolve <IEventAggregator>()));

            StaticContainer.Container.Register <ShellViewModel>(true);


            //модули
            RegisterModuleCatalogs(StaticContainer.Container);
            InitializeUnityModules();
        }
 public void CanGetContainsCustomId()
 {
     Assert.IsTrue(StaticContainer.ContainsCustomId <TestEmptyClass>(DEFAULT_ID));
     Assert.IsTrue(StaticContainer.ContainsCustomId <TestEmptyClass>(CUSTOM_ID));
     Assert.IsTrue(StaticContainer.ContainsCustomId <TestEmptyClass>(PROTOTYPE_ID));
     Assert.IsFalse(StaticContainer.ContainsCustomId <TestStruct>(DEFAULT_ID));
     Assert.IsTrue(StaticContainer.ContainsCustomId <TestStruct>(CUSTOM_ID));
 }
Exemple #7
0
 //----------------------------------------------------------------------------------------------------x
 /// <summary>Prints the specified number of lines.</summary>
 private void PrintLines(StaticContainer cont, String sLabel, Double rX, Double rAlignH, Double rY, Double rAlignV, Double rSize, Int32 iCount)
 {
     cont.AddCB_MM(rX, rY - rSize, new RepString(fontProp_Label, sLabel));
     cont.AddCC_MM(rX, rY, new RepCircleMM(penProp_Symbol, 3));
     for (Int32 i = 0; i < iCount; i++)
     {
         penProp_Line.color = aColor[i];
         RepLine repLine = new RepLineMM(penProp_Line, rSize / 1.414, rSize / 1.414);
         repLine.RotateTransform(i * 30);
         cont.AddAlignedMM(rX, rAlignH, rY, rAlignV, repLine);
     }
 }
        public void CanNewInstance()
        {
            TestClassWithConstructor objWithDefaultSingleton = StaticContainer.NewInstance <TestClassWithConstructor>();

            Assert.IsNotNull(objWithDefaultSingleton);
            Assert.AreSame(DEFAULT_EMPTY_CLASS, objWithDefaultSingleton.TestEmptyCls);

            TestClassWithCustomConstructor objWithCustomSingleton = StaticContainer.NewInstance <TestClassWithCustomConstructor>();

            Assert.IsNotNull(objWithCustomSingleton);
            Assert.AreSame(CUSTOM_EMPTY_CLASS, objWithCustomSingleton.TestEmptyCls);
        }
        public static void StaticInstantiation()
        {
            StaticContainer.Instantiate();
            StaticContainer.BindNewInstance <Weapon, HeroDefaultWeapon>();
            StaticContainer.BindNewInstance <Armor, HeroDefaultArmor>();
            StaticContainer.BindNewInstance <Character, Hero>();

            Hero hero = (Hero)StaticContainer.Get <Character>("hero");

            Console.WriteLine(string.Format("This hero has weapon with atk = {0} and armor with def = {1}.", hero.Weapon.Atk, hero.Armor.Def));

            StaticContainer.Dispose();
        }
        public void CanBind()
        {
            TestStruct testStruct;

            testStruct.idx   = 668;
            testStruct.value = 4672;

            StaticContainer.Bind <TestEmptyClass>(DEFAULT_EMPTY_CLASS);
            StaticContainer.Bind <TestEmptyClass>(CUSTOM_EMPTY_CLASS, CUSTOM_ID);
            StaticContainer.Bind <TestEmptyClass>(PROTOTYPE_EMPTY_CLASS, InstantiationType.PROTOTYPE, PROTOTYPE_ID);
            StaticContainer.Bind <TestStruct>(testStruct, CUSTOM_ID);
            StaticContainer.Bind <TestEmptyClass>(EMPTY_CHILD_CLASS, SUBCLASS_ID);
        }
Exemple #11
0
        //----------------------------------------------------------------------------------------------------
        #region Test RepLine
        //----------------------------------------------------------------------------------------------------

        /// <summary>Creates this document</summary>
        private void TestRepLine()
        {
            new Page(this);

            page_Cur.AddCT_MM(page_Cur.rWidthMM / 2, rMarginT, new RepString(fontProp_Title, "Line Test"));

            StaticContainer cont1 = new StaticContainer(170, 170);

            cont1.RotateTransform(10);
            page_Cur.AddMM(rMarginL + 20, rMarginT + 10, cont1);

            StaticContainer cont2 = new StaticContainer(170, 170);

            cont2.RotateTransform(-10);
            cont1.AddMM(0, 0, cont2);

            PrintLines(cont2);
        }
        public void CanGet()
        {
            TestEmptyClass defaultSingleton = StaticContainer.Get <TestEmptyClass>();

            Assert.AreSame(DEFAULT_EMPTY_CLASS, defaultSingleton);

            TestEmptyClass customSingleton = StaticContainer.Get <TestEmptyClass>(CUSTOM_ID);

            Assert.AreSame(CUSTOM_EMPTY_CLASS, customSingleton);

            TestEmptyClass prototype = StaticContainer.Get <TestEmptyClass>(PROTOTYPE_ID);

            Assert.AreNotSame(PROTOTYPE_EMPTY_CLASS, prototype);
            Assert.AreEqual(typeof(TestEmptyClass), prototype.GetType());

            TestEmptyChildClass childClass = (TestEmptyChildClass)StaticContainer.Get <TestEmptyClass>(SUBCLASS_ID);

            Assert.AreSame(EMPTY_CHILD_CLASS, childClass);
        }
Exemple #13
0
        public CustomCropMenu()
            : base((Game1.uiViewport.Width - WIDTH) / 2, (Game1.uiViewport.Height - HEIGHT) / 2, WIDTH, HEIGHT)
        {
            ui = new RootElement();
            ui.LocalPosition = new Microsoft.Xna.Framework.Vector2(xPositionOnScreen, yPositionOnScreen);

            seedSlot = new ItemSlot()
            {
                ItemDisplay            = new DummyItem(I18n.Menu_Seeds_Name(), I18n.Menu_Seeds_Description(), Game1.objectSpriteSheet, Game1.getSourceRectForStandardTileSheet(Game1.objectSpriteSheet, 472, 16, 16)),
                TransparentItemDisplay = true,
            };
            seedSlot.LocalPosition = new(0, (HEIGHT - seedSlot.Height) / 2 - 125);
            seedSlot.UserData      = (Func <Item, bool>)((item) => (item is StardewValley.Object sobj && sobj.Category == StardewValley.Object.SeedsCategory));

            stuff = new StaticContainer()
            {
                LocalPosition = new((WIDTH - seedSlot.Width) / 2, 0),
            };
            stuff.AddChild(seedSlot);
            ui.AddChild(stuff);

            var statsLebel = new Label()
            {
                String        = I18n.Stats(),
                LocalPosition = new((WIDTH - seedSlot.Width) / 2 + seedSlot.Width, 8),
            };

            statsLebel.LocalPosition = new(statsLebel.LocalPosition.X - statsLebel.Measure().X / 2, statsLebel.LocalPosition.Y);
            stuff.AddChild(statsLebel);

            stuff.AddChild(growthLabel = new Label()
            {
                String         = I18n.Stats_Growth(0),
                LocalPosition  = new(150, statsLebel.LocalPosition.Y + statsLebel.Measure().Y + 16),
                HoverTextColor = Color.Red,
                IdleTextColor  = Color.Red,
                NonBoldScale   = 0.5f,
                NonBoldShadow  = false,
            });
Exemple #14
0
        private void DoMarriage()
        {
            Log.debug("Marrying " + selectedNPC);
            if (selectedNPC == null)
            {
                return;
            }

            foreach (var player in Game1.getAllFarmers())
            {
                if (player.spouse == selectedNPC)
                {
                    Game1.addHUDMessage(new HUDMessage(Mod.instance.Helper.Translation.Get("spouse-taken")));
                    selectedContainer.OutlineColor = null;
                    selectedContainer = null;
                    selectedNPC       = null;
                    return;
                }
            }

            if (!Game1.IsMasterGame)
            {
                Mod.instance.Helper.Multiplayer.SendMessage(new DoMarriageMessage()
                {
                    NpcName = selectedNPC
                }, nameof(DoMarriageMessage), new string[] { Mod.instance.ModManifest.UniqueID } /*, new long[] { Game1.MasterPlayer.UniqueMultiplayerID }*/);
            }

            Mod.DoMarriage(Game1.player, selectedNPC, true);
            //Game1.addHUDMessage( new HUDMessage( Mod.instance.Helper.Translation.Get( "married" ) ) );

            selectedContainer.OutlineColor = null;
            selectedContainer = null;
            selectedNPC       = null;
            Game1.exitActiveMenu();
        }
Exemple #15
0
 private void Start()
 {
     _aimingController = (AimingController)StaticContainer.Get(typeof(AimingController));
 }
Exemple #16
0
        public MarryMenu()
            : base((Game1.uiViewport.Width - 800) / 2, (Game1.uiViewport.Height - 700) / 2, 800, 700)
        {
            var valid = new List <NPC>();

            foreach (var npc in Utility.getAllCharacters())
            {
                if (npc.datable.Value && npc.getSpouse() == null)
                {
                    valid.Add(npc);
                }
            }

            valid.Sort((a, b) => a.Name.CompareTo(b.Name));

            /*
             * for ( int i = 0; i < valid.Count; ++i )
             * {
             *  int oi = Game1.random.Next( valid.Count );
             *  var other = valid[ oi ];
             *  valid[ oi ] = valid[ i ];
             *  valid[ i ] = other;
             * }
             */

            this.Ui = new RootElement
            {
                LocalPosition = new Vector2(this.xPositionOnScreen, this.yPositionOnScreen)
            };

            var title = new Label
            {
                String = I18n.Menu_Title(),
                Bold   = true
            };

            title.LocalPosition = new Vector2((800 - title.Measure().X) / 2, 10);
            this.Ui.AddChild(title);

            this.Ui.AddChild(new Label
            {
                String        = I18n.Menu_Text(),
                LocalPosition = new Vector2(50, 75),
                NonBoldScale  = 0.75f,
                NonBoldShadow = false
            });

            this.Table = new Table
            {
                RowHeight     = 200,
                Size          = new Vector2(700, 500),
                LocalPosition = new Vector2(50, 225)
            };
            for (int row = 0; row < (valid.Count + 2) / 3; ++row)
            {
                var rowContainer = new StaticContainer();
                for (int col = row * 3; col < (row + 1) * 3; ++col)
                {
                    if (col >= valid.Count)
                    {
                        continue;
                    }

                    var cont = new StaticContainer
                    {
                        Size          = new Vector2(115 * 2, 97 * 2),
                        LocalPosition = new Vector2(250 * (col - row * 3) - 10, 0)
                    };

                    // Note: This is being called 4 times for some reason
                    // Probably a UI framework bug.
                    string curNpcName = valid[col].Name; // avoid capturing the loop variable in the callback, since it'll change value
                    void SelCallback(Element e)
                    {
                        if (this.SelectedContainer != null)
                        {
                            this.SelectedContainer.OutlineColor = null;
                        }
                        this.SelectedContainer = cont;
                        this.SelectedContainer.OutlineColor = Color.Green;
                        this.SelectedNpc = curNpcName;
                        Log.Trace("Selected " + this.SelectedNpc);
                    }

                    cont.AddChild(new Image
                    {
                        Texture          = Game1.mouseCursors,
                        TexturePixelArea = new Rectangle(583, 411, 115, 97),
                        Scale            = 2,
                        LocalPosition    = new Vector2(0, 0),
                        Callback         = SelCallback
                    });
                    cont.AddChild(new Image
                    {
                        Texture          = valid[col].Portrait,
                        TexturePixelArea = new Rectangle(0, 128, 64, 64),
                        Scale            = 2,
                        LocalPosition    = new Vector2(50, 16)
                    });
                    var name = new Label
                    {
                        String        = valid[col].displayName,
                        NonBoldScale  = 0.5f,
                        NonBoldShadow = false
                    };
                    name.LocalPosition = new Vector2(115 - name.Measure().X / 2, 160);
                    cont.AddChild(name);

                    rowContainer.AddChild(cont);
                }
                this.Table.AddRow(new Element[] { rowContainer });
            }
            this.Ui.AddChild(this.Table);

            this.Ui.AddChild(new Label
            {
                String        = I18n.Menu_Button_Cancel(),
                LocalPosition = new Vector2(175, 650),
                Callback      = e => Game1.exitActiveMenu()
            });
            this.Ui.AddChild(new Label
            {
                String        = I18n.Menu_Button_Accept(),
                LocalPosition = new Vector2(500, 650),
                Callback      = e => this.DoMarriage()
            });
        }
Exemple #17
0
 private void Start()
 {
     _inputController = (Joystick)StaticContainer.Get(typeof(Joystick));
     _animator        = GetComponent <IAnimator>();
     _direction       = Vector3.zero;
 }
 private void Awake()
 {
     StaticContainer.Add(typeof(CameraControl), this);
 }
Exemple #19
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Creates this report</summary>
        protected override void Create()
        {
            FontDef  fd       = new FontDef(this, FontDef.StandardFont.Helvetica);
            FontProp fp       = new FontPropMM(fd, 3);
            FontProp fp_Title = new FontPropMM(fd, 20);

            fp_Title.bBold = true;
            FontProp  fp_Small = new FontPropMM(fd, 1.3);
            PenProp   pp       = new PenPropMM(this, 0.2, Color.Blue);
            BrushProp bp       = new BrushProp(this, Color.FromArgb(240, 240, 240));

            #region Page 1
            Page page = new Page(this);
            page.AddCB_MM(40, new RepString(fp_Title, "Text Sample"));
            fp_Title.rSizeMM     = 4;
            fp_Title.rLineFeedMM = 8;

            // font sample
            Double rX = 20;
            Double rY = 60;
            page.AddMM(rX, rY, new RepString(fp_Title, "Fonts"));
            rY += fp_Title.rLineFeedMM;
            FontDef[] aFontDef = { new FontDef(this, FontDef.StandardFont.Courier), fd, new FontDef(this, FontDef.StandardFont.TimesRoman) };
            foreach (FontDef fontDef in aFontDef)
            {
                FontProp fp_Test = new FontPropMM(fontDef, 2.8);
                page.AddMM(rX, rY, new RepString(fp_Test, fontDef.sFontName));
                fp_Test.bBold = true;
                page.AddMM(rX + 30, rY, new RepString(fp_Test, fontDef.sFontName + " Bold"));
                fp_Test.bBold   = false;
                fp_Test.bItalic = true;
                page.AddMM(rX + 72, rY, new RepString(fp_Test, fontDef.sFontName + " Italic"));
                fp_Test.bItalic    = false;
                fp_Test.bUnderline = true;
                page.AddMM(rX + 120, rY, new RepString(fp_Test, fontDef.sFontName + " Underline"));
                rY += fp.rLineFeedMM;
            }

            rY      += 3;
            aFontDef = new FontDef[] { new FontDef(this, "Symbol"), new FontDef(this, "ZapfDingbats") };
            foreach (FontDef fontDef in aFontDef)
            {
                FontProp fp_Test = new FontPropMM(fontDef, 3);
                page.AddMM(rX, rY, new RepString(fp, fontDef.sFontName));
                page.AddMM(rX + 30, rY, new RepString(fp_Test, "ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
                rY += fp.rLineFeedMM;
            }
            rY += 10;

            // Int32 sample
            rX = 20;
            Double rYcopy = rY;
            page.AddMM(rX, rY, new RepString(fp_Title, "Int32 Values"));
            rY += fp_Title.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "no format string"));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, 12345));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"0000000\""));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, 12345, "0000000"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#,#\""));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, 12345, "$#,#"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#;($#);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, 12345, "$#;($#);Zero"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#;($#);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, -12345, "$#;($#);Zero"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#;($#);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepInt32(fp, 0, "$#;($#);Zero"));

            // Single / Double sample
            rX = 115;
            rY = rYcopy;
            page.AddMM(rX, rY, new RepString(fp_Title, "Single / Double Values"));
            rY += fp_Title.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "no format string"));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, 123.456));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"0.0000\""));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, 123.456, "0.0000"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#,#0.00\""));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, 123.456, "$#,#0.00"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#.0;($#.0);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, 123.456, "$#.0;($#.0);Zero"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#.0;($#.0);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, -123.456, "$#.0;($#.0);Zero"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"$#.0;($#.0);Zero\""));
            page.AddRightMM(rX + 80, rY, new RepReal64(fp, 0, "$#.0;($#.0);Zero"));
            rY += fp.rLineFeedMM + 10;

            // DateTime sample
            rX     = 20;
            rYcopy = rY;
            page.AddMM(rX, rY, new RepString(fp_Title, "DateTime Values"));
            rY += fp_Title.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "no format string"));
            page.AddRightMM(rX + 80, rY, new RepDateTime(fp, DateTime.Now));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"D\""));
            page.AddRightMM(rX + 80, rY, new RepDateTime(fp, DateTime.Now, "D"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"t\""));
            page.AddRightMM(rX + 80, rY, new RepDateTime(fp, DateTime.Now, "t"));
            rY += fp.rLineFeedMM;
            page.AddMM(rX, rY, new RepString(fp, "format \"dd.MM.yyyy\""));
            page.AddRightMM(rX + 80, rY, new RepDateTime(fp, DateTime.Now, "dd.MM.yyyy"));

            // color sample
            StaticContainer sc = new StaticContainer(RT.rPointFromMM(100), RT.rPointFromMM(100));
            page.AddMM(115, rYcopy + 5, sc);
            sc.RotateTransform(-8);
            sc.AddAlignedMM(-2, RepObj.rAlignLeft, -6, RepObj.rAlignTop, new RepRectMM(bp, 85, 33));
            rY = 0;
            sc.AddMM(0, rY, new RepString(fp_Title, "Colors"));
            rY += fp_Title.rLineFeedMM;
            sc.AddMM(0, rY, new RepString(fp, "Red"));
            fp.color = Color.Red;  fp.bUnderline = true;
            sc.AddRightMM(80, rY, new RepString(fp, "ABCDEFGHIJKLM"));
            fp.color = Color.Black;  fp.bUnderline = false;
            rY      += fp.rLineFeedMM;
            sc.AddMM(0, rY, new RepString(fp, "Green"));
            fp.color = Color.Green;  fp.bUnderline = true;
            sc.AddRightMM(80, rY, new RepString(fp, "ABCDEFGHIJKLM"));
            fp.color = Color.Black;  fp.bUnderline = false;
            rY      += fp.rLineFeedMM;
            sc.AddMM(0, rY, new RepString(fp, "Blue"));
            fp.color = Color.Blue;  fp.bUnderline = true;
            sc.AddRightMM(80, rY, new RepString(fp, "ABCDEFGHIJKLM"));
            fp.color = Color.Black;  fp.bUnderline = false;
            rY      += fp.rLineFeedMM;
            sc.AddMM(0, rY, new RepString(fp, "RGB(255,180,255)"));
            fp.color = Color.FromArgb(200, 200, 255);  fp.bUnderline = true;
            sc.AddRightMM(80, rY, new RepString(fp, "ABCDEFGHIJKLM"));
            fp.color = Color.Black;  fp.bUnderline = false;
            rY      += rYcopy + fp.rLineFeedMM + 10;

            // alignment sample
            rX = 20;
            String s = "Alignment";
            page.AddMM(rX, rY, new RepString(fp_Title, s));
            Double rLengthMM = fp_Title.rGetTextWidthMM(s);
            page.AddMM(rX, rY + 3, new RepLineMM(pp, rLengthMM, 0));
            page.AddMM(rX, rY + 2, new RepLineMM(pp, 0, 2));
            page.AddMM(rX + rLengthMM, rY + 2, new RepLineMM(pp, 0, 2));
            page.AddAlignedMM(rX + rLengthMM / 2, RepObj.rAlignCenter, rY + 4, RepObj.rAlignTop, new RepReal64(fp_Small, rLengthMM, "0.0 mm"));
            rX  = 100;
            rY += fp_Title.rLineFeedMM;
            Double rD = 15;
            bp.color = Color.LightSkyBlue;
            page.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            page.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, new RepString(fp, "right - bottom"));
            page.AddAlignedMM(rX, RepObj.rAlignRight, rY + rD, RepObj.rAlignTop, new RepString(fp, "right - top"));
            page.AddMM(rX + rD, rY, new RepString(fp, "left - bottom")); // default
            page.AddAlignedMM(rX + rD, RepObj.rAlignLeft, rY + rD, RepObj.rAlignTop, new RepString(fp, "left - top"));
            page.AddAlignedMM(rX + rD / 2, RepObj.rAlignCenter, rY + rD / 2, RepObj.rAlignCenter, new RepString(fp, "center"));
            rY += 30;

            // rotated string
            rX = 60;
            page.AddMM(20, rY, new RepString(fp_Title, "Rotated Strings"));
            rY    += fp_Title.rLineFeedMM + 10;
            rYcopy = rY;
            rD     = 10;
            page.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            fp.rAngle = 45;
            page.AddAlignedMM(rX + rD, RepObj.rAlignLeft, rY + rD, RepObj.rAlignTop, new RepString(fp, "[45°]"));
            fp.rAngle = 135;
            page.AddMM(rX, rY + rD, new RepString(fp, "[135°]"));
            fp.rAngle = 225;
            page.AddAlignedMM(rX, RepObj.rAlignLeft, rY, RepObj.rAlignTop, new RepString(fp, "[225°]"));
            fp.rAngle = 315;
            page.AddMM(rX + rD, rY, new RepString(fp, "[315°]"));
            fp.rAngle = 0;

            rX            = 155;
            rY            = rYcopy;
            fp.bUnderline = true;
            page.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            fp.rAngle = 45;
            page.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, new RepString(fp, "1/4 * PI"));
            fp.rAngle = 135;
            page.AddAlignedMM(rX + rD, RepObj.rAlignRight, rY, RepObj.rAlignTop, new RepString(fp, "3/4 * PI"));
            fp.rAngle = 225;
            page.AddAlignedMM(rX + rD, RepObj.rAlignRight, rY + rD, RepObj.rAlignBottom, new RepString(fp, "5/4 * PI"));
            fp.rAngle = 315;
            page.AddAlignedMM(rX, RepObj.rAlignRight, rY + rD, RepObj.rAlignTop, new RepString(fp, "7/4 * PI"));
            fp.rAngle     = 0.0;
            fp.bUnderline = false;
            rY           += 35;
            #endregion

            #region Page 2
            rX = 20;
            rY = 60;
            String sText = "Once upon a time there was a miller who was poor, but he had a beautiful daughter." + Environment.NewLine +
                           "Now it happened that he was talking with the king one time, and in order to make himself seem important, " +
                           "he said to the king, \"I have a daughter who can spin straw into gold.\"";
            page = new Page(this);
            page.AddMM(rX, rY, new RepString(fp_Title, "Best Fitting Font"));
            rY += fp_Title.rLineFeedMM;

            page.AddLT_MM(rX, rY, new RepRectMM(bp, 80, 40));
            FontProp fp_BestFit = fp_Title.fontProp_GetBestFitMM(sText, 80, 40, 1);
            rY += fp_BestFit.rLineFeedMM;
            Int32 iStart = 0;
            while (iStart <= sText.Length)
            {
                String sLine = fp_BestFit.sGetTextLine(sText, RT.rPointFromMM(80), ref iStart, TextSplitMode.Line);
                page.AddMM(rX, rY, new RepString(fp_BestFit, sLine));
                rY += fp_BestFit.rLineFeedMM;
            }
            rY += 10;

            page.AddLT_MM(rX, rY, new RepRectMM(bp, 40, 40));
            fp_BestFit = fp.fontProp_GetBestFitMM(sText, 40, 40, 1);
            rY        += fp_BestFit.rLineFeedMM;
            iStart     = 0;
            while (iStart <= sText.Length)
            {
                String sLine = fp_BestFit.sGetTextLine(sText, RT.rPointFromMM(40), ref iStart, TextSplitMode.Line);
                page.AddMM(rX, rY, new RepString(fp_BestFit, sLine));
                rY += fp_BestFit.rLineFeedMM;
            }
            rY += 10;

            page.AddLT_MM(rX, rY, new RepRectMM(bp, 30, 30));
            fp_BestFit = fp.fontProp_GetBestFitMM(sText, 30, 30, 1);
            rY        += fp_BestFit.rLineFeedMM;
            iStart     = 0;
            while (iStart <= sText.Length)
            {
                String sLine = fp_BestFit.sGetTextLine(sText, RT.rPointFromMM(30), ref iStart, TextSplitMode.Line);
                page.AddMM(rX, rY, new RepString(fp_BestFit, sLine));
                rY += fp_BestFit.rLineFeedMM;
            }
            #endregion
        }
Exemple #20
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Creates this report</summary>
        protected override void Create()
        {
            FontDef  fd       = new FontDef(this, FontDef.StandardFont.Helvetica);
            FontProp fp       = new FontPropMM(fd, 2.1);
            FontProp fp_Title = new FontPropMM(fd, 15);

            fp_Title.bBold = true;
            FontProp fp_SubTitle = new FontPropMM(fd, 4);

            fp_SubTitle.bBold = true;
            BrushProp bp       = new BrushProp(this, Color.LightGray);
            PenProp   pp       = new PenProp(this, 0.2, Color.FromArgb(235, 235, 235));
            PenProp   pp_Black = new PenProp(this, 0.2, Color.Black);
            Double    rY       = 40;

            new Page(this);
            page_Cur.AddCB_MM(rY, new RepString(fp_Title, "Image Sample"));

            System.IO.Stream stream = GetType().Assembly.GetManifestResourceStream("ReportSamples.Image.jpg");

            page_Cur.AddMM(20, 90, new RepImageMM(stream, 40, Double.NaN));
            page_Cur.AddMM(20, 95, new RepString(fp, "W = 40mm, H = auto."));
            page_Cur.AddMM(67, 90, new RepImageMM(stream, 40, 20));
            page_Cur.AddMM(67, 95, new RepString(fp, "W = 40mm, H = 20mm"));
            page_Cur.AddMM(114, 90, new RepImageMM(stream, Double.NaN, 30));
            page_Cur.AddMM(114, 95, new RepString(fp, "W = auto., H = 30mm"));
            page_Cur.AddMM(161, 90, new RepImageMM(stream, 30, 30));
            page_Cur.AddMM(161, 95, new RepString(fp, "W = 30mm, H = 30mm"));
            rY += 150;

            // adjust the size of a bounding rectangle
            RepRect dr = new RepRectMM(bp, 80, 60);

            page_Cur.AddMM(20, rY, dr);
            RepImage di = new RepImageMM(stream, 70, Double.NaN);

            page_Cur.AddMM(25, rY - 5, di);
            dr.rHeightMM = di.rHeightMM + 10;

            // rotated image
            di = new RepImageMM(stream, 40, 30);
            di.RotateTransform(-15);
            page_Cur.AddMM(120, rY - 33, di);

            // rotated image with rectangle
            StaticContainer sc = new StaticContainer(RT.rPointFromMM(45), RT.rPointFromMM(35));

            page_Cur.AddMM(145, rY - 35, sc);
            sc.RotateTransform(15);
//      sc.AddMM(0, 35, new RepRectMM(bp, 45, 35));
            sc.AddMM(1.25, 33.75, new RepLineMM(pp, 42.5, 0));
            sc.AddMM(1.25, 1.25, new RepLineMM(pp, 42.5, 0));
            sc.AddAlignedMM(22.5, RepObj.rAlignCenter, 17.5, RepObj.rAlignCenter, new RepImageMM(stream, 40, 30));
            rY += 30;

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            // alignment sample
            page_Cur.AddMM(20, rY, new RepString(fp_SubTitle, "Alignment"));
            rY += 18;
            Int32  rX = 40;
            Double rD = 20;

            bp.color = Color.DarkSalmon;
            page_Cur.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY + rD, RepObj.rAlignTop, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddMM(rX + rD, rY, new RepImageMM(stream, 20, Double.NaN)); // default
            page_Cur.AddAlignedMM(rX + rD, RepObj.rAlignLeft, rY + rD, RepObj.rAlignTop, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddAlignedMM(rX + rD / 2, RepObj.rAlignCenter, rY + rD / 2, RepObj.rAlignCenter, new RepImageMM(stream, 10, Double.NaN));

            // rotated
            rX = 140;
            page_Cur.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            RepImage repImage = new RepImageMM(stream, 20, Double.NaN);

            repImage.RotateTransform(15);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, repImage);
            repImage = new RepImageMM(stream, 20, Double.NaN);
            repImage.RotateTransform(15);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY + rD, RepObj.rAlignTop, repImage);
            repImage = new RepImageMM(stream, 20, Double.NaN);
            repImage.RotateTransform(15);
            page_Cur.AddMM(rX + rD, rY, repImage); // default
            repImage = new RepImageMM(stream, 20, Double.NaN);
            repImage.RotateTransform(15);
            page_Cur.AddAlignedMM(rX + rD, RepObj.rAlignLeft, rY + rD, RepObj.rAlignTop, repImage);
            repImage = new RepImageMM(stream, 10, Double.NaN);
            repImage.RotateTransform(15);
            page_Cur.AddAlignedMM(rX + rD / 2, RepObj.rAlignCenter, rY + rD / 2, RepObj.rAlignCenter, repImage);

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            new Page(this);
            rY = 30;

            page_Cur.AddCB_MM(rY, new RepString(fp_Title, "Ellipse Sample"));
            rY += 15;

            // arc
            page_Cur.AddLT_MM(20, rY, new RepString(fp_SubTitle, "Arc"));
            page_Cur.AddLT_MM(50, rY, new RepRectMM(pp_Black, 40, 30));
            page_Cur.AddLT_MM(50, rY, new RepArcMM(pp_Black, 40, 30, 45, 270));
            page_Cur.AddLT_MM(100, rY, new RepArcMM(pp_Black, 15, 135, 270));
            page_Cur.AddLT_MM(150, rY, new RepArcMM(pp_Black, 40, 30, 150, 130));
            rY += 35;

            // circle
            page_Cur.AddLT_MM(20, rY, new RepString(fp_SubTitle, "Circle"));
            page_Cur.AddLT_MM(50, rY, new RepRectMM(pp_Black, 30, 30));
            page_Cur.AddLT_MM(50, rY, new RepCircleMM(pp_Black, bp, 15));
            page_Cur.AddLT_MM(100, rY, new RepCircleMM(pp_Black, 15));
            page_Cur.AddLT_MM(150, rY, new RepCircleMM(bp, 15));
            rY += 35;

            // ellipse
            page_Cur.AddLT_MM(20, rY, new RepString(fp_SubTitle, "Ellipse"));
            page_Cur.AddLT_MM(50, rY, new RepRectMM(pp_Black, 40, 30));
            page_Cur.AddLT_MM(50, rY, new RepEllipseMM(pp_Black, bp, 40, 30));
            page_Cur.AddLT_MM(100, rY, new RepEllipseMM(pp_Black, 40, 30));
            page_Cur.AddLT_MM(150, rY, new RepEllipseMM(bp, 40, 30));
            rY += 35;

            // pie ellipse
            page_Cur.AddLT_MM(20, rY, new RepString(fp_SubTitle, "Pie Ellipse"));
            page_Cur.AddLT_MM(50, rY, new RepRectMM(pp_Black, 40, 30));
            page_Cur.AddLT_MM(50, rY, new RepPieMM(pp_Black, bp, 40, 30, -135, 225));
            page_Cur.AddLT_MM(100, rY, new RepPieMM(pp_Black, 40, 30, 45, 270));
            page_Cur.AddLT_MM(150, rY, new RepPieMM(bp, 40, 30, 135, 225));
            rY += 35;

            // pie circle
            page_Cur.AddLT_MM(20, rY, new RepString(fp_SubTitle, "Pie Circle"));
            page_Cur.AddLT_MM(50, rY, new RepRectMM(pp_Black, 30, 30));
            page_Cur.AddLT_MM(50, rY, new RepPieMM(pp_Black, bp, 15, -135, 225));
            page_Cur.AddLT_MM(100, rY, new RepPieMM(pp_Black, 15, 45, 270));
            page_Cur.AddLT_MM(150, rY, new RepPieMM(bp, 15, 135, 225));
            rY += 45;

            // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            // Pie alignment sample
            page_Cur.AddMM(20, rY, new RepString(fp_SubTitle, "Pie Alignment"));
            page_Cur.AddMM(105, rY, new RepString(fp_SubTitle, "rotated 30°"));
            rY      += 25;
            rX       = 50;
            rD       = 20;
            bp.color = Color.DarkSalmon;
            page_Cur.AddAlignedMM(rX, RepObj.rAlignCenter, rY, RepObj.rAlignCenter, new RepRectMM(bp, rD, rD));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, new RepPieMM(pp_Black, bp, rD, rD, 100, 250));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignTop, new RepPieMM(pp_Black, bp, rD, rD, 10, 250));
            page_Cur.AddMM(rX, rY, new RepPieMM(pp_Black, bp, rD, rD, 190, 250)); // default
            page_Cur.AddAlignedMM(rX, RepObj.rAlignLeft, rY, RepObj.rAlignTop, new RepPieMM(pp_Black, bp, rD, rD, -80, 250));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignCenter, rY, RepObj.rAlignCenter, new RepCircleMM(pp_Black, bp, rD / 2));

            rX = 150;
            page_Cur.AddAlignedMM(rX, RepObj.rAlignCenter, rY, RepObj.rAlignCenter, new RepRectMM(bp, rD, rD));

            RepPie pie = new RepPieMM(pp_Black, bp, rD, rD, 100, 250);

            pie.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, pie);
            RepRect rect = new RepRectMM(pp_Black, rD, rD);

            rect.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, rect);

            pie = new RepPieMM(pp_Black, bp, rD, rD, 10, 250);
            pie.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignTop, pie);
            rect = new RepRectMM(pp_Black, rD, rD);
            rect.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignTop, rect);

            pie = new RepPieMM(pp_Black, bp, rD, rD, 190, 250);
            pie.RotateTransform(30);
            page_Cur.AddMM(rX, rY, pie); // default
            rect = new RepRectMM(pp_Black, rD, rD);
            rect.RotateTransform(30);
            page_Cur.AddMM(rX, rY, rect);

            pie = new RepPieMM(pp_Black, bp, rD, rD, -80, 250);
            pie.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignLeft, rY, RepObj.rAlignTop, pie);
            rect = new RepRectMM(pp_Black, rD, rD);
            rect.RotateTransform(30);
            page_Cur.AddAlignedMM(rX, RepObj.rAlignLeft, rY, RepObj.rAlignTop, rect);

            page_Cur.AddAlignedMM(rX, RepObj.rAlignCenter, rY, RepObj.rAlignCenter, new RepCircleMM(pp_Black, bp, rD / 2));
        }
 public void CanGetIsManagedType()
 {
     Assert.IsTrue(StaticContainer.IsManagedType <TestEmptyClass>());
     Assert.IsTrue(StaticContainer.IsManagedType <TestStruct>());
     Assert.IsFalse(StaticContainer.IsManagedType <int>());
 }
 private void Start()
 {
     _cameraControl = (CameraControl)StaticContainer.Get(typeof(CameraControl));
     _cameraControl.SetTarget(_player.transform);
 }
 public void CanInstantiate()
 {
     StaticContainer.Instantiate();
     Assert.IsTrue(StaticContainer.IsInstantiated);
 }
        protected override void Create()
        {
            FontDef  fd       = new FontDef(this, "Arial");
            FontProp fp       = new FontPropMM(fd, 2.1);
            FontProp fp_Title = new FontPropMM(fd, 18);

            fp_Title.bBold = true;
            BrushProp bp = new BrushProp(this, System.Drawing.Color.LightGray);
            PenProp   pp = new PenProp(this, 0.2, Color.FromArgb(235, 235, 235));

            new Page(this);
            Double rY = 40;

            //exception
            page_Cur.AddCenteredMM(rY, new RepString(fp_Title, "Image Sample"));
            fp_Title.rSizeMM = 4;

            System.IO.Stream stream = GetType().Assembly.GetManifestResourceStream("ReportSamples.Image.jpg");

            page_Cur.AddMM(20, 90, new RepImageMM(stream, 40, Double.NaN));
            page_Cur.AddMM(20, 95, new RepString(fp, "W = 40mm, H = auto."));
            page_Cur.AddMM(67, 90, new RepImageMM(stream, 40, 20));
            page_Cur.AddMM(67, 95, new RepString(fp, "W = 40mm, H = 20mm"));
            page_Cur.AddMM(114, 90, new RepImageMM(stream, Double.NaN, 30));
            page_Cur.AddMM(114, 95, new RepString(fp, "W = auto., H = 30mm"));
            page_Cur.AddMM(161, 90, new RepImageMM(stream, 30, 30));
            page_Cur.AddMM(161, 95, new RepString(fp, "W = 30mm, H = 30mm"));
            rY += 150;

            // adjust the size of a bounding rectangle
            RepRect dr = new RepRectMM(bp, 80, 60);

            page_Cur.AddMM(20, rY, dr);
            RepImage di = new RepImageMM(stream, 70, Double.NaN);

            page_Cur.AddMM(25, rY - 5, di);
            dr.rHeightMM = di.rHeightMM + 10;

            // rotated image
            di = new RepImageMM(stream, 40, 30);
            di.RotateTransform(-15);
            page_Cur.AddMM(120, rY - 33, di);

            // rotated image with rectangle
            StaticContainer sc = new StaticContainer(RT.rMM(45), RT.rMM(35));

            page_Cur.AddMM(145, rY - 35, sc);
            sc.RotateTransform(15);
            sc.AddMM(0, 35, new RepRectMM(bp, 45, 35));
            sc.AddMM(1.25, 33.75, new RepLineMM(pp, 42.5, 0));
            sc.AddMM(1.25, 1.25, new RepLineMM(pp, 42.5, 0));
            sc.AddAlignedMM(22.5, RepObj.rAlignCenter, 17.5, RepObj.rAlignCenter, new RepImageMM(stream, 40, 30));
            rY += 30;

            // alignment sample
            page_Cur.AddMM(20, rY, new RepString(fp_Title, "Alignment"));
            rY += 18;
            Int32  rX = 100;
            Double rD = 20;

            bp.color = Color.DarkSalmon;
            page_Cur.AddMM(rX, rY + rD, new RepRectMM(bp, rD, rD));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY, RepObj.rAlignBottom, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddAlignedMM(rX, RepObj.rAlignRight, rY + rD, RepObj.rAlignTop, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddMM(rX + rD, rY, new RepImageMM(stream, 20, Double.NaN));  // default
            page_Cur.AddAlignedMM(rX + rD, RepObj.rAlignLeft, rY + rD, RepObj.rAlignTop, new RepImageMM(stream, 20, Double.NaN));
            page_Cur.AddAlignedMM(rX + rD / 2, RepObj.rAlignCenter, rY + rD / 2, RepObj.rAlignCenter, new RepImageMM(stream, 10, Double.NaN));
        }
Exemple #25
0
 private void Awake()
 {
     StaticContainer.Add(typeof(Joystick), this);
 }
 private void Start()
 {
     _aimingController = (AimingController)StaticContainer.Get(typeof(AimingController));
     _animator         = GetComponent <IAnimator>();
 }
 public void CanDispose()
 {
     StaticContainer.Dispose();
     Assert.IsFalse(StaticContainer.IsInstantiated);
 }
 private void Awake()
 {
     StaticContainer.Add(typeof(AimingController), this);
 }
Exemple #29
0
        public MarryMenu()
            : base((Game1.uiViewport.Width - 800) / 2, (Game1.uiViewport.Height - 700) / 2, 800, 700)
        {
            var valid = new List <NPC>();

            foreach (var npc in Utility.getAllCharacters())
            {
                if (npc.datable.Value && npc.getSpouse() == null)
                {
                    valid.Add(npc);
                }
            }

            valid.Sort((a, b) => a.Name.CompareTo(b.Name));

            /*
             * for ( int i = 0; i < valid.Count; ++i )
             * {
             *  int oi = Game1.random.Next( valid.Count );
             *  var other = valid[ oi ];
             *  valid[ oi ] = valid[ i ];
             *  valid[ i ] = other;
             * }
             */

            ui = new RootElement()
            {
                LocalPosition = new Vector2(xPositionOnScreen, yPositionOnScreen),
            };

            var title = new Label()
            {
                String = Mod.instance.Helper.Translation.Get("menu.title"),
                Bold   = true,
            };

            title.LocalPosition = new Vector2((800 - title.Measure().X) / 2, 10);
            ui.AddChild(title);

            ui.AddChild(new Label()
            {
                String        = Mod.instance.Helper.Translation.Get("menu.text").ToString().Replace("\\n", "\n"),
                LocalPosition = new Vector2(50, 75),
                NonBoldScale  = 0.75f,
                NonBoldShadow = false,
            });

            table = new Table()
            {
                RowHeight     = 200,
                Size          = new Vector2(700, 500),
                LocalPosition = new Vector2(50, 225),
            };
            for (int i = 0; i < (valid.Count + 2) / 3; ++i)
            {
                var row = new StaticContainer();
                for (int n_ = i * 3; n_ < (i + 1) * 3; ++n_)
                {
                    if (n_ >= valid.Count)
                    {
                        continue;
                    }
                    int n = n_;

                    var cont = new StaticContainer()
                    {
                        Size          = new Vector2(115 * 2, 97 * 2),
                        LocalPosition = new Vector2(250 * (n - i * 3) - 10, 0),
                    };
                    // Note: This is being called 4 times for some reason
                    // Probably a UI framework bug.
                    Action <Element> selCallback = (e) =>
                    {
                        if (selectedContainer != null)
                        {
                            selectedContainer.OutlineColor = null;
                        }
                        selectedContainer = cont;
                        selectedContainer.OutlineColor = Color.Green;
                        selectedNPC = valid[n].Name;
                        Log.trace("Selected " + selectedNPC);
                    };
                    cont.AddChild(new Image()
                    {
                        Texture       = Game1.mouseCursors,
                        TextureRect   = new Rectangle(583, 411, 115, 97),
                        Scale         = 2,
                        LocalPosition = new Vector2(0, 0),
                        Callback      = selCallback,
                    });
                    cont.AddChild(new Image()
                    {
                        Texture       = valid[n].Portrait,
                        TextureRect   = new Rectangle(0, 128, 64, 64),
                        Scale         = 2,
                        LocalPosition = new Vector2(50, 16),
                    });
                    var name = new Label()
                    {
                        String        = valid[n].displayName,
                        NonBoldScale  = 0.5f,
                        NonBoldShadow = false,
                    };
                    name.LocalPosition = new Vector2(115 - name.Measure().X / 2, 160);
                    cont.AddChild(name);

                    row.AddChild(cont);
                }
                table.AddRow(new Element[] { row });
            }
            ui.AddChild(table);

            ui.AddChild(new Label()
            {
                String        = Mod.instance.Helper.Translation.Get("menu.button.cancel"),
                LocalPosition = new Vector2(175, 650),
                Callback      = (e) => Game1.exitActiveMenu(),
            });
            ui.AddChild(new Label()
            {
                String        = Mod.instance.Helper.Translation.Get("menu.button.accept"),
                LocalPosition = new Vector2(500, 650),
                Callback      = (e) => { DoMarriage(); }
            });
        }