Exemplo n.º 1
0
 /// <summary>
 /// Logs the specified message.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="exception">The exception.</param>
 private static void Log(Levels level, object message, Exception exception) {
     string msg = message == null ? string.Empty : message.ToString();
     if(exception != null) {
         msg += ", Exception: " + exception.Message;
     }
     _logs.Add(new KeyValuePair<Levels, string>(level, msg));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Record the given log entry if the level is sufficient.
 /// </summary>
 protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder)
 {
     if (level < Levels.Error)
         return;
     outputPane.EnsureLoaded();
     outputPane.LogLine(FormatLevel(level) + messageBuilder());
 }
Exemplo n.º 3
0
        public GameplayScreen(Game1 game, Vector2 worldSize, Levels currentLevel)
            : base(game)
        {
            this.worldSize = worldSize;
            eCurrentLevel = currentLevel;

            heatmapWriteTimer = 0;

            //Make the tree a bit wider for outer walls.
            quadTree = new QuadTree(new Rectangle(
                -10, -10, (int)worldSize.X + 20, (int)worldSize.Y + 20));

            //Add the 4 walls on the outside of the world.
            Components.Add(new Wall(GDGame, new Vector2(-10, -10), new Vector2(worldSize.X + 10, 0)));
            Components.Add(new Wall(GDGame, new Vector2(worldSize.X, -10), new Vector2(worldSize.X + 10, worldSize.Y)));
            Components.Add(new Wall(GDGame, new Vector2(0, worldSize.Y), new Vector2(worldSize.X + 10, worldSize.Y + 10)));
            Components.Add(new Wall(GDGame, new Vector2(-10, 0), new Vector2(0, worldSize.Y + 10)));

            //Add the player to world.
            Components.Add(Player = new PlayerBall(GDGame, new Vector2(300, 300)));

            //Give the camera the new world size.
            GDGame.Camera.WorldSize = worldSize + new Vector2(0, 100);

            gameOver = won = false;
            GDGame.IsMouseVisible = false;
        }
Exemplo n.º 4
0
 protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception, object[] args)
 {
     if (level < Levels.Warning)
         return;
     if ((msg == null) && (exception != null)) msg = exception.Message;
     if (msg == null)
         return;
     lineNr = Math.Max(0, lineNr);
     column = Math.Max(0, column);
     switch (level)
     {
         case Levels.Warning:
             if (url != null)
                 log.LogWarning(null, null, null, url, lineNr, column, 0, 0, msg, args);
             else
                 log.LogWarning(msg, args);
             break;
         case Levels.Error:
             if (url != null)
                 log.LogError(null, null, null, url, lineNr, column, 0, 0, msg, args);
             else
                 log.LogError(msg, args);
             break;
     }
 }
Exemplo n.º 5
0
        // Checks collision of the given object against the edges of the level
        public void CheckShip(Object toCheck, Levels.SpaceLevel level)
        {
            bool currentHit = false;
            Vector2 translationVector, centerDiff;
            translationVector = Vector2.Zero;
            centerDiff = new Vector2(level.GetLevelWidth() - toCheck.GetCenter().X, level.GetLevelHeight() - toCheck.GetCenter().Y);
            if (CheckIntersection(toCheck.collisionPolygons, level.collisionPolygons, centerDiff, ref translationVector, true))
            {
                toCheck.SetPosition(new Vector2(toCheck.GetPosition().X + translationVector.X, toCheck.GetPosition().Y + translationVector.Y));
                currentHit = true; ;
            }

            if (!currentHit)
            {
                //If they are not currently intersecting, check if they will intersect
                Vector2 oldPosition1 = toCheck.GetPosition();
                toCheck.SetPosition(new Vector2(oldPosition1.X + toCheck.Velocity.X, oldPosition1.Y + toCheck.Velocity.Y));
                bool futureRet = CheckIntersection(toCheck.collisionPolygons, level.collisionPolygons, centerDiff, ref translationVector, true);

                if (futureRet)
                {
                    // Set the position back now that the future collision has been checked
                    toCheck.SetPosition(oldPosition1);
                    currentHit = true;
                }
            }
            if (currentHit)
            {
                float speed = toCheck.Velocity.Length();
                toCheck.Velocity = Vector2.Normalize(translationVector);
                toCheck.Velocity *= speed;
            }
        }
Exemplo n.º 6
0
 /* ----------------------------------------------------------------- */
 ///
 /// constructor
 ///
 /// Exception、およびその派生クラス(例外クラス)が引数に指定された
 /// 場合、Message の内容は指定されたメッセージレベルによって異なる。
 /// Info, Warn, Error, Fatal の場合は、指定された例外クラスの
 /// Message のみとなる。Trace, Debug の場合は、それに加えて
 /// 例外クラスの型名、およびスタックトレースも含まれる。
 ///
 /* ----------------------------------------------------------------- */
 public Message(Levels level, Exception e)
 {
     _level = level;
     _time = System.DateTime.Now;
     if (level == Levels.Trace || level == Levels.Debug) _message = e.ToString();
     else _message = e.Message;
 }
    private Levels levels;              // Reference to levels script

	void Awake() 
    {
        camera_script = GameObject.FindGameObjectWithTag(Tags.main_cam).GetComponent<CameraSetup>();
        levels = GetComponent<Levels>();
        brick_array = new GameObject[20, 20];
        max_types = 2;
	}
Exemplo n.º 8
0
        public override void onHit(Levels.Level l)
        {
            OffsetY -= 5;

            HitSound.Play();

            if (HeldItem != null)
            {
                l.Items.Add(HeldItem);
                l.ParticleSystems.Add(new Particles.ParticleSystemCoin(Position.X, Position.Y));
                coins--;
                if(coins == 0)
                    HeldItem = null;
            }

            if(coins == 0)
            {
                SolidBlock temp = new SolidBlock(Position.X / 24, Position.Y / 24);
                temp.OffsetY -= 5;

                l.Blocks.Add(temp);

                this.destroy(l);
            }
        }
