Exemplo n.º 1
0
        private void SetupSaveKeyInput()
        {
            this.FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.S, null, () =>
            {
                Dialog.ShowRichTextInput("Name this level".ToYellow(), (result) =>
                {
                    CurrentLevelDefinition.Save(result.ToString());
                }, initialValue: LevelId?.ToConsoleString());
            }, LifetimeManager);

            this.FocusManager.GlobalKeyHandlers.PushForLifetime(ConsoleKey.L, null, () =>
            {
                var options = LevelDefinition.GetLevelDefinitionFiles().Select(f => new DialogOption()
                {
                    DisplayText = System.IO.Path.GetFileNameWithoutExtension(f).ToYellow(), Id = f
                });

                if (options.Count() == 0)
                {
                    Dialog.ShowMessage("No levels to load");
                }
                else
                {
                    Dialog.Pick("Choose a level to load".ToYellow(), options).Then((button) =>
                    {
                        var levelFile = button.Id;
                        LoadLevel(levelFile);
                    });
                }
            }, LifetimeManager);
        }
Exemplo n.º 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (LevelId.Length != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (characteristic_ != null)
            {
                hash ^= Characteristic.GetHashCode();
            }
            if (Difficulty != global::TournamentAssistantShared.Models.BeatmapDifficulty.Easy)
            {
                hash ^= Difficulty.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (LevelId != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (Star != 0)
            {
                hash ^= Star.GetHashCode();
            }
            if (BuyCount != 0)
            {
                hash ^= BuyCount.GetHashCode();
            }
            if (Count != 0)
            {
                hash ^= Count.GetHashCode();
            }
            if (MaxScore != 0)
            {
                hash ^= MaxScore.GetHashCode();
            }
            if (ResetTime != 0L)
            {
                hash ^= ResetTime.GetHashCode();
            }
            if (ActivityId != 0)
            {
                hash ^= ActivityId.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (LevelType != 0)
            {
                hash ^= LevelType.GetHashCode();
            }
            if (DayId != 0)
            {
                hash ^= DayId.GetHashCode();
            }
            if (LevelId != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (DailylevelName != 0)
            {
                hash ^= DailylevelName.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 5
0
        public Level(LevelSaveSummary summary)
        {
            _levelId   = summary.LevelId;
            _levelName = summary.LevelName;

            _mapWidth  = summary.Width;
            _mapHeight = summary.Height;

            _tileInformation = new Dictionary <int, MapTileDetails>();
            _tileGrid        = summary.Tiles;
            foreach (KeyValuePair <int, TileType> tile in summary.TileTypes)
            {
                _tileInformation[tile.Key] = Entities.EntityFactory.CreateMapTile(tile.Value);
            }
            _revealed = summary.Revealed;

            _furnishings = new SortedDictionary <int, Furnishing>();
            foreach (KeyValuePair <int, int> furnishing in summary.Furnishings)
            {
                _furnishings[furnishing.Key] = Furnishing.GetFurnishing(furnishing.Value);
            }

            _actors = new SortedDictionary <int, Actor>();
            foreach (KeyValuePair <int, int> actor in summary.Actors)
            {
                _actors[actor.Key] = Actor.GetActor(actor.Value);
            }
        }
Exemplo n.º 6
0
 public LevelDetails(string levelName, LevelId levelId)
 {
     LevelName      = levelName;
     LevelId        = levelId;
     TileDictionary = new Dictionary <int, Entities.MapTiles.TileType>();
     Furnishings    = new List <string[]>();
 }
Exemplo n.º 7
0
 public void StartLoadLevel(LevelId level)
 {
     if (!IsLoadingStarted)
     {
         IsLoadingStarted = true;
         LoadLevel(level);
     }
 }
Exemplo n.º 8
0
    IEnumerator LoadLevelAsync(string levelName)
    {
        levelToLoadId = null;
        Debug.Log("Start async level load:" + levelName);
        loadLevelAsyncOp = SceneManager.LoadSceneAsync(levelName);
        yield return(loadLevelAsyncOp);

        Debug.Log("Async Level Load Done:" + levelName);
    }
Exemplo n.º 9
0
        public override int GetHashCode()
        {
            int result = 1;

            result = (result * 397) ^ Id.GetHashCode();
            result = (result * 397) ^ Level.GetHashCode();
            result = (result * 397) ^ LevelId.GetHashCode();
            result = (result * 397) ^ (LevelName != null ? LevelName.GetHashCode() : 0);
            return(result);
        }
Exemplo n.º 10
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (LevelId != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (BeforeLevelId != 0)
            {
                hash ^= BeforeLevelId.GetHashCode();
            }
            if (AfterLevelId != 0)
            {
                hash ^= AfterLevelId.GetHashCode();
            }
            if (Type != 0)
            {
                hash ^= Type.GetHashCode();
            }
            hash ^= abilities_.GetHashCode();
            hash ^= ItemMax.GetHashCode();
            hash ^= FansMax.GetHashCode();
            if (Max != 0)
            {
                hash ^= Max.GetHashCode();
            }
            hash ^= eventId_.GetHashCode();
            hash ^= StarSource.GetHashCode();
            hash ^= awards_.GetHashCode();
            if (GameType != 0)
            {
                hash ^= GameType.GetHashCode();
            }
            if (LevelInfoId != 0)
            {
                hash ^= LevelInfoId.GetHashCode();
            }
            if (ChapterGroup != 0)
            {
                hash ^= ChapterGroup.GetHashCode();
            }
            if (LevelMark.Length != 0)
            {
                hash ^= LevelMark.GetHashCode();
            }
            hash ^= LevelPlot.GetHashCode();
            hash ^= levelCoordinate_.GetHashCode();
            hash ^= levelBackdrop_.GetHashCode();
            if (levelExtra_ != null)
            {
                hash ^= LevelExtra.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 11
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (LevelId != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            hash ^= awards_.GetHashCode();
            return(hash);
        }
		public static LevelData GetLevelDataById(LevelId level)
		{
			LevelData result = _levels.FirstOrDefault( a => a.Level==level );
			if(result!=null)
			{
				return result;
			}
			else
			{
				Debug.LogException(new System.Exception("Not found level data for LevelId = " + level.ToString()));
				return null;
			}
		}
Exemplo n.º 13
0
        public static LevelData GetLevelDataById(LevelId level)
        {
            LevelData result = _levels.FirstOrDefault(a => a.Level == level);

            if (result != null)
            {
                return(result);
            }
            else
            {
                Debug.LogException(new System.Exception("Not found level data for LevelId = " + level.ToString()));
                return(null);
            }
        }
Exemplo n.º 14
0
        public override int GetHashCode()
        {
            int result = 1;

            result = (result * 397) ^ (AcademicQaulification != null ? AcademicQaulification.GetHashCode() : 0);
            result = (result * 397) ^ AssignedDate.GetHashCode();
            result = (result * 397) ^ (DeactivatedDate != null ? DeactivatedDate.GetHashCode() : 0);
            result = (result * 397) ^ Id.GetHashCode();
            result = (result * 397) ^ (IdNumber != null ? IdNumber.GetHashCode() : 0);
            result = (result * 397) ^ (IsActive != null ? IsActive.GetHashCode() : 0);
            result = (result * 397) ^ LevelId.GetHashCode();
            result = (result * 397) ^ (WorkStatus != null ? WorkStatus.GetHashCode() : 0);
            return(result);
        }
Exemplo n.º 15
0
        public void ShouldRenameLevel()
        {
            var          levelId      = new LevelId();
            const string newLevelName = "New Level";

            var level = new Mock <ILevel>();

            repository.Setup(repo => repo.GetLevel(levelId)).Returns(level.Object);

            CreateHandler().Handle(new RenameLevelCommand {
                LevelId = levelId, NewLevelName = newLevelName
            });

            level.Verify(it => it.Rename(newLevelName));
        }
        public void ShouldReconstituteLevelFromCreatedEvent()
        {
            var organizationId = new OrganizationId();
            var events         = new EventStore();

            DomainEvents.Register((IDomainEvent evt) => events.Add(organizationId, evt));

            var levelId = new LevelId();
            var level   = new Level(levelId, new StructureId(), "Level Name");

            var repo = new DomainRepository(organizationId, events);

            var clonedLevel = repo.GetLevel(levelId);

            clonedLevel.ShouldBeEquivalentTo(level);
        }
Exemplo n.º 17
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (LevelId != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (LevelType != 0)
            {
                hash ^= LevelType.GetHashCode();
            }
            if (LevelName.Length != 0)
            {
                hash ^= LevelName.GetHashCode();
            }
            if (LevelTheme.Length != 0)
            {
                hash ^= LevelTheme.GetHashCode();
            }
            if (LevelPicture != 0)
            {
                hash ^= LevelPicture.GetHashCode();
            }
            if (LevelUnlock != 0)
            {
                hash ^= LevelUnlock.GetHashCode();
            }
            if (Rating1 != 0)
            {
                hash ^= Rating1.GetHashCode();
            }
            hash ^= rating2_.GetHashCode();
            hash ^= rating3_.GetHashCode();
            hash ^= levelPixel_.GetHashCode();
            if (AdPuzzle != 0)
            {
                hash ^= AdPuzzle.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 18
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (LevelId.Length != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (CustomHostUrl.Length != 0)
            {
                hash ^= CustomHostUrl.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 19
0
        public void ShouldCreateNewLevel()
        {
            var          levelId     = new LevelId();
            var          structureId = new StructureId();
            const string levelName   = "New Level";

            LevelCreatedEvent result = null;

            DomainEvents.Register((LevelCreatedEvent evt) =>
            {
                result = evt;
            });

            var level = new Level(levelId, structureId, levelName);

            level.Id.Should().Be(levelId);
            level.Name.Should().Be(levelName);

            result.Should().NotBeNull("domain method should raise event");
        }
Exemplo n.º 20
0
        public Level(LevelId levelId)
        {
            _furnishings = new SortedDictionary <int, Furnishing>();
            _actors      = new SortedDictionary <int, Actor>();

            var levelTemplate = LevelDatabase.LevelDatabase.GetLevelTemplate(levelId);

            // Basic details
            _levelId   = levelId;
            _levelName = levelTemplate.LevelName;
            _mapWidth  = levelTemplate.MapWidth;
            _mapHeight = levelTemplate.MapHeight;
            _tileGrid  = levelTemplate.MapGrid;
            _revealed  = new bool[_mapWidth * _mapHeight];

            _visibleTiles = new List <XYCoordinateStruct>();

            _tileInformation = new Dictionary <int, MapTileDetails>();
            foreach (KeyValuePair <int, TileType> tile in levelTemplate.TileDictionary)
            {
                _tileInformation[tile.Key] = Entities.EntityFactory.CreateMapTile(tile.Value);
            }

            // Furnishings
            foreach (string[] furnishing in levelTemplate.Furnishings)
            {
                if (furnishing.Length < FURNISHINGSTARTINGINDEX)
                {
                    ErrorLogger.AddDebugText(string.Format("Misformed line in furnishing read: {0}", furnishing));
                    continue;
                }

                var furnishingName  = furnishing[0];
                var xLoc            = int.Parse(furnishing[1]);
                var yLoc            = int.Parse(furnishing[2]);
                var otherParameters = ParseOtherEntityParameters(furnishing, FURNISHINGSTARTINGINDEX);

                var newFurnishing = Entities.EntityFactory.CreateFurnishing(furnishingName, xLoc, yLoc, otherParameters);
                AddFurnishing(newFurnishing);
            }
        }
Exemplo n.º 21
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (LevelId != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (DepartmentLevel != 0)
            {
                hash ^= DepartmentLevel.GetHashCode();
            }
            if (CardId != 0)
            {
                hash ^= CardId.GetHashCode();
            }
            if (Favorability != 0)
            {
                hash ^= Favorability.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 22
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (LevelId != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (AltasName.Length != 0)
            {
                hash ^= AltasName.GetHashCode();
            }
            if (AltasName2.Length != 0)
            {
                hash ^= AltasName2.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 23
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Position.Length != 0)
            {
                hash ^= Position.GetHashCode();
            }
            if (LevelId.Length != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (Layout.Length != 0)
            {
                hash ^= Layout.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 24
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (UserId != 0)
            {
                hash ^= UserId.GetHashCode();
            }
            if (LevelId != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (Star != 0)
            {
                hash ^= Star.GetHashCode();
            }
            if (Count != 0)
            {
                hash ^= Count.GetHashCode();
            }
            if (ResetTime != 0L)
            {
                hash ^= ResetTime.GetHashCode();
            }
            if (MaxFraction != 0)
            {
                hash ^= MaxFraction.GetHashCode();
            }
            if (BuyCount != 0)
            {
                hash ^= BuyCount.GetHashCode();
            }
            if (FirstAwardsState != 0)
            {
                hash ^= FirstAwardsState.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 25
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (LevelId.Length != 0)
            {
                hash ^= LevelId.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            hash ^= characteristics_.GetHashCode();
            if (Loaded != false)
            {
                hash ^= Loaded.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 26
0
 public Level(LevelId id, StructureId ownerId, string name)
 {
     Raise(new LevelCreatedEvent(ownerId, id, name));
 }
Exemplo n.º 27
0
 private void Apply(LevelCreatedEvent evt)
 {
     this.id   = evt.EntityId;
     this.name = evt.LevelName;
 }
Exemplo n.º 28
0
		public string LevelName;		//название сцены
		
		public LevelData(LevelId level, string levelName)
		{
			Level = level;
			LevelName = levelName;
		}
Exemplo n.º 29
0
        public string LevelName;                        //название сцены

        public LevelData(LevelId level, string levelName)
        {
            Level     = level;
            LevelName = levelName;
        }
Exemplo n.º 30
0
 private void LoadLevel(LevelId level)
 {
     Application.LoadLevel(LevelsDictionary.GetLevelDataById(level).LevelName);
 }
Exemplo n.º 31
0
        public static LevelDetails GetLevelTemplate(LevelId levelId)
        {
            // TODO: Don't spend too much time here - will get put into a DB in the end anyway.

            var levelFilePath = Path.Combine(filePath, levelFilePaths[levelId]);

            var fileReader = new StreamReader(levelFilePath);

            // Get level name first
            var levelName = fileReader.ReadLine().Trim();

            var levelTemplate = new LevelDetails(levelName, levelId);

            if ((LevelId)Enum.Parse(typeof(LevelId), fileReader.ReadLine().Trim()) != levelId)
            {
                ErrorLogger.AddDebugText(string.Format("Level template is broken - level id doesn't match for level {0}", levelId));
                fileReader.Close();
                return(levelTemplate);
            }

            levelTemplate.MapWidth  = int.Parse(fileReader.ReadLine());
            levelTemplate.MapHeight = int.Parse(fileReader.ReadLine());

            if (fileReader.ReadLine().Trim() != "###")
            {
                ErrorLogger.AddDebugText(string.Format("Header section for level {0}, has problems", levelId));
                return(levelTemplate);
            }

            // Tile Dictionary
            string line;

            while ((line = fileReader.ReadLine().Trim()) != "###")
            {
                var splitLine = line.Split(',');
                levelTemplate.TileDictionary[int.Parse(splitLine[0])] = (TileType)Enum.Parse(typeof(TileType), splitLine[1]);
            }

            // TileMap
            levelTemplate.MapGrid = new int[levelTemplate.MapHeight * levelTemplate.MapWidth];
            for (int y = 0; y < levelTemplate.MapHeight; y++)
            {
                var splitLine = fileReader.ReadLine().Trim().Split(',');
                for (int x = 0; x < levelTemplate.MapWidth; x++)
                {
                    levelTemplate.MapGrid[y * levelTemplate.MapWidth + x] = int.Parse(splitLine[x]);
                }
            }

            if (fileReader.ReadLine().Trim() != "###")
            {
                ErrorLogger.AddDebugText(string.Format("Map section for level {0} has problems", levelId));
                return(levelTemplate);
            }

            // Furnishings
            while ((line = fileReader.ReadLine().Trim()) != "###")
            {
                var splitLine = line.Split(',');
                levelTemplate.Furnishings.Add(splitLine);
            }

            fileReader.Close();

            return(levelTemplate);
        }
Exemplo n.º 32
0
        public void OpenLevel(LevelId level)
        {
            var world = level.World;

            OpenScene(world);
        }