public Hierarchy(string uniqueName, string caption, string displayFolder) { UniqueName = uniqueName; Caption = caption; DisplayFolder = displayFolder; Levels = new LevelCollection(); }
public Hierarchy(string uniqueName, string caption, string displayFolder) { UniqueName = uniqueName; Caption = caption; DisplayFolder = displayFolder; Levels = new LevelCollection(); }
protected override void Update() { if (!finishedLoading && (finishedLoading = database.GetLevelsStatus >= TaskStatus.RanToCompletion)) { if ((levels = database.UserLevels).Count > 0) { var level = levels[0]; name.Text = $"Name: {level.Name}"; description.Text = $"Description: {level.Description}"; revision.Text = $"Revision: {level.Revision}"; version.Text = $"Version: {level.Version}"; objectCount.Text = $"Object Count: {level.ObjectCount}"; length.Text = $"Length: {level.Length}"; } else { name.Text = "No levels"; } } if (!finishedLoading) { name.Text = "Loading"; } base.Update(); }
/// <summary> /// Load Level Collection. /// </summary> /// <param name="path">QFC file path</param> /// <returns></returns> public static LevelCollection LoadLevels(string path) { LevelCollection collection = new LevelCollection(); using (var stream = TitleContainer.OpenStream(path)) { XDocument doc = XDocument.Load(stream); XElement root = doc.Element("collection"); #region Load Levels foreach (XElement el in root.Element("levels").Elements("level")) { int id = int.Parse(el.Attribute("id").Value); int[] neighbors = (from string element in el.Attribute("neighbors").Value.Split(',') select int.Parse(element)).ToArray <int>(); Level level = LoadMap(id, el.Attribute("path").Value); level.BGM = el.Attribute("music").Value; level.Title = el.Attribute("title").Value; for (int i = 0; i < 4; i++) { level.SetNeighbor((Direction)i, neighbors[i]); } collection.AddLevel(level); } #endregion Load Levels } return(collection); }
private void LoadSokobanLevels(string path) { XmlDocument doc = new XmlDocument(); doc.Load(path); XmlNode root = doc.DocumentElement; foreach (XmlNode node in root.ChildNodes) { switch (node.Name) { case "Title": Title = node.InnerText; break; case "Description": Description = node.InnerText; break; case "LevelCollection": Collection = new LevelCollection(node); break; default: break; } } if (Collection.Count > 0) { CurrentLevelId = Collection[0].Id; } }
internal Image(BasisFile file, uint index, ref ImageInfo info) { File = file; Index = index; Info = info; Levels = new LevelCollection(this); }
public void FindMemberProperty() { var connection = TestHelper.CreateConnectionToSsas(); connection.Open(); CubeDef cube = TestHelper.GetCube(connection); KpiCollection kpis = cube.Kpis; MeasureCollection meas = cube.Measures; DimensionCollection dims = cube.Dimensions; HierarchyCollection hiers = dims[0].Hierarchies; LevelCollection levels = hiers[0].Levels; MemberCollection members = levels[1].GetMembers(); MemberProperty prop = members[0].MemberProperties.Find("PARENT_UNIQUE_NAME"); Assert.IsTrue(!string.IsNullOrEmpty(prop.Value.ToString())); connection.Close(); }
public void StartGame(List <PlayerData> players, int roundTime, int totalRounds) { var pauseMenu = Instantiate(Resources.Load <GameData>("GameData").PauseMenu); pauseMenu.GetComponent <PauseMenu>().OnExit = LeaveGame; _cleanUpList.Add(pauseMenu); _GameModeCollection = gameObject.AddComponent <GameModeCollection>(); _GameModeCollection.AddCollection(Resources.Load <GameData>("GameData").GameModePrefabs); _LevelCollection = gameObject.AddComponent <LevelCollection>(); _LevelCollection.AddCollection(Resources.Load <GameData>("GameData").Levels); _roundTime = roundTime; _totalRounds = totalRounds; foreach (var obj in players) { var playerObj = new GameObject(); _cleanUpList.Add(playerObj); playerObj.name = obj.PlayerName; var player = playerObj.AddComponent <PlayerManager>(); player.Initialise(obj); player.CreatePlayerCallback += OnPlayerCreated; Container <IPlayerManager> .Instance.Add(player); } _initialized = true; StartRound(); }
/// <summary> /// ctor /// </summary> /// <param name="logplant"></param> public Ranks(ILogPlant logplant) { this.v_defaultplant = logplant; this.v_rankTable = new Dictionary <LoggerHash, ILogger>(); this.LevelCollection = new LevelCollection(); this.v_configurationChanged = this.LoadConfiguration; }
protected override void Update() { if (!finishedLoading && (finishedLoading = database.DecryptLevelDataStatus >= TaskStatus.RanToCompletion)) { levelName.Text = (levels = database.UserLevels).Count > 0 ? $"Loaded: {levels[0].Name}" : "No levels"; } base.Update(); }
public GameplayState(LevelCollection levelCollection, LevelRenderer levelRenderer) { this.levelCollection = levelCollection; this.levelRenderer = levelRenderer; this.commandRunner = new CommandRunner(); this.inputStateManager = new InputStateManager(); this.inputBuffer = new Queue <InputAction>(); }
private void changeLevelMenuItem_Click(object sender, EventArgs e) { ChangeLevelForm changeLevelForm = new ChangeLevelForm(); if (changeLevelForm.ShowDialog() == DialogResult.OK) { _levelCollection = changeLevelForm.SelectedCollection; GoToLevel(changeLevelForm.SelectedLevel); } }
public void Initialize() { UserData userData = SaveSystem.LoadUserData(); if (userData != null) { _LevelData = SaveSystem.LoadLevels(); Reset(_LevelData.GetLevel(userData._CurrentLevel)); } }
public new LevelCollection List(IEnumerable<IFilter> filters) { var levels = new LevelCollection(); var rows = Discover(filters); foreach (var row in rows) levels.AddOrIgnore(row.UniqueName, row.Caption, row.Number); return levels; }
// Use this for initialization void Start() { screenBlock = GameObject.Find("ScreenBlock"); leftDiv = GameObject.Find("Left Divider"); rightDiv = GameObject.Find("Right Divider"); gameCam = GameObject.Find("Main Camera").GetComponent <Camera>(); levels = gameObject.GetComponent <LevelCollection>(); levels.FillArray(); LoadLevel(levels.GetLevel()); }
void Awake() { Publisher.Instance.Subscribe(this); _PostGameMenuUI.SetActive(false); _PostGameFailure.SetActive(false); _PostGameSuccess.SetActive(false); _PostGameEndOfContent.SetActive(false); LevelCollection levelCollection = SaveSystem.LoadLevels(); _LevelCount = levelCollection.Count; }
private void ReloadLevelCollection() { _EditingLevel = false; _LevelCollection = SaveSystem.LoadLevels(); if (_LevelCollection._StoredLevels != null) { _LevelSliderMax = _LevelCollection._StoredLevels.Length; } else { _LevelSliderMax = 1; } }
public new LevelCollection List(IEnumerable <IFilter> filters) { var levels = new LevelCollection(); var rows = Discover(filters); foreach (var row in rows) { levels.AddOrIgnore(row.UniqueName, row.Caption, row.Number); } return(levels); }
private void levelCollectionGrid_SelectionChanged(object sender, EventArgs e) { LevelCollection selectedLevelCollection = (LevelCollection)levelCollectionGrid.CurrentRow.DataBoundItem; levelsGrid.Rows.Clear(); for (int i = 1; i <= selectedLevelCollection.NumberOfLevels; i++) { levelsGrid.Rows.Add("Level " + i); } SelectedCollection = selectedLevelCollection; levelCollectionDescriptionText.Text = selectedLevelCollection.Description; }
private void levelsGrid_SelectionChanged(object sender, EventArgs e) { SelectedLevel = levelsGrid.CurrentRow.Index; LevelCollection selectedLevelCollection = (LevelCollection)levelCollectionGrid.CurrentRow.DataBoundItem; _sokoban.LoadLevel(selectedLevelCollection[SelectedLevel]); _cellSize = levelPreview.Width / Math.Max(_sokoban.Width, _sokoban.Height); _paddingX = (levelPreview.Width - (_sokoban.Width * _cellSize)) / 2; _paddingY = (levelPreview.Height - (_sokoban.Height * _cellSize)) / 2; levelPreview.Invalidate(); }
/// <summary> /// Write Levels to ETABS as Storeys /// </summary> /// <param name="levels"></param> /// <param name="context"></param> public void WriteStoreys(LevelCollection levels, ETABSConversionContext context) { string[] storeyNames = new string[levels.Count]; double[] storeyElevations = new double[levels.Count]; bool[] isMasterStorey = new bool[levels.Count]; for (int i = 0; i < levels.Count; i++) { Level lvl = levels[i]; storeyNames[i] = lvl.Name; storeyElevations[i] = lvl.Z; isMasterStorey[i] = true; //? } SapModel.Story.SetStories(storeyNames, storeyElevations, null, isMasterStorey, null, null, null); // Are nulls OK? }
public Dungeon(Game game, IDungonBuilder builder) : base(game) { InitializeGraphics(); Game.Components.Add(this); Builder = builder; ActiveLevels = new LevelCollection(); var l = LoadLevel(0, null);//2, new Point(11, 14)); Theron = new Theron(l.StartTile, Game); Game.Components.Add(Theron); Theron.LocationChanged += CurrentPlayer_LocationChanged; EnabledChanged += Dungeon_EnabledChanged; }
void controllerBehavior_OnEnter(object sender, GameEventArgs e) { var beh = (InputBehavior)sender; _player2 = new Player2 { Position = Position + new Vector2(Size.X), CurrentLevel = CurrentLevel }; if (!e.Level.Map.Collides(_player2.CollisionRect) && !e.Level.CollidesWith(_player2.CollisionRect, true).Any()) { _player2.Health.ValueChanged += Health_ValueChanged; RemoveBehavior(beh); _player2.RemoveBehaviors(b => b is InputBehavior); _player2.AddBehavior(beh); e.Level.AddEntity(_player2); beh.OnEnter -= controllerBehavior_OnEnter; var oldHealth = Health.Quantity; LevelCollection.CloneWaypoints(this, _player2); if (Weapons != null) { foreach (var weapon in Weapons) { _player2.AddWeapon(GameStateManager.WeaponFactory[weapon.GetType().Name]()); } } foreach (var ctn in Containers) { _player2.Containers[ctn.Key].Quantity = ctn.Key == "Magic" ? ctn.Value.Quantity : ctn.Value.Quantity / 2; } Health.Quantity /= 2; _player2.Health.Quantity = oldHealth - Health.Quantity; if (Health.Quantity <= 0) { Health.Quantity = 1; } if (_player2.Health.Quantity <= 0) { _player2.Health.Quantity = 1; } _controller2Behavior = null; _keyboardBehavior = null; } }
private static LevelCollection LoadLevelData() { if (File.Exists(saveFilePath)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(saveFilePath, FileMode.Open); LevelCollection data = formatter.Deserialize(stream) as LevelCollection; stream.Close(); return data; } else { Debug.Log("New user, returning default data"); LevelCollection data = new LevelCollection { localLevelData = new List<LocalLevelData>() }; return data; } }
public void LaunchModules() { InstantiateModule = MainController.Instance.ModuleCreator.Create <InstantiateModule> ("InstantiateModule"); PoolModule = MainController.Instance.ModuleCreator.Create <PoolModule> ("PoolModule"); PrefabCollection = MainController.Instance.ModuleCreator.Create <PrefabCollection> ("PrefabCollection"); ObjectSpawner = MainController.Instance.ModuleCreator.Create <ObjectSpawner> ("ObjectSpawner"); LevelCollection = new LevelCollection(); LevelLoader = new LevelLoader(); TimeingManager = new TimeingManager(); InputModuleUIMode = new InputModuleUIMode(); InputModulePlayMode = new InputModulePlayMode(); StageCreator = new StageCreator(); CoreParametersCreator = new CoreParametersCreator(); PointSystemCreator = new PointSystemCreator(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); var tileSheetTexture = Content.Load <Texture2D>("tilesheet"); var tileSheet = new TileSheet(tileSheetTexture); levelRenderer = new LevelRenderer(graphics, tileSheet); using (var importer = new LevelImporter("Content/levels.txt")) { levelCollection = importer.LoadLevels(); } sceneStateManager = new SceneStateManager(levelCollection, levelRenderer); }
public static void Init(LevelCollectionSO collection) { if (!Initialized) { Debug.Log("Levels local Path : " + saveFilePath); LevelCollection data = LoadLevelData(); if (data != null && data.localLevelData != null) { LEVELS = new List<LocalLevelData>(); LEVELS = data.localLevelData; Debug.Log("Level Data fetched, updating variables.."); UpdateLevelVariables(collection); Initialized = true; } else { Debug.LogError("Level Collection type is not attached to resource fetched"); } } }
void Awake() { _SelectedLevel = 1; _LevelCollection = SaveSystem.LoadLevels(); int levelCount = _LevelCollection.Count; if (levelCount <= 1) { _LevelSlider.gameObject.SetActive(false); } else { _LevelSlider.minValue = 1; _LevelSlider.maxValue = levelCount; } }
public static void SaveLevelData() { try { if (LEVELS != null && LEVELS.Count > 0) { FileStream stream = new FileStream(saveFilePath, FileMode.Create); LevelCollection data = new LevelCollection(); data.localLevelData = LEVELS; BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, data); stream.Close(); Debug.Log("Saved Level File!"); } else { Debug.LogError("LEVELS Collection in Level Helper is null or empty"); } } catch (Exception ex) { Debug.LogError("Error Saving Level File.. :" + ex.Message); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ChooseVehicleMenu); context = Application.Context; if (Intent.GetIntExtra("IndexOfGameMode", 1) == 1) { levels = LevelCollection.GetLevels(); } else { levels = LevelCollection.GetTrainingLevels(); } RecyclerInitializer(); }
void controllerBehavior_OnEnter(object sender, GameEventArgs e) { var beh = (InputBehavior)sender; //TODO: criar entidade e adicionar este behavior na próxima var p2 = new Player { Position = Position + new Vector2(Size.X), CurrentLevel = CurrentLevel }; if (!e.Level.Map.Collides(p2.CollisionRect) && !e.Level.CollidesWith(p2.CollisionRect, true).Any()) { RemoveBehavior(beh); p2.RemoveBehaviors(b => b is InputBehavior); p2.AddBehavior(beh); e.Level.AddEntity(p2); beh.OnEnter -= controllerBehavior_OnEnter; var oldHealth = Health.Quantity; Health.Quantity /= 2; p2.Health.Quantity = oldHealth - Health.Quantity; LevelCollection.CloneWaypoints(this, p2); } }
private void BindLevels(TreeNode hierarchyNode, LevelCollection levels) { if (levels == null || levels.Count == 0) { return; } foreach (var level in levels) { string name = level.Name.Replace("$", ""); string caption = level.Caption.Replace("$", ""); TreeNode tempNode = new TreeNode(caption); tempNode.Name = name; bool visible = level.Properties["LEVEL_IS_VISIBLE"].Value.Value <bool>(true); tempNode.SelectedImageKey = tempNode.ImageKey = visible ? "Level" : "Level"; tempNode.ToolTipText = string.Format("Level Name:[{0}]Caption:[{1}]", name, caption); tempNode.Tag = level; hierarchyNode.Nodes.Add(tempNode); } hierarchyNode.Collapse(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ClassicGameMode); context = ApplicationContext; _CGMQuestionImage = FindViewById <ImageView>(Resource.Id.imageQuestion); _CGMAnswerA = FindViewById <Button>(Resource.Id.buttonAnswerA); _CGMAnswerB = FindViewById <Button>(Resource.Id.buttonAnswerB); _CGMAnswerC = FindViewById <Button>(Resource.Id.buttonAnswerC); _CGMAnswerD = FindViewById <Button>(Resource.Id.buttonAnswerD); _HintsPoints = FindViewById <TextView>(Resource.Id.textHintpoints); _CurrentQuestion = FindViewById <TextView>(Resource.Id.textCurrentQuetion); _CountQuestion = FindViewById <TextView>(Resource.Id.textTotalQuesion); _CorrectAnswer = FindViewById <TextView>(Resource.Id.textCorrectAnswer); _linearHeart = FindViewById <LinearLayout>(Resource.Id.linearHeart); _LoggedInGooglePlay = FindViewById <TextView>(Resource.Id.textLogged); _linearHeart = FindViewById <LinearLayout>(Resource.Id.linearHeart); _imageHeart1 = FindViewById <ImageView>(Resource.Id.imageHeart1); _imageHeart2 = FindViewById <ImageView>(Resource.Id.imageHeart2); _imageHeart3 = FindViewById <ImageView>(Resource.Id.imageHeart3); _CGMAnswerA.SetOnClickListener(this); _CGMAnswerB.SetOnClickListener(this); _CGMAnswerC.SetOnClickListener(this); _CGMAnswerD.SetOnClickListener(this); levels = LevelCollection.GetLevels(); AdMobInitialization(); GetDataFromPrevActiviity(); SetTopPanelData(); LevelDataForUnlocked(); ShowQuestion(); UpdateHeart(); ShowGoogleLoginLabel(); }
void Awake() { lc = LevelCollection.Load(path); }
private void BindLevels(TreeNode hierarchyNode, LevelCollection levels) { if (levels == null || levels.Count == 0) return; foreach (var level in levels) { string name = level.Name.Replace("$", ""); string caption = level.Caption.Replace("$", ""); TreeNode tempNode = new TreeNode(caption); tempNode.Name = name; bool visible = level.Properties["LEVEL_IS_VISIBLE"].Value.Value<bool>(true); tempNode.SelectedImageKey = tempNode.ImageKey = visible ? "Level" : "Level"; tempNode.ToolTipText = string.Format("Level Name:[{0}]Caption:[{1}]", name, caption); tempNode.Tag = level; hierarchyNode.Nodes.Add(tempNode); } hierarchyNode.Collapse(); }
// /** // * Creates a new item to be added to the list of selectable level collections. // * // * @param levelCollection the {@code LevelCollection} to extract the data from // * @param isLastPlayedEntry flag indicating whether this is a "last played" level collection // */ public SelectableLevelCollection(LevelCollection levelCollection, bool isLastPlayedEntry) : this(levelCollection.GetTitle(), levelCollection.GetFile(), levelCollection.GetDatabaseId(), isLastPlayedEntry) { }
protected Hierarchy(string uniqueName, string caption, LevelCollection levels) { UniqueName = uniqueName; Caption = caption; Levels = levels; }
public void UpdateMapList() { if (InvokeRequired) Invoke(new UpdateList(UpdateMapList)); else { if (dgvMaps.DataSource == null) dgvMaps.DataSource = lc; string selected = null; if (lc.Count > 0 && dgvMaps.SelectedRows.Count > 0) { selected = (from DataGridViewRow row in dgvMaps.Rows where row.Selected select lc[row.Index]).First().name; } dgvPlayers.SuspendLayout(); lc.Clear(); lc = new LevelCollection(new LevelListView()); Server.levels.ForEach(l => lc.Add(l)); dgvPlayers.Invalidate(); dgvMaps.DataSource = null; dgvMaps.DataSource = lc; if (selected != null) { foreach (DataGridViewRow row in Server.levels.SelectMany(l => dgvMaps.Rows.Cast<DataGridViewRow>().Where(row => (string)row.Cells[0].Value == selected))) row.Selected = true; } dgvMaps.Refresh(); dgvPlayers.ResumeLayout(); if (dgvMapsTab.DataSource == null) dgvMapsTab.DataSource = lcTAB; string selected2 = null; if (lcTAB.Count > 0 && dgvMapsTab.SelectedRows.Count > 0) { selected2 = (from DataGridViewRow row in dgvMapsTab.Rows where row.Selected select lcTAB[row.Index]).First().name; } dgvPlayers.SuspendLayout(); lcTAB.Clear(); lcTAB = new LevelCollection(new LevelListViewForTab()); Server.levels.ForEach(l => lcTAB.Add(l)); dgvPlayers.Invalidate(); dgvMapsTab.DataSource = null; dgvMapsTab.DataSource = lcTAB; if (selected2 != null) { foreach (DataGridViewRow row in from l in Server.levels from DataGridViewRow row in dgvMapsTab.Rows where Equals(row.Cells[0].Value, selected2) select row) row.Selected = true; } dgvMapsTab.Refresh(); } }
public void UpdateMapList(string blah) { /* if (this.InvokeRequired) { LogDelegate d = new LogDelegate(UpdateMapList); this.Invoke(d, new object[] { blah }); } else { LevelCollection lc = new LevelCollection(new LevelListView()); Server.levels.ForEach(delegate(Level l) { lc.Add(l); }); dgvMaps.SuspendLayout(); dgvMaps.DataSource = lc; //dgvMaps.Invalidate(); dgvMaps.ResumeLayout(); } */ if (this.InvokeRequired) { LogDelegate d = new LogDelegate(UpdateMapList); this.Invoke(d, new object[] { blah }); } else { if (dgvMaps.DataSource == null) dgvMaps.DataSource = lc; // Try to keep the same selection on update string selected = null; if (lc.Count > 0 && dgvMaps.SelectedRows.Count > 0) { selected = (from DataGridViewRow row in dgvMaps.Rows where row.Selected select lc[row.Index]).First().name; } // Update the data source and control //dgvPlayers.SuspendLayout(); lc = new LevelCollection(new LevelListView()); Server.levels.ForEach(delegate(Level l) { lc.Add(l); }); //dgvPlayers.Invalidate(); dgvMaps.DataSource = lc; // Reselect map if (selected != null) { foreach (Level l in Server.levels) foreach (DataGridViewRow row in dgvMaps.Rows) if (String.Equals(row.Cells[0].Value, selected)) row.Selected = true; } dgvMaps.Refresh(); //dgvPlayers.ResumeLayout(); } }