Exemplo n.º 1
0
        public Connect()
        {
            String tmpPath = System.IO.Path.GetTempPath();

            if (tmpPath.EndsWith(@"\") == false)
            {
                tmpPath += @"\";
            }
            tmpPath += "dspam-addin.txt";

            try
            {
                this.logger = new Logger(tmpPath);

                this.konfiguration = new Konfiguration(@"dspam_config.xml", this.logger);
                this.konfiguration.Load();

                this.language = new Language(this.konfiguration, this.logger);
                this.language.Load();
            }
            catch (Exception ex)
            {
                // errForm ef = new errForm(this.language, @"can't create file '" + tmpPath + "' for logging:" + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
Exemplo n.º 2
0
 public RuteberegningService()
 {
     this.byRepository = new ByRepository();
     this.telstarForbindelseRepository = new TelstarForbindelseRepository();
     this.connectionsIntegration       = new ConnectionsIntegration();
     this.konfiguration      = new KonfigurationRepository().Get();
     this.godstypeRepository = new GodstypeRepository();
 }
Exemplo n.º 3
0
        public List <Konfiguration> initializeKonfigurationList()
        {
            List <Konfiguration> konfigurationList = new List <Konfiguration>();

            {
                Konfiguration kon = new Konfiguration()
                {
                    OS         = "OS/2",
                    SUBD       = "DB2",
                    HD         = 130,
                    SD         = 22,
                    PRICE      = 3343,
                    CREATETIME = new DateTime(2000, 1, 1, 0, 0, 0)
                };
                konfigurationList.Add(kon);
            }
            {
                Konfiguration kon = new Konfiguration()
                {
                    OS         = "Windows/NT",
                    SUBD       = "SQLServer",
                    HD         = 230,
                    SD         = 24,
                    PRICE      = 2685,
                    CREATETIME = new DateTime(2010, 1, 1, 0, 0, 0)
                };
                konfigurationList.Add(kon);
            }
            {
                Konfiguration kon = new Konfiguration()
                {
                    OS         = "SCO/Unix",
                    SUBD       = "Oracle",
                    HD         = 110,
                    SD         = 48,
                    PRICE      = 3745,
                    CREATETIME = new DateTime(2016, 1, 1, 0, 0, 0)
                };
                konfigurationList.Add(kon);
            }
            {
                Konfiguration kon = new Konfiguration()
                {
                    OS         = "OS/2",
                    SUBD       = "DB2",
                    HD         = 130,
                    SD         = 22,
                    PRICE      = 3343,
                    CREATETIME = new DateTime(2020, 1, 1, 0, 0, 0)
                };
                konfigurationList.Add(kon);
            }
            return(konfigurationList);
        }
Exemplo n.º 4
0
        public LanguageParser(Konfiguration cfg, Logger log)
        {
            this.config = cfg;
            this.logger = log;

            String temp = Assembly.GetCallingAssembly().Location;
            temp = temp.Substring(0, temp.LastIndexOf(@"\"));
            this._lang_home = temp + @"\lang\";

            // this._lang_home = @"c:\_lang\";
            this.logger.WriteLine("Language Directory is " + this._lang_home);
        }
Exemplo n.º 5
0
        public LanguageParser(Konfiguration cfg, Logger log)
        {
            this.config = cfg;
            this.logger = log;

            String temp = Assembly.GetCallingAssembly().Location;

            temp            = temp.Substring(0, temp.LastIndexOf(@"\"));
            this._lang_home = temp + @"\lang\";

            // this._lang_home = @"c:\_lang\";
            this.logger.WriteLine("Language Directory is " + this._lang_home);
        }
Exemplo n.º 6
0
        public void Set(Konfiguration konfiguration)
        {
            _db.Konfigurations.InsertOnSubmit(konfiguration);

            try
            {
                _db.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Exemplo n.º 7
0
        public AktionForm(Konfiguration cfg, Logger log, Language lang, MailParser mp)
        {
            InitializeComponent();

            this.mailparser = mp;

            this.config = cfg;
            this.loadFromConfig();

            this.logger = log;

            this.language = lang;
            this.loadFromLanguage();

            this.tB_afterTrainSpam_MoveTo.Enabled     = this.rB_afterTrainSpam_MoveTo.Checked;
            this.tB_afterTrainSpam_PrefixWith.Enabled = this.cB_afterTrainSpam_PrefixWith.Checked;
            this.tB_afterTrainHam_MoveTo.Enabled      = this.rB_afterTrainHam_MoveTo.Checked;
            this.tB_afterTrainHam_PrefixWith.Enabled  = this.cB_afterTrainHam_PrefixWith.Checked;
        }
Exemplo n.º 8
0
        public AktionForm(Konfiguration cfg, Logger log, Language lang, MailParser mp)
        {
            InitializeComponent();

            this.mailparser = mp;

            this.config = cfg;
            this.loadFromConfig();

            this.logger = log;

            this.language = lang;
            this.loadFromLanguage();

            this.tB_afterTrainSpam_MoveTo.Enabled = this.rB_afterTrainSpam_MoveTo.Checked;
            this.tB_afterTrainSpam_PrefixWith.Enabled = this.cB_afterTrainSpam_PrefixWith.Checked;
            this.tB_afterTrainHam_MoveTo.Enabled = this.rB_afterTrainHam_MoveTo.Checked;
            this.tB_afterTrainHam_PrefixWith.Enabled = this.cB_afterTrainHam_PrefixWith.Checked;
        }
Exemplo n.º 9
0
        public MainForm(Konfiguration cfg, Logger log, Language lang, MailParser mp, Outlook.Application objOutlook, Worker w)
        {
            InitializeComponent();

            this.worker  = w;
            this.outlook = objOutlook;

            this.mailparser = mp;

            this.config = cfg;
            this.loadFromConfig();

            this.logger = log;

            this.language = lang;
            this.loadFromLanguage();

            this.bt_sendLogToDeveloper.Visible = false;
            this.bt_thankYou.Visible           = false;
        }
Exemplo n.º 10
0
        public MainForm(Konfiguration cfg, Logger log, Language lang, MailParser mp, Outlook.Application objOutlook, Worker w)
        {
            InitializeComponent();

            this.worker = w;
            this.outlook = objOutlook;

            this.mailparser = mp;

            this.config = cfg;
            this.loadFromConfig();

            this.logger = log;

            this.language = lang;
            this.loadFromLanguage();

            this.bt_sendLogToDeveloper.Visible = false;
            this.bt_thankYou.Visible = false;
        }
Exemplo n.º 11
0
        public TrainingForm(Konfiguration cfg, Logger log, Language lang, MailParser mp)
        {
            InitializeComponent();

            this.mailparser = mp;

            this.config = cfg;
            this.loadFromConfig();

            this.logger = log;

            this.language = lang;
            this.loadFromLanguage();

            this.tB_enterFolderForHam.Enabled = this.cB_useAutoTrain.Checked;
            this.tB_enterFolderForSpam.Enabled = this.cB_useAutoTrain.Checked;
            this.tB_enterForwardForHam.Enabled = this.rB_trainWithForward.Checked;
            this.tB_enterForwardForSpam.Enabled = this.rB_trainWithForward.Checked;
            this.tB_enterLoginOfDSpam.Enabled = this.rB_trainWithWebUI.Checked;
            this.tB_enterPasswordOfDSpam.Enabled = this.rB_trainWithWebUI.Checked;
            this.tB_enterUrlOfDSpam.Enabled = this.rB_trainWithWebUI.Checked;
        }
Exemplo n.º 12
0
        public TrainingForm(Konfiguration cfg, Logger log, Language lang, MailParser mp)
        {
            InitializeComponent();

            this.mailparser = mp;

            this.config = cfg;
            this.loadFromConfig();

            this.logger = log;

            this.language = lang;
            this.loadFromLanguage();

            this.tB_enterFolderForHam.Enabled    = this.cB_useAutoTrain.Checked;
            this.tB_enterFolderForSpam.Enabled   = this.cB_useAutoTrain.Checked;
            this.tB_enterForwardForHam.Enabled   = this.rB_trainWithForward.Checked;
            this.tB_enterForwardForSpam.Enabled  = this.rB_trainWithForward.Checked;
            this.tB_enterLoginOfDSpam.Enabled    = this.rB_trainWithWebUI.Checked;
            this.tB_enterPasswordOfDSpam.Enabled = this.rB_trainWithWebUI.Checked;
            this.tB_enterUrlOfDSpam.Enabled      = this.rB_trainWithWebUI.Checked;
        }
Exemplo n.º 13
0
        private void useLevel1()
        {
            _level           = Levels.CreateLevel1();
            _gameLogic.Level = _level;

            foreach (var _room in _level.Rooms)
            {
                LevelVisual.Rooms.Add(new RoomVisual()
                {
                    _Room        = _room,
                    PlayerVisual = new PlayerVisual()
                    {
                        Data = new Player()
                        {
                            //InitialPosition = _room.Player.Position,
                            Position       = _room.Player.Position,
                            RelativeBounds = new List <Vector2>()
                            {
                                new Vector2(0.0f, 0.03f),
                                new Vector2(0.025f, 0.01f),
                                new Vector2(0.07f, 0.02f),

                                new Vector2(0.02f, -0.045f),
                                new Vector2(0.0f, -0.03f),
                                new Vector2(-0.02f, -0.045f),

                                new Vector2(-0.07f, 0.02f),
                                new Vector2(-0.025f, 0.01f)
                            },
                        }
                    },
                    Data = new Model.GameObject.Room()
                    {
                        Column         = _room.Column,
                        Row            = _room.Row,
                        RelativeBounds = new List <Vector2>()
                        {
                            new Vector2(Konfiguration.Round(-1.0f), Konfiguration.Round(1.0f)),
                            new Vector2(Konfiguration.Round(-1.0f), Konfiguration.Round(-1.0f)),
                            new Vector2(Konfiguration.Round(1.0f), Konfiguration.Round(-1.0f)),
                            new Vector2(Konfiguration.Round(1.0f), Konfiguration.Round(1.0f))
                        },
                    },
                    ExitVisual = new ExitVisual()
                    {
                        Data = new Exit()
                        {
                            Position       = _room.Exit.Point1 + 0.5f * (-_room.Exit.Point1 + _room.Exit.Point3),
                            RelativeBounds = new List <Vector2>()
                            {
                                -(_room.Exit.Point1 + 0.5f * (-_room.Exit.Point1 + _room.Exit.Point3)) + _room.Exit.Point1,
                                -(_room.Exit.Point1 + 0.5f * (-_room.Exit.Point1 + _room.Exit.Point3)) + _room.Exit.Point2,
                                -(_room.Exit.Point1 + 0.5f * (-_room.Exit.Point1 + _room.Exit.Point3)) + _room.Exit.Point3,
                                -(_room.Exit.Point1 + 0.5f * (-_room.Exit.Point1 + _room.Exit.Point3)) + _room.Exit.Point4,

                                /*                               0.5f *(-_room.Exit.Point1+_room.Exit.Point3)-_room.Exit.Point1 ,
                                 *                                                                 0.5f*(-_room.Exit.Point1+_room.Exit.Point3)-_room.Exit.Point2,
                                 *                                                                  0.5f*(-_room.Exit.Point1+_room.Exit.Point3)-_room.Exit.Point3,
                                 *                                                                0.5f*(-_room.Exit.Point1+_room.Exit.Point3)- _room.Exit.Point4 ,*/
                            },
                        },
                    },
                });
                if (Math.Abs(LevelVisual.Rooms[LevelVisual.Rooms.Count - 1].ExitVisual.Data.RelativeBounds[0].X) < Math.Abs(LevelVisual.Rooms[LevelVisual.Rooms.Count - 1].ExitVisual.Data.RelativeBounds[0].Y))
                {
                    levelVisual.Rooms[LevelVisual.Rooms.Count - 1].ExitVisual.IsHorizontal = false;
                }
                else
                {
                    levelVisual.Rooms[LevelVisual.Rooms.Count - 1].ExitVisual.IsHorizontal = true;
                }

                //        System.Diagnostics.Debug.WriteLine(0.5f * (-_room.Exit.Point1 + _room.Exit.Point3));
                foreach (var lightray in _room.LightRays)
                {
                    LevelVisual.Rooms[LevelVisual.Rooms.Count - 1].LightRayVisuals.Add(
                        new LightRayVisual()
                    {
                        Data = new LightRay()
                        {
                            Position       = lightray.Origin,
                            RayDirection   = lightray.FirstDirection,
                            RelativeBounds = new List <Vector2>()
                            {
                                new Vector2(Konfiguration.Round(-.02f), Konfiguration.Round(.02f)),
                                new Vector2(Konfiguration.Round(-.02f), Konfiguration.Round(-.02f)),
                                new Vector2(Konfiguration.Round(.02f), Konfiguration.Round(-.02f)),
                                new Vector2(Konfiguration.Round(.02f), Konfiguration.Round(.02f))
                            }
                        }
                    });
                }
                foreach (var _mirror in _room.Mirrors)
                {
                    LevelVisual.Rooms[LevelVisual.Rooms.Count - 1].MirrorVisuals.Add(new MirrorVisual()
                    {
                        Data = new Mirror()
                        {
                            Position    = _mirror.RailPosition1 + 0.5f * (-_mirror.RailPosition1 + _mirror.RailPosition2),
                            RailStart   = _mirror.RailPosition1 - (_mirror.RailPosition1 + 0.5f * (-_mirror.RailPosition1 + _mirror.RailPosition2)),
                            RailEnd     = _mirror.RailPosition2 - (_mirror.RailPosition1 + 0.5f * (-_mirror.RailPosition1 + _mirror.RailPosition2)),
                            InitAngle   = _mirror.StartingAngle,
                            MinRotation = _mirror.MinimumRotation,
                            MaxRotation = _mirror.MaximumRotation,
                            StartingRelativePosition = _mirror.StartingRelativePosition,
                            RelativeBounds           = new List <Vector2>()
                            {
                                new Vector2(Konfiguration.Round(-.02f), Konfiguration.Round(.02f)),
                                new Vector2(Konfiguration.Round(-.02f), Konfiguration.Round(-.02f)),
                                new Vector2(Konfiguration.Round(.02f), Konfiguration.Round(-.02f)),
                                new Vector2(Konfiguration.Round(.02f), Konfiguration.Round(.02f))
                            },
                        },
                    });
                }
                foreach (var obstacle in _room.Obstacles)
                {
                    levelVisual.Rooms[LevelVisual.Rooms.Count - 1].ObstacleVisuals.Add(new ObstacleVisual()
                    {
                        Data = new Obstacle()
                        {
                            Position       = obstacle.Point1 + 0.5f * (-obstacle.Point1 + obstacle.Point3),
                            RelativeBounds = new List <Vector2>()
                            {
                                -(obstacle.Point1 + 0.5f * (-obstacle.Point1 + obstacle.Point3)) + obstacle.Point1,
                                -(obstacle.Point1 + 0.5f * (-obstacle.Point1 + obstacle.Point3)) + obstacle.Point2,
                                -(obstacle.Point1 + 0.5f * (-obstacle.Point1 + obstacle.Point3)) + obstacle.Point3,
                                -(obstacle.Point1 + 0.5f * (-obstacle.Point1 + obstacle.Point3)) + obstacle.Point4,
                            }
                        }
                    });
                }

                foreach (var roomV in levelVisual.Rooms)
                {
                    level.Rooms.Add(roomV.Data as Model.GameObject.Room);
                }

                _gameGraphics.Level = _level;

                //           createStartupLevel();
                //            createVisualStartupLevel();
            }
        }
Exemplo n.º 14
0
        internal void Draw(Vector2 offset, float scale)
        {
            var tmp = new List <Vector2> {
                scale *new Vector2(Konfiguration.Round(-boundBound), Konfiguration.Round(boundBound)),
                scale *new Vector2(Konfiguration.Round(-boundBound), Konfiguration.Round(-boundBound)),
                scale *new Vector2(Konfiguration.Round(boundBound), Konfiguration.Round(-boundBound)),
                scale *new Vector2(Konfiguration.Round(boundBound), Konfiguration.Round(boundBound))
            };

            var dir = (-(((Mirror)Data).RailStart) + ((Mirror)Data).RailEnd);

            dir.Normalize();

            var mirRot = Fledermaus.Utils.Util.GetRotatedVector(dir, ((Mirror)Data).InitAngle) * Mirror.MirrorLength;
            var list   = new List <Vector2>()
            {
                ((Mirror)Data).RailStart,
                ((Mirror)Data).RailEnd,
                mirRot,
                -mirRot,
            };

            Data.RelativeBounds = new List <Vector2>()
            {
                new Vector2(list.Min(x => x.X), list.Max(x => x.Y)),
                new Vector2(list.Max(x => x.X), list.Max(x => x.Y)),
                new Vector2(list.Max(x => x.X), list.Min(x => x.Y)),
                new Vector2(list.Min(x => x.X), list.Min(x => x.Y)),
            };
            var scaledList = new List <Vector2>();

            foreach (var bound in Data.RelativeBounds)
            {
                scaledList.Add(scale * bound * 1.1f);
            }

            if (IsSelected)
            {
                GL.Color3(Color.Cyan);
            }
            else
            {
                GL.Color3(Color.Blue);
            }
            DrawSquare(scale * (offset + Data.Position), scaledList);

            if (IsRailStartSelected)
            {
                GL.Color3(Color.LightGray);
            }
            else
            {
                GL.Color3(Color.Gray);
            }
            DrawSquare(scale * (offset + Data.Position + ((Mirror)Data).RailStart), tmp);

            if (isMirrorPositionSelected)
            {
                GL.Color3(Color.LightBlue);
            }
            else
            {
                GL.Color3(Color.Blue);
            }
            var mirPos = ((Mirror)Data).RailStart + (-((Mirror)Data).RailStart + ((Mirror)Data).RailEnd) * ((Mirror)Data).StartingRelativePosition;

            DrawSquare(scale * (offset + Data.Position + mirPos), tmp);


            if (isMirrorRotationSelected)
            {
                GL.Color3(Color.LightBlue);
            }
            else
            {
                GL.Color3(Color.Blue);
            }
            DrawSquare(scale * (offset + Data.Position + mirPos - mirRot), tmp);

            if (isMirrorMinRotationSelected)
            {
                GL.Color3(Color.Lime);
            }
            else
            {
                GL.Color3(Color.Green);
            }
            var MinPos = mirPos + Fledermaus.Utils.Util.GetRotatedVector(dir, ((Mirror)Data).MinRotation) * Mirror.MirrorLength;

            DrawSquare(scale * (offset + Data.Position + MinPos), tmp);

            if (isMirrorMaxRotationSelected)
            {
                GL.Color3(Color.Lime);
            }
            else
            {
                GL.Color3(Color.Green);
            }
            var MaxPos = mirPos + Fledermaus.Utils.Util.GetRotatedVector(dir, ((Mirror)Data).MaxRotation) * Mirror.MirrorLength;

            DrawSquare(scale * (offset + Data.Position + MaxPos), tmp);
        }
Exemplo n.º 15
0
        private void createStartup()
        {
            _level           = Levels.CreateLevel1();
            _gameLogic.Level = _level;

            foreach (var _room in _level.Rooms)
            {
                _room.Obstacles.Clear();
                _room.Mirrors.Clear();
                _room.LightRays.Clear();
                LevelVisual.Rooms.Add(new RoomVisual()
                {
                    _Room        = _room,
                    PlayerVisual = new PlayerVisual()
                    {
                        Data = new Player()
                        {
                            //InitialPosition = _room.Player.Position,
                            Position       = _room.Player.Position,
                            RelativeBounds = new List <Vector2>()
                            {
                                new Vector2(0.0f, 0.03f),
                                new Vector2(0.025f, 0.01f),
                                new Vector2(0.07f, 0.02f),

                                new Vector2(0.02f, -0.045f),
                                new Vector2(0.0f, -0.03f),
                                new Vector2(-0.02f, -0.045f),

                                new Vector2(-0.07f, 0.02f),
                                new Vector2(-0.025f, 0.01f)
                            },
                        }
                    },
                    Data = new Model.GameObject.Room()
                    {
                        Column         = _room.Column,
                        Row            = _room.Row,
                        RelativeBounds = new List <Vector2>()
                        {
                            new Vector2(Konfiguration.Round(-1.0f), Konfiguration.Round(1.0f)),
                            new Vector2(Konfiguration.Round(-1.0f), Konfiguration.Round(-1.0f)),
                            new Vector2(Konfiguration.Round(1.0f), Konfiguration.Round(-1.0f)),
                            new Vector2(Konfiguration.Round(1.0f), Konfiguration.Round(1.0f))
                        },
                    },
                    ExitVisual = new ExitVisual()
                    {
                        Data = new Exit()
                        {
                            Position       = _room.Exit.Point1 + 0.5f * (-_room.Exit.Point1 + _room.Exit.Point3),
                            RelativeBounds = new List <Vector2>()
                            {
                                -(_room.Exit.Point1 + 0.5f * (-_room.Exit.Point1 + _room.Exit.Point3)) + _room.Exit.Point1,
                                -(_room.Exit.Point1 + 0.5f * (-_room.Exit.Point1 + _room.Exit.Point3)) + _room.Exit.Point2,
                                -(_room.Exit.Point1 + 0.5f * (-_room.Exit.Point1 + _room.Exit.Point3)) + _room.Exit.Point3,
                                -(_room.Exit.Point1 + 0.5f * (-_room.Exit.Point1 + _room.Exit.Point3)) + _room.Exit.Point4,

                                /*                               0.5f *(-_room.Exit.Point1+_room.Exit.Point3)-_room.Exit.Point1 ,
                                 *                                                                 0.5f*(-_room.Exit.Point1+_room.Exit.Point3)-_room.Exit.Point2,
                                 *                                                                  0.5f*(-_room.Exit.Point1+_room.Exit.Point3)-_room.Exit.Point3,
                                 *                                                                0.5f*(-_room.Exit.Point1+_room.Exit.Point3)- _room.Exit.Point4 ,*/
                            },
                        },
                    },
                });
                if (Math.Abs(LevelVisual.Rooms[LevelVisual.Rooms.Count - 1].ExitVisual.Data.RelativeBounds[0].X) < Math.Abs(LevelVisual.Rooms[LevelVisual.Rooms.Count - 1].ExitVisual.Data.RelativeBounds[0].Y))
                {
                    levelVisual.Rooms[LevelVisual.Rooms.Count - 1].ExitVisual.IsHorizontal = false;
                }
                else
                {
                    levelVisual.Rooms[LevelVisual.Rooms.Count - 1].ExitVisual.IsHorizontal = true;
                }

                //        System.Diagnostics.Debug.WriteLine(0.5f * (-_room.Exit.Point1 + _room.Exit.Point3));

                /*     LevelVisual.Rooms[LevelVisual.Rooms.Count - 1].LightRayVisuals.Add(
                 *       new LightRayVisual()
                 *       {
                 *           Data = new LightRay()
                 *           {
                 *               Position = _room.LightRays.First().Origin,
                 *               RayDirection = _room.LightRays.First().FirstDirection,
                 *               RelativeBounds = new List<Vector2>() {  new Vector2( Konfiguration.Round(-.02f), Konfiguration.Round(.02f)),
                 *                                           new Vector2( Konfiguration.Round(-.02f), Konfiguration.Round(-.02f)),
                 *                                           new Vector2( Konfiguration.Round(.02f), Konfiguration.Round(-.02f)),
                 *                                           new Vector2( Konfiguration.Round(.02f), Konfiguration.Round(.02f))
                 *               }
                 *           }
                 *
                 *       });
                 */



                foreach (var roomV in levelVisual.Rooms)
                {
                    level.Rooms.Add(roomV.Data as Model.GameObject.Room);
                }

                _gameGraphics.Level = _level;

                //           createStartupLevel();
                //            createVisualStartupLevel();
            }

            /*            for (int i = 0; i < RowsToZero + (RowsToZero - 1); i++) {
             *              for(int j = 0;j<ColumnsToZero + (ColumnsToZero - 1); j++)
             *              {
             *                  levelVisual.Rooms.Add(new RoomVisual()
             *                  {
             *
             *                      Data = new Model.GameObject.Room()
             *                      {
             *                          Row = i + 1,
             *                          Column = j + 1,
             *                          RelativeBounds = new List<Vector2>() {  new Vector2( Konfiguration.Round(-1.0f), Konfiguration.Round(1.0f)),
             *                                                      new Vector2( Konfiguration.Round(1.0f), Konfiguration.Round(1.0f)),
             *                                                      new Vector2( Konfiguration.Round(1.0f), Konfiguration.Round(-1.0f)),
             *                                                      new Vector2( Konfiguration.Round(-1.0f), Konfiguration.Round(-1.0f)) },
             *
             *                      },
             *                      PlayerVisual = new PlayerVisual()
             *                      {
             *
             *                          Data = new Player() {
             *                              Position = Vector2.Zero,
             *
             *                              RelativeBounds = new List<Vector2>() {  new Vector2(0.0f, 0.03f),
             *                                                                      new Vector2(0.025f, 0.01f),
             *                                                                      new Vector2(0.07f, 0.02f),
             *
             *                                                                      new Vector2(0.02f, -0.045f),
             *                                                                      new Vector2(0.0f, -0.03f),
             *                                                                      new Vector2(-0.02f, -0.045f),
             *
             *                                                                      new Vector2(-0.07f, 0.02f),
             *                                                                      new Vector2(-0.025f, 0.01f)
             *                              },
             *                          },
             *                      },
             *                      ExitVisual = new ExitVisual()
             *                      {
             *
             *                          Data = new Exit()
             *                          {
             *                              Position = new Vector2(1.0f, .0f),
             *                              RelativeBounds = new List<Vector2>() {
             *                                      new Vector2(-0.105f, 0.045f),
             *                                      new Vector2(0.105f, 0.045f),
             *                                      new Vector2(0.105f, -0.045f),
             *                                      new Vector2(-0.105f, -0.045f),
             *                              },
             *                          },
             *                          IsHorizontal = true,
             *                      }
             *                  });
             *                  var _level2 = Serializer.getLevelAs_Level(Serializer.getLevelVisualAsLevel(LevelVisual));
             *                  levelVisual.Rooms.Last()._Room = _level2.Rooms.Last();
             *                  //_level.CurrentRoom = _level.Rooms.First();
             *
             *              }
             *          }
             *          var _level = Serializer.getLevelAs_Level(Serializer.getLevelVisualAsLevel(LevelVisual));
             *          _level.CurrentRoom = _level.Rooms.First();
             *          _gameGraphics.Level = _level;
             *          _gameLogic.Level = _level;
             */
        }
Exemplo n.º 16
0
        private void createSideMenu()
        {
            sideMenu             = new MenuScreen(false);
            sideMenu.ShowBorder  = true;
            sideMenu.Padding     = .03f;
            sideMenu.BorderWidth = 0.01f;
            //sideMenu.HorizontalAlignment = HorizontalAlignment.Center;
            sideMenu.MaxHeight = 2.0f;
            sideMenu.menuButtons.Add(
                new ButtonTexture(Resources.LightRay,
                                  delegate() {
                var lrv = new LightRayVisual()
                {
                    Data = new Model.GameObject.LightRay()
                    {
                        RayDirection   = new Vector2(.2f, .0f),
                        RelativeBounds = new List <Vector2>()
                        {
                            new Vector2(Konfiguration.Round(-.02f), Konfiguration.Round(.02f)),
                            new Vector2(Konfiguration.Round(-.02f), Konfiguration.Round(-.02f)),
                            new Vector2(Konfiguration.Round(.02f), Konfiguration.Round(-.02f)),
                            new Vector2(Konfiguration.Round(.02f), Konfiguration.Round(.02f))
                        }
                    },
                };
                selectedRoom.LightRayVisuals.Add(lrv);
                _level.CurrentRoom.AddLightRay(new GameObjects.LightRay(lrv.Data.Position, ((LightRay)lrv.Data).RayDirection));
            },
                                  true)
                );
            sideMenu.menuButtons.Add(
                new ButtonTexture(Resources.obstacle1,
                                  delegate() {
                var obst = new ObstacleVisual()
                {
                    Data = new Model.GameObject.Obstacle()
                    {
                        RelativeBounds = new List <Vector2>()
                        {
                            new Vector2(Konfiguration.Round(-.2f), Konfiguration.Round(.2f)),
                            new Vector2(Konfiguration.Round(-.2f), Konfiguration.Round(-.2f)),
                            new Vector2(Konfiguration.Round(.2f), Konfiguration.Round(-.2f)),
                            new Vector2(Konfiguration.Round(.2f), Konfiguration.Round(.2f))
                        }
                    },
                };
                selectedRoom.ObstacleVisuals.Add(obst);
                _level.CurrentRoom.AddObstacle(new GameObjects.Obstacle(obst.Data.Position + obst.Data.RelativeBounds[0], obst.Data.Position + obst.Data.RelativeBounds[2]));
            },
                                  false)
                );
            sideMenu.menuButtons.Add(
                new ButtonTexture(Resources.Mirror,
                                  delegate() {
                var mirrorV = new MirrorVisual()
                {
                    Data = new Model.GameObject.Mirror()
                    {
                        Position  = Vector2.Zero,
                        RailStart = new Vector2(-0.215f, 0.045f),
                        RailEnd   = new Vector2(0.215f, -0.045f),
                        InitAngle = 0.4f,
                        StartingRelativePosition = 0.5f,
                        MaxRotation    = 0.7f,
                        MinRotation    = -0.7f,
                        RelativeBounds = new List <Vector2>()
                        {
                            new Vector2(Konfiguration.Round(-.2f), Konfiguration.Round(.2f)),
                            new Vector2(Konfiguration.Round(-.2f), Konfiguration.Round(-.2f)),
                            new Vector2(Konfiguration.Round(.2f), Konfiguration.Round(-.2f)),
                            new Vector2(Konfiguration.Round(.2f), Konfiguration.Round(.2f))
                        }
                    },
                };
                selectedRoom.MirrorVisuals.Add(mirrorV);
                _level.CurrentRoom.AddMirror(new GameObjects.Mirror(mirrorV.Data.Position + ((Mirror)mirrorV.Data).RailStart, mirrorV.Data.Position + ((Mirror)mirrorV.Data).RailEnd, ((Mirror)mirrorV.Data).InitAngle, ((Mirror)mirrorV.Data).StartingRelativePosition));
            },
                                  false)
                );

            sideMenu.Center = new Vector2(-1.0f + sideMenu.MaxWidth / 2, .0f);

            /*
             * sideMenu = new LevelEditorSideMenu(this);
             *
             * sideMenu.ShowBorder = true;
             * sideMenu.Padding = .03f;
             * sideMenu.BorderWidth = 0.01f;
             * sideMenu.HorizontalAlignment = HorizontalAlignment.Left;
             * sideMenu.MaxHeight = 2.0f;*/
        }
Exemplo n.º 17
0
        private void createStartupLevel()
        {
            Level = new Level();


            var room = new Model.GameObject.Room()
            {
                Position       = new Vector2(Konfiguration.Round(.0f), Konfiguration.Round(.0f)),
                RelativeBounds = new List <Vector2>()
                {
                    new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(.95f)),
                    new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(-.95f)),
                    new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(-.95f)),
                    new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(.95f))
                }
            };

            Level.Rooms.Add(room);
            room.Player = new Model.GameObject.Player()
            {
                //InitialPosition = new Vector2(Konfiguration.Round(0.8f), Konfiguration.Round(-0.7f)),
                RelativeBounds = new List <Vector2>()
                {
                    new Vector2(Konfiguration.Round(-0.05f), Konfiguration.Round(-0.05f)),
                    new Vector2(Konfiguration.Round(0.05f), Konfiguration.Round(-0.05f)),
                    new Vector2(Konfiguration.Round(0.05f), Konfiguration.Round(0.05f)),
                    new Vector2(Konfiguration.Round(-0.05f), Konfiguration.Round(0.05f))
                },
            };

            room.LightRays.Add(new LightRay()
            {
                Position     = new Vector2(Konfiguration.Round(0.89f), Konfiguration.Round(0.89f)),
                RayDirection = new Vector2(Konfiguration.Round(-0.16f), Konfiguration.Round(-0.28f)),
            });

            /* room.SolarPanel = new SolarPanel()
             * {
             *   Position = new Vector2(Konfiguration.Round(-0.45f), Konfiguration.Round(-0.4f))
             * };*/

            var room2 = new Model.GameObject.Room()
            {
                Position       = new Vector2(Konfiguration.Round(-2.0f), Konfiguration.Round(.0f)),
                RelativeBounds = new List <Vector2>()
                {
                    new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(.95f)),
                    new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(-.95f)),
                    new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(-.95f)),
                    new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(.95f))
                }
            };

            Level.Rooms.Add(room2);

            var room3 = new Model.GameObject.Room()
            {
                Position       = new Vector2(Konfiguration.Round(0.0f), Konfiguration.Round(2.0f)),
                RelativeBounds = new List <Vector2>()
                {
                    new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(.95f)),
                    new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(-.95f)),
                    new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(-.95f)),
                    new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(.95f))
                }
            };

            Level.Rooms.Add(room3);

            var room4 = new Model.GameObject.Room()
            {
                Position       = new Vector2(Konfiguration.Round(2.0f), Konfiguration.Round(.0f)),
                RelativeBounds = new List <Vector2>()
                {
                    new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(.95f)),
                    new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(-.95f)),
                    new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(-.95f)),
                    new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(.95f))
                }
            };

            Level.Rooms.Add(room4);

            var room5 = new Model.GameObject.Room()
            {
                Position       = new Vector2(Konfiguration.Round(0.0f), Konfiguration.Round(-2.0f)),
                RelativeBounds = new List <Vector2>()
                {
                    new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(.95f)),
                    new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(-.95f)),
                    new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(-.95f)),
                    new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(.95f))
                }
            };

            Level.Rooms.Add(room5);

            /*            room.Exits.Add(new Exit()
             *          {
             *              Position = new Vector2(Konfiguration.Round(-0.9075f), Konfiguration.Round(-0.7f)),
             *              RelativeBounds = new List<Vector2>()
             *              {
             *                  new Vector2(Konfiguration.Round(-0.0325f),Konfiguration.Round(-0.1f)),
             *                  new Vector2(Konfiguration.Round(0.0325f),Konfiguration.Round(-0.1f)),
             *                  new Vector2(Konfiguration.Round(0.0325f),Konfiguration.Round(0.1f)),
             *                  new Vector2(Konfiguration.Round(-0.0325f),Konfiguration.Round(0.1f)),
             *              },
             *          });*/
        }
