Inheritance: MonoBehaviour
Example #1
0
		public void AcceptButton ()
		{
			Form form = new Form ();
			Assert.IsNull (form.AcceptButton, "#A");

			MockButton buttonA = new MockButton (true);
			Assert.IsFalse (buttonA.IsDefaultButton, "#B1");
			form.AcceptButton = buttonA;
			Assert.IsNotNull (form.AcceptButton, "#B2");
			Assert.AreSame (buttonA, form.AcceptButton, "#B3");
			Assert.IsTrue (buttonA.IsDefaultButton, "#B4");

			form.AcceptButton = null;
			Assert.IsNull (form.AcceptButton, "#C1");
			Assert.IsFalse (buttonA.IsDefaultButton, "#C2");

			ButtonControl buttonB = new ButtonControl ();
			Assert.IsFalse (buttonB.IsDefaultButton, "#D1");
			form.AcceptButton = buttonB;
			Assert.IsNotNull (form.AcceptButton, "#D2");
			Assert.AreSame (buttonB, form.AcceptButton, "#D3");
			Assert.IsFalse (buttonA.IsDefaultButton, "#D4");
			Assert.IsTrue (buttonB.IsDefaultButton, "#D5");

			MockButton buttonC = new MockButton (false);
			Assert.IsFalse (buttonC.IsDefaultButton, "#E1");
			form.AcceptButton = buttonC;
			Assert.IsNotNull (form.AcceptButton, "#E2");
			Assert.AreSame (buttonC, form.AcceptButton, "#E3");
			Assert.IsFalse (buttonC.IsDefaultButton, "#E4");
			Assert.IsFalse (buttonA.IsDefaultButton, "#E5");
			Assert.IsFalse (buttonB.IsDefaultButton, "#E6");
		}
Example #2
0
 void OnButtonPress(ButtonControl control,GameObject hit)
 {
     if(control==iniB)
         grapher.rb=hit.rigidbody;
     if(control==fireB&&iniB.IsPress){
         grapher.StartLog();}
     if(control==endB)
         grapher.StopLog();
 }
Example #3
0
 void ButtonUp(ButtonControl control,GameObject hit)
 {
     string buttonId=control.name.Split('-')[1];
     string[] d=hit.name.Split('-');
     string cubeId=d[d.Length-1];
     if(buttonId==cubeId){
         isButtonPress[control]=false;
     }
 }
Example #4
0
    void Start()
    {
        GameObject bc = GameObject.Find("BuildCreator");

        objectCreator  = (ObjectCreator)bc.GetComponent(typeof(ObjectCreator));
        unitOperations = new UnitOperations();
        GameObject bCntrl = GameObject.Find("ButtonScrollList");

        buttonControl = (ButtonControl)bCntrl.GetComponent(typeof(ButtonControl));
    }
Example #5
0
        protected override void FinishSetup(InputDeviceBuilder builder)
        {
            grip            = builder.GetControl <AxisControl>("grip");
            primary         = builder.GetControl <ButtonControl>("primary");
            gripPressed     = builder.GetControl <ButtonControl>("gripPressed");
            trackpadPressed = builder.GetControl <ButtonControl>("trackpadPressed");
            triggerPressed  = builder.GetControl <ButtonControl>("triggerPressed");

            base.FinishSetup(builder);
        }
    public override bool Verify(StateComponent statesComponent)
    {
        _button = _inputAction.activeControl as ButtonControl;
        if (_button != null)
        {
            return(_button.isPressed);
        }

        return(false);
    }