Exemplo n.º 9
0
 protected override void Write(Levels level, DContext context, string url, int column, int lineNr, Func<string> messageBuilder)
 {
     if (level < Levels.Info)
         return;
     lineNr = Math.Max(0, lineNr);
     column = Math.Max(0, column);
     switch (level)
     {
         //case Levels.Info:
         //        log.LogMessage(messageBuilder());
         //    break;
         case Levels.Info: //TODO: get LogMessage to work.
         case Levels.Warning:
             if (url != null)
                 log.LogWarning(null, null, null, url, lineNr, column, 0, 0, messageBuilder());
             else
                 log.LogWarning(messageBuilder());
             break;
         case Levels.Error:
             if (url != null)
                 log.LogError(null, null, null, url, lineNr, column, 0, 0, messageBuilder());
             else
                 log.LogError(messageBuilder());
             break;
     }
 }
Exemplo n.º 10
0
        public LevelManager( Levels startingLevel, Level levelObj)
        {
            m_levelDictionary = new Dictionary<Levels,Level>();

            m_currentLevel = startingLevel;
            m_levelDictionary.Add( Levels.JungTown, levelObj );
        }
    private string level_name;                  // Custom level name
    // TODO: custom level names regex check for invalid chars

	void Awake ()
	{
		camera_script        = GameObject.FindGameObjectWithTag(Tags.main_cam).GetComponent<CameraSetup>();
        level_builder_script = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<LevelBuilder>();
        grid_script          = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<Grid>();
        levels_script        = GameObject.FindGameObjectWithTag(Tags.game_manager).GetComponent<Levels>();
	}
Exemplo n.º 12
0
 protected override void SetMyProperties()
 {
     myFirstName = properties.myFirstname;
     health = properties.health;
     timeBetweenShoot = properties.timeBetweenShoots;
     initialForce = properties.initialForce;
     level = Levels.Level2;
 }
Exemplo n.º 13
0
 private Result(Levels level, int? line, int? column, int? selectionStart, int? selectionLength, string message)
 {
     this._level = level;
     this._line = line.HasValue ? line.Value : (int?)null;
     this._column = column.HasValue ? column.Value : (int?)null;
     this._selectionStart = selectionStart.HasValue ? selectionStart.Value : (int?)null;
     this._selectionLength = selectionLength.HasValue ? selectionLength.Value : (int?)null;
     this._message = (message == null) ? "" : message;
 }
Exemplo n.º 14
0
    void Start()
    {
        bar = GetComponent<RectTransform>();
        levels = PlayerController.player.GetComponent<PlayerController>().levels;
        playerHealth = PlayerController.player.GetComponent<Health>();

        if (property != Property.XP)
            text = transform.parent.GetComponentInChildren<UnityEngine.UI.Text>();
    }
Exemplo n.º 15
0
 public LevelsJson MapLevels2Json(Levels json)
 {
     return new LevelsJson()
     {
         Beginner = json.Beginner,
         Expert = json.Expert,
         Intermediate = json.Intermediate
     };
 }
Exemplo n.º 16
0
 public void CreateCode(Levels levels, System.IO.Stream stream)
 {
     foreach (Level nivel in levels)
     {
         string code;
         nivel.Ordena();
         code = nivel.ToString(Version.DameVersion(CPUVersion.CPC));
         stream.Write(Encoding.UTF8.GetBytes(code), 0, Encoding.UTF8.GetByteCount(code));
     }
 }
Exemplo n.º 17
0
        public void CreateCode(Levels levels, System.IO.Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream);

            for (int levelNum = 0; levelNum < levels.Count && levelNum < 41; levelNum++)
            {
                Level lvl = levels[levelNum];

                byte nextByte;

                nextByte = (byte)(((byte)lvl.TileFondo << 6) |
                              ((byte)lvl.PaperColor << 3) |
                              ((byte)lvl.InkColor));

                writer.Write(nextByte);
                int i = 0;
                for (i = 0; i < lvl.Plataformas.Count; i++)
                {
                    Plataforma plat = lvl.Plataformas[i];
                    nextByte = (byte)(((byte)plat.Longitud) << 4 | ((byte)plat.TipoPlataforma) << 1 | ((byte)plat.Direccion));
                    writer.Write(nextByte);
                    nextByte = (byte)(((byte)plat.X) << 4 | ((byte)plat.Y));
                    writer.Write(nextByte);
                }
                for (; i < Version.DameVersion(CPUVersion.ZX).MaxPlataformas; i++)
                {
                    writer.Write((byte)0);
                    writer.Write((byte)0);
                }

                for (i = 0; i < lvl.Enemigos.Count; i++)
                {
                    Enemigo enem = lvl.Enemigos[i];
                    nextByte = (byte)(((byte)enem.TileVert) << 4 | ((byte)enem.TipoEnemigo) << 1 | ((byte)enem.Velocidad));
                    writer.Write(nextByte);
                    nextByte = (byte)(((byte)enem.TileIzq) << 4 | ((byte)enem.TileDer));
                    writer.Write(nextByte);
                }
                for (; i < Version.DameVersion(CPUVersion.ZX).MaxEnemigos; i++)
                {
                    writer.Write((byte)0);
                    writer.Write((byte)0);
                }
                for (i = 0; i < lvl.Monedas.Count; i++)
                {
                    Moneda moneda = lvl.Monedas[i];
                    nextByte = (byte)(((byte)moneda.X) << 4 | ((byte)moneda.Y));
                    writer.Write(nextByte);
                }
                for (; i < Version.DameVersion(CPUVersion.ZX).MaxMonedas; i++)
                {
                    writer.Write((byte)0);
                }
            }
        }
        int xpos, ypos; //the location in tiles (xpos = column, ypos= row)

        #endregion Fields

        #region Constructors

        //float movingTime = (0);
        public PlayerCharacter(ContentManager myContent, SpriteBatch spriteBatch, int x, int y, Levels.Level currentLevel)
        {
            isMoving = false;
            environment = currentLevel;
            xpos = x;
            ypos = y;
            location = setlocation();
            sprite = new Sprite("playercharacter", true, location, myContent, spriteBatch);

            moveSpeed = ((float)environment.tileSize) / 24f;
        }
