Esempio n. 1
0
        void InitializeGUI(ContentManager Content, MenuHandler menuHandler)
        {
            DrawProperties     button         = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), DisplayLayer.Menu, 1.0f, 0.0f, Color.White);
            DrawProperties     frame          = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White);
            DrawProperties     clickedButton  = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White);
            DrawTextProperties textProperties = new DrawTextProperties("previous", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, DisplayLayer.Menu + 0.03f, 1.0f);

            components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 0), ButtonSize, this.MenuRectangle));
            components[0].StoreAndExecuteOnMouseRelease((new PuzzleEngineAlpha.Actions.ChangeMiniMapAction(this.miniMap, -1)));

            textProperties.text = "load";
            components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(+ButtonSize.X, 0), ButtonSize, this.MenuRectangle));
            components[1].StoreAndExecuteOnMouseRelease(new PuzzleEngineAlpha.Actions.LoadMapAction(this.miniMap, this.tileMap));

            textProperties.text = "next";
            components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(+ButtonSize.X * 2, 0), ButtonSize, this.MenuRectangle));
            components[2].StoreAndExecuteOnMouseRelease((new PuzzleEngineAlpha.Actions.ChangeMiniMapAction(this.miniMap, +1)));

            textProperties.text = "back";
            components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(+ButtonSize.X, ButtonSize.Y), ButtonSize, this.MenuRectangle));
            components[3].StoreAndExecuteOnMouseRelease(new Actions.SwapGameWindowAction(menuHandler, "mainMenu"));

            //   foreach (AGUIComponent component in components)
            // enumerator.AddGUIComponent(component);

            //  components[0].IsFocused = true;
        }
Esempio n. 2
0
        void InitializeGUI(ContentManager Content, MenuHandler menuHandler, Level.TileMap tileMap)
        {
            int messageOffset = 148;

            textboxes.Add("initialID", new TextBox(new Input.KeyboardNumberInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), Location, TextBoxWidth, TextBoxHeight, Scene.DisplayLayer.Menu + 0.01f));
            messages.Add(new Animations.DisplayMessage(Content, new Vector2(-23, +messageOffset), "initial id", -1));
            textboxes["initialID"].Text = "0";

            textboxes.Add("tilesize", new TextBox(new Input.KeyboardNumberInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), Location + new Vector2(0, TextBoxHeight), TextBoxWidth, TextBoxHeight, Scene.DisplayLayer.Menu + 0.01f));
            messages.Add(new Animations.DisplayMessage(Content, new Vector2(-23, +messageOffset - TextBoxHeight), "tile size ", -1));
            textboxes["tilesize"].Text = "64";
            textboxes.Add("mapwidth", new TextBox(new Input.KeyboardNumberInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), Location + new Vector2(0, 2 * TextBoxHeight), TextBoxWidth, TextBoxHeight, Scene.DisplayLayer.Menu + 0.01f));
            messages.Add(new Animations.DisplayMessage(Content, new Vector2(-23, +messageOffset - TextBoxHeight * 2), "map width ", -1));
            textboxes["mapwidth"].Text = "100";
            textboxes.Add("mapheight", new TextBox(new Input.KeyboardNumberInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), Location + new Vector2(0, 3 * TextBoxHeight), TextBoxWidth, TextBoxHeight, Scene.DisplayLayer.Menu + 0.01f));
            textboxes["mapheight"].Text = "100";
            messages.Add(new Animations.DisplayMessage(Content, new Vector2(-23, +messageOffset - TextBoxHeight * 3), "map height", -1));

            DrawProperties     button         = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), Scene.DisplayLayer.Menu, 1.0f, 0.0f, Color.White);
            DrawProperties     frame          = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), Scene.DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White);
            DrawProperties     clickedButton  = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), Scene.DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White);
            DrawTextProperties textProperties = new DrawTextProperties("new map", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.Menu + 0.03f, 1.0f);

            components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (TextBoxHeight * 4)), ButtonSize, this.MenuRectangle));
            components[0].StoreAndExecuteOnMouseRelease(new Actions.NewMapAction(textboxes["initialID"], textboxes["tilesize"], textboxes["mapwidth"], textboxes["mapheight"], tileMap));
            textProperties.text = "back";
            components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, ButtonSize.Y + (TextBoxHeight * 4)), ButtonSize, this.MenuRectangle));
            components[1].StoreAndExecuteOnMouseRelease(new Actions.SwapEditorWindowAction(menuHandler, "mainMenu"));
        }