Example #7
0
        protected override void FinishSetup()
        {
            grip            = GetChildControl <AxisControl>("grip");
            primary         = GetChildControl <ButtonControl>("primary");
            gripPressed     = GetChildControl <ButtonControl>("gripPressed");
            trackpadPressed = GetChildControl <ButtonControl>("trackpadPressed");
            triggerPressed  = GetChildControl <ButtonControl>("triggerPressed");

            base.FinishSetup();
        }
        public override void InitialiseControls()
        {
            var flow = new FlowContainerControl
            {
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                ApplyAlignment      = true,
                Padding             = new Padding(10)
            };

            var backgroundControl = new BackgroundControl
            {
                Position            = Position,
                Padding             = new Padding(3),
                ShrinkToContents    = true,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            };

            var downFlow = new FlowContainerControl {
                FlowDirection = FlowDirection.TopDown, VerticalAlignment = VerticalAlignment.Top, ShrinkToContents = true
            };
            var sideFlow = new FlowContainerControl {
                FlowDirection = FlowDirection.LeftToRight, ShrinkToContents = true
            };
            var textControl = new TextControl {
                Parameters = _caption, Margin = new Padding(1)
            };
            var buttonControl = new ButtonControl {
                Text = "Cancel"
            };

            HoveredCellName = new TextControl {
                Parameters = HoveredCellText
            };

            buttonControl.OnClick += buttonControl_OnClick;

            Controls.Add(flow);
            flow.Controls.Add(backgroundControl);

            backgroundControl.Controls.Add(downFlow);

            downFlow.Controls.Add(textControl);
            downFlow.Controls.Add(sideFlow);
            downFlow.Controls.Add(HoveredCellName);
            downFlow.Controls.Add(buttonControl);

            foreach (var cell in Entities)
            {
                sideFlow.Controls.Add(new MenuEntityControl {
                    Entity = cell, Margin = new Padding(1)
                });
            }
        }
Example #9
0
        public virtual void InitializeComponent()
        {
            Children.Clear();

            _ingredientsRect = new RectangleF(240, 275, 360, 42);

            _recipesList = new ListControl {
                SelectionMode = ListSelectionMode.Single
            };
            _recipesList.Bounds            = new UniRectangle(20, 50, 200, 300);
            _recipesList.SelectionChanged += RecipesListOnSelectionChanged;

            foreach (var recipe in _conf.Recipes.Where(r => r.ContainerBlueprintId == 0))
            {
                _recipesList.Items.Add(recipe);
            }

            Children.Add(_recipesList);

            // cells

            _resultModel = new ModelControl(_iconFactory.VoxelModelManager)
            {
                Bounds = new UniRectangle(300, 10, 230, 230)
            };

            Children.Add(_resultModel);

            _ingredientCells = new List <InventoryCell>();
            for (int i = 0; i < 6; i++)
            {
                var cell = new InventoryCell(null, _iconFactory, new Vector2I(), _inputsManager)
                {
                    DrawIconsGroupId      = 5,
                    DrawIconsActiveCellId = 6,
                    IsVisible             = false
                };

                _ingredientCells.Add(cell);
                Children.Add(cell);
            }

            // craft button

            const int buttonWidth  = 212;
            const int buttomHeight = 40;

            _craftButton = new ButtonControl
            {
                Text   = "Craft",
                Bounds = new UniRectangle(340, 300, buttonWidth, buttomHeight)
            };

            Children.Add(_craftButton);
        }
Example #10
0
        private void CreateControls()
        {
            // Login Input
            _loginBox = new InputControl
            {
                Bounds    = new UniRectangle(new UniScalar(0.5f, -100f), new UniScalar(0.4f, -30), 200, 30),
                IsHidden  = false,
                MaxLength = 20,
                RealText  = Settings.Default.login,
                Text      = Settings.Default.login
            };

            // Password Input
            _passwordBox = new InputControl
            {
                Bounds    = new UniRectangle(new UniScalar(0.5f, -100f), new UniScalar(0.4f, 30), 200, 30),
                IsHidden  = true,
                MaxLength = 20,
                RealText  = Settings.Default.password,
                Text      = InputControl.HiddenText(Settings.Default.password)
            };

            // Login Label
            _loginLabel = new LabelControl(Strings.User_Name)
            {
                Bounds = new UniRectangle(new UniScalar(0.5f, -32), new UniScalar(0.4f, -60), 100, 30)
            };

            // Password Label
            _passwordLabel = new LabelControl(Strings.Password)
            {
                Bounds = new UniRectangle(new UniScalar(0.5f, -32), new UniScalar(0.4f, 0), 100, 30)
            };

            // Login Button
            _loginButton = new ButtonControl
            {
                Text   = Strings.Login,
                Bounds = new UniRectangle(new UniScalar(0.5f, 110), new UniScalar(0.4f, 70), 100, 32)
            };

            // Back Button
            _exitButton = new ButtonControl
            {
                Text   = Strings.Exit,
                Bounds = new UniRectangle(new UniScalar(0.5f, -210f), new UniScalar(0.4f, 70), 100, 32),
            };

            // New Account Button
            _newAccountButton = new ButtonControl
            {
                Text   = Strings.Create_New_Account,
                Bounds = new UniRectangle(new UniScalar(0.5f, -75f), new UniScalar(0.4f, 70), 150, 32)
            };
        }