Exemplo n.º 19
0
 public ScoreMenu(Game1 game, float timeleft, int percentageBurned, int score, int collectables,
     Levels nextLevel, Levels currentLevel)
     : base(game, Keyboard.GetState(), GamePad.GetState(PlayerIndex.One))
 {
     this.totalTimeScore = timeleft * TimeScoreMod;
     this.totalBurnScore = score;
     this.percentageBurned = percentageBurned;
     this.totalCollectableScore = collectables * CollectableScoreMod;
     this.totalScore = this.totalTimeScore + this.totalBurnScore + this.totalCollectableScore;
     this.currentLevel = currentLevel;
     this.nextLevel = nextLevel;
 }
Exemplo n.º 20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Header"/> class.
        /// </summary>
        /// <param name="messageId">The message id.</param>
        /// <param name="maxMessageSize">Size of the max message.</param>
        /// <param name="securityLevel">The security level.</param>
        /// <remarks>If you want an empty header, please use <see cref="Empty"/>.</remarks>
        public Header(Integer32 messageId, Integer32 maxMessageSize, Levels securityLevel)
        {
            if (maxMessageSize == null)
            {
                throw new ArgumentNullException("maxMessageSize");
            }

            _messageId = messageId;
            _maxSize = maxMessageSize;
            SecurityLevel = securityLevel;
            _flags = new OctetString(SecurityLevel);
            _securityModel = DefaultSecurityModel;
        }
Exemplo n.º 21
0
        public Room(Levels level, int id, RoomTypes type, Items item, int upRoomIndex, int straightRoomIndex, int downRoomIndex)
        {
            Level = level;
            Id = id;
            RoomType = type;
            Item = item;
            IsItemCollected = false;
            RoomUpIndex = upRoomIndex;
            RoomStraightIndex = straightRoomIndex;
            RoomDownIndex = downRoomIndex;

            _enemies = new List<IEnemy>();
        }
Exemplo n.º 22
0
 /// <summary>
 /// Record the given log entry if the level is sufficient.
 /// </summary>
 protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception,
                               object[] args)
 {
     if (level < Levels.Error)
         return;
     if ((msg == null) && (exception != null)) msg = exception.Message;
     if (msg == null)
         return;
     if (!Show(level, context))
         return;
     outputPane.EnsureLoaded();
     outputPane.LogLine(FormatLevel(level) + FormatContext(context) + string.Format(msg, args));
 }
Exemplo n.º 23
0
        public override void collision(Levels.Level level)
        {
            foreach (Block b in level.Blocks)
            {
                if (Position.Intersects(b.Position))
                {
                    Block final = b;

                    foreach (Block n in level.getAdjacentBlocks(b))
                    {

                        if (Rectangle.Intersect(Position, n.Position).Width * Rectangle.Intersect(Position, n.Position).Height > Rectangle.Intersect(Position, final.Position).Width * Rectangle.Intersect(Position, final.Position).Height)
                            final = n;

                    }
                    if (Rectangle.Intersect(Position, final.Position).Width >= Rectangle.Intersect(Position, final.Position).Height)
                    {

                        if (Rectangle.Intersect(Position, final.Position).Top == final.Position.Top)
                        {
                            Position = new Rectangle(Position.X, final.Position.Top - Position.Height, Position.Width, Position.Height);
                            Velocity = new Vector2(Velocity.X, - 6);
                        }
                        else if (Rectangle.Intersect(Position, final.Position).Bottom == final.Position.Bottom)
                        {
                            Position = new Rectangle(Position.X, final.Position.Bottom, Position.Width, Position.Height);
                            Velocity = new Vector2(Velocity.X, Velocity.Y * -1); ;
                        }
                    }
                    else
                    {

                        if (Rectangle.Intersect(Position, final.Position).Left == final.Position.Left)
                        {
                            Velocity = new Vector2(-1, Velocity.Y);
                            Position = new Rectangle(final.Position.Left - Position.Width, Position.Y, Position.Width, Position.Height);

                        }
                        else if (Rectangle.Intersect(Position, final.Position).Right == final.Position.Right)
                        {
                            Velocity = new Vector2(1, Velocity.Y);
                            Position = new Rectangle(final.Position.Right, Position.Y, Position.Width, Position.Height);
                        }

                    }

                    break;
                }
            }
        }
Exemplo n.º 24
0
 protected LogEntry(int eventId, Keywords keyword, Opcodes opcode, Tasks task, Levels level, EventSource eventSource, int version, string message, Payload payload, DateTime created)
 {
     Id = Guid.NewGuid();
     EventId = eventId;
     Keyword = keyword;
     Opcode = opcode;
     Task = task;
     Level = level;
     EventSource = eventSource;
     Version = version;
     Message = message;
     Payload = payload;
     Created = created;
 }
		/// <summary>
		/// Apply the current text settings to the values
		/// </summary>
		/// <param name="values">values array to be used</param>
		/// <returns>Array of strings from the values using the current settings</returns>
		public string[] Apply(byte[,] values)
		{
			if (values == null)
			{
				return null;
			}

			// only apply brightness and contrast if necessary
			if (Brightness != 0 || Contrast != 0)
			{
				BrightnessContrast filter = new BrightnessContrast(IsBlackTextOnWhite ? Brightness : -Brightness,
					IsBlackTextOnWhite ? Contrast : -Contrast);

				values = filter.Apply(values);
			}

			if (Stretch)
			{
				Stretch filter = new Stretch();
				values = filter.Apply(values);
			}

			if (Levels.Minimum != 0 || Levels.Maximum != 255 || Levels.Median != 0.5f)
			{
				//values = AscgenConverter.ApplyLevels(values, Levels.Minimum, Levels.Maximum, Levels.Median);

				Levels filter = new Levels(Levels.Minimum, Levels.Maximum, Levels.Median);
				values = filter.Apply(values);
			}

			if (Sharpen)
			{
				values = AsciiConverter.SharpenValues(values);
			}

			if (Unsharp)
			{
				values = AsciiConverter.UnsharpMaskValues(values, 3);
			}

			if (FlipHorizontally || FlipVertically)
			{
				Flip filter = new Flip(FlipHorizontally, FlipVertically);
				values = filter.Apply(values);
			}

			return _ValuesToText.Apply(values);
		}
