Inheritance: MonoBehaviour
 private void EntityEvents_ButtonUpdate100(ButtonPanel buttonPanel)
 {
     try
     {
         if ((MyAPIGateway.Session.Player.GetPosition() - buttonPanel.Entity.GetPosition()).Length() <= 2)
         {
             var autodoor = GetShipHangar(buttonPanel);
             if (autodoor != null)
             {
                 if (!_notificationShown)
                 {
                     MyAPIGateway.Utilities.ShowNotification("This button controls hangar door", 1000, MyFontEnum.Green);
                     _notificationShown = true;
                 }
             }
         }
         else
         {
             _notificationShown = false;
         }
     }
     catch (Exception e)
     {
         Log.Error(e, "EntityEvents_SensorStateChanged");
     }
 }
Exemplo n.º 2
0
        public IconTextButton()
        {
            InitializeComponent();

            // Creates the Gesture that will be handle the Taps
            var gesture = new TapGestureRecognizer();

            gesture.Tapped += (s, e) => {
                if (IsAnimateOnClick)
                {
                    Task.Run(async() => {
                        AnchorX = 0.48;
                        AnchorY = 0.48;

                        await ButtonPanel.ScaleTo(0.8, 50, Easing.Linear);
                        await Task.Delay(100);
                        await ButtonPanel.ScaleTo(1, 50, Easing.Linear);
                    });
                }

                Clicked?.Invoke(this, EventArgs.Empty);
                Command?.Execute(CommandParameter);
            };
            GestureRecognizers.Add(gesture);
        }
Exemplo n.º 3
0
        private Implementation.AutoDoor.AutoDoor GetAutodoor(ButtonPanel buttonPanel)
        {
            if (!buttonPanel.Entity.CustomName.StartsWith(Constants.AutoDoorPrefix, StringComparison.OrdinalIgnoreCase))
            {
                return(null);
            }

            // Locate a sensor within D meters within the same grid
            var buttonPanelPosition = buttonPanel.Entity.GetPosition();
            var sensor = Entities.Sensors
                         .Where(p => p.Entity.CustomName.StartsWith(Constants.AutoDoorPrefix, StringComparison.OrdinalIgnoreCase))
                         .Where(p => p.Entity.CubeGrid == buttonPanel.Entity.CubeGrid)
                         .FirstOrDefault(p => (p.Entity.GetPosition() - buttonPanelPosition).Length() <= Distance);

            if (sensor != null)
            {
                var autodoor = GetAutodoor(sensor);
                return(autodoor);
            }

            MyAPIGateway.Utilities.ShowNotification(
                string.Format("AUTODOOR: there is no sensor with name prefix '{0}' nearby", Constants.AutoDoorPrefix),
                font: MyFontEnum.Red);
            Log.Write("AUTODOOR: there is no sensor nearby this button panel");
            return(null);
        }
Exemplo n.º 4
0
        public ShipHangarGears(ButtonPanel button)
        {
            _button          = button;
            HangarGearsState = HangarState.Closed;

            Log.Write("Hangar {0} gears created: ", button.HangarCode);
        }
Exemplo n.º 5
0
        private Slot CreateSlot(ButtonPanel panel, GameObject slotPrefab)
        {
            Slot slot = panel.AddElement(slotPrefab).GetComponent <Slot>();

            OnSlotAdded?.Invoke(slot);
            return(slot);
        }
Exemplo n.º 6
0
 public void ThemeChanged(ITheme visualTheme)
 {
     MainChart.ThemeChanged(visualTheme);
     ButtonPanel.ThemeChanged(visualTheme);
     ButtonPanel.BackColor = visualTheme.Window;
     ChartBanner.ThemeChanged(visualTheme);
     panelMain.BackColor = visualTheme.Window;
 }
Exemplo n.º 7
0
 public void ShowDetails()
 {
     cardImage.SetActive(false);
     ViewingPanel.SetActive(true);
     ButtonPanel.SetActive(true);
     ShowCardButton.SetActive(true);
     ShowDetailsButton.SetActive(false);
 }