Example #11
0
    void Start()
    {
        body  = GetComponent <Rigidbody>();
        anim  = GetComponent <Animator>();
        btcon = GameObject.FindGameObjectWithTag("phone").GetComponent <ButtonControl>();

        if (btcon.use)
        {
            CamSet.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
        }
    }
Example #12
0
    private void ShowCTXInfo(InputAction.CallbackContext ctx)
    {
        ButtonControl control = ctx.control as ButtonControl;

        m_ctxInfoText.text = ctx.action.name + "\n"
                             + ctx.phase.ToString() + "\n"
                             + ctx.startTime.ToString("F2") + "\n"
                             + ctx.duration.ToString("F2") + "\n"
                             + ctx.time.ToString("F2") + "\n"
                             + control?.pressPoint.ToString("F1");
    }
Example #13
0
    private void ToggleCustomizationCallback(InputAction.CallbackContext ctx)
    {
        ButtonControl button = ctx.control as ButtonControl;

        if (!button.wasPressedThisFrame)
        {
            return;
        }

        ToggleCustomization();
    }
Example #14
0
    public void OnMouseDown()
    {
        ButtonControl b = GameObject.Find("ButtonInspector").GetComponent <ButtonControl>();

        b.funckCallUpdate(UpLevel);
        b.funckCallDestroy(destroyObj);
        b.PanelsButton1.SetActive(true);
        b.Panels.SetActive(false);
        b.PanelsButton.SetActive(false);
        b.CorectTextUpdate(Price);
    }
Example #15
0
        public MainForm()
        {
            InitializeComponent();

            directBitmap = new DirectBitmap(1124, 680);
            this.mainPictureBox.Image = directBitmap.Bitmap;
            _drawing = new Drawing.Drawing(directBitmap);
            var buttonControl = new ButtonControl(this);

            _formLogic = new FormLogic(_drawing, TimeTextBox, buttonControl);
        }
Example #16
0
    private void SubmitInputCallback(InputAction.CallbackContext ctx)
    {
        ButtonControl button = ctx.control as ButtonControl;

        if (!button.wasPressedThisFrame)
        {
            return;
        }

        InitiateGame();
    }
 private KeyboardShipController(
     ButtonControl _thrust_pos_axis, ButtonControl _thrust_neg_axis,
     ButtonControl _rot_pos_axis, ButtonControl _rot_neg_axis,
     ButtonControl _thrust_key, ButtonControl _gun_key, ButtonControl _bomb_key)
 {
     thrust_axis = new RawAxis(_thrust_pos_axis, _thrust_neg_axis);
     rot_axis    = new RawAxis(_rot_pos_axis, _rot_neg_axis);
     thrust_key  = _thrust_key;
     gun_key     = _gun_key;
     bomb_key    = _bomb_key;
 }
Example #18
0
 void Start()
 {
     GPGSMng.GetInstance.InitializeGPGS();
     this.buttonControl =
         GameObject.FindGameObjectWithTag("GameController").GetComponent <ButtonControl>();
     // If we haven't set up the Unity Purchasing reference
     if (m_StoreController == null)
     {
         InitializePurchasing();
     }
 }
Example #19
0
        public void TestFindByRoot()
        {
            var button = new ButtonControl();

            button.SystemUnderTest(new ControlLocatorDef <FindControl>(
                                       () => new FindByAutomationId("Form1", true),
                                       () => new FindByName("Ok")
                                       ));
            button.Click();
            Assert.AreEqual("clicked", TextBoxOne.Text);
        }