Exemplo n.º 18
0
        private void createVisualStartupLevel()
        {
            LevelVisual = new LevelVisual();

            var roomV = new Model.GameObjectVisual.RoomVisual()
            {
                Data = new Model.GameObject.Room()
                {
                    Column         = 0,
                    Row            = 1,
                    Position       = new Vector2(Konfiguration.Round(.0f), Konfiguration.Round(.0f)),
                    RelativeBounds = new List <Vector2>()
                    {
                        new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(.95f)),
                        new Vector2(Konfiguration.Round(-.95f), Konfiguration.Round(-.95f)),
                        new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(-.95f)),
                        new Vector2(Konfiguration.Round(.95f), Konfiguration.Round(.95f))
                    },
                    Player = new Model.GameObject.Player()
                    {
                        //InitialPosition = new Vector2(Konfiguration.Round(0.0f), Konfiguration.Round(-0.0f)),
                        RelativeBounds = new List <Vector2>()
                        {
                            new Vector2(Konfiguration.Round(-0.05f), Konfiguration.Round(-0.05f)),
                            new Vector2(Konfiguration.Round(0.05f), Konfiguration.Round(-0.05f)),
                            new Vector2(Konfiguration.Round(0.05f), Konfiguration.Round(0.05f)),
                            new Vector2(Konfiguration.Round(-0.05f), Konfiguration.Round(0.05f))
                        },
                    },
                    Exit = new Exit()
                    {
                        Position       = new Vector2(1.0f, .0f),
                        RelativeBounds = new List <Vector2>()
                        {
                            new Vector2(-0.105f, 0.045f),
                            new Vector2(0.105f, 0.045f),
                            new Vector2(0.105f, -0.045f),
                            new Vector2(-0.105f, -0.045f),
                        },
                    },
                },
            };

            roomV.PlayerVisual = new PlayerVisual()
            {
                Data = ((Model.GameObject.Room)roomV.Data).Player,
            };
            roomV.ExitVisual = new ExitVisual()
            {
                Data = ((Model.GameObject.Room)roomV.Data).Exit
            };

            LevelVisual.Rooms.Add(roomV);

