//object as a item, this is for the 3 categories
    public void objectClicked(int id, PanelPosition position)
    {
        if ((BUILDINGS)id != m_selectedID)
        {
            m_selectedID = (BUILDINGS)id;
            switch (position)
            {
            case PanelPosition.LEFT:
                changePanelToSelected(buyLeftPanel);
                changePanelToUnselected(buyCenterPanel);
                changePanelToUnselected(buyRightPanel);
                break;

            case PanelPosition.CENTER:
                changePanelToUnselected(buyLeftPanel);
                changePanelToSelected(buyCenterPanel);
                changePanelToUnselected(buyRightPanel);
                break;

            case PanelPosition.RIGHT:
                changePanelToUnselected(buyLeftPanel);
                changePanelToUnselected(buyCenterPanel);
                changePanelToSelected(buyRightPanel);
                break;
            }
        }
        updateBuildingInfo();
    }
예제 #2
0
        public PlayerPanel(PanelPosition panelPosition, PlayerType playerType, TurnDelegate tDelegate)
        {
            this.panelPosition = panelPosition;
            this.playerType    = playerType;
            this.tDelegate     = tDelegate;

            Initialize();
            Random rnd1 = new Random(Guid.NewGuid().GetHashCode());
            Random rnd2 = new Random(Guid.NewGuid().GetHashCode());

            if (playerType == PlayerType.Human)
            {
                while (brain.stIndex < brain.st.Length - 1)
                {
                    int    row    = rnd1.Next(0, 10);
                    int    column = rnd1.Next(0, 10);
                    string msg    = string.Format("{0}_{1}", row, column);
                    brain.Process(msg);
                }
            }

            if (playerType == PlayerType.Bot)
            {
                while (brain.stIndex < brain.st.Length - 1)
                {
                    int    row    = rnd2.Next(0, 10);
                    int    column = rnd2.Next(0, 10);
                    string msg    = string.Format("{0}_{1}", row, column);
                    brain.Process(msg);
                }
            }
        }
예제 #3
0
        private void switchPanel(PanelPosition panelPosition)
        {
            SlidePanel.Slide slideType;

            if (panelPosition == actualPosition)
            {
                return;
            }

            MetroPanel panel = new ListViewPanel((int)panelPosition);

            if (panelPosition > actualPosition)
            {
                slideType = SlidePanel.Slide.Up;
            }
            else
            {
                slideType = SlidePanel.Slide.Down;
            }

            this.Controls.Add(panel);
            SlidePanel.setPanel(slideType, panel, this.panel_clinicInside);
            this.Controls.Remove(panel_clinicInside);
            panel_clinicInside.Dispose();
            panel_clinicInside = panel;
            actualPosition     = panelPosition;
        }
예제 #4
0
    //object as a item, this is for the 3 categories
    public void objectClicked(int id, PanelPosition position)
    {
        if (id != selectedId)
        {
            selectedId = id;
            switch (position)
            {
            case PanelPosition.LEFT:
                changePanelToSelected(buyLeftPanel);
                changePanelToUnselected(buyCenterPanel);
                changePanelToUnselected(buyRightPanel);
                break;

            case PanelPosition.CENTER:
                changePanelToUnselected(buyLeftPanel);
                changePanelToSelected(buyCenterPanel);
                changePanelToUnselected(buyRightPanel);
                break;

            case PanelPosition.RIGHT:
                changePanelToUnselected(buyLeftPanel);
                changePanelToUnselected(buyCenterPanel);
                changePanelToSelected(buyRightPanel);
                break;
            }
        }
    }
예제 #5
0
    private void changePanel(RectTransform panel, int id, string imgPath, PanelPosition panelPosition)
    {
        if (id == -1)
        {
            panel.gameObject.SetActive(false);
            return;
        }
        else
        {
            panel.gameObject.SetActive(true);
        }
        Image objectImage = panel.transform.FindChild("ObjectImage").GetComponent <Image>();

        if (imgPath != null)
        {
            objectImage.sprite = Resources.Load <Sprite>(imgPath);
        }
        panel.GetComponent <Button>().GetComponent <InvestigationPanelButton>().id            = id;
        panel.GetComponent <Button>().GetComponent <InvestigationPanelButton>().PanelPosition = panelPosition;
        if (id == selectedId)
        {
            changePanelToSelected(panel);
        }
        else
        {
            changePanelToUnselected(panel);
        }
    }