Example #20
0
        public void Test02_CalcResult()
        {
            var b = new ButtonControl();

            b.SystemUnderTestFromRepo("4");
            b.Click();
            var textBox = new TextBoxControl();

            textBox.SystemUnderTestFromRepo("result");

            Assert.AreEqual("4", textBox.Name);
        }
Example #21
0
        private void CreateControls()
        {
            // CreateGame Button
            _createGameButton = new ButtonControl
            {
                Text   = "Create Game",
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -350f), new UniScalar(0.4f, -160f), 120, 32)
            };

            // Back Button
            _backButton = new ButtonControl
            {
                Text   = "Back",
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -350f), new UniScalar(0.4f, -80f), 120, 32)
            };

            // JoinGame Button
            _joinGameButton = new ButtonControl
            {
                Text   = "Join Game",
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -350f), new UniScalar(0.4f, -120f), 120, 32)
            };

            // Label of maps
            _mapLabel = new LabelControl
            {
                Bounds = new UniRectangle(300.0f, -30.0f, 200.0f, 24.0f),
                Text   = "Games"
            };

            // Games List
            _gameList = new ListControl
            {
                Bounds = new UniRectangle(300f, -10f, 225f, 300f)
            };

            _gameList.Slider.Bounds.Location.X.Offset -= 1.0f;
            _gameList.Slider.Bounds.Location.Y.Offset += 1.0f;
            _gameList.Slider.Bounds.Size.Y.Offset     -= 2.0f;

            _gameList.SelectionMode = ListSelectionMode.Single;

            // Refresh Button
            _refreshButton = new ButtonControl
            {
                Text   = "Refresh",
                Bounds =
                    new UniRectangle(new UniScalar(0.5f, -20f), new UniScalar(0.4f, 140f), 120, 32)
            };
        }
        public WorkersOptionEditorForm( )
        {
            InitializeComponent( );

            workersDefaultNumSuccessfullChangedMessageLabel.Text = string.Empty;
            workersMaximumNumSuccessfullChangedMessageLabel.Text = string.Empty;

            ButtonControl buttonControls = new ButtonControl( );

            saveWorkerOptionsButton.MouseEnter += buttonControls.controlButtons_MouseEnter;
            saveWorkerOptionsButton.MouseLeave += buttonControls.controlButtons_MouseLeave;
        }
Example #23
0
        /// <summary>
        /// Sets the key index and sets the changing key
        /// @Author Steven
        /// </summary>
        /// <param name="keyIndex"></param>
        /// <param name="currentButton"></param>
        private void changeKey(int keyIndex, ButtonControl currentButton, LabelControl currentLabel)
        {
            keyToChange      = keyIndex;
            currentKeyChange = currentButton;
            oldKey           = keyToEnter.Text;

            keyToEnter.Text       = "";
            screen.FocusedControl = keyToEnter;

            keyToEnterLabel.Text = "Enter a new key for " + currentLabel.Text;
            changingKey          = true;
        }
Example #24
0
 void Awake()
 {
     if (control == null)
     {
         DontDestroyOnLoad(gameObject);
         control = this;
     }
     else if (control != this)
     {
         Destroy(gameObject);
     }
 }
    // Callback funtion when a button is pressed. The button can be on a keyboard or mouse
    private void OnButtonPress(ButtonControl control)
    {
        // Rule out Keyboard and Mouse input
        string device = control.device.description.deviceClass;

        if (device == "Keyboard" || device == "Mouse")
        {
            return;
        }

        OnControllerButtonPress(control);
    }
