示例#1
0
 public void UnCheckSwitchesVariablesSelection()
 {
     WANOK.UnCheckRadios(HeroesSelectionRadios);
     WANOK.UnableRadios(HeroesConditionRadios);
     WANOK.UnCheckAllControls(HeroesSelectionItems);
     WANOK.UnCheckAllControls(HeroesConditionItems);
 }
示例#2
0
        // -------------------------------------------------------------------
        // SaveDatas
        // -------------------------------------------------------------------

        public void SaveDatas()
        {
            WANOK.SaveBinaryDatas(Heroes, WANOK.HeroesPath);
            WANOK.SaveBinaryDatas(BattleSystem, WANOK.BattleSystemPath);
            WANOK.SaveBinaryDatas(System, WANOK.SystemPath);
            WANOK.SaveBinaryDatas(Tilesets, WANOK.TilesetsPath);
        }
示例#3
0
        // -------------------------------------------------------------------
        // GetCharacterTexture
        // -------------------------------------------------------------------

        public static Texture2D GetCharacterTexture(GraphicsDevice device, Texture2D originalTexture)
        {
            Texture2D newTexture = new Texture2D(device, 125 * WANOK.SQUARE_SIZE, 5 * WANOK.SQUARE_SIZE);

            Color[] imageData = new Color[originalTexture.Width * originalTexture.Height];
            originalTexture.GetData(imageData);

            int count;

            for (int a = 0; a < Autotiles.listA.Length; a++)
            {
                count = 0;
                for (int b = 0; b < Autotiles.listB.Length; b++)
                {
                    for (int c = 0; c < Autotiles.listC.Length; c++)
                    {
                        for (int d = 0; d < Autotiles.listD.Length; d++)
                        {
                            WANOK.FillImage(device, newTexture, imageData, originalTexture.Width, new Rectangle(count * WANOK.SQUARE_SIZE, a * WANOK.SQUARE_SIZE, WANOK.SQUARE_SIZE / 2, WANOK.SQUARE_SIZE / 2), new Rectangle((Autotiles.AutotileBorder[Autotiles.listA[a]] % 4) * (WANOK.SQUARE_SIZE / 2), (Autotiles.AutotileBorder[Autotiles.listA[a]] / 4) * (WANOK.SQUARE_SIZE / 2), WANOK.SQUARE_SIZE / 2, WANOK.SQUARE_SIZE / 2));
                            WANOK.FillImage(device, newTexture, imageData, originalTexture.Width, new Rectangle(count * WANOK.SQUARE_SIZE + (WANOK.SQUARE_SIZE / 2), a * WANOK.SQUARE_SIZE, WANOK.SQUARE_SIZE / 2, WANOK.SQUARE_SIZE / 2), new Rectangle((Autotiles.AutotileBorder[Autotiles.listB[b]] % 4) * (WANOK.SQUARE_SIZE / 2), (Autotiles.AutotileBorder[Autotiles.listB[b]] / 4) * (WANOK.SQUARE_SIZE / 2), WANOK.SQUARE_SIZE / 2, WANOK.SQUARE_SIZE / 2));
                            WANOK.FillImage(device, newTexture, imageData, originalTexture.Width, new Rectangle(count * WANOK.SQUARE_SIZE, a * WANOK.SQUARE_SIZE + (WANOK.SQUARE_SIZE / 2), WANOK.SQUARE_SIZE / 2, WANOK.SQUARE_SIZE / 2), new Rectangle((Autotiles.AutotileBorder[Autotiles.listC[c]] % 4) * (WANOK.SQUARE_SIZE / 2), (Autotiles.AutotileBorder[Autotiles.listC[c]] / 4) * (WANOK.SQUARE_SIZE / 2), WANOK.SQUARE_SIZE / 2, WANOK.SQUARE_SIZE / 2));
                            WANOK.FillImage(device, newTexture, imageData, originalTexture.Width, new Rectangle(count * WANOK.SQUARE_SIZE + (WANOK.SQUARE_SIZE / 2), a * WANOK.SQUARE_SIZE + (WANOK.SQUARE_SIZE / 2), WANOK.SQUARE_SIZE / 2, WANOK.SQUARE_SIZE / 2), new Rectangle((Autotiles.AutotileBorder[Autotiles.listD[d]] % 4) * (WANOK.SQUARE_SIZE / 2), (Autotiles.AutotileBorder[Autotiles.listD[d]] / 4) * (WANOK.SQUARE_SIZE / 2), WANOK.SQUARE_SIZE / 2, WANOK.SQUARE_SIZE / 2));
                            count++;
                        }
                    }
                }
            }
            originalTexture.Dispose();

            return(newTexture);
        }