Esempio n. 3
0
        public void InitializeButtons(Rectangle sceneRectangle)
        {
            this.sceneRectangle = sceneRectangle;

            //move camera to its initial location
            this.Camera.Position = Vector2.Zero;

            DrawProperties     button        = new DrawProperties(Content.Load <Texture2D>(@"Textures/PlatformTilesTemp"), Scene.DisplayLayer.Tile, 1.0f, 0.0f, Color.White);
            DrawProperties     buttonActor   = new DrawProperties(Content.Load <Texture2D>(@"Textures/ActorsTemp"), Scene.DisplayLayer.Tile, 1.0f, 0.0f, Color.White);
            DrawProperties     frame         = new DrawProperties(Content.Load <Texture2D>(@"Buttons/tileFrame"), Scene.DisplayLayer.TileFrame, 1.0f, 0.0f, Color.White);
            DrawTextProperties passableText  = new DrawTextProperties("x", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.TileFrame + 0.01f, 1.0f);
            DrawTextProperties codeValueText = new DrawTextProperties("", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.TileFrame + 0.01f, 1.0f);
            Texture2D          background    = Content.Load <Texture2D>(@"Textures/whiteRectangle");

            editorMapSquares = new EditorMapSquare[MapWidth, MapHeight];
            for (int x = 0; x < MapWidth; x++)
            {
                for (int y = 0; y < MapHeight; y++)
                {
                    editorMapSquares[x, y]                      = new EditorMapSquare(passableText, codeValueText, background, button, buttonActor, frame, new Vector2(x * TileWidth, y * TileHeight), new Vector2(TileWidth, TileHeight), TileSourceRectangle(mapCells[x, y].LayerTile), this.Camera, sceneRectangle, mapCells[x, y].LayerTile);
                    editorMapSquares[x, y].MapSquare            = mapCells[x, y];
                    editorMapSquares[x, y].ActorSourceRectangle = actorTileSheet.TileSourceRectangle(mapCells[x, y].ActorID);
                    editorMapSquares[x, y].StoreAndExecuteOnMouseDown(new Actions.SetEditorMapSquare(editorMapSquares[x, y]));
                    editorMapSquares[x, y].StoreAndExecuteOnMouseRelease(new Actions.SetEditorSelectedTileAction(editorMapSquares[x, y]));
                }
            }
        }
Esempio n. 4
0
        void InitializeGUI(ContentManager Content, IScene selectionScene, IScene actorSelectionScene)
        {
            Passable = true;
            textBox  = new TextBox(new Input.KeyboardInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), new Vector2(5, 5) + SceneLocation, 160, 30, Scene.DisplayLayer.Editor - 0.01f);
            textBox.StoreAndExecuteOnTextChange(new Actions.SetSelectedCodeValueAction(textBox));

            DrawProperties     button         = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), Scene.DisplayLayer.Editor, 1.0f, 0.0f, Color.White);
            DrawProperties     frame          = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), Scene.DisplayLayer.Editor + 0.02f, 1.0f, 0.0f, Color.White);
            DrawProperties     clickedButton  = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), Scene.DisplayLayer.Editor + 0.01f, 1.0f, 0.0f, Color.White);
            DrawTextProperties textProperties = new DrawTextProperties("is passable", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.Editor + 0.03f, 1.0f);

            components.Add(new MenuButton(button, frame, clickedButton, textProperties, new Vector2(5, 50) + SceneLocation, new Vector2(160, 40), this.SceneRectangle));
            components[0].StoreAndExecuteOnMouseRelease(new Actions.TogglePassableAction((MenuButton)components[0]));

            textProperties.text = "deselect";
            components.Add(new MenuButton(button, frame, clickedButton, textProperties, new Vector2(5, 100) + SceneLocation, new Vector2(160, 40), this.SceneRectangle));
            components[1].StoreAndExecuteOnMouseRelease(new Actions.UnSelectedTileAction());

            textProperties.text = "tiles";
            components.Add(new MenuButton(button, frame, clickedButton, textProperties, new Vector2(0, 150) + SceneLocation, new Vector2(85, 60), this.SceneRectangle));
            components[2].StoreAndExecuteOnMouseRelease(new Actions.ToggleSelectionAction((SelectionScene)selectionScene, (SelectionScene)actorSelectionScene, true));

            textProperties.text = "actors";
            components.Add(new MenuButton(button, frame, clickedButton, textProperties, new Vector2(85, 150) + SceneLocation, new Vector2(85, 60), this.SceneRectangle));
            components[3].StoreAndExecuteOnMouseRelease(new Actions.ToggleSelectionAction((SelectionScene)selectionScene, (SelectionScene)actorSelectionScene, false));
        }