Exemplo n.º 26
0
        /// <summary>
        /// Record the given log entry if the level is sufficient.
        /// </summary>
        protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception,
                                      object[] args)
        {
            if (context != DContext.VSStatusBar)
                return;

            if ((msg == null) && (exception != null)) msg = exception.Message;
            if (msg == null)
                return;
            if (!Show(level, context))
                return;

            string text = string.Format(msg, args);

            SetText(level, text);
        }
Exemplo n.º 27
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     backgroundRectangle = new Rectangle(0, 0, 1366, 768);
     action = new Action();
     user = new User(3);
     graphics.PreferredBackBufferWidth = 1366;
     graphics.PreferredBackBufferHeight = 768;
     screenWidth = graphics.PreferredBackBufferWidth;
     screenHeight = graphics.PreferredBackBufferHeight;
     graphics.IsFullScreen = true;
     menu = new Menu();
     MediaPlayer.Stop();//инициализация
     levels = new Levels();
 }
Exemplo n.º 28
0
        public static GameLevel CreateLevel(Game game, Levels level)
        {
            // Remove all services from the last level
            game.Services.RemoveService(typeof(CameraManager));
            game.Services.RemoveService(typeof(LightManager));
            game.Services.RemoveService(typeof(Terrain));

            switch (level)
            {
                case Levels.Forest:
                    return CreateForestLevel(game);

                default:
                    throw new ArgumentException("Invalid game level");
            }
        }
Exemplo n.º 29
0
        public override void onHit(Levels.Level l)
        {
            base.onHit(l);

            if (HeldItem != null)
            {
                if (HeldItem is ItemCoin)
                    l.ParticleSystems.Add(new Particles.ParticleSystemCoin(Position.X, Position.Y));
                l.Items.Add(HeldItem);
                HeldItem = null;
            }

            SolidBlock temp = new SolidBlock(Position.X / 24, Position.Y / 24);
            temp.OffsetY -= 5;

            l.Blocks.Add(temp);

            this.destroy(l);
        }
Exemplo n.º 30
0
        protected ErrorLogEntry(Guid id, Guid accountId, int eventId, Keywords keyword, Opcodes opcode, Tasks task, Levels level,
			EventSource eventSource, int version, string message, string exceptionType, string exceptionMessage, string stackTrace, Payload payload, DateTime created)
        {
            Id = id;
            AccountId = accountId;
            EventId = eventId;
            Keyword = keyword;
            Opcode = opcode;
            Task = task;
            Level = level;
            EventSource = eventSource;
            Version = version;
            Message = message;
            ExceptionType = exceptionType;
            ExceptionMessage = exceptionMessage;
            StackTrace = stackTrace;
            Payload = payload;
            Created = created;
        }
Exemplo n.º 31
0
    // Use this for initialization
    void Start()
    {
        sound = PlayerPrefs.GetInt("sound", 0);
        string _achievements = PlayerPrefs.GetString("achievements", "{\"achievements\":[]}");

        achievements = JsonUtility.FromJson <Achievements>(_achievements);
        if (achievements.achievements == null)
        {
            achievements.achievements = new string[0];
        }

        string _levels = PlayerPrefs.GetString("levels", "{\"levels\":[]}");

        levels = JsonUtility.FromJson <Levels>(_levels);

        if (levels.levels == null)
        {
            levels.levels = new Level[0];
        }
        SceneManager.LoadScene(1);
        Sound.instance.GetComponent <AudioSource>().mute |= sound != 1;
    }
Exemplo n.º 32
0
        public static List <Player> GetAccountCharacters(long accountId)
        {
            List <Player> characters;

            using (DatabaseContext context = new DatabaseContext())
            {
                characters = context.Characters
                             .Where(p => p.AccountId == accountId)
                             .Include(p => p.Levels)
                             .Include(p => p.Inventory).ThenInclude(p => p.DB_Items)
                             .ToList();
            }

            foreach (Player player in characters)
            {
                player.Inventory = new Inventory(player.Inventory);
                Levels levels = player.Levels;
                player.Levels = new Levels(player, levels.Level, levels.Exp, levels.RestExp, levels.PrestigeLevel, levels.PrestigeExp, levels.MasteryExp, levels.Id);
            }

            return(characters);
        }
Exemplo n.º 33
0
 /// <summary>
 /// Record the given log entry if the level is sufficient.
 /// </summary>
 protected override void Write(Levels level, DContext context, string url, int column, int lineNr, string msg, Exception exception,
                               object[] args)
 {
     if (level < Levels.Error)
     {
         return;
     }
     if ((msg == null) && (exception != null))
     {
         msg = exception.Message;
     }
     if (msg == null)
     {
         return;
     }
     if (!Show(level, context))
     {
         return;
     }
     outputPane.EnsureLoaded();
     outputPane.LogLine(FormatLevel(level) + FormatContext(context) + string.Format(msg, args));
 }
Exemplo n.º 34
0
    void Start()
    {
        InputManager IM = GameObjects.GetInputManager();

        IM.LoadPreviousLevel += LoadPreviousLevel;
        IM.LoadNextLevel     += LoadNextLevel;
        IM.ReloadLevel       += ReloadLevel;

        if (!CreatorMode)
        {
            string firstLevelName;
            if (TwoDimensions)
            {
                firstLevelName = Levels.GetFirst2DLevelName();
            }
            else
            {
                firstLevelName = Levels.GetFirst3DLevelName();
            }
            LoadLevel(firstLevelName);
        }
    }