示例#4
0
        // -------------------------------------------------------------------
        // Draw
        // -------------------------------------------------------------------

        protected override void Draw(GameTime gameTime)
        {
            if (!Control.IsMapReloading && Control.Map != null)
            {
                LoadSettings();

                GraphicsDevice.Clear(WANOK.GetColor(Control.Map.MapInfos.SkyColor));

                // Effect settings
                effect.View       = Control.Camera.View;
                effect.Projection = Control.Camera.Projection;

                // Drawings components
                Control.Map.Draw(gameTime, effect, Control.Camera, SelectedDrawType);
                effect.Alpha = 1.0f;
                if (!IsViewMode)
                {
                    Control.CursorEditor.Draw(GraphicsDevice, gameTime, effect);
                }

                // Draw position
                string pos = "[" + Control.CursorEditor.GetX() + "," + Control.CursorEditor.GetZ() + "]";
                string fps = string.Format("FPS: {0}", (int)FrameCounter.AverageFramesPerSecond);
                //string fps = Debug2 == null ? "null" : string.Format("FPS: {0}, {1}", Debug2[0], Debug2[1]);
                //string fps = string.Format("FPS: {0}", Debug);
                SpriteBatch.Begin();
                SpriteBatch.DrawString(font, pos, new Vector2(GraphicsDevice.Viewport.Width - 10, GraphicsDevice.Viewport.Height - 10), Color.White, 0, font.MeasureString(pos), 1.0f, SpriteEffects.None, 0.5f);
                SpriteBatch.DrawString(font, fps, new Vector2(GraphicsDevice.Viewport.Width - 10, 40), Color.White, 0, font.MeasureString(fps), 1.0f, SpriteEffects.None, 0.5f);
                SpriteBatch.End();
            }
        }
示例#5
0
        // -------------------------------------------------------------------
        // LoadDatas
        // -------------------------------------------------------------------

        public void LoadDatas()
        {
            Heroes       = WANOK.LoadBinaryDatas <HeroesDatas>(WANOK.HeroesPath);
            BattleSystem = WANOK.LoadBinaryDatas <BattleSystemDatas>(WANOK.BattleSystemPath);
            System       = WANOK.LoadBinaryDatas <SystemDatas>(WANOK.SystemPath);
            Tilesets     = WANOK.LoadBinaryDatas <TilesetsDatas>(WANOK.TilesetsPath);
        }
示例#6
0
        // -------------------------------------------------------------------
        // UpdateAround
        // -------------------------------------------------------------------

        public void UpdateAround(int x, int y1, int y2, int z, bool update)
        {
            int[] portion = MapEditor.Control.GetPortion(x, z); // portion where you are setting autotile
            for (int X = x - 1; X <= x + 1; X++)
            {
                for (int Z = z - 1; Z <= z + 1; Z++)
                {
                    int[]    coords         = new int[] { X, y1, y2, Z };
                    Autotile autotileAround = TileOnWhatever(coords);
                    if (autotileAround != null)
                    {
                        if (update)
                        {
                            autotileAround.Update(this, coords, portion);
                        }
                        else
                        {
                            int[] newPortion = MapEditor.Control.GetPortion(X, Z);
                            if (WANOK.IsInPortions(newPortion))
                            {
                                MapEditor.Control.AddPortionsAutotileToUpdate(newPortion);
                                WANOK.AddPortionsToAddCancel(MapEditor.Control.Map.MapInfos.RealMapName, MapEditor.Control.GetGlobalPortion(newPortion));
                            }
                            else
                            {
                                autotileAround.Update(this, coords, portion);
                            }
                        }
                    }
                }
            }
        }
        public void InitializeMain()
        {
            // Creating RPG Paper Maker Games folder
            string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            path = Path.Combine(path, "RPG Paper Maker Games");
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            // This code created the basic engine settings

            /*
             * WANOK.SaveDatas(new EngineSettings(), "EngineSettings.JSON");
             */


            // Getting engine settings
            WANOK.Settings = WANOK.LoadDatas <EngineSettings>(WANOK.PATHSETTINGS);

            // Updating special infos
            WANOK.ABSOLUTEENGINEPATH = Path.GetDirectoryName(WANOK.ExcecutablePath);
            ClearHeight();
        }
