Exemplo n.º 1
0
        public void exitProperty_Click(object sender, EventArgs e)
        {
            exitPropForm.SetExit(lastselectedExit);
            DialogResult dr = exitPropForm.ShowDialog();

            if (dr == DialogResult.OK)
            {
                int index = Array.IndexOf(jsonData.exitsOWs, lastselectedExit);
                jsonData.exitsOWs[index] = exitPropForm.editingExit;
                lastselectedExit         = jsonData.exitsOWs[index];
                scene.sceneMode          = SceneMode.exits;
            }
            else if (dr == DialogResult.Yes)
            {
                scene.sceneMode = SceneMode.door;
                if (lastselectedExit.doorType1 != 0) //wooden door
                {
                    scene.selectedTiles       = new ushort[2, 1];
                    scene.selectedTiles[0, 0] = 1865;
                    scene.selectedTiles[1, 0] = 1866;
                    scene.setOverlaytiles(scene.allgfx16Ptr);
                }
                else if ((lastselectedExit.doorType2 & 0x8000) != 0) //castle door
                {
                    scene.selectedTiles       = new ushort[2, 2];
                    scene.selectedTiles[0, 0] = 3510;
                    scene.selectedTiles[1, 0] = 3511;
                    scene.selectedTiles[0, 1] = 3512;
                    scene.selectedTiles[1, 1] = 3513;
                    scene.setOverlaytiles(scene.allgfx16Ptr);
                }
                else if ((lastselectedExit.doorType2 & 0x7FFF) != 0) //sanc door
                {
                    scene.selectedTiles       = new ushort[2, 1];
                    scene.selectedTiles[0, 0] = 3502;
                    scene.selectedTiles[1, 0] = 3503;
                    scene.setOverlaytiles(scene.allgfx16Ptr);
                }
            }
            else
            {
                scene.sceneMode = SceneMode.exits;
            }
            selectedExit     = null;
            scene.mouse_down = false;
            scene.rightClick = false;
        }
Exemplo n.º 2
0
        public void onMouseUp(MouseEventArgs e, int mouse_x, int mouse_y, short mouseOverMap, Map16 map)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (selectedExit != null)
                {
                    lastselectedExit = selectedExit;
                    selectedExit     = null;
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                for (int i = 0; i < 78; i++)
                {
                    ExitOW en = jsonData.exitsOWs[i];
                    if (en.mapId >= scene.offset && en.mapId < 64 + scene.offset)
                    {
                        if (mouse_x >= en.playerX && mouse_x < en.playerX + 16 && mouse_y >= en.playerY && mouse_y < en.playerY + 16)
                        {
                            ContextMenuStrip menu = new ContextMenuStrip();
                            menu.Items.Add("Exit Properties");
                            lastselectedExit = en;
                            selectedExit     = null;
                            scene.mouse_down = false;
                            scene.rightClick = true;
                            if (lastselectedExit == null)
                            {
                                menu.Items[0].Enabled = false;
                            }

                            menu.Items[0].Click += exitProperty_Click;
                            menu.Show(Cursor.Position);
                        }
                    }
                }
            }
        }