Exemplo n.º 35
0
        private static void OnWrite(string text, Levels level)
        {
            StackTrace stackTrace = new StackTrace();

            // Get calling method name

            var frame    = new StackTrace().GetFrame(2);
            var method   = frame.GetMethod();
            var line     = frame.GetFileLineNumber();
            var file     = frame.GetFileName();
            var name     = stackTrace.GetFrame(2).GetMethod().Name;
            var fullName = method.DeclaringType.FullName;
            var member   = String.Format(@"{0}{1}", fullName, name);
            //var signature = member.GetParameter();
            Type declaringType = method.DeclaringType;
            var  module        = declaringType.FullName;

            if (Log.Write != null)
            {
                Log.Write(text, level, line, member, file);
            }
        }
Exemplo n.º 36
0
    /// <summary>
    /// Нажали на кнопку следующего уровня
    /// </summary>
    public void LevelNext()
    {
        restartcount = 0;
        if (curState != "start")
        {
            Levels.updateStars(level, TheSun.starCount);
            level++;
            if (Levels.DoneLevel <= level)
            {
                Levels.DoneLevel = level;
            }

            if (level - startLevel < scenes.Length)
            {
                initLevel();
            }
            else
            {
                LevelSelect();
            }
        }
    }
        //+ COROUTINE
        private IEnumerator TimedUpdate()
        {
            if (!SceneContext.Instance)
            {
                yield return(WAIT_UNTIL_CONTEXT);
            }
            if (!Levels.IsLevel(Levels.WORLD))
            {
                yield return(WAIT_UNTIL_WORLD);
            }

            while (Levels.IsLevel(Levels.WORLD))
            {
                if (SceneContext.Instance.TimeDirector.HasPauser())
                {
                    yield return(WAIT_UNTIL_PAUSE);
                }

                OnGameTimedUpdate?.Invoke(SR.Game, SR.Scene);
                yield return(SECONDS_REALTIME);
            }
        }
Exemplo n.º 38
0
        /// <summary>
        /// gets the maximum framesize given a level
        /// </summary>
        /// <param name="level">the level</param>
        /// <returns>the maximum framesize in number of macroblocks
        /// (1MB = 16x16)</returns>
        public int getMaxFS(Levels avcLevel)
        {
            switch (avcLevel)
            {
            case Levels.L_10: return(99);

            case Levels.L_1B: return(99);

            case Levels.L_11: return(396);

            case Levels.L_12: return(396);

            case Levels.L_13: return(396);

            case Levels.L_20: return(396);

            case Levels.L_21: return(792);

            case Levels.L_22: return(1620);

            case Levels.L_30: return(1620);

            case Levels.L_31: return(3600);

            case Levels.L_32: return(5120);

            case Levels.L_40: return(8192);

            case Levels.L_41: return(8192);

            case Levels.L_42: return(8192);

            case Levels.L_50: return(22080);

            case Levels.L_51: return(36864);

            default: return(36864);    // level 5.2
            }
        }
Exemplo n.º 39
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here

            // Load start screen and background pictures
            startImage        = Content.Load <Texture2D>("Background/startlogo");
            backgroundPicture = Content.Load <Texture2D>("Background/background");
            // Game font for loading screen
            GameStartFont = Content.Load <SpriteFont>("StartGameFont");
            // Font for displaying scores
            ScoresFont = Content.Load <SpriteFont>("ScoresFont");
            // Dice roll button texture and sprite
            DiceRollButton = Content.Load <Texture2D>("buttonroll");
            diceSprite     = Content.Load <Texture2D>("diceone");
            // Background, button and dice rectangles
            backgroundRectangle = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
            buttonRectangle     = new Rectangle(750, 700, DiceRollButton.Width, DiceRollButton.Height);
            diceRectangle       = new Rectangle(795, 600, diceSprite.Width, diceSprite.Height);
            // Player textures load
            playerTexture        = Content.Load <Texture2D>("playerOne");
            computerTexture      = Content.Load <Texture2D>("playerTwo");
            playerPosition       = new Vector2(15, 710);
            playerStartRectangle = new Rectangle((int)playerPosition.X, (int)playerPosition.Y, playerTexture.Width, playerTexture.Height);

            playerOne = new Player(playerTexture, new Rectangle(0, 0, 0, 0), playerPosition, 0, GraphicsDevice, Content);
            playerTwo = new Player(computerTexture, new Rectangle(0, 0, 0, 0), playerPosition, 0, GraphicsDevice, Content);

            //tiles
            Tiles = new BoardTileMap(GraphicsDevice);
            Level = new Levels(GraphicsDevice);

            Level.LoadContent(Content);

            //test font
            testFont = Content.Load <SpriteFont>("testFont");
        }
Exemplo n.º 40
0
        /// <summary>
        /// gets the level number as text
        /// </summary>
        /// <param name="avcLevel">the level</param>
        /// <returns>the level number</returns>
        public static string GetLevelText(Levels avcLevel)
        {
            switch (avcLevel)
            {
            case Levels.L_10: return("1.0");

            case Levels.L_1B: return("1b");

            case Levels.L_11: return("1.1");

            case Levels.L_12: return("1.2");

            case Levels.L_13: return("1.3");

            case Levels.L_20: return("2.0");

            case Levels.L_21: return("2.1");

            case Levels.L_22: return("2.2");

            case Levels.L_30: return("3.0");

            case Levels.L_31: return("3.1");

            case Levels.L_32: return("3.2");

            case Levels.L_40: return("4.0");

            case Levels.L_41: return("4.1");

            case Levels.L_42: return("4.2");

            case Levels.L_50: return("5.0");

            case Levels.L_51: return("5.1");

            default: return("5.2");
            }
        }
Exemplo n.º 41
0
        /// <summary>
        /// gets the Maximum macroblock rate given a level
        /// </summary>
        /// <param name="level">the level</param>
        /// <returns>the macroblock rate</returns>
        public int getMaxMBPS(Levels avcLevel)
        {
            switch (avcLevel)
            {
            case Levels.L_10: return(1485);

            case Levels.L_1B: return(1485);

            case Levels.L_11: return(3000);

            case Levels.L_12: return(6000);

            case Levels.L_13: return(11880);

            case Levels.L_20: return(11880);

            case Levels.L_21: return(19800);

            case Levels.L_22: return(20250);

            case Levels.L_30: return(40500);

            case Levels.L_31: return(108000);

            case Levels.L_32: return(216000);

            case Levels.L_40: return(245760);

            case Levels.L_41: return(245760);

            case Levels.L_42: return(491520);

            case Levels.L_50: return(589824);

            case Levels.L_51: return(983040);

            default: return(2073600);    // level 5.2
            }
        }