示例#8
0
        // -------------------------------------------------------------------
        // EVENTS
        // -------------------------------------------------------------------

        private void ok_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            WANOK.Game.System.Switches = Switches;
            WANOK.SaveBinaryDatas(WANOK.Game.System, WANOK.SystemPath);
            Close();
        }
示例#9
0
 private void DialogEvent_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (WANOK.GetGeneralDrawType(Control.Model.Pages[tabControl1.SelectedIndex].GraphicDrawType) != WANOK.GetGeneralDrawType((DrawType)graphicControl1.GetComboBox().SelectedIndex))
     {
         graphicControl1.ResetGraphics();
     }
     Control.Model.Pages[tabControl1.SelectedIndex].GraphicDrawType = (DrawType)graphicControl1.GetComboBox().SelectedIndex;
 }
示例#10
0
        // -------------------------------------------------------------------
        // Draw
        // -------------------------------------------------------------------

        public void Draw(GameTime gameTime, AlphaTestEffect effect, Camera camera, string DrawType)
        {
            // Drawing map portion & events
            for (int i = -WANOK.PORTION_RADIUS; i <= WANOK.PORTION_RADIUS; i++)
            {
                for (int j = -WANOK.PORTION_RADIUS; j <= WANOK.PORTION_RADIUS; j++)
                {
                    int[] portion = new int[] { i, j };

                    // map portion
                    GameMapPortion gameMap = Portions[portion];
                    if (gameMap != null)
                    {
                        gameMap.Draw(Device, effect, MapEditor.TexTileset, camera, DrawType);
                    }

                    // events
                    effect.Alpha = MapEditor.IsViewMode || DrawType == "ItemEvent" ? 1.0f : 0.5f;
                    if (!MapEditor.IsViewMode)
                    {
                        EventsPortions[portion].DrawSquares(Device, effect);
                    }
                    EventsPortions[portion].DrawSprites(Device, effect, camera);
                }
            }


            // Drawing Start position
            if (StartSquare != null)
            {
                effect.Alpha = MapEditor.IsViewMode || DrawType == "ItemEvent" ? 1.0f : 0.5f;
                StartSquare.Draw(Device, gameTime, effect, MapEditor.TexStartCursor, WANOK.GetVector3Position(StartPosition));
            }

            // Drawing event square selection
            if (EventPosition != null)
            {
                effect.Alpha = DrawType == "ItemEvent" ? 1.0f : 0.5f;
                EventSquare.Draw(Device, gameTime, effect, MapEditor.TexEventSelectCursor, WANOK.GetVector3Position(EventPosition));
            }

            // Drawing grid
            effect.Texture    = MapEditor.TexGrid;
            effect.Alpha      = DrawType == "ItemEvent" ? 1.0f : 0.5f;
            Device.BlendState = BlendState.Additive;
            effect.World      = Matrix.Identity * Matrix.CreateScale(WANOK.SQUARE_SIZE, 1.0f, WANOK.SQUARE_SIZE) * Matrix.CreateTranslation(0, WANOK.GetPixelHeight(GridHeight) + 0.1f, 0);
            if (!MapEditor.IsViewMode && DisplayGrid)
            {
                Device.SetVertexBuffer(VBGrid);
                foreach (EffectPass pass in effect.CurrentTechnique.Passes)
                {
                    pass.Apply();
                    Device.DrawPrimitives(PrimitiveType.LineList, 0, GridVerticesArray.Length / 2);
                }
            }
            Device.BlendState = BlendState.NonPremultiplied;
        }