Example #26
0
    public void OnMouseDown()
    {
        ButtonControl b = GameObject.Find("ButtonInspector").GetComponent <ButtonControl>();

        b.positionClickOfCreate(this.transform);
        b.Panels.SetActive(true);
        b.PanelsButton.SetActive(true);
        b.PanelsButton1.SetActive(false);

        //print("+");
        //GetComponent<Renderer>().material.color = new Color(1, 1, 1);
    }
        private void InitializeComponentInternal()
        {
            _stMenuButton    = ToDispose(new SpriteTexture(_engine.Device, @"Images\MainMenu\menu_button.png", new Vector2I()));
            _stMenuHover     = ToDispose(new SpriteTexture(_engine.Device, @"Images\MainMenu\menu_button_hover.png", new Vector2I()));
            _stMenuDown      = ToDispose(new SpriteTexture(_engine.Device, @"Images\MainMenu\menu_button_down.png", new Vector2I()));
            _stMenuBackLabel = ToDispose(new SpriteTexture(_engine.Device, @"Images\back_label.png", new Vector2I()));

            _form = new Control();

            _windowLabel = new LabelControl()
            {
                Text       = "??????",
                Color      = new ByteColor(198, 0, 75),
                CustomFont = CommonResources.FontBebasNeue35,
                CustomHorizontalPlacement = FlatGuiGraphics.Frame.HorizontalTextAlignment.Center,
                CustomVerticalPlacement   = FlatGuiGraphics.Frame.VerticalTextAlignment.Center
            };

            _leftMenuPanel = new PanelControl()
            {
                Color = Color.WhiteSmoke
            };
            _cubesPatern = new ImageControl()
            {
                Image = CommonResources.StCubesPattern
            };
            _linenPatern = new ImageControl()
            {
                Image = CommonResources.StLinenPattern
            };
            _shadow = new ImageControl()
            {
                Image = CommonResources.StShadow
            };
            _backPanel = new ImageControl()
            {
                Image = CommonResources.StLinenPattern
            };

            _btBack = new ButtonControl
            {
                CustomImage      = _stMenuButton,
                CustomImageDown  = _stMenuDown,
                CustomImageHover = _stMenuHover,
                CusomImageLabel  = _stMenuBackLabel,
                TextFontId       = 1,
                Text             = "Back",
                Color            = new ByteColor(200, 200, 200, 255)
            };
            _btBack.Pressed += delegate { btBackPressed(); };

            InitializeComponent();
        }
Example #28
0
        private void AButton_Click(object sender, EventArgs e)
        {
            ButtonControl b = new ButtonControl();

            Controls.Add(b);
            b.Location     = new Point(10, 176);
            b.Size         = new Size(178, 174);
            b.m_Label.Text = "A key: ";
            b.m_Bind.Key   = Preset.Current.m_BindList.AButton;

            KeyPanelClass.CurrentPanel = b;
        }
Example #29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SelectGameScene"/> class.
        /// </summary>
        /// <param name="games">The games.</param>
        /// <param name="gameStateManager">Game state manager the game state belongs to</param>
        public SelectGameScene(List <IGame> games, GameManager gameManager)
            : base(gameManager)
        {
            _games       = games;
            _gameManager = gameManager;

            var label = new LabelControl
            {
                Text = "Select game",
            };

            label.Bounds.Location.X = Left;
            label.Bounds.Location.Y = Top;
            label.Frame             = "labelTitle";

            Screen.Desktop.Children.Add(label);

            var gameList = new ListControl();

            gameList.SelectionMode     = ListSelectionMode.Single;
            gameList.Bounds.Location.X = Left;
            gameList.Bounds.Location.Y = Top + 25;
            gameList.Bounds.Size.Y     = 100;
            gameList.Bounds.Size.X     = Width;

            foreach (var game in _games)
            {
                gameList.Items.Add(game.Name);
            }

            Screen.Desktop.Children.Add(gameList);

            var button = new ButtonControl();

            button.Text = "Play";
            button.Bounds.Location.X = Left;
            button.Bounds.Location.Y = Top + 150;
            button.Bounds.Size.X     = Width;
            button.Bounds.Size.Y     = 30;
            button.Pressed          += (sender, arguments) =>
            {
                if (gameList.SelectedItems.Count > 0)
                {
                    var name = gameList.Items[gameList.SelectedItems[0]];
                    var game = _games.FirstOrDefault(e => e.Name == name);
                    if (game != null)
                    {
                        _gameManager.StartGame(game);
                    }
                }
            };
            Screen.Desktop.Children.Add(button);
        }