예제 #6
0
    public void investigationClicked(int id, PanelPosition position)
    {
        if (id != selectedId)
        {
            selectedId = id;
            //Debug.Log ("SelectedId=" + selectedId);
            switch (position)
            {
            case PanelPosition.LEFT:
                changePanelToSelected(investigationLeftPanel);
                changePanelToUnselected(investigationCenterPanel);
                changePanelToUnselected(investigationRightPanel);
                break;

            case PanelPosition.CENTER:
                changePanelToUnselected(investigationLeftPanel);
                changePanelToSelected(investigationCenterPanel);
                changePanelToUnselected(investigationRightPanel);
                break;

            case PanelPosition.RIGHT:
                changePanelToUnselected(investigationLeftPanel);
                changePanelToUnselected(investigationCenterPanel);
                changePanelToSelected(investigationRightPanel);
                break;
            }
        }
    }
예제 #7
0
        public void CollapsePanel(PanelPosition position)
        {
            switch (position)
            {
                case PanelPosition.Top:
                    pnlTop.Visible = false;
                    splitTop.Visible = false;
                    Properties.Settings.Default.TopPanelVisible = false;
                    break;
                case PanelPosition.Bottom:
                    pnlBottom.Visible = false;
                    splitBottom.Visible = false;
                    Properties.Settings.Default.BottomPanelVisible = false;
                    break;
                case PanelPosition.Left:
                    pnlLeft.Visible = false;
                    splitLeft.Visible = false;
                    Properties.Settings.Default.LeftPanelVisible = false;
                    break;
                case PanelPosition.Right:
                    pnlRight.Visible = false;
                    splitRight.Visible = false;
                    Properties.Settings.Default.RightPanelVisible = false;
                    break;
            }

            Properties.Settings.Default.Save();
        }
예제 #8
0
    public void MoveTo(string positionName)
    {
        StopAllCoroutines();
        LeanTween.cancel(this.gameObject);
        PanelPosition pos = positions.Find(x => x.name == positionName);

        StartCoroutine(Move(pos));
    }
예제 #9
0
 public static void AddPanel <TPanelView, TPanel>(this IServiceCollection me, PanelPosition defaultPosition = PanelPosition.Document, bool removeOnHide = true, bool isPinned = true)
     where TPanelView : FrameworkElement
     where TPanel : class, IPanel
 {
     me.AddTransient <TPanelView>();
     me.AddTransient <TPanel>();
     me.AddSingleton <IPanelDescriptor>(sp => new GenericPanelDescriptor(typeof(TPanel).GetTypeKey(), typeof(TPanelView), defaultPosition, removeOnHide, isPinned));
 }
예제 #10
0
 public GenericPanelDescriptor(string name, Type viewType, PanelPosition defaultPosition, bool removeOnHide, bool isPinned)
 {
     Name            = PanelName.Parse(name);
     ViewType        = viewType;
     DefaultPosition = defaultPosition;
     RemoveOnHide    = removeOnHide;
     IsPinned        = isPinned;
 }
예제 #11
0
 public PlayerPanel(PanelPosition panelPosition, PlayerType playerType, TurnDelegate tDelegate, TurnDelegate gDelegate, Color ColorBot)
 {
     this.panelPosition = panelPosition;
     this.playerType    = playerType;
     this.tDelegate     = tDelegate;
     this.gDelegate     = gDelegate;
     this.ColorBot      = ColorBot;
     Initialize();
 }
예제 #12
0
    // ------------------

    /// <summary>
    /// Return panel gameObject based on panelName
    /// </summary>
    /// <param name="panelName">The name of the panel to get</param>
    public Panel GetPanel(string panelName)
    {
        GameObject    panelGameObject = panelsTransform.Find(panelName).gameObject;
        PanelPosition panelPosition   = PanelPosition.center;

        return(new Panel {
            gameObject = panelGameObject,
            parent = null,
            position = panelPosition
        });
    }