示例#11
0
        // -------------------------------------------------------------------
        // GetDefaultHeroes
        // -------------------------------------------------------------------

        public static List <SystemHero> GetDefaultHeroes()
        {
            List <SystemHero> list = new List <SystemHero>();

            list.Add(new SystemHero(1, WANOK.GetDefaultNames("Lucas")));
            list.Add(new SystemHero(2, WANOK.GetDefaultNames("Kate")));

            return(list);
        }
        // -------------------------------------------------------------------
        // GetDefaultStatistics
        // -------------------------------------------------------------------

        public static List<SystemStatistics> GetDefaultStatistics()
        {
            List<SystemStatistics> list = new List<SystemStatistics>();

            list.Add(new SystemStatistics(1, WANOK.GetDefaultNames("HP"), new SystemGraphic("hpBar.png", true, GraphicKind.Bar, new object[] { 68, 4, 56, 8 }), new GameOverOptions(false, true, null, Comparaison.Equal, 0, Measure.Unit)));
            list.Add(new SystemStatistics(2, WANOK.GetDefaultNames("MP"),new SystemGraphic("mpBar.png", true, GraphicKind.Bar, new object[] { 68, 4, 56, 8 }), new GameOverOptions(true)));
            list.Add(new SystemStatistics(3, WANOK.GetDefaultNames("SP"),new SystemGraphic("spBar.png", true, GraphicKind.Bar, new object[] { 68, 4, 56, 8 }),new GameOverOptions(true)));

            return list;
        }
示例#13
0
 private void graphicFrameTimer_Elapsed(object sender, EventArgs e)
 {
     if (checkBoxMoveAnimation.Checked)
     {
         int maxFrames = (int)graphicControl1.panel.Graphic.Options[(int)SystemGraphic.OptionsEnum.Frames];
         graphicControl1.panel.Frame++;
         graphicControl1.panel.Frame = WANOK.Mod(graphicControl1.panel.Frame, maxFrames);
         graphicControl1.panel.Invalidate();
     }
 }
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public DialogStatistics(SystemStatistics statistics)
        {
            InitializeComponent();

            Control = new DialogStatisticsControl(statistics);
            ViewModelBindingSource.DataSource = Control;

            // Initialise general datas
            textBoxName.InitializeParameters(Control.Model.Names);
            textBoxGraphicIcon.InitializeParameters(statistics.Bar.CreateCopy(), typeof(DialogPreviewGraphicSelectRectangle), OptionsKind.BarSelection);
            PictureBoxIcon.SizeMode          = PictureBoxSizeMode.StretchImage;
            PictureBoxIcon.InterpolationMode = InterpolationMode.NearestNeighbor;
            LoadBar(statistics.Bar);

            // Game over
            listView1.Columns[0].Width = listView1.Size.Width - 4;
            for (int i = 0; i < WANOK.Game.Heroes.HeroesList.Count; i++)
            {
                listView1.Items.Add(WANOK.GetStringList(WANOK.Game.Heroes.HeroesList[i].Id, WANOK.Game.Heroes.HeroesList[i].Name));
                if (statistics.AllGameOverOptions.HeroesSelected != null && statistics.AllGameOverOptions.HeroesSelected.Contains(WANOK.Game.Heroes.HeroesList[i].Id))
                {
                    listView1.Items[i].Checked = true;
                }
            }
            comboBoxComparaison1.InitValues();
            comboBoxMeasure1.InitValues();
            ListControlsGameOver.Add(new Control[] { });
            ListControlsGameOver.Add(new Control[] { radioButton3, radioButton4, listView1, label3, comboBoxComparaison1, label4, numericUpDown1, comboBoxMeasure1 });
            ListControlsGameOverHeroes.Add(new Control[] { });
            ListControlsGameOverHeroes.Add(new Control[] { listView1 });
            if (statistics.AllGameOverOptions.NoImplication)
            {
                radioButton1.Checked = true;
            }
            else
            {
                radioButton2.Checked = true;
            }
            if (statistics.AllGameOverOptions.AllHeroes)
            {
                radioButton3.Checked = true;
            }
            else
            {
                radioButton4.Checked = true;
            }
            comboBoxComparaison1.SelectedIndex = (int)statistics.AllGameOverOptions.Comparaison;
            comboBoxMeasure1.SelectedIndex     = (int)statistics.AllGameOverOptions.Measure;

            // Events
            textBoxGraphicIcon.GetTextBox().SelectedValueChanged += textBoxGraphicIcon_SelectedValueChanged;

            InitializeDataBindings();
        }