/*
 *          var roomV2 = new Model.GameObjectVisual.RoomVisual()
 *          {
 *              Data = new Model.GameObject.Room()
 *              {
 *                  Position = new Vector2(Konfiguration.Round(2.0f), Konfiguration.Round(.0f)),
 *                  RelativeBounds = new List<Vector2>() {  new Vector2( Konfiguration.Round(-.95f), Konfiguration.Round(.95f)),
 *                                                      new Vector2( Konfiguration.Round(-.95f), Konfiguration.Round(-.95f)),
 *                                                      new Vector2( Konfiguration.Round(.95f), Konfiguration.Round(-.95f)),
 *                                                      new Vector2( Konfiguration.Round(.95f), Konfiguration.Round(.95f))
 *                  },
 *                  Player = new Model.GameObject.Player()
 *                  {
 *                      //InitialPosition = new Vector2(Konfiguration.Round(2.0f), Konfiguration.Round(-0.0f)),
 *                      RelativeBounds = new List<Vector2>() { new Vector2(Konfiguration.Round(-0.05f), Konfiguration.Round(-0.05f)),
 *                                                     new Vector2(Konfiguration.Round(0.05f), Konfiguration.Round(-0.05f)),
 *                                                     new Vector2(Konfiguration.Round(0.05f), Konfiguration.Round(0.05f)),
 *                                                     new Vector2(Konfiguration.Round(-0.05f), Konfiguration.Round(0.05f))},
 *                  },
 *
 *              },
 *          };
 *          LevelVisual.Rooms.Add(roomV2);*/

            var _level = Serializer.getLevelAs_Level(Serializer.getLevelVisualAsLevel(LevelVisual));

            _level.CurrentRoom  = _level.Rooms.First();
            _gameGraphics.Level = _level;
            _gameLogic.Level    = _level;
        }