예제 #1
0
        public override void PreformAction(Engine engine, string ActionName, params String[] Arguments)
        {
            switch (ActionName)
            {
            case "Set Back":
                xyGotoAngle  = MathHelper.Pi;
                zGotoAngle   = 0;
                SelectedSide = 2;
                break;

            case "Set Front":
                xyGotoAngle  = 0;
                zGotoAngle   = 0;
                SelectedSide = 0;
                break;

            case "Set Left":
                xyGotoAngle  = MathHelper.PiOver2;
                zGotoAngle   = 0;
                SelectedSide = 3;
                break;

            case "Set Right":
                xyGotoAngle  = -MathHelper.PiOver2;
                zGotoAngle   = 0;
                SelectedSide = 1;
                break;

            case "Set Top":
                xyGotoAngle  = 0;
                zGotoAngle   = MathHelper.PiOver2;
                SelectedSide = 5;
                break;

            case "Set Bottom":
                xyGotoAngle  = 0;
                zGotoAngle   = -MathHelper.PiOver2;
                SelectedSide = 4;
                break;

            case "#Set Back":
                CurrentBlock.SideProperty[2] += 1;
                if (CurrentBlock.SideProperty[2] == Block.MaxSideProperty)
                {
                    CurrentBlock.SideProperty[2] = 0;
                }
                UpdateButtonColor();
                break;

            case "#Set Front":
                CurrentBlock.SideProperty[0] += 1;
                if (CurrentBlock.SideProperty[0] == Block.MaxSideProperty)
                {
                    CurrentBlock.SideProperty[0] = 0;
                }
                UpdateButtonColor();
                break;

            case "#Set Left":
                CurrentBlock.SideProperty[3] += 1;
                if (CurrentBlock.SideProperty[3] == Block.MaxSideProperty)
                {
                    CurrentBlock.SideProperty[3] = 0;
                }
                UpdateButtonColor();
                break;

            case "#Set Right":
                CurrentBlock.SideProperty[1] += 1;
                if (CurrentBlock.SideProperty[1] == Block.MaxSideProperty)
                {
                    CurrentBlock.SideProperty[1] = 0;
                }
                UpdateButtonColor();
                break;

            case "#Set Top":
                CurrentBlock.SideProperty[5] += 1;
                if (CurrentBlock.SideProperty[5] == Block.MaxSideProperty)
                {
                    CurrentBlock.SideProperty[5] = 0;
                }
                UpdateButtonColor();
                break;

            case "#Set Bottom":
                CurrentBlock.SideProperty[4] += 1;
                if (CurrentBlock.SideProperty[4] == Block.MaxSideProperty)
                {
                    CurrentBlock.SideProperty[4] = 0;
                }
                UpdateButtonColor();
                break;

            case "Back":
                if (TextureSelector.Page > 0)
                {
                    TextureSelector.Page--;
                    TextureSelector.UpdatePage();
                    UpdateHeader();
                }
                break;

            case "Forward":
                if (TextureSelector.FilteredList.Count > (TextureSelector.PrevMaximumColumns * TextureSelector.PrevMaximumRows) * (TextureSelector.Page + 1))
                {
                    TextureSelector.Page++;
                    TextureSelector.UpdatePage();
                    UpdateHeader();
                }
                break;

            case "Click Texture":
                CurrentBlock.Tex[SelectedSide] = tileset.Tiles.FindIndex(TextureSelector.MouseTexture.Equals);
                break;

            case "Cover Texture":
                for (int i = 0; i < 6; i++)
                {
                    CurrentBlock.Tex[i] = tileset.Tiles.FindIndex(TextureSelector.MouseTexture.Equals);
                }
                break;

            case "Input":
                if (TextureSelector.FilteredList.Count > 0)
                {
                    CurrentBlock.Tex[SelectedSide] = tileset.Tiles.FindIndex(TextureSelector.FilteredList[0].Equals);
                }
                break;

            case "Name":
                Screen _scr = new InputPrompt(engine, this, "Name Chooser", "Type in a name for this block to be used in searches.", CurrentBlock.Name, false);
                _scr.Center(engine);
                engine.screenManager.AddScreen(_scr);
                break;

            case "Name Chooser":
                CurrentBlock.Name = Arguments[0];
                UpdateHeader();
                break;

            case "Give Block Name":
                CurrentBlock.Name = Arguments[0];
                PreformAction(engine, "Save");
                break;

            case "Save":
                if (CurrentBlock.Name == "")
                {
                    Screen _scre = new InputPrompt(engine, this, "Give Block Name", "Give this block a name before you save it.", CurrentBlock.Name, false);
                    _scre.Center(engine);
                    engine.screenManager.AddScreen(_scre);
                }
                else
                {
                    if (!EditMode)
                    {
                        int _firstNullSpot = engine.room.BlockSet.Blocks.FindIndex(
                            delegate(Block block)
                        {
                            return(block == null);
                        });
                        if (_firstNullSpot != -1)
                        {
                            engine.room.BlockSet.Blocks[_firstNullSpot] = CurrentBlock;
                        }
                        else
                        {
                            engine.room.BlockSet.Blocks.Add(CurrentBlock);
                        }
                    }
                    parentScreen.FilterBlocks(engine);
                    engine.room.UpdateRoomVertices();
                    PreformAction(engine, "Close");
                }
                break;

            case "Settings":
                engine.screenManager.AddScreen(new BlockSettings(engine, CurrentBlock));
                break;

            case "Delete":
                if (engine.room.BlockSet.Blocks.FindIndex(CurrentBlock.Equals) > 2)
                {
                    engine.screenManager.AddScreen(new ConfirmPrompt(engine, this, "Confirm Delete", "Are you sure you want to delete this block?"));
                }
                else
                {
                    engine.screenManager.AddScreen(new Message(engine, "This is a special block, you cannot delete it.", true));
                }
                break;

            case "Confirm Delete Yes":
                int ii = engine.room.BlockSet.Blocks.FindIndex(CurrentBlock.Equals);
                engine.room.ReplaceBlocks(ii, 1);
                engine.room.BlockSet.Blocks[ii] = null;
                parentScreen.SelectedBlock      = 1;
                parentScreen.FilterBlocks(engine);
                PreformAction(engine, "Close");
                engine.room.UpdateRoomVertices();
                break;
            }
            base.PreformAction(engine, ActionName);
        }