示例#15
0
        // -------------------------------------------------------------------
        // LoadPortion
        // -------------------------------------------------------------------

        public void LoadPortion(int real_i, int real_j, int i, int j)
        {
            int[] portion       = new int[] { i, j };
            int[] globalPortion = new int[] { real_i, real_j };
            Portions[portion]       = WANOK.LoadPortionMap(MapInfos.RealMapName, real_i, real_j);
            EventsPortions[portion] = new EventsPortion(Events.CompleteList.ContainsKey(globalPortion) ? Events.CompleteList[globalPortion] : null);
            if (Portions[portion] != null)
            {
                GenTextures(portion);
            }
            GenEvent(portion, globalPortion);
        }
        // -------------------------------------------------------------------
        // AddMountain
        // -------------------------------------------------------------------

        public bool AddMountain(int[] coords, int newId, Mountain newMountain)
        {
            bool modified = false;
            int  height   = WANOK.GetCoordsPixelHeight(coords);

            object[] before = ContainsMountain(height, coords);

            // Remplacing
            if (before == null)
            {
                modified = true;
            }
            else
            {
                int      beforeId       = (int)before[0];
                Mountain beforeMountain = (Mountain)before[1];
                if (beforeId != newId)
                {
                    modified = true;
                }
                Mountains[height].Remove(coords, beforeId, height);
            }

            if (!Mountains.ContainsKey(height))
            {
                Mountains[height] = new Mountains();
            }
            Mountains[height].Add(coords, newId, newMountain, height);

            SystemTileset tileset = MapEditor.GetMapTileset();

            object[] reliefTop = tileset.ReliefTop[tileset.Reliefs.IndexOf(newId)];


            switch ((DrawType)reliefTop[0])
            {
            case DrawType.Floors:
                AddFloor(new int[] { coords[0], coords[1] + newMountain.SquareHeight, coords[2] + newMountain.PixelHeight, coords[3] }, (int[])reliefTop[1]);
                break;

            case DrawType.Autotiles:
                int id = ((int[])reliefTop[1])[0];
                if (id > 0)
                {
                    AddAutotile(new int[] { coords[0], coords[1] + newMountain.SquareHeight, coords[2] + newMountain.PixelHeight, coords[3] }, id, true);
                }
                break;
            }


            return(modified);
        }
示例#17
0
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public EventsPortion(Dictionary <int[], SystemEvent> dictionary)
        {
            if (dictionary != null)
            {
                foreach (KeyValuePair <int[], SystemEvent> entry in dictionary)
                {
                    if (WANOK.GetGeneralDrawType(entry.Value.GetCurrentPage().GraphicDrawType) == GeneralDrawtype.Sprite)
                    {
                        AddSprite(entry.Key, entry.Value);
                    }
                }
            }
        }
示例#18
0
        // -------------------------------------------------------------------
        // SetStartInfos
        // -------------------------------------------------------------------

        public void SetStartInfos(SystemDatas system, int[] startPosition)
        {
            if (startPosition[0] >= 0 && startPosition[0] < MapInfos.Width && startPosition[3] >= 0 && startPosition[3] < MapInfos.Height)
            {
                SetStartInfos(startPosition);
            }
            // If not into the portions, delete it
            else
            {
                system.NoStart();
                WANOK.SaveBinaryDatas(system, WANOK.SystemPath);
            }
        }