Exemplo n.º 8
0
 private void CreateResetButton()
 {
     resetButton = buttonsPanel.AddUIComponent <ButtonPanel>();
     resetButton.Build(PanelType.None, new Layout(new Vector2(0.0f, 40.0f), true, LayoutDirection.Horizontal, LayoutStart.TopLeft, 0));
     resetButton.SetAnchor(UIAnchorStyle.Left | UIAnchorStyle.CenterVertical);
     resetButton.SetText(Translation.Instance.GetTranslation(TranslationID.BUTTON_RESET));
     resetButton.EventButtonClicked += OnResetClicked;
 }
Exemplo n.º 9
0
 private void CreateLoadButton()
 {
     _loadButtonPanel = _selectMixPanel.AddUIComponent <ButtonPanel>();
     _loadButtonPanel.Setup("Load Button", 340.0f, 30.0f);
     _loadButtonPanel.SetAnchor(UIAnchorStyle.Left | UIAnchorStyle.CenterVertical);
     _loadButtonPanel.SetText(Translation.Instance.GetTranslation(TranslationID.BUTTON_LOAD));
     _loadButtonPanel.AlignRight();
     _loadButtonPanel.EventButtonClicked += OnLoadClicked;
 }
 internal void ThemeChanged(ITheme visualTheme)
 {
     ButtonPanel.ThemeChanged(visualTheme);
     ButtonPanel.BackColor = visualTheme.Window;
     ChartBanner.ThemeChanged(visualTheme);
     panelMain.ThemeChanged(visualTheme);
     panelMain.BackColor = visualTheme.Window;
     zedThemeChanged(visualTheme, zedChart);
 }
Exemplo n.º 11
0
 private void CreateSaveButton()
 {
     _saveButtonPanel = _saveMixPanel.AddUIComponent <ButtonPanel>();
     _saveButtonPanel.Setup("Save Button", 340.0f, 30.0f);
     _saveButtonPanel.SetAnchor(UIAnchorStyle.Left | UIAnchorStyle.CenterVertical);
     _saveButtonPanel.SetText(Translation.Instance.GetTranslation(TranslationID.BUTTON_SAVE));
     _saveButtonPanel.AlignRight();
     _saveButtonPanel.DisableButton();
     _saveButtonPanel.EventButtonClicked += OnSaveClicked;
 }
Exemplo n.º 12
0
 private void CreateSubscribeButton()
 {
     _subscribeButtonPanel = _selectMixPanel.AddUIComponent <ButtonPanel>();
     _subscribeButtonPanel.Setup("Download Button", 340.0f, 30.0f);
     _subscribeButtonPanel.SetAnchor(UIAnchorStyle.Left | UIAnchorStyle.CenterVertical);
     _subscribeButtonPanel.SetText(Translation.Instance.GetTranslation(TranslationID.BUTTON_SUBSCRIBE), Translation.Instance.GetTranslation(TranslationID.TOOLTIP_BUTTON_SUBSCRIBE));
     _subscribeButtonPanel.AlignRight();
     _subscribeButtonPanel.EventButtonClicked += OnSubscribeClicked;
     _subscribeButtonPanel.isVisible           = false;
 }
Exemplo n.º 13
0
 // Start is called before the first frame update
 void Start()
 {
     Cursor.visible   = false;
     Cursor.lockState = CursorLockMode.Locked;
     state            = BattleState.START;
     audioManager     = FindObjectOfType <AudioManager>();
     eventSystem      = FindObjectOfType <EventSystem>();
     buttonPanel      = FindObjectOfType <ButtonPanel>();
     battleBounty     = FindObjectOfType <BattleBounty>();
     SetUpBattle();
 }
Exemplo n.º 14
0
        private void AddButtons(ButtonsCollection control, int idx)
        {
            for (int i = 0; i < control.ButtonsCount; i++)
            {
                var panel = new ButtonPanel();
                panel.SetInfo(control, i + 1, idx);
                AddPanel(panel);

                RegiseterLink(panel.GetLink());
            }
        }