Example #30
0
        private void CreateControls()
        {
            // Login Input
            _loginBox = new InputControl
            {
                IsHidden = false,
                Bounds   = new UniRectangle(new UniScalar(0.5f, -100f), new UniScalar(0.4f, -30), 200, 30),
                Text     = Settings.Default.login
            };

            // Password Input
            _passwordBox = new InputControl
            {
                IsHidden = true,
                Bounds   = new UniRectangle(new UniScalar(0.5f, -100f), new UniScalar(0.4f, 30), 200, 30),
                RealText = Settings.Default.password,
                Text     = InputControl.HiddenText(Settings.Default.password)
            };

            // Login Label
            _loginLabel = new LabelControl("Username")
            {
                Bounds = new UniRectangle(new UniScalar(0.5f, -32), new UniScalar(0.4f, -70), 100, 30)
            };

            // Password Label
            _passwordLabel = new LabelControl("Password")
            {
                Bounds = new UniRectangle(new UniScalar(0.5f, -32), new UniScalar(0.4f, 0), 100, 30)
            };

            // Login Button
            _loginButton = new ButtonControl
            {
                Text   = "Login",
                Bounds = new UniRectangle(new UniScalar(0.5f, 110), new UniScalar(0.4f, 70), 100, 32)
            };

            // Back Button
            _exitButton = new ButtonControl
            {
                Text   = "Exit",
                Bounds = new UniRectangle(new UniScalar(0.5f, -210f), new UniScalar(0.4f, 70), 100, 32),
            };

            // New Account Button
            _newAccountButton = new ButtonControl
            {
                Text   = "Create new account",
                Bounds = new UniRectangle(new UniScalar(0.5f, -75f), new UniScalar(0.4f, 70), 150, 32)
            };
        }
Example #31
0
        private void BuildWindow(ref ByteColor LeftPanelColor)
        {
            //Create the Close Button
            _debugWindow        = new WindowControl();
            _debugWindow.Name   = "DebugComponent";
            _debugWindow.Title  = "Debug Component";
            _debugWindow.Bounds = new UniRectangle(0, 0, 600, 400);
            _closeBt            = ToDispose(new CloseWindowButtonControl()
            {
                Bounds = new UniRectangle(_debugWindow.Bounds.Right - 20, 5, 15, 15)
            });
            _closeBt.Pressed += closeBt_Pressed;
            _debugWindow.Children.Add(_closeBt);

            //Create the Left Menu panel
            PanelControl menu = ToDispose(new PanelControl()
            {
                Bounds = new UniRectangle(4, 24, 100, _debugWindow.Bounds.Size.Y - 28), Color = LeftPanelColor
            });
            LabelControl menu_title = ToDispose(new LabelControl()
            {
                Bounds = new UniRectangle(5, 0, menu.Bounds.Size.X, 30), Color = Color.Yellow, Text = "Visualisation"
            });

            menu.Children.Add(menu_title);

            ButtonControl btOptions = ToDispose(new ButtonControl()
            {
                Tag = "btOptions", Bounds = new UniRectangle(4, menu_title.Bounds.Bottom - 6, 92, 40), Text = "Debug Options"
            });

            btOptions.Pressed += new EventHandler(btMenu_Pressed);
            menu.Children.Add(btOptions);

            ButtonControl btComponent = ToDispose(new ButtonControl()
            {
                Tag = "btComponent", Bounds = new UniRectangle(4, menu_title.Bounds.Bottom - 6 + 40, 92, 40), Text = "Game Comp."
            });

            btComponent.Pressed += new EventHandler(btMenu_Pressed);
            menu.Children.Add(btComponent);

            ButtonControl btPerf = ToDispose(new ButtonControl()
            {
                Tag = "btPerf", Bounds = new UniRectangle(4, menu_title.Bounds.Bottom - 6 + 80, 92, 40), Text = "Perf. Comp."
            });

            btPerf.Pressed += new EventHandler(btMenu_Pressed);
            menu.Children.Add(btPerf);

            _debugWindow.Children.Add(menu);
        }