Esempio n. 5
0
        void InitializeGUI(ContentManager Content, MenuHandler menuHandler, SceneDirector sceneDirector)
        {
            DrawProperties     button         = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), Scene.DisplayLayer.Menu, 1.0f, 0.0f, Color.White);
            DrawProperties     frame          = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), Scene.DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White);
            DrawProperties     clickedButton  = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), Scene.DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White);
            DrawTextProperties textProperties = new DrawTextProperties("editor", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.Menu + 0.03f, 1.0f);

            components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 0), ButtonSize, this.MenuRectangle));
            components[0].StoreAndExecuteOnMouseRelease(new Actions.ExitMenuAction());

            textProperties.text = "new";
            components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, ButtonSize.Y), ButtonSize, this.MenuRectangle));
            components[1].StoreAndExecuteOnMouseRelease(new Actions.SwapEditorWindowAction(menuHandler, "newMap"));

            textProperties.text = "load";
            components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 2), ButtonSize, this.MenuRectangle));
            components[2].StoreAndExecuteOnMouseRelease(new Actions.SwapEditorWindowAction(menuHandler, "loadMap"));

            textProperties.text = "save";
            components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 3), ButtonSize, this.MenuRectangle));
            components[3].StoreAndExecuteOnMouseRelease(new Actions.SwapEditorWindowAction(menuHandler, "saveMap"));

            textProperties.text = "game";
            components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 4), ButtonSize, this.MenuRectangle));
            components[4].StoreAndExecuteOnMouseRelease(new Actions.ToggleActiveSceneryAction(sceneDirector));

            textProperties.text = "exit";
            components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 5), ButtonSize, this.MenuRectangle));
            components[5].StoreAndExecuteOnMouseRelease(new Actions.TerminateGameAction());
        }
Esempio n. 6
0
        protected override void OnStateChange()
        {
            if (State == State.SetDefaults)
            {
                Description             = @"Enter the description for your new custom Indicator here.";
                Name                    = "DowPivotOld";
                Calculate               = Calculate.OnEachTick;
                IsOverlay               = true;
                DisplayInDataBox        = true;
                DrawOnPricePanel        = true;
                DrawHorizontalGridLines = false;
                DrawVerticalGridLines   = false;
                PaintPriceMarkers       = false;
                ScaleJustification      = NinjaTrader.Gui.Chart.ScaleJustification.Right;
                //Disable this property if your indicator requires custom values that cumulate with each new market data event.
                //See Help Guide for additional information.
                IsSuspendedWhileInactive = true;

                // Zig Zag parameters
                CalculationType = ZigZagCalculationType.SwingDelayed;
                Strength        = 5;
                UseHighLow      = true;
                DrawProp        = new DrawProperties()
                {
                    ShowTopBottomPoints = true,
                    ShowZigZag          = true,
                    ZigZagWidth         = 3,
                    ZigZagColor         = Brushes.White
                };

                // Pivot parameters
                ShowTargetAndStop       = false;
                PercentProfitTargetFibo = 161.8;
                FiboPivot = new FiboPivotRetraction()
                {
                    MaxPercentOfPivotRetraction = 95,
                    MinPercentOfPivotRetraction = 38.2
                };

                AddPlot(Brushes.Transparent, "EntrySignal"); // -1 go short, 0 no signal and 1 go long
                AddPlot(Brushes.Transparent, "StopLossPriceSignal");
                AddPlot(Brushes.Transparent, "ProfitTargetPriceSignal");
            }
            else if (State == State.Configure)
            {
            }
            else if (State == State.DataLoaded)
            {
                pointsCalculation          = new PointsCalculation(this);
                swingDelayedCalculation    = new SwingDelayedCalculation(this);
                swingForwardCalculationOld = new SwingForwardCalculationOld(this);
                swingForwardCalculationNew = new SwingForwardCalculationNew(this);
                pivotLogic = new PivotLogic(this);

                // Toda vez que a tecla F5 for pressionada automaticamente passara pelo metodo
                // NinjaTrader.Code.Output.Reset() e limpara todas as abas da janela Output das saidas anteriores.
                NinjaTrader.Code.Output.Reset(PrintTo.OutputTab1);
                NinjaTrader.Code.Output.Reset(PrintTo.OutputTab2);
            }
        }