Exemplo n.º 15
0
 private void CreateSaveButton()
 {
     saveButton = buttonsPanel.AddUIComponent <ButtonPanel>();
     saveButton.Build(PanelType.None, new Layout(new Vector2(0.0f, 40.0f), true, LayoutDirection.Horizontal, LayoutStart.TopLeft, 0));
     saveButton.SetAnchor(UIAnchorStyle.Left | UIAnchorStyle.CenterVertical);
     saveButton.SetText(Translation.Instance.GetTranslation(TranslationID.BUTTON_SAVE));
     saveButton.EventButtonClicked += OnSaveClicked;
     if (savedSwatches.Count == MAX_SAVED_SWATCHES)
     {
         saveButton.Disable();
     }
 }
Exemplo n.º 16
0
        protected void ClosePopup(bool fromButton)
        {
            if (ChildPopup.IsOpen)
            {
                ChildPopup.IsOpen = false;
            }
            Mouse.Capture(null);

            if (fromButton)
            {
                ButtonPanel.Focus();
            }
        }
Exemplo n.º 17
0
 private void EntityEvents_ButtonPressed(ButtonPanel buttonPanel, int button)
 {
     try
     {
         var autodoor = GetAutodoor(buttonPanel);
         if (autodoor != null)
         {
             autodoor.Toggle(this);
         }
     }
     catch (Exception e)
     {
         Log.Error(e, "EntityEvents_ButtonPressed");
     }
 }
 private void EntityEvents_ButtonPressed(ButtonPanel buttonPanel, int button)
 {
     try
     {
         var depot = GetShipHangar(buttonPanel);
         if (depot != null)
         {
             depot.Toggle(this);
         }
     }
     catch (Exception e)
     {
         Log.Error(e, "EntityEvents_ButtonPressed");
     }
 }
Exemplo n.º 19
0
 private void EntityEvents_ButtonPressed(ButtonPanel buttonPanel, int button)
 {
     try
     {
         var hangarGears = GetHangarGears(buttonPanel);
         if (hangarGears != null)
         {
             hangarGears.Toggle(this);
         }
     }
     catch (Exception e)
     {
         Log.Error(e, "EntityEvents_ButtonPressed");
     }
 }
Exemplo n.º 20
0
        internal Dialog(bool includeButtons)
        {
            DockPadding.All = 10;
            StartPosition   = FormStartPosition.CenterParent;
            MinimizeBox     = false;
            MaximizeBox     = false;
            FormBorderStyle = FormBorderStyle.FixedDialog;

            if (includeButtons)
            {
                ButtonPanel bp = new ButtonPanel(this, ButtonPanel.CANCEL);
                bp.Dock = DockStyle.Bottom;
                Controls.Add(bp);
            }
        }
Exemplo n.º 21
0
    private void InitializeButtons()
    {
        byte counter = 0;

        foreach (Transform t in transform.GetChild(0).Find("Buttons"))
        {
            ButtonPanel newButtonPanel = new ButtonPanel()
            {
                image = t.GetComponent <Image>(),
                isOn  = true
            };
            buttons.Add(newButtonPanel);
            counter++;
        }
        SetRandomStatusButtons();
    }
Exemplo n.º 22
0
        private ShipHangarGears GetHangarGears(ButtonPanel button)
        {
            if (!button.Entity.CustomName.StartsWith(Constants.SpacePortPrefix, StringComparison.OrdinalIgnoreCase) || button.ButtonType != ButtonType.Gears)
            {
                return(null);
            }

            ShipHangarGears shipHangar;

            if (!_hangarGears.TryGetValue(button, out shipHangar))
            {
                shipHangar = new ShipHangarGears(button);
                _hangarGears.Add(button, shipHangar);
            }

            return(shipHangar);
        }
        private ShipHangar GetShipHangar(ButtonPanel button)
        {
            //Log.Write("GetShipHangar initiated {0}", button.Entity.CustomName);
            if (!button.Entity.CustomName.StartsWith(Constants.SpacePortPrefix, StringComparison.OrdinalIgnoreCase) || button.ButtonType != ButtonType.Pistons)
            {
                return(null);
            }

            ShipHangar shipHangar;

            if (!_hangarPistons.TryGetValue(button, out shipHangar))
            {
                shipHangar = new ShipHangar(button);
                _hangarPistons.Add(button, shipHangar);
            }

            return(shipHangar);
        }
        /// <summary>
        /// Update visual theme
        /// </summary>
        /// <param name="visualTheme"></param>
        public void ThemeChanged(ITheme visualTheme)
        {
            ButtonPanel.ThemeChanged(visualTheme);
            ButtonPanel.BackColor = visualTheme.Window;
            ChartBanner.ThemeChanged(visualTheme);
            panelMain.ThemeChanged(visualTheme);
            panelMain.BackColor   = visualTheme.Window;
            panelConfig.BackColor = visualTheme.Control;
            zedThemeChanged(visualTheme, zedChart);
            txtPower.ThemeChanged(visualTheme);
            txtPwrBands.ThemeChanged(visualTheme);
            txtCadence.ThemeChanged(visualTheme);
            txtCrank.ThemeChanged(visualTheme);
            treeActivities.ThemeChanged(visualTheme);

            menuTree.Renderer  = new ThemedContextMenuStripRenderer(visualTheme);
            chartMenu.Renderer = new ThemedContextMenuStripRenderer(visualTheme);
        }