예제 #2
0
 public override void PreformAction(Engine engine, string ActionName, params String[] Arguments)
 {
     switch (ActionName)
     {
         case "Set Back":
             xyGotoAngle = MathHelper.Pi;
             zGotoAngle = 0;
             SelectedSide = 2;
             break;
         case "Set Front":
             xyGotoAngle = 0;
             zGotoAngle = 0;
             SelectedSide = 0;
             break;
         case "Set Left":
             xyGotoAngle = MathHelper.PiOver2;
             zGotoAngle = 0;
             SelectedSide = 3;
             break;
         case "Set Right":
             xyGotoAngle = -MathHelper.PiOver2;
             zGotoAngle = 0;
             SelectedSide = 1;
             break;
         case "Set Top":
             xyGotoAngle = 0;
             zGotoAngle = MathHelper.PiOver2;
             SelectedSide = 5;
             break;
         case "Set Bottom":
             xyGotoAngle = 0;
             zGotoAngle = -MathHelper.PiOver2;
             SelectedSide = 4;
             break;
         case "#Set Back":
             CurrentBlock.SideProperty[2] += 1;
             if (CurrentBlock.SideProperty[2] == Block.MaxSideProperty)
                 CurrentBlock.SideProperty[2] = 0;
             UpdateButtonColor();
             break;
         case "#Set Front":
             CurrentBlock.SideProperty[ 0] += 1;
             if (CurrentBlock.SideProperty[ 0] == Block.MaxSideProperty)
                 CurrentBlock.SideProperty[ 0] = 0;
             UpdateButtonColor();
             break;
         case "#Set Left":
             CurrentBlock.SideProperty[3] += 1;
             if (CurrentBlock.SideProperty[3] == Block.MaxSideProperty)
                 CurrentBlock.SideProperty[3] = 0;
             UpdateButtonColor();
             break;
         case "#Set Right":
             CurrentBlock.SideProperty[1] += 1;
             if (CurrentBlock.SideProperty[1] == Block.MaxSideProperty)
                 CurrentBlock.SideProperty[1] = 0;
             UpdateButtonColor();
             break;
         case "#Set Top":
             CurrentBlock.SideProperty[5] += 1;
             if (CurrentBlock.SideProperty[5] == Block.MaxSideProperty)
                 CurrentBlock.SideProperty[5] = 0;
             UpdateButtonColor();
             break;
         case "#Set Bottom":
             CurrentBlock.SideProperty[4] += 1;
             if (CurrentBlock.SideProperty[4] == Block.MaxSideProperty)
                 CurrentBlock.SideProperty[4] = 0;
             UpdateButtonColor();
             break;
         case "Back":
             if (TextureSelector.Page > 0)
             {
                 TextureSelector.Page--;
                 TextureSelector.UpdatePage();
                 UpdateHeader();
             }
             break;
         case "Forward":
             if (TextureSelector.FilteredList.Count > (TextureSelector.PrevMaximumColumns * TextureSelector.PrevMaximumRows) * (TextureSelector.Page + 1))
             {
                 TextureSelector.Page++;
                 TextureSelector.UpdatePage();
                 UpdateHeader();
             }
             break;
         case "Click Texture":
             CurrentBlock.Tex[SelectedSide] = tileset.Tiles.FindIndex(TextureSelector.MouseTexture.Equals);
             break;
         case "Cover Texture":
             for (int i = 0; i < 6; i++)
                 CurrentBlock.Tex[i] = tileset.Tiles.FindIndex(TextureSelector.MouseTexture.Equals);
             break;
         case "Input":
             if (TextureSelector.FilteredList.Count > 0)
                 CurrentBlock.Tex[SelectedSide] = tileset.Tiles.FindIndex(TextureSelector.FilteredList[0].Equals);
             break;
         case "Name":
             Screen _scr = new InputPrompt(engine, this, "Name Chooser", "Type in a name for this block to be used in searches.", CurrentBlock.Name, false);
             _scr.Center(engine);
             engine.screenManager.AddScreen(_scr);
             break;
         case "Name Chooser":
             CurrentBlock.Name = Arguments[0];
             UpdateHeader();
             break;
         case "Give Block Name":
             CurrentBlock.Name = Arguments[0];
             PreformAction(engine, "Save");
             break;
         case "Save":
             if (CurrentBlock.Name == "")
             {
                 Screen _scre = new InputPrompt(engine, this, "Give Block Name", "Give this block a name before you save it.", CurrentBlock.Name, false);
                 _scre.Center(engine);
                 engine.screenManager.AddScreen(_scre);
             }
             else
             {
                 if (!EditMode)
                 {
                     int _firstNullSpot = engine.room.BlockSet.Blocks.FindIndex(
                         delegate(Block block)
                         {
                             return block == null;
                         });
                     if (_firstNullSpot != -1)
                         engine.room.BlockSet.Blocks[_firstNullSpot] = CurrentBlock;
                     else
                         engine.room.BlockSet.Blocks.Add(CurrentBlock);
                 }
                 parentScreen.FilterBlocks(engine);
                 engine.room.UpdateRoomVertices();
                 PreformAction(engine, "Close");
             }
             break;
         case "Settings":
             engine.screenManager.AddScreen(new BlockSettings(engine, CurrentBlock));
             break;
         case "Delete":
             if (engine.room.BlockSet.Blocks.FindIndex(CurrentBlock.Equals) > 2)
                 engine.screenManager.AddScreen(new ConfirmPrompt(engine, this, "Confirm Delete", "Are you sure you want to delete this block?"));
             else
                 engine.screenManager.AddScreen(new Message(engine, "This is a special block, you cannot delete it.",true));
             break;
         case "Confirm Delete Yes":
             int ii = engine.room.BlockSet.Blocks.FindIndex(CurrentBlock.Equals);
             engine.room.ReplaceBlocks(ii, 1);
             engine.room.BlockSet.Blocks[ii] = null;
             parentScreen.SelectedBlock = 1;
             parentScreen.FilterBlocks(engine);
             PreformAction(engine, "Close");
             engine.room.UpdateRoomVertices();
             break;
     }
     base.PreformAction(engine, ActionName);
 }