Esempio n. 7
0
 public override void DrawCall(SpriteBatch spriteBatch, DrawProperties worldProperties)
 {
     // loop through all layers to draw them
     foreach (TileLayer layer in Layers)
     {
         layer.DrawCall(spriteBatch, worldProperties);
     }
 }
 public EditorMapSquare(DrawTextProperties passableText, DrawTextProperties codeValueText, Texture2D background, DrawProperties buttonDrawProperties, DrawProperties buttonActorDrawProperties, DrawProperties frameDrawProperties, Vector2 position, Vector2 size, Rectangle sourceRectangle, Camera.Camera camera, Rectangle generalArea, int layerTile)
     : base(buttonDrawProperties, frameDrawProperties, position, size, sourceRectangle, camera, generalArea, layerTile)
 {
     this.passableText  = passableText;
     this.codeValueText = codeValueText;
     this.background    = background;
     this.buttonActor   = buttonActorDrawProperties;
 }
Esempio n. 9
0
        void InitializeGUI(ContentManager Content, MenuHandler menuHandler)
        {
            DrawProperties     button         = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), DisplayLayer.Menu, 1.0f, 0.0f, Color.White);
            DrawProperties     frame          = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White);
            DrawProperties     clickedButton  = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White);
            DrawTextProperties textProperties = new DrawTextProperties("back", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, DisplayLayer.Menu + 0.03f, 1.0f);

            components.Add(new MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 0), ButtonSize, this.MenuRectangle));
            components[0].StoreAndExecuteOnMouseRelease(new Actions.SwapGameWindowAction(menuHandler, "mainMenu"));
        }
Esempio n. 10
0
 void DrawableEntity(SpriteBatch spriteBatch, DrawProperties entity)
 {
     if (this.Camera != null)
     {
         spriteBatch.Draw(entity.texture, Camera.WorldToScreen(ButtonRectangle), null, entity.color * entity.transparency, entity.rotation, Vector2.Zero, SpriteEffects.None, entity.layer);
     }
     else
     {
         spriteBatch.Draw(entity.texture, ButtonRectangle, null, entity.color * entity.transparency, entity.rotation, Vector2.Zero, SpriteEffects.None, entity.layer);
     }
 }
Esempio n. 11
0
 public MenuButton(DrawProperties buttonDrawProperties, DrawProperties frameDrawProperties, DrawProperties clickedButtonDrawProperties, DrawTextProperties textProperties, Vector2 position, Vector2 size, Rectangle generalArea)
     : base()
 {
     button             = buttonDrawProperties;
     frame              = frameDrawProperties;
     clickedButton      = clickedButtonDrawProperties;
     defaultText        = textProperties;
     this.Size          = size;
     this.Position      = position;
     this.GeneralArea   = generalArea;
     this.mouseLocation = Input.InputHandler.MousePosition;
 }
Esempio n. 12
0
 public TileButton(DrawProperties buttonDrawProperties, DrawProperties frameDrawProperties, Vector2 position, Vector2 size, Rectangle sourceRectangle, Camera camera, Rectangle generalArea, int layertile)
     : base()
 {
     button = buttonDrawProperties;
     frame  = frameDrawProperties;
     this.sourceRectangle = sourceRectangle;
     this.camera          = camera;
     this.Size            = size;
     this.Position        = position;
     this.GeneralArea     = generalArea;
     this.LayerTile       = layertile;
 }
Esempio n. 13
0
        public virtual void InitializeGUI(ContentManager Content)
        {
            camera = new Camera.Camera(Vector2.Zero, new Vector2(this.Width, Resolution.ResolutionHandler.WindowHeight - 215), new Vector2(this.Width, this.Height));

            for (int i = 0; i < CountTiles; i++)
            {
                DrawProperties button = new DrawProperties(Content.Load <Texture2D>(@"Textures/PlatformTilesTemp"), Scene.DisplayLayer.Editor + 0.1f, 1.0f, 0.0f, Color.White);
                DrawProperties frame  = new DrawProperties(Content.Load <Texture2D>(@"Buttons/tileFrame"), Scene.DisplayLayer.Editor + 0.2f, 1.0f, 0.0f, Color.White);
                components.Add(new TileButton(button, frame, new Vector2((i % 2) * (TileWidth + TileOffset) + TileOffset, i / 2 * (TileHeight + TileOffset) + TileOffset) + SceneLocation, new Vector2(TileWidth, TileHeight), TileSourceRectangle(i), this.camera, this.SceneRectangle, i));
                components[i].StoreAndExecuteOnMouseRelease(new Actions.SetSelectedTileAction((TileButton)components[i]));
            }
            vScrollBar = new VScrollBar(Content.Load <Texture2D>(@"ScrollBars/bullet"), Content.Load <Texture2D>(@"ScrollBars/bar"), camera, new Vector2(this.scenerySize.X - ScrollBarWidth, 0) + SceneLocation, new Vector2(ScrollBarWidth, scenerySize.Y - 5), Scene.DisplayLayer.Editor + 0.1f);
        }