Exemplo n.º 25
0
 public void AddButtons()
 {
     ButtonPanel.Children.Clear();
     foreach (Pakage p in Corelib.Pakages)
     {
         //< Button Content = "Button" Height = "33.275" Width = "558.557" HorizontalAlignment = "Center" DockPanel.Dock = "Top" Background = "#FF132857" />
         Button B = new Button()
         {
             Height = 33.275,
             Width  = 558.557,
             HorizontalAlignment = HorizontalAlignment.Center,
             Background          = new SolidColorBrush(Color.FromArgb(100, 19, 40, 87)),
             Name    = p.JName,
             Content = p.Name
         };
         B.Click += new RoutedEventHandler(Click);
         DockPanel.SetDock(B, Dock.Top);
         ButtonPanel.Children.Add(B);
         ButtonPanel.UpdateLayout();
     }
 }
        private void ClipSupporterForm_Load(object sender, EventArgs e)
        {
#warning タブコントロール生成処理追加 必要

#warning 現状SamplePanel不要
            // SamplePanelの削除
            for (int tp = tabControl1.TabPages.Count - 1; tp >= 0; tp--)
            {
                int cntCount = tabControl1.TabPages[tp].Controls.Count;
                for (int i = cntCount - 1; i >= 0; i--)
                {
                    tabControl1.TabPages[tp].Controls.RemoveAt(i);
                }
            }

            // Tabコントロールの生成
            Config.PanelSection cfgSection = (Config.PanelSection)Config.PanelSection.GetConfigs();
            int topPos = 3;
            foreach (var cfg in cfgSection.Panels)
            {
                if (cfg is Config.PanelConfigElement)
                {
                    for (int i = 0; i < 1; i++)
                    {
                        ButtonPanel pnl = new ButtonPanel((Config.PanelConfigElement)cfg);
                        pnl.Top  = topPos;
                        pnl.Left = 3;
                        tabControl1.TabPages[0].Controls.Add(pnl);
                        topPos += pnl.Height;
                    }
                }
            }

            // Formの高さを縮める
            tabControl1.Height = topPos + 30;
            this.Height        = topPos + 105;

            tabControl1.SelectedIndex = 0;
        }
Exemplo n.º 27
0
    public void Init()
    {
        button_style.normal.background = button_up_texture;
        button_style.active.background = button_down_texture;
        button_style.normal.textColor  = Color.white;
        button_style.active.textColor  = new Color(0.75f, 0.75f, 0.75f);
        button_style.alignment         = TextAnchor.MiddleCenter;
        button_style.fontSize          = 30;

        remove_style.normal.background = red_button_up_texture;
        remove_style.active.background = red_button_down_texture;
        remove_style.normal.textColor  = Color.black;
        remove_style.active.textColor  = new Color(0.75f, 0.75f, 0.75f);
        remove_style.alignment         = TextAnchor.MiddleCenter;
        remove_style.fontSize          = 30;

        code_style.fontSize         = 20;
        code_style.normal.textColor = Color.black;
        code_style.font             = ide_font;
        code_style.wordWrap         = false;

        shouldPopup = shouldRemove = false;

        //editorPanel = new Rectangle(0,0,Screen.width*3/4,Screen.height);
        editorPanel = new EditorPanel(this);
        editorPanel.setTexture(left_panel_background);
        //editorPanel.scale((float) 0.5, (float) 0.75);
        //editorPanel.move(800, 150);
        errorPanel = new ErrorPanel(this);
        errorPanel.setTexture(left_panel_background);
        //errorPanel.scale((float) 2, (float) 0.25);
        //errorPanel.move(-200, 500);
        //errorPanel = new Rectangle(Screen.width*3/4+5,0,Screen.width*1/4-5,Screen.height);
        buttonPanel = new ButtonPanel(this);
        trashcan    = Resources.Load("Crumpled_Paper") as Texture2D;
        //trashcan.Resize(32, 32);
    }