示例#19
0
        // -------------------------------------------------------------------
        // Update
        // -------------------------------------------------------------------

        public void Update(Mountains mountains, int[] coords, int[] portion, int height)
        {
            DrawTop   = !CanDraw(mountains.TileOnTop(coords, portion, height));
            DrawBot   = !CanDraw(mountains.TileOnBottom(coords, portion, height));
            DrawLeft  = !CanDraw(mountains.TileOnLeft(coords, portion, height));
            DrawRight = !CanDraw(mountains.TileOnRight(coords, portion, height));

            // Update & save update
            int[] portionToUpdate = MapEditor.Control.GetPortion(coords[0], coords[3]);
            MapEditor.Control.AddPortionToUpdate(portionToUpdate);
            MapEditor.Control.AddPortionToSave(portionToUpdate);
            WANOK.AddPortionsToAddCancel(MapEditor.Control.Map.MapInfos.RealMapName, MapEditor.Control.GetGlobalPortion(portionToUpdate));
        }
示例#20
0
        // -------------------------------------------------------------------
        // GetDefaultElements
        // -------------------------------------------------------------------

        public static List <SystemElement> GetDefaultElements()
        {
            List <SystemElement> list = new List <SystemElement>();

            list.Add(new SystemElement(1, WANOK.GetDefaultNames("Fire"), new SystemGraphic("fire.png", true, GraphicKind.Icon)));
            list.Add(new SystemElement(2, WANOK.GetDefaultNames("Water"), new SystemGraphic("water.png", true, GraphicKind.Icon)));
            list.Add(new SystemElement(3, WANOK.GetDefaultNames("Grass"), new SystemGraphic("grass.png", true, GraphicKind.Icon)));
            list.Add(new SystemElement(4, WANOK.GetDefaultNames("Wind"), new SystemGraphic("wind.png", true, GraphicKind.Icon)));
            list.Add(new SystemElement(5, WANOK.GetDefaultNames("Light"), new SystemGraphic("light.png", true, GraphicKind.Icon)));
            list.Add(new SystemElement(6, WANOK.GetDefaultNames("Darkness"), new SystemGraphic("darkness.png", true, GraphicKind.Icon)));

            return(list);
        }
        // -------------------------------------------------------------------
        // ok_Click
        // -------------------------------------------------------------------

        private void ok_Click(object sender, EventArgs e)
        {
            string message = Control.CreateProject();

            if (message != null)
            {
                WANOK.ShowWarningMessage(message);
            }
            else
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }
示例#22
0
        // -------------------------------------------------------------------
        // ToString
        // -------------------------------------------------------------------

        public static string ToString(List <object> condition)
        {
            int selection = (int)condition[1];

            switch ((int)condition[0])
            {
            // Switches & varaibles
            case 0:
                if (selection == 0)
                {
                    return("Switch " + WANOK.GetStringSwitch((int)condition[2]) + " is " + ((int)condition[3] == 0 ? "ON" : "OFF"));
                }
                else if (selection == 1)
                {
                    return("");
                }
                else if (selection == 3)
                {
                    return("");
                }
                break;

            // Heroes
            case 1:
                if (selection == 0)
                {
                    return("");
                }
                else if (selection == 1)
                {
                    return("");
                }
                else if (selection == 3)
                {
                    return("");
                }
                break;

            case 2:
                break;

            default:
                break;
            }

            return("");
        }
示例#23
0
        public void UnCheckHeroesSelection()
        {
            WANOK.UnCheckRadios(SwitchesVariablesSelectionRadios);
            WANOK.UnCheckAllControls(SwitchesVariablesSelectionItems);
            WANOK.UnableRadios(HeroesConditionRadios, true);
            int index = 0;

            for (int i = 0; i < HeroesConditionRadios.Count; i++)
            {
                if (HeroesConditionRadios[i].Checked)
                {
                    break;
                }
                index++;
            }
            CheckHeroesCondition(index);
        }
        // -------------------------------------------------------------------
        // RemoveMountain
        // -------------------------------------------------------------------

        public bool RemoveMountain(int[] coords)
        {
            bool modified = false;
            int  height   = WANOK.GetCoordsPixelHeight(coords);

            object[] before = ContainsMountain(height, coords);
            if (before != null)
            {
                modified = true;
                int      beforeId       = (int)before[0];
                Mountain beforeMountain = (Mountain)before[1];
                Mountains[height].Remove(coords, beforeId, height);
                RemoveFloor(new int[] { coords[0], coords[1] + beforeMountain.SquareHeight, coords[2] + beforeMountain.PixelHeight, coords[3] });
            }

            return(modified);
        }