Esempio n. 14
0
 public override void Draw(SpriteBatch spriteBatch, DrawProperties worldProperties)
 {
     spriteBatch.Draw(
         this.Emitter.Data.BaseTexture,
         this.Position,
         this.SourceRectangle,
         this.Color * worldProperties.Alpha,
         this.Rotation,
         this.Origin,
         this.Scale,
         this.SpriteEffects,
         Node.GetDrawDepth(this.Depth));
 }
Esempio n. 15
0
        void InitializeGUI(ContentManager Content, MenuHandler menuHandler)
        {
            textBox      = new TextBox(new Input.KeyboardInput(), Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Content.Load <Texture2D>(@"Textboxes/textbox"), Location, (int)ButtonSize.X, 30, Scene.DisplayLayer.Menu + 0.01f);
            textBox.Text = "mapName";
            DrawProperties     button         = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), Scene.DisplayLayer.Menu, 1.0f, 0.0f, Color.White);
            DrawProperties     frame          = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), Scene.DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White);
            DrawProperties     clickedButton  = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), Scene.DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White);
            DrawTextProperties textProperties = new DrawTextProperties("save", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, Scene.DisplayLayer.Menu + 0.03f, 1.0f);

            components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 30), ButtonSize, this.MenuRectangle));
            components[0].StoreAndExecuteOnMouseRelease(new Actions.SaveMapAction(this.mapHandler, this.textBox));

            textProperties.text = "back";
            components.Add(new Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, ButtonSize.Y + 30), ButtonSize, this.MenuRectangle));
            components[1].StoreAndExecuteOnMouseRelease(new Actions.SwapEditorWindowAction(menuHandler, "mainMenu"));
        }
Esempio n. 16
0
        private AnimDrawable LoadUpgrade(StructureObject structObj, int upgradeSlot, DrawProperties inheritProps)
        {
            string upgradeName = "";

            if (upgradeSlot == 0)
            {
                upgradeName = structObj.Upgrade1;
            }
            else if (upgradeSlot == 1)
            {
                upgradeName = structObj.Upgrade2;
            }
            else if (upgradeSlot == 2)
            {
                upgradeName = structObj.Upgrade3;
            }

            IniFile.IniSection upgradeRules = OwnerCollection.Rules.GetOrCreateSection(upgradeName);
            if (upgradeRules != null && upgradeRules.HasKey("Image"))
            {
                upgradeName = upgradeRules.ReadString("Image");
            }
            IniFile.IniSection upgradeArt = OwnerCollection.Art.GetOrCreateSection(upgradeName);
            if (upgradeArt != null && upgradeArt.HasKey("Image"))
            {
                upgradeName = upgradeArt.ReadString("Image");
            }

            IniFile.IniSection upgRules = OwnerCollection.Rules.GetOrCreateSection(upgradeName);
            IniFile.IniSection upgArt   = OwnerCollection.Art.GetOrCreateSection(upgradeName);
            AnimDrawable       upgrade  = new AnimDrawable(_config, _vfs, upgRules, upgArt);

            upgrade.OwnerCollection = OwnerCollection;
            upgrade.Props           = inheritProps;
            upgrade.LoadFromRules();
            upgrade.NewTheater     = this.NewTheater;
            upgrade.IsBuildingPart = true;
            string shpfilename = NewTheater ? OwnerCollection.ApplyNewTheaterIfNeeded(upgradeName, upgradeName + ".shp") : upgradeName + ".shp";

            upgrade.Shp = _vfs.Open <ShpFile>(shpfilename);
            Point powerupOffset = new Point(_powerupSlots[upgradeSlot].X, _powerupSlots[upgradeSlot].Y);

            upgrade.Props.Offset.Offset(powerupOffset);
            return(upgrade);
        }