예제 #13
0
    IEnumerator Move(PanelPosition panelPosition)
    {
        rect.anchorMax = panelPosition.anchorMax;
        rect.anchorMin = panelPosition.anchorMin;
        int id = LeanTween.move(rect, panelPosition.position, 0.5f).id;

        while (LeanTween.descr(id) != null)
        {
            yield return(null);
        }
    }
예제 #14
0
 /// <summary>
 /// Set panel position
 /// </summary>
 /// <param name="panel">The panel to set its position</param>
 /// <param name="position">The position of the panel</param>
 private void SetPanelPosition(Panel panel, PanelPosition position)
 {
     for (int i = 0, c = panels.Length; i < c; i++)
     {
         // Panel found
         if (panels[i].gameObject == panel.gameObject)
         {
             // Change its position
             panels[i].position = position;
         }
     }
 }
예제 #15
0
		private void RemovePanelFromGroupedPanel(IdePanel panel, IdeGroupedPanel groupedPanel)
		{
			var sibling = groupedPanel.Panels.FirstOrDefault(p => p != panel);
			if (sibling != null)
			{
				_memorizedPanelPositions[panel] = new PanelPosition
				{
					Index = groupedPanel.Tabs.FindIndex(t => t.Panel == panel),
					Sibling = sibling
				};
			}
			groupedPanel.RemovePanel(panel);
		}
예제 #16
0
        private void PositionPanel(RadPane radPane, PanelPosition position)
        {
            //logger.LogDebug($"PositionPanel - position {position}");
            log.Trace($"{nameof(PositionPanel)}({nameof(position)}: {position})");
            if (locked)
            {
                LockRadPane(radPane);
            }
            else
            {
                UnlockRadPane(radPane);
            }
            switch (position)
            {
            case PanelPosition.DockedBottom:
            case PanelPosition.DockedLeft:
            case PanelPosition.DockedRight:
            case PanelPosition.DockedTop:
            case PanelPosition.Document:
            {
                if (docking.SplitItems.ToList().FirstOrDefault(i => i.Control.Tag is PanelPosition pos && pos == position) is RadPaneGroup group)
                {
                    group.Items.Add(radPane);
                }
                return;
            }

            case PanelPosition.FloatingDockable:
            case PanelPosition.FloatingOnly:
            {
                var split = docking.GeneratedItemsFactory.CreateSplitContainer();
                var group = docking.GeneratedItemsFactory.CreatePaneGroup();
                split.Items.Add(group);
                group.Items.Add(radPane);
                docking.Items.Add(split);
                if (position == PanelPosition.FloatingDockable)
                {
                    radPane.MakeFloatingDockable();
                }
                else
                {
                    radPane.MakeFloatingOnly();
                }
                return;
            }

            default:
                throw new ArgumentException($"Panel default position '{position}' is not a valid value");
            }
        }
        public async Task <IActionResult> Position(int id, [FromBody] UpdatePanelPosition model)
        {
            //TODO: change when automapper
            var newPosition = new PanelPosition()
            {
                Column = model.Column,
                Row    = model.Row,
                Width  = model.Width,
                Height = model.Height
            };

            var r = await _panelService.UpdatePanelPosition(id, newPosition);

            return(ApiResponse.FromServiceResult(r));
        }
        public override string GetStepParameters()
        {
            var parameters = new List <string>();

            parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$");
            parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$");
            parameters.Add(Name != null ? Name.ToStepValue() : "$");
            parameters.Add(Description != null ? Description.ToStepValue() : "$");
            parameters.Add(OperationType.ToStepValue());
            parameters.Add(PanelPosition.ToStepValue());
            parameters.Add(FrameDepth != null ? FrameDepth.ToStepValue() : "$");
            parameters.Add(FrameThickness != null ? FrameThickness.ToStepValue() : "$");
            parameters.Add(ShapeAspectStyle != null ? ShapeAspectStyle.ToStepValue() : "$");

            return(string.Join(", ", parameters.ToArray()));
        }