示例#25
0
        // -------------------------------------------------------------------
        // OpenLabelDialogCommand
        // -------------------------------------------------------------------

        public void OpenLabelDialogCommand()
        {
            if (ListCommandsSelectedLabel != null)
            {
                EventCommandKind kind         = (EventCommandKind)ListCommandsSelectedLabel.Tag;
                EventCommand     eventCommand = null;
                switch (kind)
                {
                case EventCommandKind.None:
                    eventCommand = new EventCommandOther();
                    break;

                case EventCommandKind.ChangeSwitches:
                    eventCommand = new EventCommandOther(EventCommandKind.ChangeSwitches, new List <object>(new object[] { 0, 1, 0 }));
                    break;

                case EventCommandKind.Conditions:
                    eventCommand = new EventCommandConditions();
                    break;

                default:
                    break;
                }
                ModelForm dialog = (ModelForm)GetDialogEventCommand(eventCommand);
                if (kind == EventCommandKind.None)
                {
                    WANOK.ShowActionMessage();
                }
                else
                {
                    DontLooseFocus = true;
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        ((NTree <EventCommand>)CommandsView.SelectedNode.Tag).Data = dialog.GetModel();
                        CommandsView.SelectedNode.Text = WANOK.ListBeginning + dialog.GetModel().ToString();
                        TreeNode             node        = CommandsView.Nodes.Add(WANOK.ListBeginning);
                        NTree <EventCommand> commandTree = Control.Model.GetCurrentPage().CommandsTree.AddChildData(new EventCommandOther());
                        node.Tag = commandTree;
                        UpdateTreeCommandsSelection();
                    }
                    DontLooseFocus = false;
                }
            }
        }
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public GraphicControl()
        {
            InitializeComponent();

            panel.BorderStyle = BorderStyle.FixedSingle;
            panel.Dock        = DockStyle.Fill;
            tableLayoutPanel1.Controls.Add(panel, 0, 1);

            // Combobox draw type
            foreach (DrawType drawtype in Enum.GetValues(typeof(DrawType)))
            {
                comboBox1.Items.Add(WANOK.DrawTypeToString(drawtype));
            }

            // Event
            panel.Click       += panel_Click;
            panel.DoubleClick += Panel_DoubleClick;
            panel.LostFocus   += Panel_LostFocus;
        }
示例#27
0
        public void FillComboBox(List <int> list, MethodGetSuperItemById getById, MethodGetIndexById getIndexById, int currentId)
        {
            for (int i = 0; i < list.Count; i++)
            {
                ComboxBoxSpecialTilesetItem item = (ComboxBoxSpecialTilesetItem)getById(list[i]);
                Items.Add(new DropDownItem(WANOK.GetStringComboBox(item.Id, item.Name), item.Graphic.LoadImage()));
            }
            int id = list.IndexOf(currentId);

            if (Items.Count > 0)
            {
                if (id >= 0 && id < Items.Count)
                {
                    SelectedIndex = id;
                }
                else
                {
                    SelectedIndex = 0;
                }
            }
        }