Exemplo n.º 42
0
    public List <Player> FindAllByAccountId(long accountId)
    {
        List <Player> characters = new();

        IEnumerable <dynamic> result = QueryFactory.Query(TableName).Where(new
        {
            account_id = accountId,
            is_deleted = false
        })
                                       .Join("levels", "levels.id", "characters.levels_id")
                                       .Select(
            "characters.{*}",
            "levels.{level, exp, rest_exp, prestige_level, prestige_exp, mastery_exp}").Get();

        foreach (dynamic data in result)
        {
            characters.Add(new()
            {
                AccountId    = data.account_id,
                CharacterId  = data.character_id,
                CreationTime = data.creation_time,
                Name         = data.name,
                Gender       = (Gender)data.gender,
                Awakened     = data.awakened,
                Job          = (Job)data.job,
                Levels       = new Levels(data.level, data.exp, data.rest_exp, data.prestige_level,
                                          data.prestige_exp, JsonConvert.DeserializeObject <List <MasteryExp> >(data.mastery_exp), null, data.levels_id),
                MapId       = data.map_id,
                Stats       = JsonConvert.DeserializeObject <Stats>(data.stats),
                TrophyCount = JsonConvert.DeserializeObject <int[]>(data.trophy_count),
                Motto       = data.motto,
                ProfileUrl  = data.profile_url,
                Inventory   = DatabaseManager.Inventories.FindById(data.inventory_id),
                SkinColor   = JsonConvert.DeserializeObject <SkinColor>(data.skin_color)
            });
        }

        return(characters);
    }
 private void Awake()
 {
     if (this.IsIgnored() &&
         (!(!Levels.IsNativeLevelEuropean() && gameObject?.name == Constants.EuropeBeautification)) && //to load tennis court
         (!(!Levels.IsNativeLevelWinter() && gameObject?.name == Constants.WinterBeautification))    //to load curling
         )
     {
         Destroy(this);
         return;
     }
     if ((!Levels.IsNativeLevelWinter() && gameObject?.name == Constants.WinterPreorderPack)) //to prevent wrong preorder pack props versions from loading
     {
         Destroy(this);
         return;
     }
     if ((Levels.IsNativeLevelWinter() && gameObject?.name == Constants.PreorderPack))
     {
         m_prefabs       = m_prefabs.Where(p => p.name == "Basketball Court Decal").ToArray();
         m_replacedNames = null;
     }
     Singleton <LoadingManager> .instance.QueueLoadingAction(InitializePrefabs(this.gameObject.name, this.m_prefabs, this.m_replacedNames));
 }