Exemplo n.º 28
0
        private void CreateUIElements()
        {
            _topPanel = AddUIComponent <UIPanel>();
            string colorButtonTooltip = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_OPENCOLORPICKER);

            _colorButton = UIUtils.CreateButton(_topPanel, new Vector2(22.0f, 22.0f), tooltip: colorButtonTooltip, backgroundSprite: "WhiteRect", atlas: UISprites.DefaultAtlas);
            _colorLabel  = _topPanel.AddUIComponent <UILabel>();
            string loadTooltip = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_LOADFROMTHEME);

            _loadButton = UIUtils.CreateButton(_topPanel, new Vector2(22.0f, 22.0f), tooltip: loadTooltip, backgroundSprite: "ThemesIcon", atlas: UISprites.Atlas);
            string resetTooltip = Translation.Instance.GetTranslation(TranslationID.TOOLTIP_RESET);

            _resetButton   = UIUtils.CreateButton(_topPanel, new Vector2(22.0f, 22.0f), tooltip: resetTooltip, backgroundSprite: "", foregroundSprite: "UndoIcon", atlas: UISprites.Atlas);
            _savedSwatches = Data.GetSavedSwatches(ColorID);
            if (Mod.InGame)
            {
                var field = UITemplateManager.Get <UIPanel>("LineTemplate").Find <UIColorField>("LineColor");
                field        = Instantiate(field);
                _colorPicker = Instantiate(field.colorPicker);
                AttachUIComponent(_colorPicker.gameObject);
                var hsb = _colorPicker.component.Find <UITextureSprite>("HSBField");
                var hue = _colorPicker.component.Find <UISlider>("HueSlider");
                hsb.relativePosition = new Vector3(55.0f, 7.0f);
                hue.relativePosition = new Vector3(267.0f, 7.0f);
            }
            _rgbPanel     = AddUIComponent <PanelBase>();
            _buttonsPanel = AddUIComponent <PanelBase>();
            _closeButton  = _buttonsPanel.AddUIComponent <ButtonPanel>();
            _saveButton   = _buttonsPanel.AddUIComponent <ButtonPanel>();

            RefreshSavedSwatchesPanel();
            this.CreateSpace(1.0f, 0.1f);

            color = UIColor;
            autoFitChildrenHorizontally = true;
        }
Exemplo n.º 29
0
 void Awake()
 {
     Instance = this;
 }
Exemplo n.º 30
0
 // fsm interface
 public void ToggleCheat()
 {
     if (buttonPanel != null)
     {
         buttonPanel = null;
     }
     else
     {
         buttonPanel = new ButtonPanel(UI.GetPuzzleArea(), heroEntity, heroCharacter, itemDropManager, stageEntity.ConsumableTier);
         buttonPanel.SetQueue(user.commandQueue);
     }
 }
Exemplo n.º 31
0
 // fsm interface
 public void ToggleCheat()
 {
     if (buttonPanel != null)
     {
         buttonPanel = null;
     }
     else
     {
         buttonPanel = new ButtonPanel(UI.GetPuzzleArea(), BlockSpawn.GetDart(subClassEntity.subClassCode), heroCharacter, itemDropManager, 0);
         buttonPanel.SetQueue(user.commandQueue);
     }
 }
Exemplo n.º 32
0
    void Awake()
    {
        if (Instance == null)
            Instance = this;
        else
            Destroy(gameObject);

        DontDestroyOnLoad(gameObject);
        buttonPanel = FindObjectOfType<ButtonPanel>();
    }
