private void LoadTiles(List <string> textlines, int width, Dictionary <char, string> tiletypechar) { LevelGrid level = new LevelGrid(width, textlines.Count, 0, "levelgrid"); RootList.Add(level); level.CellWidth = 108; level.CellHeight = 54; Camera camera = GetObject("camera") as Camera; camera.Width = (width) * level.CellWidth / 2; camera.Height = (textlines.Count) * level.CellHeight; for (int x = 0; x < width; x++) { for (int y = 0; y < textlines.Count; y++) { try { Tile t = LoadTile(x, y, tiletypechar[textlines[y][x]]); level.Add(t, x, y); } catch { Tile t = LoadTile(x, y, tiletypechar['a']); level.Add(t, x, y); } } } }
private void GetRoots() { foreach (KeyValuePair <string, string> kvproot in SubFolders) { RootList.Add(kvproot.Key, new SyncRoot(ForestName, kvproot.Key, kvproot.Value)); } }
public void LoadTiles(List <string> textlines, int width, Dictionary <char, string> tiletypechar) { LevelGrid level = new LevelGrid(width, textlines.Count, 0, "tiles"); RootList.Add(level); level.CellWidth = 108; level.CellHeight = 54; Camera camera = GetObject("camera") as Camera; camera.Width = (width) * level.CellWidth / 2; camera.Height = (textlines.Count) * level.CellHeight; for (int x = 0; x < width; x++) { for (int y = 0; y < textlines.Count; y++) { Tile t; if (textlines[y][x] == '1') { t = LoadPlayer(x, y); } else { t = LoadTile(x, y, tiletypechar[textlines[y][x]]); } level.Add(t, x, y); } } }
void m_worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (m_disposeRequested) { Dispose(); return; } if (e.Error == null) { if (e.Result is VCServerPathRootViewModel) { VCServerPathRootViewModel rootNode = e.Result as VCServerPathRootViewModel; RootList.Add(rootNode); } else if (e.Result is VCServerPathNodeViewModel) { VCServerPathNodeViewModel node = e.Result as VCServerPathNodeViewModel; node.PopulateChildren(); if (m_queue.Count > 0) { QueueLoadChildren(m_queue.Dequeue()); } } } IsLoading = false; }
/// <summary> /// 装载清单数据 /// </summary> public void Load() { NodeList.ListChanged -= OnNodeList_ListChanged; RootList.Clear(); NodeList.Clear(); updateList.Clear(); List <ContractBoiNode> lstNode = new List <ContractBoiNode>(); Boq = contractBoqService.GetByProjectNo(ProjectNo); if (Boq != null) { lstNode = Convert(Boq.BoiList); lstNode.ForEach(m => NodeList.Add(m)); } else { Boq = new ContractBoq(); Boq.ProjectNo = ProjectNo; Boq.BoQName = ProjectName; } NodeList.ListChanged += OnNodeList_ListChanged; if (ListChanged != null) { ListChanged(); } }
public Eu4Save(string filePath, string modFilePath) : base(modFilePath) { //ModPath = modFilePath; //LoadHistory(); //LoadRegions(); //LoadBuildingData(); //LoadLocalisation(); ReadSave(filePath); Date = RootList.KeyValuePairs["date"]; PlayerTag = RootList.GetString("player"); var versionSub = RootList.Sublists["savegame_version"]; Version = $"{versionSub.FloatValues["first"].Single()}.{versionSub.FloatValues["second"].Single()}.0.0"; //LoadCountryTags(); LoadCountryData(); LoadDiploRelations(); //Console.WriteLine($"Average merc: {Countries.Where(c => c.Value.Exists).Sum(c => c.Value.Mercantilism) / Countries.Count}"); LoadProvinceData(); GreatestPower = Countries.OrderByDescending(c => c.Value.GreatPowerScore).First().Value; Console.WriteLine("The greatest power is " + GreatestPower.CountryTag); //LoadReligionData(); //LoadCultureData(); PostInitLoad(); Console.WriteLine("EU4 data loaded."); }
/// <summary> /// Adds an entity to the appropriate place in the object graph. /// </summary> /// <param name="entityInstance"></param> public void AddEntity(object entityInstance) { _entity = entityInstance; // Add newly created entityInstance to list (Many) or set it to field (One) if (this.IsRoot) { RootList.Add(entityInstance); } else if (_relationship.RelationshipInfo.RelationType == RelationshipTypes.Many) { var list = _parent._entityReferences[_parent.GroupingKeyColumns.GroupingKey] .ChildLists[_relationship.Member.Name]; list.Add(entityInstance); } else // RelationTypes.One { _relationship.Setter(_parent._entity, entityInstance); } EntityReference entityRef = new EntityReference(entityInstance); if (GroupingKeyColumns.GroupingKey != null && !_entityReferences.ContainsKey(GroupingKeyColumns.GroupingKey)) { _entityReferences.Add(GroupingKeyColumns.GroupingKey, entityRef); } InitOneToManyChildLists(entityRef); }
public void LoadLevel(string path) { GameObjectList entities = new GameObjectList(2, "entities"); RootList.Add(entities); GameObjectList items = new GameObjectList(1, "items"); entities.Add(items); GameObjectList enemies = new GameObjectList(1, "enemies"); entities.Add(enemies); Camera camera = new Camera("player", 0, "camera"); RootList.Add(camera); GameMouse mouse = new GameMouse(); RootList.Add(mouse); LoadOverlays(); LoadFile(path); }
private void UpdateRootList() { try { var actual = _walletManager.CurrentWallet.TransactionProcessor?.Coins?.ToHashSet() ?? Enumerable.Empty <SmartCoin>(); var old = RootList.Items.ToDictionary(c => c.Model, c => c); var coinToRemove = old.Where(c => !actual.Contains(c.Key)).ToArray(); var coinToAdd = actual.Where(c => !old.ContainsKey(c)).ToArray(); RootList.RemoveMany(coinToRemove.Select(kp => kp.Value)); var newCoinViewModels = coinToAdd.Select(c => new CoinViewModel(_walletManager, _config, _bitcoinStore, c)).ToArray(); foreach (var cvm in newCoinViewModels) { SubscribeToCoinEvents(cvm); } RootList.AddRange(newCoinViewModels); foreach (var item in coinToRemove) { item.Value.Dispose(); } } catch (Exception ex) { Logger.LogError(ex); } finally { IsCoinListLoading = false; } }
private void LoadOverlay() { RootList.Add(new EditorMouse()); OverlayStatus overlay = new OverlayStatus(this); RootList.Add(overlay); overlay.AddStatus("Floor", new TileOverlay(this, "Content/Editor/Tiles/Floor.txt")); overlay.AddStatus("Wall", new TileOverlay(this, "Content/Editor/Tiles/Wall.txt")); //overlay.AddStatus("Cave", new TileOverlay(this, "Content/Editor/Tiles/Cave.txt")); overlay.AddStatus("Tree", new TileOverlay(this, "Content/Editor/Tiles/Tree.txt")); overlay.AddStatus("Items", new EntityOverlay(this, "Content/Editor/Entities/Item.txt")); overlay.AddStatus("Objects-1", new EntityOverlay(this, "Content/Editor/Entities/Object.txt")); overlay.AddStatus("Objects-2", new EntityOverlay(this, "Content/Editor/Entities/Objects2.txt")); //overlay.AddStatus("Cave_Objects", new EntityOverlay(this, "Content/Editor/Entities/Cave_Object.txt")); overlay.AddStatus("Enemies", new EntityOverlay(this, "Content/Editor/Entities/Enemy.txt")); overlay.AddStatus("Spawn", new EntityOverlay(this, "Content/Editor/Entities/Spawn.txt")); LevelGrid levelGrid = GetObject("levelgrid") as LevelGrid; Camera camera = new Camera(); camera.SetupCamera = levelGrid.AnchorPosition(5, 5) - GameEnvironment.Screen.ToVector2() / 2; RootList.Add(camera); }
private void LoadEntities(List <string> textlines, int width, Dictionary <char, string> entitytypechar) { ItemGrid level = new ItemGrid(width, textlines.Count, 0, "itemgrid"); RootList.Add(level); level.CellWidth = 108; level.CellHeight = 54; for (int x = 0; x < width; x++) { for (int y = 0; y < textlines.Count; y++) { try { EditorEntity e = LoadEntity(x, y, entitytypechar[textlines[y][x]]); level.Add(e, x, y); } catch { EditorEntity e = LoadEntity(x, y, "None"); level.Add(e, x, y); } } } }
private void LoadButtons() { Vector2 startposition = new Vector2((GameEnvironment.Screen.X / 30) * 8, (GameEnvironment.Screen.Y / 13) * 4); Vector2 newPosition; int xOffset = (int)(GameEnvironment.Screen.X / 30) * 5; int yOffset = (int)(GameEnvironment.Screen.Y / 4); for (int y = 0; y < 3; y++) { newPosition = new Vector2(startposition.X, startposition.Y + yOffset * y); for (int x = 0; x < 3; x++) { Button button = new Button("Sprites/Menu/Select_Button", 109); buttonList.Add(button); button.Sprite.Size = new Vector2(0.6f, 0.6f); button.Position = new Vector2(startposition.X + x * xOffset, newPosition.Y); RootList.Add(button); int nummer = (3) * y + x + 1; SpriteGameObject level = new SpriteGameObject("Sprites/Menu/Level_Button_" + nummer, 110); levelList.Add(level); level.Sprite.Size = new Vector2(0.6f, 0.6f); level.Position = new Vector2(startposition.X + x * xOffset, newPosition.Y - 150); RootList.Add(level); } } returnButton = new Button("Sprites/Menu/Return_Button", 101); returnButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - returnButton.Width / 2, (GameEnvironment.Screen.Y - returnButton.Height) / 16 * 15); RootList.Add(returnButton); }
/// <summary> /// Adds an entity to the appropriate place in the object graph. /// </summary> /// <param name="entityInstance"></param> public void AddEntity(object entityInstance) { _entity = entityInstance; // Add newly created entityInstance to list (Many) or set it to field (One) if (IsRoot) { RootList.Add(entityInstance); } else if (_relationship.RelationshipInfo.RelationType == RelationshipTypes.Many) { var list = _parent._entityReferences[_parent.GroupingKeyColumns.GroupingKey] .ChildLists[_relationship.Member.Name]; list.Add(entityInstance); } else // RelationTypes.One { if (_relationship.IsLazyLoaded) { _relationship.Setter(_parent._entity, Activator.CreateInstance(_relationship.MemberType, entityInstance)); } else { _relationship.Setter(_parent._entity, entityInstance); } } EntityReference entityRef = new EntityReference(entityInstance); _entityReferences.Add(GroupingKeyColumns.GroupingKey, entityRef); InitOneToManyChildLists(entityRef); }
/// <summary> /// 插入节点 /// </summary> /// <param name="ParentNode"></param> public ContractBoiNode InsertNode(ContractBoiNode ParentNode = null) { String strParentCode; String strMaxCode; String strNewCode; int iNewCode; ContractBoiNode nodeNew = new ContractBoiNode(); if (ParentNode != null) { strParentCode = ParentNode.ItemCode; strMaxCode = ParentNode.Children.Max(m => m.ItemCode); if (String.IsNullOrEmpty(strMaxCode)) { strNewCode = strParentCode + "001"; } else { iNewCode = System.Convert.ToInt32(strMaxCode.Substring(strMaxCode.Length - 3, 3)) + 1; if (iNewCode > 999) { throw new BusinessException("清单项超出限制(子项不多余999项)"); } strNewCode = strParentCode + iNewCode.ToString().PadLeft(3, '0'); } ParentNode.Children.Add(nodeNew); nodeNew.ParentCode = ParentNode.ItemCode; } else { strMaxCode = RootList.Max(m => m.ItemCode); if (String.IsNullOrEmpty(strMaxCode)) { strNewCode = "01"; } else { iNewCode = System.Convert.ToInt32(strMaxCode) + 1; if (iNewCode > 99) { throw new BusinessException("清单项超出限制(顶层项不多余99项)"); } strNewCode = iNewCode.ToString().PadLeft(2, '0'); } RootList.Add(nodeNew); } nodeNew.ItemCode = strNewCode; nodeNew.ProjectNo = ProjectNo; nodeNew.BoQNo = Boq.BoQNo; nodeNew.ParentBoiNode = ParentNode; CalcNode(nodeNew); NodeList.Add(nodeNew); if (ListChanged != null) { ListChanged(); } return(nodeNew); }
private void InitChanged() { List <ContractBoqChangeDetailEx> lstDetail = ChangeDetailExList.ToList(); List <ContractBoqChangeDetailEx> lstDelete = lstDetail.FindAll(m => m.ChangeType == ChangeType.Delete).OrderByDescending(m => m.ItemCode).ToList(); List <ContractBoqChangeDetailEx> lstUpdate = lstDetail.FindAll(m => m.ChangeType == ChangeType.Update).OrderByDescending(m => m.ItemCode).ToList(); List <ContractBoqChangeDetailEx> lstNew = lstDetail.FindAll(m => m.ChangeType == ChangeType.Add).OrderBy(m => m.ItemCode).ToList(); List <ContractBoqChangeDetailEx> lstDiable = lstDetail.FindAll(m => m.ChangeType == ChangeType.Disable).OrderByDescending(m => m.ItemCode).ToList(); List <ContractBoqChangeDetailEx> lstEnable = lstDetail.FindAll(m => m.ChangeType == ChangeType.Enable).OrderByDescending(m => m.ItemCode).ToList(); List <ContractBoiChangeNode> lstNode = NodeList.ToList(); lstDelete.ForEach(m => { ContractBoiChangeNode node = lstNode.FirstOrDefault(n => n.ItemNo == m.ItemNo); node.ChangeDetailEx = m; ChangeNodeStat(node, false); }); lstNew.ForEach(m => { ContractBoiChangeNode nodeAdd = HDAutoMapper.DynamicMap <ContractBoiChangeNode>(m); nodeAdd.CtrctPrjPrice = m.AfPrice; nodeAdd.CtrctQty = m.AfQty; nodeAdd.CtrctAmount = m.AfAmount; nodeAdd.ChangeDetailEx = m; ContractBoiChangeNode parentNode = lstNode.FirstOrDefault(n => n.ItemCode == nodeAdd.ParentCode); if (parentNode != null) { parentNode.Children.Add(nodeAdd); } else { RootList.Add(nodeAdd); } NodeList.Add(nodeAdd); }); lstUpdate.ForEach(m => { ContractBoiChangeNode node = lstNode.Find(n => n.ItemNo == m.ItemNo); node.CtrctAmount = m.AfAmount; node.CtrctPrjPrice = m.AfPrice; node.CtrctQty = m.AfQty; node.IItemCoe = m.IItemCoe; node.Uom = m.Uom; node.ItemName = m.ItemName; node.ChangeDetailEx = m; }); lstDiable.ForEach(m => { ContractBoiChangeNode node = lstNode.Find(n => n.ItemNo == m.ItemNo); node.ChangeDetailEx = m; ChangeNodeStat(node, false); }); lstEnable.ForEach(m => { ContractBoiChangeNode node = lstNode.Find(n => n.ItemNo == m.ItemNo); node.ChangeDetailEx = m; ChangeNodeStat(node, true); }); }
public SelectEditState() : base() { SpriteGameObject titleScreen = new SpriteGameObject("Sprites/Menu/Screen1", 100, "background"); RootList.Add(titleScreen); buttonList = new List <Button>(); levelList = new List <SpriteGameObject>(); LoadButtons(); }
public void LoadOverlays() { OverlayManager overlayManager = new OverlayManager(); RootList.Add(overlayManager); overlayManager.AddOverlay("hud", new Hud(this)); overlayManager.AddOverlay("inventory", new Inventory(this)); overlayManager.SwitchTo("hud"); }
public HostSelectionState() { GameEnvironment.GameSettingsManager.SetValue("level", "1"); //load level 1 by default buttonReadyList = new List <Button>(); buttonUnreadyList = new List <Button>(); buttonWarriorList = new List <Button>(); buttonWizzardList = new List <Button>(); buttonBardList = new List <Button>(); //Load all menu sprites (e.g. background images, overlay images, button sprites) SpriteGameObject titleScreen = new SpriteGameObject("Sprites/Menu/Screen2", 100, "background"); RootList.Add(titleScreen); SpriteGameObject lobbyBackground = new SpriteGameObject("Sprites/Menu/Screen2", 101, "lobby"); lobbyBackground.Sprite.Color = Color.DarkBlue; lobbyBackground.Sprite.Size = new Vector2(0.3f, 0.5f); lobbyBackground.Origin = lobbyBackground.Sprite.Center; lobbyBackground.Position = new Vector2((GameEnvironment.Screen.X / 10 * 8), GameEnvironment.Screen.Y / 7 * 3); RootList.Add(lobbyBackground); startButton = new Button("Sprites/Menu/Start_Button", 101); startButton.Position = new Vector2((GameEnvironment.Screen.X - startButton.Width) / 8 * 1, (GameEnvironment.Screen.Y - startButton.Height) / 6); RootList.Add(startButton); changeButton = new Button("Sprites/Menu/Change_Button", 101); changeButton.Position = new Vector2((GameEnvironment.Screen.X - changeButton.Width) / 8, (GameEnvironment.Screen.Y - changeButton.Height) / 4); RootList.Add(changeButton); warriorButton = new Button("Sprites/Menu/Player_Warrior_Button", 101); warriorButton.Position = new Vector2((GameEnvironment.Screen.X - warriorButton.Width) / 8 * 1, (GameEnvironment.Screen.Y - warriorButton.Height) / 12 * 5); RootList.Add(warriorButton); sorcererButton = new Button("Sprites/Menu/Player_Wizzard_Button", 101); sorcererButton.Position = new Vector2((GameEnvironment.Screen.X - sorcererButton.Width) / 8 * 2, (GameEnvironment.Screen.Y - sorcererButton.Height) / 12 * 5); RootList.Add(sorcererButton); bardButton = new Button("Sprites/Menu/Player_Bard_Button", 101); bardButton.Position = new Vector2((GameEnvironment.Screen.X - bardButton.Width) / 8 * 3, (GameEnvironment.Screen.Y - bardButton.Height) / 12 * 5); RootList.Add(bardButton); returnButton = new Button("Sprites/Menu/Return_Button", 101); returnButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - returnButton.Width / 2, (GameEnvironment.Screen.Y - returnButton.Height) / 8 * 7); RootList.Add(returnButton); popup = new MapSelectionPopUp("Sprites/Menu/Screen2", new Vector2(0.5f, 0.78f)); RootList.Add(popup); popup.LoadButtons(); popup.active = false; Selected = new SpriteGameObject("Sprites/Menu/Selected_Button", 101); Selected.Position = new Vector2((GameEnvironment.Screen.X - warriorButton.Width) / 8 * 1, (GameEnvironment.Screen.Y - warriorButton.Height) / 12 * 8); RootList.Add(Selected); skillbuttons = new string[3, 3]; skilltext = new string[3, 3]; LoadSkillText(); LoadSkillButtons(); GameEnvironment.GameSettingsManager.SetValue("character", "Warrior"); }
public void LoadOverlays() { OverlayManager overlayManager = new OverlayManager(); RootList.Add(overlayManager); overlayManager.AddOverlay("hud", new Hud(this)); overlayManager.AddOverlay("menu", new InGameMenu(this)); overlayManager.AddOverlay("die", new Die(this, "Sprites/Overlay/spr_die")); overlayManager.AddOverlay("finish", new Die(this, "Sprites/Overlay/spr_finish")); overlayManager.SwitchTo("hud"); }
private void PopulateRootList() { var temp = new List <string>(); if (DirectoryUtils.IsWindows8OrHigher) { try { RootList.Add(new FileTreeViewModel(new DirectoryInfoEx(KnownFolderIds.SkyDrive)) { FileExtensionFilter = temp }); } catch { } } if (DirectoryUtils.IsWindows7OrHigher) { try { RootList.Add(new FileTreeViewModel(new DirectoryInfoEx(KnownFolderIds.Libraries)) { FileExtensionFilter = temp }); } catch { } } if (DirectoryUtils.IsWindows7OrHigher) { try { RootList.Add(new FileTreeViewModel(new DirectoryInfoEx(KnownFolderIds.HomeGroup)) { FileExtensionFilter = temp }); } catch { } } RootList.Add(new FileTreeViewModel(new DirectoryInfoEx(KnownFolderIds.UsersFiles)) { FileExtensionFilter = temp }); RootList.Add(new FileTreeViewModel(DirectoryInfoEx.MyComputerDirectory) { FileExtensionFilter = temp }); RootList.Add(new FileTreeViewModel(new DirectoryInfoEx(KnownFolderIds.NetworkFolder)) { FileExtensionFilter = temp }); }
void m_worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (m_disposeRequested) { Dispose(); return; } if (e.Error == null) { WITQueryNodeViewModel root = e.Result as WITQueryNodeViewModel; RootList.Add(root); IsLoading = false; } }
public SettingsState() { //Load all menu sprites (e.g. background images, overlay images, button sprites) SpriteGameObject titleScreen = new SpriteGameObject("Sprites/Overlay/Menu_BG_Grey", 100, "background"); RootList.Add(titleScreen); startButton = new Button("Sprites/Menu/Select_Button", 101); startButton.Position = new Vector2((GameEnvironment.Screen.X - startButton.Width) / 16 * 13, (GameEnvironment.Screen.Y - startButton.Height) / 4); RootList.Add(startButton); settingsButton = new Button("Sprites/Menu/Select_Button", 101); settingsButton.Position = new Vector2((GameEnvironment.Screen.X - settingsButton.Width) / 16 * 13, (GameEnvironment.Screen.Y - startButton.Height) / 2); RootList.Add(settingsButton); returnButton = new Button("Sprites/Menu/Return_Button", 101); returnButton.Position = new Vector2((GameEnvironment.Screen.X - settingsButton.Width) / 16 * 13, (GameEnvironment.Screen.Y - startButton.Height) / 4 * 3); RootList.Add(returnButton); }
public void NewLevel(int width, int height) { LevelGrid levelGrid = new LevelGrid(width, height, 0, "levelgrid"); RootList.Add(levelGrid); levelGrid.CellWidth = 108; levelGrid.CellHeight = 54; levelGrid.SetupGrid(); ItemGrid itemGrid = new ItemGrid(width, height, 1, "itemgrid"); RootList.Add(itemGrid); itemGrid.CellWidth = 108; itemGrid.CellHeight = 54; itemGrid.SetupGrid(); }
public HostClientSelectionState() { //Load all menu sprites (e.g. background images, overlay images, button sprites) SpriteGameObject titleScreen = new SpriteGameObject("Sprites/Menu/Screen1", 100, "background"); RootList.Add(titleScreen); createGameButton = new Button("Sprites/Menu/CreateGame_Button", 101); createGameButton.Sprite.Size = new Vector2(2f, 3f); createGameButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - createGameButton.BoundingBox.Width / 2, (GameEnvironment.Screen.Y - createGameButton.BoundingBox.Height) / 4); RootList.Add(createGameButton); joinGameButton = new Button("Sprites/Menu/JoinGame_Button", 101); joinGameButton.Sprite.Size = new Vector2(2f, 3f); joinGameButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - joinGameButton.BoundingBox.Width / 2, (GameEnvironment.Screen.Y - joinGameButton.BoundingBox.Height) / 2); RootList.Add(joinGameButton); returnButton = new Button("Sprites/Menu/Return_Button", 101); returnButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - returnButton.Width / 2, (GameEnvironment.Screen.Y - returnButton.Height) / 8 * 7); RootList.Add(returnButton); }
public ModeSelectionState() { //Load all menu sprites (e.g. background images, overlay images, button sprites) SpriteGameObject titleScreen = new SpriteGameObject("Sprites/Menu/Screen1", 100, "background"); RootList.Add(titleScreen); offlineButton = new Button("Sprites/Menu/PlayOffline_Button", 101); offlineButton.Sprite.Size = new Vector2(2f, 3f); offlineButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - offlineButton.BoundingBox.Width / 2, (GameEnvironment.Screen.Y - offlineButton.BoundingBox.Height) / 4); RootList.Add(offlineButton); onlineButton = new Button("Sprites/Menu/PlayOnline_Button", 101); onlineButton.Sprite.Size = new Vector2(2f, 3f); onlineButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - onlineButton.BoundingBox.Width / 2, (GameEnvironment.Screen.Y - onlineButton.BoundingBox.Height) / 2); RootList.Add(onlineButton); returnButton = new Button("Sprites/Menu/Return_Button", 101); returnButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - returnButton.Width / 2, (GameEnvironment.Screen.Y - returnButton.Height) / 8 * 7); RootList.Add(returnButton); }
private void LoadProvinceData() { Console.WriteLine("Loading provinces..."); Provinces = new Dictionary <int, Eu4ProvinceBase>(); var provinces = RootList.GetSublist("provinces"); provinces.ForEachSublist(provList => { if (!provList.Value.KeyValuePairs.ContainsKey("culture")) { return; } var province = new Eu4Province(provList.Value, this); Provinces.Add(province.ProvinceID, province); }); Console.WriteLine($"Loaded {Provinces.Count} provinces."); }
public SettingsState() { //Load all menu sprites (e.g. background images, overlay images, button sprites) SpriteGameObject titleScreen = new SpriteGameObject("Sprites/Menu/Screen1", 100, "background"); RootList.Add(titleScreen); fullScreenButton = new Button("Sprites/Menu/FullScreen_Button", 101); fullScreenButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - fullScreenButton.Width / 2, (GameEnvironment.Screen.Y - fullScreenButton.Height) / 4); RootList.Add(fullScreenButton); volumeUpButton = new Button("Sprites/Menu/VolumeUp_Button", 101); volumeUpButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - volumeUpButton.Width / 2, (GameEnvironment.Screen.Y - fullScreenButton.Height) / 8 * 3); RootList.Add(volumeUpButton); volumeDownButton = new Button("Sprites/Menu/VolumeDown_Button", 101); volumeDownButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - volumeDownButton.Width / 2, (GameEnvironment.Screen.Y - fullScreenButton.Height) / 2); RootList.Add(volumeDownButton); returnButton = new Button("Sprites/Menu/Return_Button", 101); returnButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - volumeDownButton.Width / 2, (GameEnvironment.Screen.Y - fullScreenButton.Height) / 4 * 3); RootList.Add(returnButton); }
/// <summary> /// 将Boi列表转换为Node列表 /// </summary> /// <param name="BoiList"></param> /// <returns></returns> private List <ContractBoiNode> Convert(List <ContractBoi> BoiList) { List <ContractBoiNode> lstBoiNode; List <ContractBoiNode> lstRoot; lstBoiNode = BoiList.ConvertAll <ContractBoiNode>(m => { ContractBoiNode node = HDAutoMapper.DynamicMap <ContractBoiNode>(m); node.OriginalBoi = m; return(node); }); lstRoot = lstBoiNode.FindAll(m => String.IsNullOrEmpty(m.ParentCode)); RootList.AddRange(lstRoot); lstRoot.ForEach(m => { RecursionNode(lstBoiNode, m); }); return(lstBoiNode); }
public PortSelectionState() { //Load all menu sprites (e.g. background images, overlay images, button sprites) SpriteGameObject titleScreen = new SpriteGameObject("Sprites/Menu/Screen1", 100, "background"); RootList.Add(titleScreen); SpriteGameObject lobby = new SpriteGameObject("Sprites/Menu/Screen2", 101, "lobby"); lobby.Sprite.Size = new Vector2(0.75f, 0.5f); lobby.Origin = lobby.Sprite.Center; lobby.Position = new Vector2(GameEnvironment.Screen.X / 2, GameEnvironment.Screen.Y / 2); lobby.Sprite.Color = Color.Gray; RootList.Add(lobby); returnButton = new Button("Sprites/Menu/Return_Button", 101); returnButton.Position = new Vector2(GameEnvironment.Screen.X / 2 - returnButton.Width / 2, (GameEnvironment.Screen.Y - returnButton.Height) / 8 * 7); RootList.Add(returnButton); buttonList = new List <Button>(); }
/// <summary> /// 装载清单数据 /// </summary> public void Load() { RootList.Clear(); NodeList.Clear(); updateList.Clear(); List <ContractBoiChangeNode> lstNode = new List <ContractBoiChangeNode>(); Boq = contractBoqService.GetByProjectNo(ProjectNo); lstNode = Convert(Boq.BoiList); ////初始化批复值 //RootList.ForEach(m => //{ // InitReply(lstNode, m); //}); lstNode.ForEach(m => NodeList.Add(m)); NodeList.ListChanged += OnNodeList_ListChanged; RootList.ForEach(m => m.PropertyChanged += M_PropertyChanged); InitChanged(); }
public void SuppressListChangedEventsDoNotRaiseCollectionChanged() { bool changed = false; var obj = new RootList(); obj.ListChanged += (o, e) => { changed = true; }; var child = new RootListChild(); // object is marked as child Assert.IsTrue(obj.RaiseListChangedEvents); using (obj.SuppressListChangedEvents) { Assert.IsFalse(obj.RaiseListChangedEvents); obj.Add(child); } Assert.IsFalse(changed, "Should not raise ListChanged event"); Assert.IsTrue(obj.RaiseListChangedEvents); Assert.AreEqual(child, obj[0]); }