Esempio n. 17
0
        private AnimDrawable LoadExtraImage(string extraImage, DrawProperties inheritProps)
        {
            string animSection = Art.ReadString(extraImage);

            if (animSection == "")
            {
                return(null);
            }

            IniFile.IniSection extraRules = OwnerCollection.Rules.GetOrCreateSection(animSection);
            IniFile.IniSection extraArt   = OwnerCollection.Art.GetOrCreateSection(animSection);
            var anim = new AnimDrawable(_config, _vfs, extraRules, extraArt);

            anim.OwnerCollection = OwnerCollection;
            anim.LoadFromRules();

            anim.NewTheater = this.NewTheater;

            if (extraArt.HasKey("YSortAdjust") || Art.HasKey(extraImage + "YSort") ||
                extraArt.HasKey("ZAdjust") || Art.HasKey(extraImage + "ZAdjust"))
            {
                anim.Props.SortIndex = extraArt.ReadInt("YSortAdjust", Art.ReadInt(extraImage + "YSort"))
                                       - extraArt.ReadInt("ZAdjust", Art.ReadInt(extraImage + "ZAdjust"));
            }
            else
            {
                anim.Props.SortIndex = inheritProps.SortIndex;
            }
            if (Art.HasKey(extraImage + "X") || Art.HasKey(extraImage + "Y"))
            {
                anim.Props.Offset = this.Props.Offset + new Size(Art.ReadInt(extraImage + "X"), Art.ReadInt(extraImage + "Y"));
            }
            else
            {
                anim.Props.Offset = inheritProps.Offset;
            }
            anim.Props.ZAdjust  = Art.ReadInt(extraImage + "ZAdjust");
            anim.IsBuildingPart = true;

            anim.Shp = _vfs.Open <ShpFile>(anim.GetFilename());
            return(anim);
        }
Esempio n. 18
0
        void InitializeGUI(ContentManager Content, MenuHandler menuHandler, GameSceneDirector sceneDirector)
        {
            DrawProperties     button         = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), PuzzleEngineAlpha.Scene.DisplayLayer.Menu, 1.0f, 0.0f, Color.White);
            DrawProperties     frame          = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), PuzzleEngineAlpha.Scene.DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White);
            DrawProperties     clickedButton  = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White);
            DrawTextProperties textProperties = new DrawTextProperties("play", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, PuzzleEngineAlpha.Scene.DisplayLayer.Menu + 0.03f, 1.0f);

            components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 0), ButtonSize, this.MenuRectangle));
            components[0].StoreAndExecuteOnMouseRelease(new ExitMenuAction());
            //  components[0].StoreAndExecuteOnMouseOver(new SetEnumeratorValueAction(this.enumerator,0));

            textProperties.text = "load";
            components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, ButtonSize.Y), ButtonSize, this.MenuRectangle));
            components[1].StoreAndExecuteOnMouseRelease(new Actions.SwapGameWindowAction(menuHandler, "loadMap"));
            //   components[1].StoreAndExecuteOnMouseOver(new SetEnumeratorValueAction(this.enumerator, 1));

            textProperties.text = "settings";
            components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 2), ButtonSize, this.MenuRectangle));
            components[2].StoreAndExecuteOnMouseRelease(new Actions.SwapGameWindowAction(menuHandler, "settings"));
            // components[2].StoreAndExecuteOnMouseOver(new SetEnumeratorValueAction(this.enumerator, 2));

            textProperties.text = "editor";
            components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 3), ButtonSize, this.MenuRectangle));
            components[3].StoreAndExecuteOnMouseRelease(new PuzzleEngineAlpha.Actions.ToggleActiveSceneryAction((PuzzleEngineAlpha.Scene.SceneDirector)sceneDirector));
            // components[3].StoreAndExecuteOnMouseOver(new SetEnumeratorValueAction(this.enumerator, 3));

            textProperties.text = "exit";
            components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, (ButtonSize.Y) * 4), ButtonSize, this.MenuRectangle));
            components[4].StoreAndExecuteOnMouseRelease(new Actions.TerminateGameAction());
            // components[4].StoreAndExecuteOnMouseOver(new SetEnumeratorValueAction(this.enumerator, 4));

            // foreach (AGUIComponent component in components)
            // enumerator.AddGUIComponent(component);

            components[0].IsFocused = true;
        }