Exemplo n.º 33
0
	public void Init()
	{
		button_style.normal.background = button_up_texture;
		button_style.active.background = button_down_texture;
		button_style.normal.textColor = Color.white;
		button_style.active.textColor = new Color(0.75f,0.75f,0.75f);
		button_style.alignment = TextAnchor.MiddleCenter;
		button_style.fontSize = 30;
		
		remove_style.normal.background = red_button_up_texture;
		remove_style.active.background = red_button_down_texture;
		remove_style.normal.textColor = Color.black;
		remove_style.active.textColor = new Color(0.75f,0.75f,0.75f);
		remove_style.alignment = TextAnchor.MiddleCenter;
		remove_style.fontSize = 30;
	
		code_style.fontSize = 20;
		code_style.normal.textColor = Color.black;
		code_style.font = ide_font;
		code_style.wordWrap = false;
		
		shouldPopup = shouldRemove = false;
		
		//editorPanel = new Rectangle(0,0,Screen.width*3/4,Screen.height);
		editorPanel = new EditorPanel(this);
		editorPanel.setTexture(left_panel_background);
		//editorPanel.scale((float) 0.5, (float) 0.75);
		//editorPanel.move(800, 150);
		errorPanel = new ErrorPanel(this);
		errorPanel.setTexture(left_panel_background);
		//errorPanel.scale((float) 2, (float) 0.25);
		//errorPanel.move(-200, 500);
		//errorPanel = new Rectangle(Screen.width*3/4+5,0,Screen.width*1/4-5,Screen.height);
		buttonPanel = new ButtonPanel(this);
		trashcan = Resources.Load("Crumpled_Paper") as Texture2D;
		//trashcan.Resize(32, 32);
	}
        public GettingStartedDialog() : base(!INCLUDE_BUTTONS)
        {
            Text = StringParser.Parse("${res:ComponentInspector.GettingStartedDialog.Title}");

            String descText;

            /*if (ObjectBrowser.License.
             *      HasProduct(NogoopLicense.PRODUCT_COM_COMPINSP))
             * {*/
            Height   = 400;
            descText = StringParser.Parse("${res:ComponentInspector.GettingStartedDialog.Information}");

            /*}
             * else
             * {
             *      Height = 350;
             *      descText =
             *              "Open a control or application assembly using the File menu. "
             + "\n\n"
             +
             +"Once the assembly is open, it appears in the "
             + "Assemblies/Types tab, and its controls appear in "
             + "the Controls tab.\n\n"
             +
             +"To create an object, navigate down the above trees to "
             + "an item shown in bold.  Drag this to the Design Surface "
             + "or Objects panel on the left.\n\n"
             +
             +"You may then inspect or invoke members of the created "
             + "object by right-clicking the member in the Objects tree. "
             + "If its a Control, you may move/resize/embed it "
             + "in another Control on the design surface.";
             +
             + }*/

            _textBox      = Utils.MakeDescText(descText, this);
            _textBox.Dock = DockStyle.Fill;
            Controls.Add(_textBox);

            Label l = new Label();

            l.Dock = DockStyle.Fill;
            Controls.Add(l);

            Panel bottomPanel = new Panel();

            bottomPanel.Dock = DockStyle.Bottom;

            _checkBox                 = new CheckBox();
            _checkBox.Dock            = DockStyle.Left;
            _checkBox.FlatStyle       = FlatStyle.System;
            _checkBox.Checked         = true;
            _checkBox.Text            = StringParser.Parse("${res:ComponentInspector.GettingStartedDialog.ShowThisDialogCheckBox}");
            _checkBox.TextAlign       = ContentAlignment.TopLeft;
            _checkBox.CheckAlign      = ContentAlignment.TopLeft;
            _checkBox.Width           = 100;
            _checkBox.CheckedChanged += new EventHandler(GetStartChecked);
            bottomPanel.Controls.Add(_checkBox);

            ButtonPanel bp = new ButtonPanel(this, !ButtonPanel.CANCEL);

            bp.Dock = DockStyle.Right;
            bottomPanel.Controls.Add(bp);
            bottomPanel.Height = Utils.BUTTON_HEIGHT;
            Controls.Add(bottomPanel);
        }