示例#28
0
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public DialogAddingAutotilesList(string text, TilesetsDatas model, List <int> superListTileset) : base(text, model, superListTileset, typeof(SystemAutotile))
        {
            // Collision settings
            collisionSettings      = new CollisionSettings();
            collisionSettings.Dock = DockStyle.Fill;
            PanelOther.Controls.Add(collisionSettings);
            collisionSettings.LoadTextures();

            listBoxComplete.GetListBox().SelectedIndexChanged += listBoxComplete_SelectedIndexChanged;
            listBoxComplete.InitializeListParameters(true, WANOK.GetSuperListItem(model.Autotiles.Cast <SuperListItem>().ToList()), null, Type, 1, SystemAutotile.MAX_AUTOTILES);
            List <SuperListItem> modelTileset = new List <SuperListItem>();

            for (int i = 0; i < superListTileset.Count; i++)
            {
                modelTileset.Add(model.GetAutotileById(superListTileset[i]));
            }

            listBoxTileset.InitializeListParameters(true, modelTileset, null, Type, 0, 0, false);

            textBoxGraphic.GetTextBox().SelectedValueChanged += textBoxGraphic_SelectedValueChanged;
            listBoxComplete.GetListBox().MouseDown           += listBoxComplete_SelectedIndexChanged;
            listBoxComplete.GetButton().Click += listBoxComplete_Click;
        }
        // -------------------------------------------------------------------
        // PasteMap
        // -------------------------------------------------------------------

        public string PasteMap(string mapName)
        {
            string newMapName = WANOK.GenerateMapName();

            Directory.CreateDirectory(Path.Combine(WANOK.MapsDirectoryPath, newMapName));
            string[] filePaths = Directory.GetFiles(Path.Combine(WANOK.MapsDirectoryPath, mapName, "temp"));
            if (filePaths.Length == 0)
            {
                filePaths = Directory.GetFiles(Path.Combine(WANOK.MapsDirectoryPath, mapName));
            }
            foreach (string filePath in filePaths)
            {
                File.Copy(filePath, Path.Combine(WANOK.MapsDirectoryPath, newMapName, Path.GetFileName(filePath)));
            }
            Directory.CreateDirectory(Path.Combine(WANOK.MapsDirectoryPath, newMapName, "temp"));
            string   infosPath = Path.Combine(WANOK.MapsDirectoryPath, newMapName, "infos.map");
            MapInfos mapInfos  = WANOK.LoadBinaryDatas <MapInfos>(infosPath);

            mapInfos.RealMapName = newMapName;
            WANOK.SaveBinaryDatas(mapInfos, infosPath);

            return(newMapName);
        }
        // -------------------------------------------------------------------
        // Constructor
        // -------------------------------------------------------------------

        public BattleSystemDatas()
        {
            // Get defaults lists
            Elements   = SystemElement.GetDefaultElements();
            Statistics = SystemStatistics.GetDefaultStatistics();

            // Weapons kind
            WeaponsKind.Add(new SuperListItemName(1, WANOK.GetDefaultNames("Sword")));
            WeaponsKind.Add(new SuperListItemName(2, WANOK.GetDefaultNames("Axe")));
            WeaponsKind.Add(new SuperListItemName(3, WANOK.GetDefaultNames("Spear")));
            WeaponsKind.Add(new SuperListItemName(4, WANOK.GetDefaultNames("Staff")));
            WeaponsKind.Add(new SuperListItemName(5, WANOK.GetDefaultNames("Bow")));
            WeaponsKind.Add(new SuperListItemName(6, WANOK.GetDefaultNames("Firearm")));

            // Armors kind
            ArmorsKind.Add(new SuperListItemName(1, WANOK.GetDefaultNames("Helmet")));
            ArmorsKind.Add(new SuperListItemName(2, WANOK.GetDefaultNames("Cap")));
            ArmorsKind.Add(new SuperListItemName(3, WANOK.GetDefaultNames("Mail")));
            ArmorsKind.Add(new SuperListItemName(4, WANOK.GetDefaultNames("Vest")));
            ArmorsKind.Add(new SuperListItemName(5, WANOK.GetDefaultNames("Vambraces")));
            ArmorsKind.Add(new SuperListItemName(6, WANOK.GetDefaultNames("Guards")));
            ArmorsKind.Add(new SuperListItemName(7, WANOK.GetDefaultNames("Greaves")));
            ArmorsKind.Add(new SuperListItemName(8, WANOK.GetDefaultNames("Leggings")));
        }