예제 #19
0
        protected void RegisterPanel(int uiId, Bitmap icon, Form panel, PanelPosition position = PanelPosition.Left)
        {
            var tbIcon    = GetTransparentIcon(icon, 16, 16);
            var nppTbData = new NppTbData();

            nppTbData.hClient = panel.Handle;
            nppTbData.pszName = PluginName;
            nppTbData.dlgID   = uiId;
            // define the default docking behavior
            nppTbData.uMask         = (NppTbMsg)position | NppTbMsg.DWS_ICONTAB | NppTbMsg.DWS_ICONBAR;
            nppTbData.hIconTab      = (uint)tbIcon.Handle;
            nppTbData.pszModuleName = PluginName;
            var ptrNppTbData = Marshal.AllocHGlobal(Marshal.SizeOf(nppTbData));

            Marshal.StructureToPtr(nppTbData, ptrNppTbData, false);

            Win32.SendMessage(_nppData._nppHandle, NppMsg.NPPM_DMMREGASDCKDLG, 0, ptrNppTbData);
        }
        public void Positions([FromBody] UpdatePanelPositions model)
        {
            //TODO: change when automapper
            model.UpdatedPanelPositions
            .ToList()
            .ForEach(async m =>
            {
                var pos = new PanelPosition()
                {
                    Column = m.Position.Column,
                    Row    = m.Position.Row,
                    Width  = m.Position.Width,
                    Height = m.Position.Height
                };

                await _panelService.UpdatePanelPosition(m.PanelId, pos);
            });
        }
예제 #21
0
		private void RemovePanelFromSplitContainer(IdePanel panel)
		{
			var multiSplitPanel = panel.Parent as MultiSplitPanel;
			if (multiSplitPanel == null) multiSplitPanel = panel.Parent.Parent as MultiSplitPanel;
			if (multiSplitPanel != null)
			{
				var splitContainer = multiSplitPanel.Parent as MultiSplitContainer;
				_memorizedPanelPositions[panel] = new PanelPosition
					{
						SplitContainer = splitContainer,
						Index = splitContainer.Panels.IndexOf(multiSplitPanel)
					};
				splitContainer.RemovePanel(multiSplitPanel);
				if (splitContainer.Splits.Count == 0)
				{
					// TODO: Last panel removed, hide it but keep the dock suggestion available
				}
			}
		}
예제 #22
0
파일: PlayerPanel.cs 프로젝트: Iseke/Mylabs
        public PlayerPanel(PanelPosition panelPosition, PlayerType playerType, TurnDelegate tDelegate, Color BusyColor)
        {
            this.playerType    = playerType;
            this.panelPosition = panelPosition;
            this.tDelegate     = tDelegate;
            this.BusyColor     = BusyColor;
            Initialize();

            switch (panelPosition)
            {
            case PanelPosition.Left:
                //RndH();
                break;

            case PanelPosition.Right:
                RndB();
                break;

            default:
                break;
            }
        }
예제 #23
0
        public PlayerPanel(PanelPosition panelPosition, PlayerType playerType, TurnDelegate tDelegate, Color ColorToFillBusy)
        {
            this.panelPosition   = panelPosition;
            this.playerType      = playerType;
            this.tDelegate       = tDelegate;
            this.ColorToFillBusy = ColorToFillBusy;

            Initialize();

            //Random rnd1 = new Random(Guid.NewGuid().GetHashCode());
            //Random rnd2 = new Random(Guid.NewGuid().GetHashCode());

            if (playerType == PlayerType.Human)
            {
                //RandomGenerateShips();
            }

            if (playerType == PlayerType.Bot)
            {
                //RandomGenerateShips();
                this.Enabled = false;
            }
        }
    /*
     * public void updateQuantities()  // +++++++++++++++++++++++++
     * {
     * BuildingsManager buildingsMan = BuildingsManager.GetInstance();
     * int initialObject = Math.Min(itemsPerPage * selectedPage, m_buildingsID.Count - itemsPerPage);
     * for (int i = 0; i < itemsPerPage; ++i) {
     *  Building buildingToModify = buildingsMan.getBuilding(m_buildingsID[initialObject + i]);
     *  string quantityText = "level: " + (buildingToModify.getCurrentLevel() + 1);
     *  switch (i) {
     *      case 0:
     *          changeQuantityOnPanel(buyLeftPanel, quantityText);
     *          break;
     *      case 1:
     *          changeQuantityOnPanel(buyCenterPanel, quantityText);
     *          break;
     *      case 2:
     *          changeQuantityOnPanel(buyRightPanel, quantityText);
     *          break;
     *  }
     * }
     * }
     *
     * private void changeQuantityOnPanel(RectTransform panel, string quantityText)
     * {
     * Transform childPanel = panel.transform.FindChild("Quantities");
     * Text quantities = childPanel.gameObject.GetComponent<Text>();
     * quantities.text = quantityText;
     * }
     */

    private void changePanel(RectTransform panel, BUILDINGS id, string imgPath, PanelPosition panelPosition, string quantityText)
    {
        Image objectImage = panel.transform.FindChild("ObjectImage").GetComponent <Image>();

        if (imgPath != null)
        {
            objectImage.sprite = Resources.Load <Sprite>(imgPath);
        }
        Transform childPanel = panel.transform.FindChild("Quantities");
        Text      quantities = childPanel.gameObject.GetComponent <Text>();

        quantities.text = quantityText;
        panel.GetComponent <Button>().GetComponent <UpgradePanelButton>().id            = (int)id;
        panel.GetComponent <Button>().GetComponent <UpgradePanelButton>().PanelPosition = panelPosition;
        if (id == m_selectedID)
        {
            changePanelToSelected(panel);
        }
        else
        {
            changePanelToUnselected(panel);
        }
    }
