public static void SetLoadingProgress(TileContainer container, int value) { var tile = container.Items.FirstOrDefault(); if (tile == null) return; if (tile.Elements.Count < 2) return; tile.Elements[0].Text = value + "%"; }
/// <summary> /// Activates all necessary objects and places them /// on the passed TerrainTile. /// </summary> /// <param name="tile"></param> public void ActivateTile(TerrainTile tile) { TileContainer setContainer = null; foreach (TileContainer container in Tiles) { if (container.Tile == tile) { setContainer = container; } } if (setContainer == null) { setContainer = new TileContainer(tile, this); Tiles.Add(setContainer); } //Compute positions if needed if (!setContainer.HasComputedPositions()) { setContainer.ComputePositions(); } setContainer.PlaceObjects(); }
private void LoadTile(Vector2Int mapPosition, Vector3Int position, TileContainer tile) { Tile ghostBuilding = GhostBuildingTile(mapPosition, tile); Tile ghostTerrain = GhostTerrainTile(mapPosition, tile); // Terrain if (ghostTerrain != null) { terrainTilemap.SetTile(position, ghostTerrain); } else if (tile.terrain != null) { terrainTilemap.SetTile(position, tileResources.TileForDisplayable(tile.terrain)); } // Growable if (tile.growable?.CurrentStage != null && ghostBuilding == null) { growableTilemap.SetTile(position, tileResources.TileForDisplayable(tile.growable.CurrentStage)); } // Building if (ghostBuilding != null) { buildingsTilemap.SetTile(position, ghostBuilding); } else if (tile.specialEntity != null) { buildingsTilemap.SetTile(position, tileResources.TileForDisplayable(tile.specialEntity)); } else if (tile.building != null) { buildingsTilemap.SetTile(position, tileResources.TileForDisplayable(tile.building.Entity)); } }
void IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ManageDevicesGrid = (Grid)target; return; case 2: this.GridHeadLine = (Grid)target; return; case 3: this.HeadingTextBlock = (TextBlock)target; return; case 4: this.LogoutTextBlock = (TextBlock)target; this.LogoutTextBlock.MouseLeftButtonDown += new MouseButtonEventHandler(this.LogoutTextBlock_MouseLeftButtonDown); return; case 5: this.DeviceTileControl = (TileContainer)target; return; default: this._contentLoaded = true; return; } }
public bool Build(TerrainUpgradeEntity terrainUpgrade, TileContainer tileContainer) { if (CanUpgradeTerrainOnTile(tileContainer, terrainUpgrade)) { return(state.TryBuild(terrainUpgrade, resolvedMultipliers, tileContainer)); } return(false); }
public void Initialize(TileContainer wallContainer, TileContainer pitContainer, Tilemap floors, Tilemap walls, Tilemap pits) { _wallContainer = wallContainer; _pitContainer = pitContainer; _floors = floors; _walls = walls; _pits = pits; }
public bool Build(BuildingEntity building, TileContainer tileContainer) { if (CanBuildOnTile(tileContainer, building)) { return(state.TryBuild(building, resolvedMultipliers, tileContainer)); } return(false); }
// Adds the given tile to this tile's list of neighbors and vice versa, ignoring duplicates public void AddNeighbor(TileContainer tile) { if (neighbors.Contains(tile)) { return; } neighbors.Add(tile); tile.AddNeighbor(this); }
private void SwapTiles(TileContainer A, TileContainer B) { TileManagerService tileManager = TileManagerService.GetInstance(); tileManager.SwapTilesInContainer( A, B ); }
public void AddTile(Tile tile, ClickEventHandler onClick = null) { TileContainer tileContainer = new TileContainer(tile); tileContainer.Clicked += onClick; MultiBox.AddItem(tileContainer); RefreshScrollBars(); }
private void Start() { tiles = GameObject.Find("Grid").GetComponent <TileContainer>(); areaDisplay = Instantiate(areaDisplayPrefab); areaDisplay.transform.position = this.transform.position; areaDisplay.transform.parent = this.transform; _shootingDelay = shootingDelay; }
public void TransitionToThenSwap(TileContainer tileA, TileContainer tileB) { if (TileManagerService .GetInstance() .AreTilesAdjacent(tileA, tileB) ) { IsTransitioning = true; bool tileATransitionComplete = false; bool tileBTransitionComplete = false; if (tileA.Tile != null) { StartCoroutine(tileA.Tile.TransitionTo( tileB.transform.position, delegate() { SfxManagerService.GetInstance().PlayTileDing(); tileATransitionComplete = true; if (tileATransitionComplete && tileBTransitionComplete) { SwapTiles(tileA, tileB); IsTransitioning = false; } } )); } else { tileATransitionComplete = true; } if (tileB.Tile != null) { StartCoroutine(tileB.Tile.TransitionTo( tileA.transform.position, delegate() { tileBTransitionComplete = true; if (tileATransitionComplete && tileBTransitionComplete) { SwapTiles(tileA, tileB); IsTransitioning = false; } } )); } else { tileBTransitionComplete = true; } if (tileATransitionComplete && tileBTransitionComplete) { SwapTiles(tileA, tileB); IsTransitioning = false; } } }
private void LoadModelMenu() { ((ISupportInitialize)(this._MetroUI)).BeginInit(); dtMenu = DBEngine.execReturnDataTable("sp_Menu_Load", CommonConst.A_LanguageID, StaticVars.LanguageID, CommonConst.A_LoginID, StaticVars.LoginID); //xac dinh so containt can tao _MetroUI.ContentContainers.Clear(); foreach (DataRow drContaint in DBEngine.execReturnDataTable("Select distinct ParentMenuID from MEN_MENU where IsVisible = 1").Rows) { TileContainer tc = new TileContainer(); if (drContaint["ParentMenuID"] != DBNull.Value) { tc.Caption = drContaint["ParentMenuID"].ToString(); _MetroUI.ContentContainers.Add(tc); } } // xac dinh cha con foreach (TileContainer tc in _MetroUI.ContentContainers) { string parentName = string.Empty; if (dtMenu.Select(string.Format("MenuID = '{0}'", tc.Caption)).Length > 0) { parentName = dtMenu.Select(string.Format("MenuID = '{0}'", tc.Caption))[0]["ParentMenuID"].ToString(); } foreach (TileContainer parent in _MetroUI.ContentContainers) { if (parent.Caption.Equals(parentName)) { tc.Parent = parent; break; } } } foreach (DataRow drTile in dtMenu.Rows) { CreateTile(drTile); } foreach (TileContainer tc in _MetroUI.ContentContainers) { if (tc.Caption == "Mnu") { tc.Caption = Methods.GetMessage("lblApplicationName1"); } else { if (dtMenu.Select(String.Format("MenuID = '{0}'", tc.Caption)).Length > 0) { tc.Caption = dtMenu.Select(String.Format("MenuID = '{0}'", tc.Caption))[0][CommonConst.NAME].ToString(); } } } ((ISupportInitialize)(this._MetroUI)).EndInit(); }
public void SwapTilesInContainer(TileContainer tileFrom, TileContainer tileTo) { if (AreTilesAdjacent(tileFrom, tileTo)) { Vector2 fromCoord = GetTileContainerCoordinates(tileFrom); Vector2 toCoord = GetTileContainerCoordinates(tileTo); SwapTiles(fromCoord, toCoord); tileTo.AttachNewTile(TileMap[(int)toCoord.y][(int)toCoord.x].Tile); tileFrom.AttachNewTile(TileMap[(int)fromCoord.y][(int)fromCoord.x].Tile); } }
private void Start() { _tileContainer = _tileContainerData; min = CalculateWorldPosition(Vector3.zero); max = CalculateWorldPosition(new Vector3(Screen.width, Screen.height, 0)); CoordinateSystem.width = _tileContainer.Layer(TileHeight.zero).meshSizeX; HexPoint start = CoordinateSystem.pixel_to_flat_hex(Vector3.zero, out start); CreateMap(start, _mapRadius); CoordinateSystem.isInitialized = true; }
public bool AreTilesAdjacent(TileContainer tileA, TileContainer tileB) { Vector2 from = GetTileContainerCoordinates(tileA); Vector2 to = GetTileContainerCoordinates(tileB); if ((Math.Abs(from.x - to.x) == 0 || Math.Abs(from.y - to.y) == 0) && (Math.Abs(from.x - to.x) == 1 || Math.Abs(from.y - to.y) == 1) ) { return(true); } return(false); }
public bool DestroyBuilding(TileContainer tile) { if (tile.building != null) { tile.building = null; if (tile.terrain.Growable != null) { tile.growable = new GrowableIncarnation(tile.terrain.Growable.Entity); } return(true); } return(false); }
// DragSource private void DragSource_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { this._sourceItemsControl = (TileContainer)sender; var visual = e.OriginalSource as Visual; this._topWindow = Window.GetWindow(this._sourceItemsControl); this._initialMousePosition = e.GetPosition(this._topWindow); this._sourceItemContainer = _sourceItemsControl.ListBox.ContainerFromElement(visual) as FrameworkElement; if (this._sourceItemContainer != null) { this._draggedData = this._sourceItemContainer.DataContext; } }
private void TickBuilding(TileContainer tile) { if (tile.building.Entity.Effect is BuildingEffectGenerator generator) { state.TryGenerate(generator, resolvedMultipliers); } else if (tile.building.Entity.Effect is BuildingEffectHarvester) { if (tile.growable != null) { CollectGrowable(tile.growable); } } }
void Update() { if (mouseHelper.DidClickOnGame()) { Vector2Int tileCoordinates = mouseHelper.TileCoordinateForCurrentMousePosition(); TileContainer tileContainer = GameManager.Instance.TileContainerAtPosition(tileCoordinates); if (tileContainer != null) { switch (UIManager.Instance.State.state) { case UIState.Value.BuildingSelected: if (GameManager.Instance.Build(UIManager.Instance.State.buildingEntity, tileContainer)) { UIManager.Instance.State = UIState.Default(); } break; case UIState.Value.TerrainUpgradeSelected: if (GameManager.Instance.Build(UIManager.Instance.State.terrainUpgradeEntity, tileContainer)) { UIManager.Instance.State = UIState.Default(); } break; case UIState.Value.DestoryBuildings: if (GameManager.Instance.DestroyBuilding(tileContainer)) { UIManager.Instance.State = UIState.Default(); } break; case UIState.Value.Default: if (tileContainer.growable != null) { GameManager.Instance.CollectGrowable(tileContainer.growable); } break; } } else { UIManager.Instance.State = UIState.Default(); } } else if (mouseHelper.DidRightClickOverGame()) { UIManager.Instance.State = UIState.Default(); } }
public void OnPointerEnter(PointerEventData eventData) { if (TileManagerService.GetInstance().IsLocked) { return; } TileSelector selector = TileSelector.GetInstance(); if (selector.IsTileSelected() && selector.GetSelected() != this) { TileContainer tileB = selector.GetSelected(); TransitionToThenSwap(this, tileB); selector.Unselect(); } }
public static TileContainer CreateTileContainer(WindowsUIView view, Tile activationTile, string caption = "", String subCaption = "", IContentContainer parent = null) { TileContainer container = new TileContainer() { Caption = caption, Subtitle = subCaption, Parent = parent }; if (activationTile != null) { (container as IContentContainer).Name = activationTile.Tag.ToString(); activationTile.ActivationTarget = container; } container.Properties.IndentBetweenItems = 1; container.Properties.IndentBetweenGroups = 16; container.Properties.ItemSize = 128; container.Properties.ShowGroupText = DefaultBoolean.True; container.AppearanceGroupText.Font = new Font("Segoe UI Light", 18); container.Properties.AllowItemHover = DefaultBoolean.True; return container; }
private void InitializeGrid() { grid = new TileContainer[width * height][]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { grid[x + width * y] = new TileContainer[inputReader.TileTypes.Count]; for (int i = 0; i < inputReader.TileTypes.Count; ++i) { grid[x + width * y][i] = new TileContainer(inputReader.TileTypes[i], x, y); } } } } // enables every posible tile for each index in grid
public bool TryBuild(BuildingEntity building, ResolvedMultipliers multipliers, TileContainer tileContainer) { List <ResolvedGenerator> cost = ResolvedGenerator.List(building.BuildCost.Resources, multipliers); if (!CanAfford(cost)) { return(false); } Buy(cost); tileContainer.building = new BuildingIncarnation(building); if (!(building.Effect is BuildingEffectHarvester)) { tileContainer.growable = null; } return(true); }
private Tile GhostBuildingTile(Vector2Int mapPosition, TileContainer tile) { UIState state = UIManager.Instance.State; if (state.state == UIState.Value.BuildingSelected) { if (GameManager.Instance.CanBuildOnTile(tile, state.buildingEntity)) { if (UIManager.Instance.HoverPosition == mapPosition) { Color ghostBuildingColor = new Color(1, 1, 1, 0.5f); return(tileResources.ColoredTileForDisplayable(state.buildingEntity, ghostBuildingColor)); } } } return(null); }
public void DeactivateTile(TerrainTile tile) { TileContainer setContainer = null; foreach (TileContainer container in Tiles) { if (container.Tile == tile) { setContainer = container; } } if (setContainer != null) { setContainer.RemoveObjects(); } }
private void Start() { Vector3 bottomLeft = GetBottomLeftOfGrid() + new Vector3(0.5f, 0.5f); grid = new TileContainer[rows][]; // Fill grid with plain tiles for (int ii = 0; ii < rows; ii++) { grid[ii] = new TileContainer[columns]; for (int jj = 0; jj < columns; jj++) { GameObject tileObj = Instantiate(plainTile, bottomLeft + new Vector3(jj, ii), Quaternion.identity, transform); TileContainer tile = tileObj.GetComponent <TileContainer>(); grid[ii][jj] = tile; // Add tile above and tile to the left to this tile's neighbors, and add this tile to their neighbors if (ii > 0) { tile.AddNeighbor(grid[ii - 1][jj]); } if (jj > 0) { tile.AddNeighbor(grid[ii][jj - 1]); } } } // Place initial farmhouses and crop tiles based on serialized offset values grid[farmhouseOffsetY][farmhouseOffsetX].ConvertToFarmhouse(0); grid[farmhouseOffsetY + 1][farmhouseOffsetX].ConvertToCrop(0); grid[farmhouseOffsetY][farmhouseOffsetX + 1].ConvertToCrop(0); grid[farmhouseOffsetY][columns - farmhouseOffsetX - 1].ConvertToFarmhouse(1); grid[farmhouseOffsetY + 1][columns - farmhouseOffsetX - 1].ConvertToCrop(1); grid[farmhouseOffsetY][columns - farmhouseOffsetX - 2].ConvertToCrop(1); grid[rows - farmhouseOffsetY - 1][farmhouseOffsetX].ConvertToFarmhouse(2); grid[rows - farmhouseOffsetY - 2][farmhouseOffsetX].ConvertToCrop(2); grid[rows - farmhouseOffsetY - 1][farmhouseOffsetX + 1].ConvertToCrop(2); grid[rows - farmhouseOffsetY - 1][columns - farmhouseOffsetX - 1].ConvertToFarmhouse(3); grid[rows - farmhouseOffsetY - 2][columns - farmhouseOffsetX - 1].ConvertToCrop(3); grid[rows - farmhouseOffsetY - 1][columns - farmhouseOffsetX - 2].ConvertToCrop(3); }
private Tile GhostTerrainTile(Vector2Int mapPosition, TileContainer tile) { UIState state = UIManager.Instance.State; if (state.state == UIState.Value.TerrainUpgradeSelected) { if (GameManager.Instance.CanUpgradeTerrainOnTile(tile, state.terrainUpgradeEntity)) { if (UIManager.Instance.HoverPosition == mapPosition) { float tint = 0.8f; Color ghostTerrainColor = new Color(tint, tint, tint); return(tileResources.ColoredTileForDisplayable(state.terrainUpgradeEntity.Replacement.Entity, ghostTerrainColor)); } } } return(null); }
private Vector2 GetTileContainerCoordinates(TileContainer tileContainer) { for (int y = 0; y < Rows; y++) { for (int x = 0; x < Columns; x++) { if (TileMap[y][x] == tileContainer) { return(new Vector2(x, y)); } } } throw new Exception( "`TileManagerService` ->\n" + "`GetTileContainerCoordinates` ->\n" + "Attempted to get an untracked tile container" ); }
public bool CanBuildOnTile(TileContainer tile, BuildingEntity entity) { if (tile.specialEntity != null) { return(false); } if (entity.BuildRule.PreviousBuilding != null) { return(entity.BuildRule.PreviousBuilding.Entity == tile.building?.Entity); } else if (tile.building != null) { return(false); } return(entity.BuildRule.PossibleTerrains == null || entity.BuildRule.PossibleTerrains.Contains(tile.terrain.Id)); }
//This is a Deep copy. If this isnt added into here, we have issues making single copies of all the elements for the whole array when trying to go over it. //This lets us make a copy that contains all the information we need, however isnt a reference to the original one, otherwise any chance we made to one copy in our array would change them all. public TileContainer DeepCopy() { TileContainer Copy = new TileContainer(); Copy.SingleTile = this.SingleTile; Copy.possibleUpTiles = this.possibleUpTiles; Copy.possibleDownTiles = this.possibleDownTiles; Copy.possibleLeftTiles = this.possibleLeftTiles; Copy.possibleRightTiles = this.possibleRightTiles; Copy.possibleTilesForThis = this.possibleTilesForThis; Copy.collisionX = this.collisionX; Copy.collisionY = this.collisionY; Copy.removethisElement = this.removethisElement; Copy.hasBeenCollapsed = this.hasBeenCollapsed; Copy.hasCollision = this.hasCollision; return(Copy); }
private void OnGUIGenerate() { EditorGUILayout.Space(); EditorGUILayout.LabelField("GENERATE", EditorStyles.boldLabel); seed = EditorGUILayout.IntField(new GUIContent("Seed", seedDesc), seed); lstmSettingsFile = EditorGUILayout.ObjectField(new GUIContent("LSTM settings file", lstmSettingsFileDesc), lstmSettingsFile, typeof(Object), true); tileContainer = (TileContainer)EditorGUILayout.ObjectField(new GUIContent("Tile container prefab", tileContainerDesc), tileContainer, typeof(TileContainer), true); seed = Mathf.Clamp(seed, 1, 25); if (tileContainer != null) { EditorGUILayout.Space(); EditorGUILayout.LabelField("Tile probability coefficient", EditorStyles.miniLabel); for (int i = 0; i < tileContainer.tileTag.Count; i++) { tilesSlider[i] = EditorGUILayout.Slider(new GUIContent(tileContainer.tileTag[i]), tilesSlider[i], -20f, 20f); } } GUI.enabled = lstmSettingsFile != null && tileContainer != null; if (GUILayout.Button("GENERATE")) { string generateParameters = lstmSettingsFile.name + '\n'; generateParameters += seed.ToString() + '\n'; generateParameters += tileContainer.tileTag.Count.ToString() + "\n"; for (int i = 0; i < tileContainer.tileTag.Count; i++) { generateParameters += tilesSlider[i].ToString() + "\n"; } File.WriteAllText("Assets/LevelGenerator/Files/NetworkFiles/GenerateFile.txt", generateParameters); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.WorkingDirectory = Directory.GetCurrentDirectory() + @"\Assets\LevelGenerator\LSTM\"; startInfo.FileName = "Generating.exe"; Process.Start(startInfo).WaitForExit(); LevelReader.ReadLevelFromFile("Assets/LevelGenerator/Files/NetworkFiles/OutputFile.txt", tileContainer); EditorSceneManager.SaveScene(SceneManager.GetActiveScene()); } GUI.enabled = true; }
public void SpawnTiles(Layout layout) { for (int y = 0; y < layout.Height; y++) { for (int x = 0; x < layout.Width; x++) { SpawnedTile = layout.Tiles[x, y]; if (SpawnedTile == null) { continue; } SpawnedTileObj = Instantiate(TilePrefab); SpawnedTileObj.transform.SetParent(TileContainer, false); SpawnedTileObj.Init(layout.Tiles[x, y], layout.Tiles); } } }
private void LoadModelMenu() { ((ISupportInitialize)(this._MetroUI)).BeginInit(); dtMenu = DBEngine.execReturnDataTable("sp_Menu_Load", CommonConst.A_LanguageID, StaticVars.LanguageID, CommonConst.A_LoginID, StaticVars.LoginID); //xac dinh so containt can tao _MetroUI.ContentContainers.Clear(); foreach (DataRow drContaint in DBEngine.execReturnDataTable("Select distinct ParentMenuID from MEN_MENU where IsVisible = 1").Rows) { TileContainer tc = new TileContainer(); if (drContaint["ParentMenuID"] != DBNull.Value) { tc.Caption = drContaint["ParentMenuID"].ToString(); _MetroUI.ContentContainers.Add(tc); } } // xac dinh cha con foreach (TileContainer tc in _MetroUI.ContentContainers) { string parentName = string.Empty; if (dtMenu.Select(string.Format("MenuID = '{0}'", tc.Caption)).Length > 0) parentName = dtMenu.Select(string.Format("MenuID = '{0}'", tc.Caption))[0]["ParentMenuID"].ToString(); foreach (TileContainer parent in _MetroUI.ContentContainers) { if (parent.Caption.Equals(parentName)) { tc.Parent = parent; break; } } } foreach (DataRow drTile in dtMenu.Rows) { CreateTile(drTile); } foreach (TileContainer tc in _MetroUI.ContentContainers) { if (tc.Caption == "Mnu") tc.Caption = Methods.GetMessage("lblApplicationName1"); else { if (dtMenu.Select(String.Format("MenuID = '{0}'", tc.Caption)).Length > 0) tc.Caption = dtMenu.Select(String.Format("MenuID = '{0}'", tc.Caption))[0][CommonConst.NAME].ToString(); } } ((ISupportInitialize)(this._MetroUI)).EndInit(); }
public Boolean RemoveTile(TileContainer tileContainer) { if (!MultiBox.RemoveItem(tileContainer)) return false; RefreshScrollBars(); Init(); return true; }
/**--------------------------------------------------------------------------------- * Load the XML file with all the tile data. */ public void LoadXML() { tileContainer = getTileTypes(); }
public Form1() { InitializeComponent(); if(Components == null) Components = new System.ComponentModel.Container(); this.SuspendLayout(); try { fDocumentManager = new DocumentManager(Components); ((System.ComponentModel.ISupportInitialize)(DocumentManager)).BeginInit(); try { DocumentManager.ContainerControl = this; fMainView = new WindowsUIView(Components); ((System.ComponentModel.ISupportInitialize)(MainView)).BeginInit(); try { MainView.SplashScreenProperties.ShowCaption = true; MainView.SplashScreenProperties.ShowLoadingDescription = true; MainView.SplashScreenProperties.ShowImage = true; MainView.TileContainerProperties.HeaderOffset = -10; MainView.TileContainerProperties.Margin = new Padding(25); MainView.TileContainerProperties.ItemSize = 160; MainView.TileContainerProperties.ItemPadding = new Padding(8); MainView.PageProperties.HeaderOffset = -10; MainView.PageProperties.Margin = new System.Windows.Forms.Padding(0, -15, 0, 0); MainView.AddTileWhenCreatingDocument = DevExpress.Utils.DefaultBoolean.False; MainView.AllowCaptionDragMove = DevExpress.Utils.DefaultBoolean.True; DocumentManager.ViewCollection.Add(MainView); DocumentManager.View = MainView; fMainMenu = new TileContainer(Components); ((System.ComponentModel.ISupportInitialize)(MainMenu)).BeginInit(); try { MainMenu.Properties.AllowDrag = DevExpress.Utils.DefaultBoolean.True; MainMenu.Properties.AllowDragTilesBetweenGroups = DevExpress.Utils.DefaultBoolean.True; MainMenu.Properties.AllowHtmlDraw = DevExpress.Utils.DefaultBoolean.True; MainMenu.Properties.AllowGroupHighlighting = DevExpress.Utils.DefaultBoolean.False; MainMenu.Properties.AllowItemHover = DevExpress.Utils.DefaultBoolean.False; MainMenu.Properties.AllowSelectedItem = DevExpress.Utils.DefaultBoolean.False; MainMenu.Properties.ShowGroupText = DevExpress.Utils.DefaultBoolean.True; MainMenu.Properties.HorizontalContentAlignment = DevExpress.Utils.HorzAlignment.Near; MainMenu.Properties.VerticalContentAlignment = DevExpress.Utils.VertAlignment.Top; MainMenu.EndItemDragging += MainMenu_EndItemDragging; MainView.ContentContainers.Add(MainMenu); { Tile Tile = new Tile(); Tile.Tag = null; Tile.Padding = new Padding(5, 5, 5, 5); Tile.Properties.ItemSize = TileItemSize.Small; Tile.Properties.AllowCheck = DevExpress.Utils.DefaultBoolean.False; { TileItemElement Element = new TileItemElement(); Element.Text = @"Test"; Element.TextAlignment = TileItemContentAlignment.BottomCenter; Tile.Elements.Add(Element); } MainView.Tiles.Add(Tile); MainMenu.Items.Add(Tile); } } finally { ((System.ComponentModel.ISupportInitialize)(MainMenu)).EndInit(); } { Flyout Flyout = new Flyout(); FlyoutAction FlyoutAction = new FlyoutAction(); FlyoutAction.Caption = @"Enter New Group Name"; FlyoutAction.Commands.Add(FlyoutCommand.OK); FlyoutAction.Commands.Add(FlyoutCommand.Cancel); Flyout.Action = FlyoutAction; fQueryGroupNameFlyout = Flyout; MainView.ContentContainers.Add(Flyout); } MainView.ActivateContainer(MainMenu); } finally { ((System.ComponentModel.ISupportInitialize)(MainView)).EndInit(); } } finally { ((System.ComponentModel.ISupportInitialize)(DocumentManager)).EndInit(); } QueryGroupNameFlyout.Document = MainView.AddDocument(new TextEdit()) as Document; } finally { this.ResumeLayout(false); this.PerformLayout(); } }
private static bool IsTileContainerContainVisibleItem(TileContainer cont) { for (int InxContainers = 0; InxContainers < ((TileContainer)cont).Items.Count; InxContainers++) { for (int i = (cont).Items.Count - 1; i >= 0; i--) { Tile tile = (Tile)(cont).Items[i]; if (tile.Visible == true) return true; } } return false; }
public void AddTile(List<Tile> tiles, ClickEventHandler onClick = null) { List<Widget> tileContainers = new List<Widget>(); foreach (Tile tile in tiles) { TileContainer tileContainer = new TileContainer(tile); tileContainer.Clicked += onClick; tileContainers.Add(tileContainer); } MultiBox.AddItem(tileContainers); }
public static void SetStatusLoading(TileContainer container) { container.Items.Clear(); var loadingTile = TileHelper.CreateLoadingTile(); container.Items.Add(loadingTile); }
public static void InitQuestionaryContainerActions(TileContainer con) { con.Properties.ItemCheckMode = TileItemCheckMode.Single; DelegateAction deleteAction = new DelegateAction(() => true, () => { BaseTile checkedTile = con.Items.First(x => x.Checked.HasValue && x.Checked.Value); if (checkedTile.Tag == null) return; int? questionaryId = TagHelper.GetQuestionaryId(checkedTile.Tag.ToString()); if (!questionaryId.HasValue) return; try { //Questionary questionary = RepoHelper.Repo.GetById<Questionary>(questionaryId.Value); //RepoHelper.Repo.Delete(questionary); con.Items.Remove(checkedTile); } catch (Exception) { } }) { Caption = "Удалить анкету", Type = ActionType.Context, Edge = ActionEdge.Right, Behavior = ActionBehavior.HideBarOnClick }; con.Actions.Clear(); con.Actions.Add(deleteAction); DelegateAction newAction = new DelegateAction(() => true, () => { try { var questionary = new questionary() { questionary_title = "Новая анкета" , questions = new HashSet<question>()}; //RepoHelper.Repo.Save(questionary); Tile newTile = TileHelper.CreateQuestionaryTile(questionary, (WindowsUIView) con.Manager.View, con); con.Items.Add(newTile); } catch (Exception ex) { MessageBox.Show(ex.Message); } }) { Caption = "Новая анкета", Edge = ActionEdge.Right }; con.Buttons.AddAction(newAction); }
protected void Start() { renderer = GetComponent<Renderer>(); container = FindObjectOfType<TileContainer>(); }
public static void RemoveStatusLoading(TileContainer container) { container.Items.Clear(); }
void OnTextureModeTileClick(object sender, MouseButtonEventArgs e) { CurrentEditedTileContainer = (TileContainer)sender; if (e.Button != Mouse.Button.Right) return; CallConfirmationDialogBox(new String[] { ConfirmationDialogBox.Instance.GetDeletionStr("Tile", CurrentEditedTileContainer.GetCurrentTileType()) }, RemoveTile); }
public static void InitFormContainerActions(TileContainer con) { con.Properties.ItemCheckMode = TileItemCheckMode.Single; var deleteAction = new DelegateAction(() => true, async () => { var checkedTile = con.Items.FirstOrDefault(x => x.Checked.HasValue && x.Checked.Value) as Tile; if (checkedTile == null) return; if (checkedTile.Tag == null) return; int? formId = TagHelper.GetFormDataId(checkedTile.Tag.ToString()); if (!formId.HasValue) return; var view = (WindowsUIView)con.Manager.View; var fly = view.ContentContainers.FindFirst(x => x is Flyout && x.Caption == "Сообщение") as Flyout; var formType = ((Page)checkedTile.ActivationTarget).Document.ControlName; switch (formType) { case "FormData1": case "ArchiveFormData1": case "FormData2": case "ArchiveFormData2": { try { using (var repo = new Repository()) { var data = await repo.GetEduFormDataById(formId.Value); var form = await repo.GetForm(data.form_id); var res = fly != null ? GuiUtility.ShowFlyoutMessage(view, fly, "Подтверждение", string.Format("Удалить форму \"{0}\"?", form), FlyoutCommand.Yes, FlyoutCommand.No) : MessageBox.Show(string.Format("Удалить форму {0}?", form), "Подтверждение", MessageBoxButtons.OKCancel); if (res == DialogResult.No) return; if (await form.IsBlockedAsync()) { var mes = fly != null ? GuiUtility.ShowFlyoutMessage(view, fly, "Информация", "Удаление формы отключено, так как срок сдачи истек.\n" + "Чтобы иметь возможность удалить эту форму, обратитесь к региональному оператору") : MessageBox.Show("Удаление формы отключено, так как срок сдачи истек.\n" + "Чтобы иметь возможность удалить эту форму, обратитесь к региональному оператору", "Информация", MessageBoxButtons.OKCancel); return; } var file = await repo.GetFile(data.file_id); var forms = file.edu_form_data; var tag = TagHelper.GetFormDataTag(TagHelper.TagType.Tile, data); var tiles = con.Items.Find(t => t.Tag.ToString() == tag).ToArray(); repo.RemoveRange(forms); repo.Remove(file); await repo.SaveChangesAsync(); if (con.Items.Count == 1) con.Items.Clear(); else con.Items.RemoveRange(tiles); } } catch (Exception ex) { var mess = fly != null ? GuiUtility.ShowFlyoutMessage(view, fly, "Ошибка удаления", ex.Message) : MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK); } break; } case "FormData3": case "ArchiveFormData3": case "FormData4": case "ArchiveFormData4": { try { using (var repo = new Repository()) { var data = await repo.GetMunitFormDataById(formId.Value); var form = await repo.GetForm(data.form_id); var res = fly != null ? GuiUtility.ShowFlyoutMessage(view, fly, "Подтверждение", string.Format("Удалить форму \"{0}\"?", form), FlyoutCommand.Yes, FlyoutCommand.No) : MessageBox.Show(string.Format("Удалить форму {0}?", form), "Подтверждение", MessageBoxButtons.OKCancel); if (res == DialogResult.No) return; if (await form.IsBlockedAsync()) { var mes = fly != null ? GuiUtility.ShowFlyoutMessage(view, fly, "Информация", "Удаление формы отключено, так как срок сдачи истек.\n" + "Чтобы иметь возможность удалить эту форму, обратитесь к региональному оператору") : MessageBox.Show("Удаление формы отключено, так как срок сдачи истек.\n" + "Чтобы иметь возможность удалить эту форму, обратитесь к региональному оператору", "Информация", MessageBoxButtons.OKCancel); return; } var file = data.file; var forms = file.municipality_form_data; var tag = TagHelper.GetFormDataTag(TagHelper.TagType.Tile, data); var tiles = con.Items.Find(t => t.Tag.ToString() == tag).ToArray(); repo.RemoveRange(forms); repo.Remove(file); await repo.SaveChangesAsync(); if (con.Items.Count == 1) con.Items.Clear(); else con.Items.RemoveRange(tiles); } } catch (Exception ex) { var mess = fly != null ? GuiUtility.ShowFlyoutMessage(view, fly, "Ошибка удаления", ex.Message) : MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK); } break; } case "FormData5": case "ArchiveFormData5": case "FormData6": case "ArchiveFormData6": { try { using (var repo = new Repository()) { var data = await repo.GetRegionFormDataById(formId.Value); var res = fly != null ? GuiUtility.ShowFlyoutMessage(view, fly, "Подтверждение", string.Format("Удалить форму \"{0}\"?", data.form), FlyoutCommand.Yes, FlyoutCommand.No) : MessageBox.Show(string.Format("Удалить форму {0}?", data.form), "Подтверждение", MessageBoxButtons.OKCancel); if (res == DialogResult.No) return; var file = data.file; var forms = file.region_form_data; var tag = TagHelper.GetFormDataTag(TagHelper.TagType.Tile, data); var tiles = con.Items.Find(t => t.Tag.ToString() == tag).ToArray(); repo.RemoveRange(forms); repo.Remove(file); await repo.SaveChangesAsync(); if (con.Items.Count == 1) con.Items.Clear(); else con.Items.RemoveRange(tiles); } } catch (Exception ex) { var mess = fly != null ? GuiUtility.ShowFlyoutMessage(view, fly, "Ошибка удаления", ex.Message) : MessageBox.Show(ex.Message, "Ошибка удаления", MessageBoxButtons.OK); } break; } } }) { Caption = "Удалить форму", Type = ActionType.Context, Edge = ActionEdge.Right, Behavior = ActionBehavior.HideBarOnClick }; var searchAction = new DelegateAction(() => true, () => (con.Manager.View as WindowsUIView).ShowSearchPanel()) { Caption = "Поиск", Type = ActionType.Default, Edge = ActionEdge.Left, Behavior = ActionBehavior.HideBarOnClick }; con.Actions.Clear(); con.Actions.Add(deleteAction); con.Actions.Add(searchAction); }
void OnTileClick(object sender, MouseButtonEventArgs e) { CurrentEditedTileContainer = (TileContainer)sender; if (e.Button == Mouse.Button.Right) { CallConfirmationDialogBox(new String[] { ConfirmationDialogBox.Instance.GetDeletionStr("Tile", CurrentEditedTileContainer.GetCurrentTileType()) }, RemoveTile); return; } SetFocusedWindow(TileMan.Instance, new OpeningInfo(false, new Dictionary<String, Object>() { { "Mode", "TileSetCreator_Edit_Mode" } }), OnTileManEditValidated); }