Example #32
0
        public virtual void InitializeComponent()
        {
            Children.Clear();

            _recipesList = new ListControl {
                SelectionMode = ListSelectionMode.Single
            };
            _recipesList.Bounds            = new UniRectangle(200, 200, 200, 120);
            _recipesList.SelectionChanged += RecipesListOnSelectionChanged;

            _hostModel = new ModelControl(_iconFactory.VoxelModelManager)
            {
                Bounds = new UniRectangle(20, 20, 210, 170)
            };
            _hostModel.AlterTransform = Matrix.Identity;

            Children.Add(_hostModel);


            // craft button

            const int buttonWidth  = 185;
            const int buttomHeight = 50;

            _craftButton = new ButtonControl
            {
                Text   = "Craft",
                Bounds = new UniRectangle(244, 330, buttonWidth, buttomHeight)
            };

            _resultModel = new ModelControl(_iconFactory.VoxelModelManager)
            {
                Bounds = new UniRectangle(210, 20, 190, 120)
            };

            _hostModel.Bounds.Size.X = 200;

            _ingredientsRect = new RectangleF(200, 145, 200, 42);

            _ingredientCells = new List <InventoryCell>();
            for (int i = 0; i < 6; i++)
            {
                var cell = new InventoryCell(null, _iconFactory, new Vector2I(), _inputsManager)
                {
                    DrawIconsGroupId      = 5,
                    DrawIconsActiveCellId = 6,
                    IsVisible             = false
                };

                _ingredientCells.Add(cell);
            }
        }
Example #33
0
    //key bindings
    public void UseSkillAt(InputAction.CallbackContext ctx)
    {
        if (!m_PlayerStance.CanPerformAction(PlayerStance.Action.ACTION_CASTSPELL))
        {
            return;
        }

        ButtonControl button = ctx.control as ButtonControl;

        if (!button.wasPressedThisFrame)
        {
            return;
        }

        if (m_ItemSkillSlots.Count == 0)
        {
            return;
        }

        if (m_PlayerStance == null)
        {
            return;
        }

        SkillItem currentSkill = m_ItemSkillSlots.Peek();


        if (currentSkill.IsGroundOnlySpell())
        {
            if (!m_PlayerStance.CanPerformAction(PlayerStance.Action.ACTION_CASTSPELL))
            {
                return;
            }
        }

        // Player must draw his weapon before spell cast
        if (!m_PlayerStance.GetWeaponTransform().gameObject.activeInHierarchy)
        {
            return;
        }

        currentSkill.UseSkill(this.transform);
        m_CurrentActiveSkill = currentSkill.GetSkillType();
        m_CastInCurrentFrame = true;
        currentSkill.DecrementUses();


        if (currentSkill.HasNoMoreUses())
        {
            RemoveSkill();
        }
    }
Example #34
0
 void OnButtonUp(ButtonControl control,GameObject hit)
 {
     //if(hit.tag=="Player")
         //pause.pause=false;
 }
Example #35
0
 void OnButtonPress(ButtonControl control,GameObject hit)
 {
     //if(hit.tag=="Player")
         //pause.pause=true;
 }
    // Awake happens before Start
    void Awake()
    {
        // If there is no current button control, make this one the button control
        if (button == null) // The variable has not been assigned yet
        {
            // Whatever gameObject this script is put on, will persist from scene to scene
            DontDestroyOnLoad(gameObject);

            // This becomes the one object that will be referenced by this variable
            button = this;
        }
        else if (button != null)// If button already exists and this is not it, destroy this
        {
            Destroy(gameObject);
        }

        // Before scene loads - load up saved button assignments
        LoadButtonAssignment();
    }
 // Use this for initialization
 void Start()
 {
     activator = GetComponent<ButtonControl> ();
     activator.OnActivate += DepressButton;
 }
Example #38
0
 void OnButtonUp(ButtonControl control,GameObject hit)
 {
     grapher.Reset();
 }
Example #39
0
 void ButtonPress(ButtonControl control,GameObject hit)
 {
     if(cube!=null&&hit==cube){
         isFinished=true;
     }
 }
Example #40
0
 void ButtonUp(ButtonControl control,GameObject hit)
 {
     if(cube!=null&&hit==cube){
         isFinished=false;
     }
 }