Esempio n. 19
0
        void InitializeGUI(ContentManager Content, MenuHandler menuHandler, PuzzleEngineAlpha.Resolution.ResolutionHandler resolutionHandler)
        {
            DrawProperties     button         = new DrawProperties(Content.Load <Texture2D>(@"Buttons/button"), DisplayLayer.Menu, 1.0f, 0.0f, Color.White);
            DrawProperties     frame          = new DrawProperties(Content.Load <Texture2D>(@"Buttons/frame"), DisplayLayer.Menu + 0.02f, 1.0f, 0.0f, Color.White);
            DrawProperties     clickedButton  = new DrawProperties(Content.Load <Texture2D>(@"Buttons/clickedButton"), DisplayLayer.Menu + 0.01f, 1.0f, 0.0f, Color.White);
            DrawTextProperties textProperties = new DrawTextProperties("back", 11, Content.Load <SpriteFont>(@"Fonts/menuButtonFont"), Color.Black, DisplayLayer.Menu + 0.03f, 1.0f);

            components.Add(new MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, 0), ButtonSize, this.MenuRectangle));
            components[0].StoreAndExecuteOnMouseRelease(new Actions.SwapGameWindowAction(menuHandler, "mainMenu"));
            // components[0].StoreAndExecuteOnMouseOver(new PuzzleEngineAlpha.Actions.SetEnumeratorValueAction(this.enumerator, 0));
            ButtonCount          = 1;
            components[0].Camera = this.camera;

            int i = 1;

            foreach (var resolution in PuzzleEngineAlpha.Resolution.ResolutionHandler.GetSupportedResolutions())
            {
                textProperties.text = resolution.Key;
                components.Add(new PuzzleEngineAlpha.Components.Buttons.MenuButton(button, frame, clickedButton, textProperties, Location + new Vector2(0, i * ButtonSize.Y), ButtonSize, this.MenuRectangle));
                components[i].StoreAndExecuteOnMouseRelease(new PuzzleEngineAlpha.Actions.ApplyResolutionAction(resolutionHandler, resolution.Value));
                //   components[i].StoreAndExecuteOnMouseOver(new PuzzleEngineAlpha.Actions.SetEnumeratorValueAction(this.enumerator, i));
                components[i].Camera = camera;
                i++;
                ButtonCount++;
            }
            //   foreach (AGUIComponent component in components)
            //   enumerator.AddGUIComponent(component);

            components[0].IsFocused = true;

            camera = new Camera(Vector2.Zero, GUIAreaSize, Size);

            vScrollBar = new VScrollBar(Content.Load <Texture2D>(@"ScrollBars/bullet"), Content.Load <Texture2D>(@"ScrollBars/bar"), camera, new Vector2(this.Size.X - ScrollBarWidth, 0) + Location, new Vector2(ScrollBarWidth, Size.Y - 5), PuzzleEngineAlpha.Scene.DisplayLayer.Editor + 0.1f);

            ResetSizes(this, EventArgs.Empty);
        }
Esempio n. 20
0
        public override void Draw(SpriteBatch spriteBatch, DrawProperties worldProperties)
        {
            this.Texture = CurrentTexture;

            base.Draw(spriteBatch, worldProperties);
        }
Esempio n. 21
0
 public DowPivotOld DowPivotOld(ISeries <double> input, ZigZagCalculationType calculationType, double strength, bool useHighLow, DrawProperties drawProp, double percentProfitTargetFibo, FiboPivotRetraction fiboPivot)
 {
     if (cacheDowPivotOld != null)
     {
         for (int idx = 0; idx < cacheDowPivotOld.Length; idx++)
         {
             if (cacheDowPivotOld[idx] != null && cacheDowPivotOld[idx].CalculationType == calculationType && cacheDowPivotOld[idx].Strength == strength && cacheDowPivotOld[idx].UseHighLow == useHighLow && cacheDowPivotOld[idx].DrawProp == drawProp && cacheDowPivotOld[idx].PercentProfitTargetFibo == percentProfitTargetFibo && cacheDowPivotOld[idx].FiboPivot == fiboPivot && cacheDowPivotOld[idx].EqualsInput(input))
             {
                 return(cacheDowPivotOld[idx]);
             }
         }
     }
     return(CacheIndicator <DowPivotOld>(new DowPivotOld()
     {
         CalculationType = calculationType, Strength = strength, UseHighLow = useHighLow, DrawProp = drawProp, PercentProfitTargetFibo = percentProfitTargetFibo, FiboPivot = fiboPivot
     }, input, ref cacheDowPivotOld));
 }
Esempio n. 22
0
 public DowPivotOld DowPivotOld(ZigZagCalculationType calculationType, double strength, bool useHighLow, DrawProperties drawProp, double percentProfitTargetFibo, FiboPivotRetraction fiboPivot)
 {
     return(DowPivotOld(Input, calculationType, strength, useHighLow, drawProp, percentProfitTargetFibo, fiboPivot));
 }
Esempio n. 23
0
 public Indicators.DowPivotOld DowPivotOld(ISeries <double> input, ZigZagCalculationType calculationType, double strength, bool useHighLow, DrawProperties drawProp, double percentProfitTargetFibo, FiboPivotRetraction fiboPivot)
 {
     return(indicator.DowPivotOld(input, calculationType, strength, useHighLow, drawProp, percentProfitTargetFibo, fiboPivot));
 }