Exemplo n.º 44
0
        public bool FindTwoLevels()
        {
            FilteredElementIterator fei = new FilteredElementCollector(ThisExtension.Revit.ActiveUIDocument.Document).OfClass(typeof(Level)).GetElementIterator();

            fei.Reset();
            int nblevel = 0;

            while (fei.MoveNext())
            {
                Level level = fei.Current as Level;
                if (null != level)
                {
                    Levels.Add(level);
                    nblevel++;
                    if (nblevel > 1)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 45
0
 public void PlayBanner(Levels level)
 {
     // If we're not already playing a banner
     if (!isPlayingBanner)
     {
         // If we have a banner prepared for this level
         if (levelToBanner.ContainsKey(level))
         {
             StartCoroutine(PlayBannerCoroutine(level));
         }
     }
     // If we're playing a banner and attempting to queue up a different banner
     else if (level != lastBannerLoaded && levelToBanner.ContainsKey(level))
     {
         queuedBanner = level;
     }
     // If we're playing a banner and attempt to queue up the same banner
     else
     {
         queuedBanner = Levels.ManagerScene;
     }
 }
        public MainViewModel()
        {
            departments      = new Departments();
            levels           = new Levels();
            managers         = new Managers();
            projects         = new Projects();
            statuses         = new Statuses();
            subsidiaries     = new Subsidiaries();
            types            = new Types();
            aggregatedTable  = new DataTable();
            projectsCounters = new ProjectsCounters();

            FormAggregatedTable();

            subsidiariesList = GetSubsidiariesList(true);
            managersList     = GetManagersList(true);

            selectedSubsidiary = "Все предприятия";
            selectedManager    = "Все менеджеры проектов";

            selectedRowIndex = -1;
        }
Exemplo n.º 47
0
    // Start is called before the first frame update
    void Start()
    {
        _thisLevel      = this;
        Level           = 0;
        _debounce       = false;
        toKillThisRound = new Dictionary <int, int>();
        _roundTime      = 0f;
        _running        = false;
        _mobSpawners    = new List <MobSpawner>();
        for (int i = 0; i < _spawnerCount; i++)
        {
            var        r     = Random.Range(0, _spawners.Count);
            GameObject obj   = _spawners[r];
            var        spwnr = obj.AddComponent <MobSpawner>();
            spwnr.SetSpawnTimer(5f);
            _mobSpawners.Add(spwnr);
            _spawners.RemoveAt(r);
        }
        StartCoroutine(WaitForLoaded(Rounds.Loaded, NewRound));

        Debug.Log("----------------");
    }
Exemplo n.º 48
0
 public void FinishInvasion()
 {
     Status = InvasionStatus.Finished;
     _CoreTimer.Stop();
     RemoveInvaders();
     if (ValidSpawnPoints != null)
     {
         ValidSpawnPoints.Clear();
         ValidSpawnPoints.TrimExcess();
     }
     if (TownGates != null)
     {
         DeleteGates();
     }
     Notify.Broadcast <HydraMotMNotifyGump>(
         "The " + InvasionName + " has ended!",
         true,
         1.0,
         10.0);
     GenerateScoreboards();
     CurrentLevel = Levels.First();
 }
Exemplo n.º 49
0
        public Resources()
        {
            Configuration = new Configuration();
            Configuration.Initialize();

            //Csv = new Csv();
            Fingerprint = new Fingerprint();

            _mysql               = new MySQL();
            _messagefactory      = new MessageFactory();
            _commandfactory      = new CommandFactory();
            _debugcommandfactory = new DebugCommandFactory();
            _apiService          = new ApiService();

            Levels           = new Levels();
            PlayerCache      = new PlayerCache();
            LeaderboardCache = new LeaderboardCache();

            ChatManager = new LogicGlobalChatManager();

            Gateway = new Gateway();
        }
Exemplo n.º 50
0
    public async Task LoadPasswordAsync()
    {
        var validationRule = new Utility_R1PasswordGenerator_PasswordValidationRule().Validate(Password, CultureInfo.CurrentCulture);

        if (!validationRule.IsValid)
        {
            return;
        }

        var password = new PS1Password(Password, ModeSelection.SelectedValue);
        var save     = password.Decode();

        if (save == null)
        {
            await Services.MessageUI.DisplayMessageAsync(Resources.R1Passwords_Invalid, MessageType.Error);

            return;
        }

        LivesCount     = save.LivesCount;
        ContinuesCount = save.Continues;

        // Set level states
        for (int i = 0; i < Levels.Length; i++)
        {
            Levels[i].IsUnlocked  = save.WorldInfo[i].IsUnlocked;
            Levels[i].HasAllCages = save.WorldInfo[i].HasAllCages;
        }

        // Set boss flags
        foreach (var lev in Levels.Where(x => x.HasBoss))
        {
            lev.BeatBoss = save.FinBossLevel.HasFlag(lev.BossFlag);
        }

        // Set flags
        HasHelpedTheMusician = save.FinBossLevel.HasFlag(FinBossLevel.HelpedMusician);
    }
Exemplo n.º 51
0
        public Server()
        {
            try
            {
                Console.WriteLine("Starting Server...");
                this.TcpServer = new TCPServer("*", Config.getServerPort(), Config.getServerMaxConnection());

                Connection.SendAllThread.Start();

                Levels.LoadLevels();

                Console.WriteLine("Loading templates...");
                Class_Template.LoadTemplates();
                Console.WriteLine("Loaded " + Class_Template.ClassTemplates.Count + " templates");

                Console.WriteLine("Loading Achievements...");
                Achievements.LoadAchievementsFromFile();
                Console.WriteLine("Loaded " + Achievements.achievementList.Count + " achievements");

                Console.WriteLine("Loading OpCodes...");
                OpCodes.Init();
                Console.WriteLine("Loaded " + (OpCodes.ClientTypes.Count + OpCodes.ServerTypes.Count) + " OpCodes");

                DAOManager.Initialise("SERVER=" + Config.getDatabaseHost() + ";DATABASE=" + Config.getDatabaseName() + ";UID=" + Config.getDatabaseUser() + ";PASSWORD="******";PORT=" + Config.getDatabasePort() + ";charset=utf8");

                Console.WriteLine("Loading TCP...");
                this.TcpServer.BeginListening();

                Connection.sendThread.Start();
                Console.WriteLine("Server Started !");
                Server.serverOn = true;
            }
            catch (Exception exception)
            {
                Console.WriteLine("Can't start server : ", exception.Message);
                return;
            }
        }
Exemplo n.º 52
0
        public Resources()
        {
            Configuration = new Configuration();
            Configuration.Initialize();

            _logger = new Logger();

            Logger.Log($"ENV: {(Utils.IsLinux ? "Linux" : "Windows")}");

            Csv         = new Csv();
            Fingerprint = new Fingerprint();

            _playerDb   = new PlayerDb();
            _replayDb   = new ReplayDb();
            _allianceDb = new AllianceDb();

            if (!string.IsNullOrEmpty(Configuration.RedisPassword) && !string.IsNullOrEmpty(Configuration.RedisServer))
            {
                _redis = new Redis();
            }

            _messagefactory      = new LogicMagicMessageFactory();
            _commandfactory      = new LogicCommandManager();
            _debugcommandfactory = new DebugCommandFactory();

            Levels           = new Levels();
            PlayerCache      = new PlayerCache();
            AllianceCache    = new AllianceCache();
            LeaderboardCache = new LeaderboardCache();

            ChatManager = new LogicGlobalChatManager();

            Gateway = new Gateway();

            StartDateTime = DateTime.UtcNow;

            Gateway.StartAsync().Wait();
        }
Exemplo n.º 53
0
        public static Player GetCharacter(long characterId)
        {
            Player player;

            using (DatabaseContext context = new DatabaseContext())
            {
                player = context.Characters
                         .Include(p => p.Levels)
                         .Include(p => p.SkillTabs)
                         .Include(p => p.Guild)
                         // .Include(p => p.Home)
                         .Include(p => p.GameOptions)
                         .Include(p => p.Mailbox).ThenInclude(p => p.Mails)
                         .Include(p => p.Wallet)
                         .Include(p => p.BuddyList)
                         .Include(p => p.QuestList)
                         .Include(p => p.Inventory).ThenInclude(p => p.DB_Items)
                         .Include(p => p.BankInventory).ThenInclude(p => p.DB_Items)
                         .FirstOrDefault(p => p.CharacterId == characterId);
                if (player == null)
                {
                    return(null);
                }
            }

            Levels levels = player.Levels;
            Wallet wallet = player.Wallet;

            player.BankInventory = new BankInventory(player.BankInventory);
            player.Inventory     = new Inventory(player.Inventory);
            player.SkillTabs.ForEach(skilltab => skilltab.GenerateSkills(player.Job));
            player.Levels = new Levels(player, levels.Level, levels.Exp, levels.RestExp, levels.PrestigeLevel, levels.PrestigeExp, levels.MasteryExp, levels.Id);
            player.Wallet = new Wallet(player, wallet.Meso.Amount, wallet.Meret.Amount, wallet.GameMeret.Amount,
                                       wallet.EventMeret.Amount, wallet.ValorToken.Amount, wallet.Treva.Amount,
                                       wallet.Rue.Amount, wallet.HaviFruit.Amount, wallet.MesoToken.Amount, wallet.Bank.Amount, wallet.Id);

            return(player);
        }
Exemplo n.º 54
0
 public void NewArena(MapInfo map)
 {
     lock (LevelSync)
     {
         AnvilWorldProvider l;
         if (OnlyRead)
         {
             l = map.ProviderCache;
         }
         else
         {
             l = map.ProviderCache.Clone() as AnvilWorldProvider;
         }
         int id = LevelCount;
         if (LevelPoolId.Count > 0)
         {
             id = LevelPoolId.First();
             LevelPoolId.Remove(id);
         }
         else
         {
             LevelCount++;
             id = LevelCount;
         }
         var level = new xCoreLevel(l, Game.Context.Server.LevelManager.EntityManager, Game, map, id);
         LevelCount++;
         level.Initialize();
         SkyLightCalculations.Calculate(level);
         while (l.LightSources.Count > 0)
         {
             var block = l.LightSources.Dequeue();
             block = level.GetBlock(block.Coordinates);
             BlockLightCalculations.Calculate(level, block);
         }
         Game.Initialization(level);
         Levels.Add(level);
     }
 }
Exemplo n.º 55
0
        public bool LevelComplete(Levels levelId, Mode modeBeaten = Mode.Any, Grade gradeBeaten = Grade.Any)
        {
            IntPtr save = CurrentSave();
            //.levelDataManager.levelObjects
            IntPtr lvls = (IntPtr)Program.Read <uint>(save, 0x20, 0x8);
            int    size = Program.Read <int>(lvls, 0xc);

            lvls = (IntPtr)Program.Read <uint>(lvls, 0x8);
            for (int i = 0; i < size; i++)
            {
                IntPtr item  = (IntPtr)Program.Read <uint>(lvls, 0x10 + (i * 4));
                Levels level = (Levels)Program.Read <int>(item, 0x8);
                if (level == levelId)
                {
                    bool  completed  = Program.Read <bool>(item, 0xc);
                    Grade grade      = (Grade)Program.Read <int>(item, 0x10);
                    Mode  difficulty = (Mode)Program.Read <int>(item, 0x14);

                    return(completed && grade >= gradeBeaten && difficulty >= modeBeaten);
                }
            }
            return(false);
        }
        private string BuildUrl()
        {
            var url = $"{BaseUrl}trainingcourses?keyword={Keyword}";

            if (OrderBy != OrderBy.None)
            {
                url += $"&orderby={OrderBy}";
            }
            if (Sectors != null && Sectors.Any())
            {
                url += "&routeIds=" + string.Join("&routeIds=", Sectors.Select(HttpUtility.HtmlEncode));
            }
            if (Levels != null && Levels.Any())
            {
                url += "&levels=" + string.Join("&levels=", Levels);
            }

            if (_shortlistUserId.HasValue)
            {
                url += $"&shortlistUserId={_shortlistUserId}";
            }
            return(url);
        }
Exemplo n.º 57
0
        public void SetExtDic(DicED dicOpt, Document doc)
        {
            SetDataValues(dicOpt?.GetRec("Recs")?.Values, doc);
            var   dicLevels = dicOpt?.GetInner("Levels");
            int   index     = 0;
            RecXD recL;

            do
            {
                recL = dicLevels?.GetRec("Level" + index++);
                if (recL != null)
                {
                    var level = new TileLevel();
                    level.SetDataValues(recL.Values, doc);
                    Levels.Add(level);
                }
            } while (recL != null && index < 4);
            if (Levels == null)
            {
                // Дефолтные уровни
                Levels = TileLevel.Defaults();
            }
        }
Exemplo n.º 58
0
        public bool Equals(Commendation other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Equals(Category, other.Category) &&
                   ContentId.Equals(other.ContentId) &&
                   string.Equals(Description, other.Description) &&
                   string.Equals(IconImageUrl, other.IconImageUrl) &&
                   Id.Equals(other.Id) &&
                   Levels.OrderBy(l => l.Id).SequenceEqual(other.Levels.OrderBy(l => l.Id)) &&
                   string.Equals(Name, other.Name) &&
                   RequiredLevels.OrderBy(rl => rl.Id).SequenceEqual(other.RequiredLevels.OrderBy(rl => rl.Id)) &&
                   Equals(Reward, other.Reward) &&
                   Type == other.Type);
        }
Exemplo n.º 59
0
    public static void LoadSelectedLevel()
    {
        if (closestId >= 0 && closestId < levels.levels.Length)
        {
            // Load level
            currentLevel = levels.levels[closestId];

            if (currentLevel != null)
            {
                // Parse level name
                Level level = Levels.GetLevel(levels.levels[closestId].name);

                if (level != null)
                {
                    // Update level select GUI to show this level name if we press back
                    LevelSelectGUI.worldToShow = "World" + level.world;
                    LevelSelectGUI.levelToShow = level.number;
                }

                Loading.Load(levels.levels[closestId].name, Loading.Transition.FOV);
            }
        }
    }
Exemplo n.º 60
0
        //+ ACTIONS
        // Triggers when the window opens
        protected override void OnOpen()
        {
            //& Dev menu can only run on the menu and on the world, anywhere else it should be denied
            if (!Levels.isMainMenu() || Levels.IsLevel(Levels.WORLD))
            {
                Close();
                return;
            }

            if (!SceneContext.Instance.TimeDirector.HasPauser())
            {
                SceneContext.Instance.TimeDirector.Pause(true, true);
            }
            else
            {
                wasPaused = true;
            }

            previousInput = SRInput.Instance.GetInputMode();
            SRInput.Instance.SetInputMode(SRInput.InputMode.NONE);

            DEV_TABS[currentTab].Show();
        }