예제 #25
0
        public PlayerPanel(PanelPosition panelPosition, PlayerType playerType, PanelDelegate tDelegate, PanelDelegate enDelegate)
        {
            this.panelPosition = panelPosition;
            this.playerType    = playerType;
            this.tDelegate     = tDelegate;
            this.enDelegate    = enDelegate;

            Initialize();                                           //What does this mean?
            Random rnd1 = new Random(Guid.NewGuid().GetHashCode()); // What is guid?
            Random rnd2 = new Random(Guid.NewGuid().GetHashCode());

            /*
             * if (playerType == PlayerType.Human)
             * {
             *  while (brain.stIndex < brain.st.Length - 1) // ???
             *  {
             *      int row = rnd1.Next(1, 11);
             *      int column = rnd1.Next(1, 11);
             *      string msg = string.Format("{0}_{1}", row, column);
             *      brain.Process(msg);
             *  }
             * }
             */

            if (playerType == PlayerType.Bot)
            {
                this.Enabled = false;
                while (brain.stIndex < brain.st.Length - 1)
                {
                    int    row    = rnd2.Next(1, 11);
                    int    column = rnd2.Next(1, 11);
                    string msg    = string.Format("{0}_{1}", row, column);
                    brain.Process(msg);
                }
            }
        }
        internal void ChangePanelPosition(PanelPosition panelPosition)
        {
            foreach (string f in StyleFiles)
            {
                StringBuilder newFile = new StringBuilder();
                string temp = "";
                string[] fileAsString = File.ReadAllLines(f);

                foreach (string fileLine in fileAsString)
                {
                    if (fileLine.Contains(NotificationPanelPosition))
                    {
                        temp = PanelPositionRegex.Replace(fileLine, panelPosition.ToString(), 1);
                        newFile.AppendLine(temp);

                        if(this.Verbose == true)
                            Console.WriteLine(temp.TrimStart());
                    }
                    else
                    {
                        newFile.AppendLine(fileLine);
                    }
                }

                File.WriteAllText(f, newFile.ToString());
            }

            this.PopulateStylesInfo();

            if (this.Verbose == true)
                Console.WriteLine();
        }
예제 #27
0
        public async Task <ServiceObjectResult <Panel> > UpdatePanelPosition(int panelId, PanelPosition position)
        {
            var validationResult = await _validationService.ValidateAsync <PanelPositionValidator, PanelPosition>(position);

            if (!validationResult.IsValid)
            {
                return(ServiceObjectResult <Panel> .Error(validationResult));
            }

            var entity = await GetPanelByIdAsync(panelId);

            if (entity == null)
            {
                return(null);
            }

            //TODO: change when automaper
            entity.Position.Column = position.Column;
            entity.Position.Row    = position.Row;
            entity.Position.Width  = position.Width;
            entity.Position.Height = position.Height;

            var r = await _panelRepository.UpdateAsync(entity, panelId);

            await _panelRepository.SaveAsync();

            return(ServiceObjectResult <Panel> .Ok(r));
        }