Esempio n. 24
0
 protected void DrawableEntity(SpriteBatch spriteBatch, Rectangle rect, DrawProperties entity, Color color)
 {
     spriteBatch.Draw(entity.texture, camera.WorldToScreen(ButtonRectangle), rect, color * entity.transparency, entity.rotation, Vector2.Zero, SpriteEffects.None, entity.layer);
 }
Esempio n. 25
0
        private unsafe void BlitVoxelToSurface(DrawingSurface ds, DrawingSurface vxl_ds, GameObject obj, DrawProperties props, int transLucency = 0)
        {
            Point d = new Point(obj.Tile.Dx * _config.TileWidth / 2, (obj.Tile.Dy - obj.Tile.Z) * _config.TileHeight / 2);

            d.Offset(props.GetOffset(obj));
            d.Offset(-vxl_ds.BitmapData.Width / 2, -vxl_ds.BitmapData.Height / 2);

            // rows inverted!
            var   w_low        = (byte *)ds.BitmapData.Scan0;
            byte *w_high       = w_low + ds.BitmapData.Stride * ds.BitmapData.Height;
            var   zBuffer      = ds.GetZBuffer();
            var   shadowBufVxl = vxl_ds.GetShadows();
            var   shadowBuf    = ds.GetShadows();

            // int rowsTouched = 0;

            // clip to 25-50-75-100
            transLucency = transLucency / 25 * 25;
            float a = transLucency / 100f;
            float b = 1 - a;

            // short firstRowTouched = short.MaxValue;
            for (int y = 0; y < vxl_ds.Height; y++)
            {
                byte *src_row = (byte *)vxl_ds.BitmapData.Scan0 + vxl_ds.BitmapData.Stride * (vxl_ds.Height - y - 1);
                byte *dst_row = ((byte *)ds.BitmapData.Scan0 + (d.Y + y) * ds.BitmapData.Stride + d.X * 3);
                int   zIdx    = (d.Y + y) * ds.Width + d.X;
                if (dst_row < w_low || dst_row >= w_high)
                {
                    continue;
                }

                for (int x = 0; x < vxl_ds.Width; x++)
                {
                    // only non-transparent pixels
                    if (*(src_row + x * 4 + 3) > 0)
                    {
                        if (transLucency != 0)
                        {
                            *(dst_row + x * 3)     = (byte)(a * *(dst_row + x * 3) + b * *(src_row + x * 4));
                            *(dst_row + x * 3 + 1) = (byte)(a * *(dst_row + x * 3 + 1) + b * *(src_row + x * 4 + 1));
                            *(dst_row + x * 3 + 2) = (byte)(a * *(dst_row + x * 3 + 2) + b * *(src_row + x * 4 + 2));
                        }
                        else
                        {
                            *(dst_row + x * 3)     = *(src_row + x * 4);
                            *(dst_row + x * 3 + 1) = *(src_row + x * 4 + 1);
                            *(dst_row + x * 3 + 2) = *(src_row + x * 4 + 2);
                        }

                        // if (y < firstRowTouched)
                        //  firstRowTouched = (short)y;

                        short zBufVal = (short)((obj.Tile.Rx + obj.Tile.Ry + obj.Tile.Z) * _config.TileHeight / 2);
                        if (zBufVal >= zBuffer[zIdx])
                        {
                            zBuffer[zIdx] = zBufVal;
                        }
                    }
                    // or shadows
                    else if (shadowBufVxl[x + y * vxl_ds.Height])
                    {
                        int shadIdx = (d.Y + y) * ds.Width + d.X + x;
                        if (!shadowBuf[shadIdx])
                        {
                            *(dst_row + x * 3)     /= 2;
                            *(dst_row + x * 3 + 1) /= 2;
                            *(dst_row + x * 3 + 2) /= 2;
                            shadowBuf[shadIdx]      = true;
                        }
                    }
                    zIdx++;
                }
            }
        }
Esempio n. 26
0
 /// <summary>
 /// Does the surface have the specified DrawProperties?
 /// </summary>
 /// <param name="properties">The draw properties to check for.</param>
 /// <returns>True if the surface has the specified draw properties.</returns>
 public bool HasDrawProperties(DrawProperties properties)
 {
     return (DrawProperties & properties) == properties;
 }
Esempio n. 27
0
 public override void DrawCall(SpriteBatch spriteBatch, DrawProperties worldProperties)
 {
     // we need to pass a zero vector to the draw call, because the particle engine always is at 0,0
     worldProperties.Position = Vector2.Zero;
     base.DrawCall(spriteBatch, worldProperties);
 }