コード例 #1
0
        private void layoutGradient()
        {
            var gradientLayer = CustomControls.ButtonBackground(this);

            BackgroundColor = UIColor.Clear;
            Layer.InsertSublayer(gradientLayer, 1);
        }
コード例 #2
0
    private void Update()
    {
        bool ret = false;

        if (bot == false)
        {
            try
            {
                CustomControls.GetButton(joystick, button1);
                joystick.Poll();
                FindObjectOfType <ControllerDisconnect>().Reconnect(playerNumber);
            }
            catch
            {
                FindObjectOfType <ControllerDisconnect>().Disconnect(playerNumber);
                joystick = FindObjectOfType <PlayerData>().controllers[playerNumber];
                button1  = FindObjectOfType <PlayerData>().button1[playerNumber];
                button2  = FindObjectOfType <PlayerData>().button2[playerNumber];
                ret      = true;
            }
        }
        if (ret)
        {
            return;
        }
        if (infection == true)
        {
            team.transform.localEulerAngles = -transform.eulerAngles;
        }

        if (Time.timeScale != 0)
        {
            UpdateMe();
        }
    }
コード例 #3
0
        public void GivenPasswordIs(string pass)
        {
            CustomControls.Entertext("//input[@placeholder='Password']", pass, propertytype.XPath);
            CustomControls.click("//button[normalize-space()='Sign in']", propertytype.XPath);

            try
            {
                CustomControls.click("//button[normalize-space()='Confirm']", propertytype.XPath);
                flag = 1;
            }

            catch (Exception e)
            {
                Console.WriteLine("Not able to login");
            }

            finally
            {
                if (flag == 1)
                {
                    string title = PropertiesCollection.ngdriver.Title;
                    Console.WriteLine(title);
                }
            }
        }
コード例 #4
0
        public bool IsLoggedIn()
        {
            CustomControls.SwitchPopUpTo(Constants.TopNavigationElements.userTabId);
            Thread.Sleep(2000);

            return(profileLink.Text == UserGenerator.LastGeneratedUser.UserName);
        }
コード例 #5
0
        private void layoutGradient()
        {
            //Console.WriteLine("Hitted");
            var gradientLayer = CustomControls.ButtonBackground(this);

            Layer.InsertSublayer(gradientLayer, 0);
        }
コード例 #6
0
 protected override void InitializeControls()
 {
     base.InitializeControls();
     UpdateButtonsControlLayout();
     UpdateApplyChangesButton();
     UpdateCancelButton();
     UpdateOKButton();
     UpdateDesignerModeButton();
     UpdateContextHelpButton();
     UpdateMainControlLayout();
     UpdateCustomControls();
     UpdateDescriptionEdit();
     UpdateNameEdit();
     TopLevelControl.MoveItem(0, BaseMessagePanel);
     TopLevelControl.MoveItem(1, MainControlLayout);
     MainControlLayout.MoveItem(0, NameEdit);
     MainControlLayout.MoveItem(1, DescriptionEdit);
     MainControlLayout.MoveItem(2, CustomControls);
     CustomControls.InsertItem(0, CreateIsSignableCheckBox());
     TopLevelControl.MoveItem(2, ButtonsControlLayout);
     ButtonsControlLayout.MoveItem(0, ContextHelpButton);
     ButtonsControlLayout.MoveItem(1, DesignerModeButton);
     ButtonsControlLayout.MoveItem(2, SpacerButton);
     ButtonsControlLayout.MoveItem(3, OKButton);
     ButtonsControlLayout.MoveItem(4, CancelButton);
     ButtonsControlLayout.MoveItem(5, ApplyChangesButton);
     TopLevelControl.MoveItem(3, DataSource);
     SetControlsDefInheritance(UId);
     InitializeLocalizableValues();
 }
コード例 #7
0
ファイル: HolderForm.cs プロジェクト: Narinyir/DantesPlayer
 /// <summary>
 /// Handles slider movement 
 /// </summary>
 /// <param name="slider">A custom slider object</param>
 /// <param name="video">A DirectX video</param>
 public static void HandleBarMovemenetVideo(
     CustomControls.CustomSlider slider, DirectXAllias::Video video)
 {
     if (CheckException.CheckNull(video))
     {
         video.CurrentPosition = slider.Value;
     }
 }
コード例 #8
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var gradient = CustomControls.ButtonBackground(gradientView);

            gradientView.Layer.InsertSublayer(gradient, 0);
            aboutLabel.Text = "About Us";
        }
コード例 #9
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var gradient = CustomControls.ButtonBackground(profileLabelView);

            profileLabelView.Layer.InsertSublayer(gradient, 0);
            profileLabel.Text = "Profile";
        }
コード例 #10
0
 public void Test1()
 {
     Console.WriteLine("Test1");
     Driver.Url = "https://demowf.aspnetawesome.com/";
     Driver.FindElement(By.Id("ContentPlaceHolder1_Meal")).SendKeys("Tomato");
     Driver.FindElement(By.XPath("//input[@name='ctl00$ContentPlaceHolder1$ChildMeal1']/following-sibling::div[text()='Celery']")).Click();
     CustomControls.comboBox("ContentPlaceHolder1_AllMealsCombo", "Almond");
     Driver.Close();
 }
コード例 #11
0
        public void GivenUserEntersSiteIdUsernameAndPasswordAsBelow(Table credentials)
        {
            PropertiesCollection.ngdriver.Manage().Window.Maximize();
            dynamic Credentials = credentials.CreateDynamicInstance();


            CustomControls.Entertext(PageObjects.Login_Screen(1), Credentials.site_id, propertytype.CssSelector);
            CustomControls.Entertext(PageObjects.Login_Screen(2), Credentials.user_id, propertytype.CssSelector);
            CustomControls.Entertext(PageObjects.Login_Screen(3), Credentials.password, propertytype.CssSelector);
            Console.WriteLine(PropertiesCollection.ngdriver.Title);
        }
コード例 #12
0
        public void ThenUserEntersBelowInformation(Table user_info)
        {
            dynamic User_info = user_info.CreateDynamicInstance();



            CustomControls.Entertext(PageObjects.Create_new_Account(6), User_info.Email, propertytype.CssSelector);
            CustomControls.Entertext(PageObjects.Create_new_Account(7), User_info.Password, propertytype.CssSelector);
            CustomControls.Entertext(PageObjects.Create_new_Account(8), User_info.Confirm_password, propertytype.CssSelector);
            CustomControls.click(PageObjects.Create_new_Account(9), propertytype.XPath);
            CustomControls.click(PageObjects.Create_new_Account(10), propertytype.XPath);
        }
コード例 #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            messageTextView.Layer.BorderColor = UIColor.Gray.CGColor;
            var gradient = CustomControls.ButtonBackground(reccommendationView);

            reccommendationView.Layer.InsertSublayer(gradient, 0);
            reccomendationLabel.Text = "Reccomandations";

            messageTextView.Layer.BorderColor = UIColor.Black.CGColor;
            messageTextView.Layer.BorderWidth = 0.5F;
        }
コード例 #14
0
 public void Shoot()
 {
     if (CustomControls.GetButton(joystick, button1) && ableToShoot)
     {
         ableToShoot = false;
         GameObject cloneBullet = Instantiate(bullet) as GameObject;
         cloneBullet.transform.position = bulletPosition.transform.position;
         if (team == 0)
         {
             cloneBullet.GetComponent <Rigidbody2D>().velocity = new Vector2(0f, bulletSpeed);
         }
         else if (team == 1)
         {
             cloneBullet.GetComponent <Rigidbody2D>().velocity = new Vector2(0f, -bulletSpeed);
         }
         cloneBullet.GetComponent <SpaceShooter_Bullet>().GetDamageInfo(bulletDamage);
         cloneBullet.GetComponent <SpaceShooter_Bullet>().GetTeamInfo(team);
         cloneBullet.GetComponent <SpaceShooter_Bullet>().player = gameObject;
         if (tripleShot)
         {
             GameObject cloneBullet2 = Instantiate(bullet) as GameObject;
             cloneBullet2.transform.position = bulletPosition.transform.position;
             if (team == 0)
             {
                 cloneBullet2.GetComponent <Rigidbody2D>().velocity = new Vector2(2f, bulletSpeed);
             }
             else if (team == 1)
             {
                 cloneBullet2.GetComponent <Rigidbody2D>().velocity = new Vector2(2f, -bulletSpeed);
             }
             cloneBullet2.GetComponent <SpaceShooter_Bullet>().GetDamageInfo(bulletDamage);
             cloneBullet2.GetComponent <SpaceShooter_Bullet>().GetTeamInfo(team);
             cloneBullet2.GetComponent <SpaceShooter_Bullet>().player = gameObject;
             GameObject cloneBullet3 = Instantiate(bullet) as GameObject;
             cloneBullet3.transform.position = bulletPosition.transform.position;
             if (team == 0)
             {
                 cloneBullet3.GetComponent <Rigidbody2D>().velocity = new Vector2(-2f, bulletSpeed);
             }
             else if (team == 1)
             {
                 cloneBullet3.GetComponent <Rigidbody2D>().velocity = new Vector2(-2f, -bulletSpeed);
             }
             cloneBullet3.GetComponent <SpaceShooter_Bullet>().GetDamageInfo(bulletDamage);
             cloneBullet3.GetComponent <SpaceShooter_Bullet>().GetTeamInfo(team);
             cloneBullet3.GetComponent <SpaceShooter_Bullet>().player = gameObject;
         }
         shoot.Play();
         Invoke("AbleToShoot", attackSpeed);
     }
 }
コード例 #15
0
ファイル: HolderForm.cs プロジェクト: Narinyir/DantesPlayer
 public static void HandleAudioProgress(
     CustomControls.CustomSlider slider, DirectXAllias::Audio audio)
 {
     if(audio.Disposed == false)
     {
         slider.Maximum = Convert.ToInt32(audio.Duration);
         slider.Value = Convert.ToInt32(audio.CurrentPosition);
         if (Convert.ToInt32(audio.CurrentPosition) > slider.Maximum)
         {
             slider.Value = slider.Maximum;
             return;
         }
     }
 }
コード例 #16
0
        public void SetCustomControls(CustomControls newControls)
        {
            customControlsMode = customControlsMode != newControls ? newControls : CustomControls.None;

            switch (customControlsMode)
            {
            case CustomControls.Sell: Cursors.SetSellCursor(); break;

            case CustomControls.Repair: Cursors.SetRepairCursor(); break;

            case CustomControls.None:
                Cursors.lockCursorChange = false;
                Cursors.SetDefaultCursor();
                break;
            }
        }
コード例 #17
0
 private void radioPanel_FormatEnum(object sender, CustomControls.FormatEventArgs e)
 {
     //if (e.Source is MonthlySchedule.IntervalType)
     //{
     //    switch ((MonthlySchedule.IntervalType)e.Source)
     //    {
     //        case MonthlySchedule.IntervalType.DayOfMonth:
     //            e.Target = "Day of month";
     //            break;
     //        case MonthlySchedule.IntervalType.DayOfWeek:
     //            e.Target = "Day of week";
     //            break;
     //        default:
     //            break;
     //    }
     //}
 }
コード例 #18
0
 private void Movement()
 {
     if (!bot)
     {
         if (keyboard)
         {
             if (CustomControls.GetButton(joystick, stanga))
             {
                 GetComponent <Rigidbody2D>().velocity = new Vector2(-shipSpeed, GetComponent <Rigidbody2D>().velocity.y);
             }
             else if (CustomControls.GetButton(joystick, dreapta))
             {
                 GetComponent <Rigidbody2D>().velocity = new Vector2(shipSpeed, GetComponent <Rigidbody2D>().velocity.y);
             }
             else
             {
                 GetComponent <Rigidbody2D>().velocity = new Vector2(0, GetComponent <Rigidbody2D>().velocity.y);
             }
             if (CustomControls.GetButton(joystick, sus))
             {
                 GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, shipSpeed);
             }
             else if (CustomControls.GetButton(joystick, jos))
             {
                 GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, -shipSpeed);
             }
             else
             {
                 GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, 0);
             }
         }
         else if ((CustomControls.GetAxis(joystick).Yaxis > 40000 || CustomControls.GetAxis(joystick).Yaxis < 20000 || CustomControls.GetAxis(joystick).Xaxis > 40000 || CustomControls.GetAxis(joystick).Xaxis < 20000))
         {
             GetComponent <Rigidbody2D>().velocity = new Vector2(shipSpeed * (CustomControls.GetAxis(joystick).Xaxis - 32767) / 32767, -shipSpeed * (CustomControls.GetAxis(joystick).Yaxis - 32767) / 32767);
         }
         else
         {
             GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);
         }
     }
 }
コード例 #19
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var gradient = CustomControls.ButtonBackground(homeHeading);

            homeHeading.Layer.InsertSublayer(gradient, 0);

            homeHeadingLabel.Text = "Now ->";

            var tableItems = new List <AvatarDetails>()
            {
                new AvatarDetails {
                    AvatarCompany = "*****@*****.**", AvatarName = "Kumar D"
                },
                new AvatarDetails {
                    AvatarCompany = "*****@*****.**", AvatarName = "Vivek S"
                }
            };

            homeTableView.Source = new TableSource(tableItems);
        }
コード例 #20
0
 public void Ultimate()
 {
     if (CustomControls.GetButton(joystick, button2) && !usedUltimate)
     {
         if (!laserult)
         {
             GameObject cloneBullet = Instantiate(ultimateBullet) as GameObject;
             cloneBullet.transform.position = bulletPosition.transform.position;
             if (team == 0)
             {
                 cloneBullet.GetComponent <Rigidbody2D>().velocity = new Vector2(0f, ultimateSpeed);
             }
             else if (team == 1)
             {
                 cloneBullet.GetComponent <Rigidbody2D>().velocity = new Vector2(0f, -ultimateSpeed);
             }
             cloneBullet.GetComponent <SpaceShooter_Bullet>().GetDamageInfo(ultimateBulletDamage);
             cloneBullet.GetComponent <SpaceShooter_Bullet>().GetTeamInfo(team);
             cloneBullet.GetComponent <SpaceShooter_Bullet>().player = gameObject;
             ultimate.Play();
             usedUltimate = true;
         }
         else
         {
             GameObject ult = Instantiate(laserUlt);
             ult.GetComponent <SpaceShooter_LaserUltimate>().team = team;
             ult.transform.position = laserUltPos.transform.position;
             ult.GetComponent <SpaceShooter_LaserUltimate>().active = true;
             tutorialAbleToMove = false;
             GetComponent <Rigidbody2D>().velocity = Vector2.zero;
             laserult     = false;
             usedUltimate = true;
             Invoke("StartMoving", 2.5f);
         }
     }
 }
コード例 #21
0
ファイル: GridContext.xaml.cs プロジェクト: dingxinbei/OLdBck
        private void InitBubbleAn(CustomControls.Bubbles bb)
        {
            //Canvas.SetBottom(bb, -bb.ActualHeight / 2);
            //Canvas.SetRight(bb, -bb.ActualWidth / 2);

            bb.RenderTransformOrigin = new Point(0.5, 0.5);
            bb.RandomColors();
            TranslateTransform translate = new TranslateTransform();
            //RotateTransform rotate = new RotateTransform();
            TransformGroup group = (TransformGroup)bb.RenderTransform;
            //group.Children.Add(rotate);//先旋转
            group.Children.Add(translate);//再平移
            //ScaleTransform st = new ScaleTransform(0.1, 0.1);
            //group.Children.Add(st);
            bb.RenderTransform = group;

            NameScope.SetNameScope(this, new NameScope());
            this.RegisterName("translate", translate);
            //this.RegisterName("rotate", rotate);

            //Path p = new Path();
            //p.Data = (PathGeometry)PathGeometry.Parse("M416,752 C416.62132,721.83583 376.22793,703.51499 417.86397,661.5075 459.5,619.5 418.99008,606.83656 419.55313,579.50109 420.17109,549.50009 385.31468,541.49617 421.40702,489.49808 457.49935,437.5 422.80709,421.52692 423.50712,387.54134 424.0839,359.53949 388.9757,351.57158 425.23747,303.53579 461.49924,255.5 426.58377,238.17526 427.25691,205.49499 427.77851,180.1724 372.14433,181.55445 428.8217,129.52722 485.49907,77.5 429.94781,74.856289&#xd;&#xa;430.51087,47.520822 430.84058,31.513881 387.50032,25.5 431.5,-0.5");
            //PathGeometry p = new PathGeometry();
            //p = (PathGeometry)PathGeometry.Parse("M416,752 C416.62132,721.83583 376.22793,703.51499 417.86397,661.5075 459.5,619.5 418.99008,606.83656 419.55313,579.50109 420.17109,549.50009 385.31468,541.49617 421.40702,489.49808 457.49935,437.5 422.80709,421.52692 423.50712,387.54134 424.0839,359.53949 388.9757,351.57158 425.23747,303.53579 461.49924,255.5 426.58377,238.17526 427.25691,205.49499 427.77851,180.1724 372.14433,181.55445 428.8217,129.52722 485.49907,77.5 429.94781,74.856289&#xd;&#xa;430.51087,47.520822 430.84058,31.513881 387.50032,25.5 431.5,-0.5");
            DoubleAnimationUsingPath animationX = new DoubleAnimationUsingPath();
            animationX.PathGeometry = p.Data.GetFlattenedPathGeometry();
            animationX.Source = PathAnimationSource.X;
            animationX.Duration = new Duration(TimeSpan.FromSeconds(2));

            DoubleAnimationUsingPath animationY = new DoubleAnimationUsingPath();
            animationY.PathGeometry = p.Data.GetFlattenedPathGeometry();
            animationY.Source = PathAnimationSource.Y;
            animationY.Duration = animationX.Duration;

            //DoubleAnimationUsingPath animationAngle = new DoubleAnimationUsingPath();
            //animationAngle.PathGeometry = p.Data.GetFlattenedPathGeometry();
            //animationAngle.Source = PathAnimationSource.Angle;
            //animationAngle.Duration = animationX.Duration;

            Storyboard story = new Storyboard();
            story.RepeatBehavior = RepeatBehavior.Forever;
            //story.AutoReverse = true;
            story.SpeedRatio = 0.1 + 0.3 * gRr.NextDouble();
            story.Children.Add(animationX);
            story.Children.Add(animationY);
            //story.Children.Add(animationAngle);
            Storyboard.SetTargetName(animationX, "translate");
            Storyboard.SetTargetName(animationY, "translate");
            //Storyboard.SetTargetName(animationAngle, "rotate");
            Storyboard.SetTargetProperty(animationX, new PropertyPath(TranslateTransform.XProperty));
            Storyboard.SetTargetProperty(animationY, new PropertyPath(TranslateTransform.YProperty));
            //Storyboard.SetTargetProperty(animationAngle, new PropertyPath(RotateTransform.AngleProperty));
            //story.Completed += new EventHandler(story_Completed);
            story.Begin(this);
        }
コード例 #22
0
ファイル: GridContext.xaml.cs プロジェクト: dingxinbei/OLdBck
        private void InitAntiBubble(CustomControls.Bubbles bb)
        {
            bb.RenderTransformOrigin = new Point(0.5, 0.5);
            MatrixTransform matrix = new MatrixTransform();
            bb.RenderTransform = matrix;

            NameScope.SetNameScope(this, new NameScope());
            this.RegisterName("matrix", matrix);

            MatrixAnimationUsingPath matrixAnimation = new MatrixAnimationUsingPath();
            matrixAnimation.PathGeometry = (PathGeometry)PathGeometry.Parse("M416,752 C416.62132,721.83583 376.22793,703.51499 417.86397,661.5075 459.5,619.5 418.99008,606.83656 419.55313,579.50109 420.17109,549.50009 385.31468,541.49617 421.40702,489.49808 457.49935,437.5 422.80709,421.52692 423.50712,387.54134 424.0839,359.53949 388.9757,351.57158 425.23747,303.53579 461.49924,255.5 426.58377,238.17526 427.25691,205.49499 427.77851,180.1724 372.14433,181.55445 428.8217,129.52722 485.49907,77.5 429.94781,74.856289&#xd;&#xa;430.51087,47.520822 430.84058,31.513881 387.50032,25.5 431.5,-0.5"); ;
            matrixAnimation.Duration = new Duration(TimeSpan.FromSeconds(2));
            matrixAnimation.RepeatBehavior = RepeatBehavior.Forever;
            //matrixAnimation.AutoReverse = true;
            matrixAnimation.IsOffsetCumulative = !matrixAnimation.AutoReverse;
            matrixAnimation.DoesRotateWithTangent = true;//旋转

            Storyboard story = new Storyboard();
            story.SpeedRatio = 0.5;
            //story.RepeatBehavior = RepeatBehavior.Forever;
            story.Children.Add(matrixAnimation);
            Storyboard.SetTargetName(matrixAnimation, "matrix");
            Storyboard.SetTargetProperty(matrixAnimation, new PropertyPath(MatrixTransform.MatrixProperty));
            story.Begin(this);
        }
コード例 #23
0
ファイル: MainForm.cs プロジェクト: sulerzh/DbExporter
 private void datePicker1_ValueChanged(object sender, CustomControls.CheckDateEventArgs e)
 {
     lbSelectedSampleId.Items.Clear();
     RefreshSampleIdList(datePicker1.Value);
 }
コード例 #24
0
        void ContractPanel_OnComboChange(object sender, CustomControls.ContractArgs args)
        {
            try
            {

                dgvMarketPicture.Rows.Clear();
                lblResetText();

                //int item = ComData.AtsBroadcastList.ToList().FindIndex(x => x.GatewayID == (AtsEnums.GatewayId)ContractPanel.ContractData.GatewayId);

                //if (item >= 0)
                //{
                //    ComData.AtsBroadcastList[item].broadcast.TokenRequest(ContractPanel.ContractData.ContractInfo, ContractPanel.ContractData.GatewayId);

                //}

            }
            catch (Exception ex)
            {
               // AppGlobal.Logger.WriteinFileWindowAndBox(ex, LogEnums.WriteOption.LogWindow_ErrorLogFile, color: AppLog.RedColor);
            }
        }
コード例 #25
0
    // Update is called once per frame
    public void UpdateMe()
    {
        if (trapped && bot)
        {
            GetComponent <AIPath>().enabled = false;
        }
        else if (trapped == false && bot == true)
        {
            GetComponent <AIPath>().enabled = true;
        }
        if (bot)
        {
            if (target != null)
            {
            }
            else
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);
                ZombieSurvival_player[] players = FindObjectsOfType <ZombieSurvival_player>();
                if (players.Length != 0)
                {
                    target = players[Random.Range(0, 10000000) % players.Length].gameObject;
                    GetComponent <AIDestinationSetter>().target = target.transform;
                }
            }
        }
        else
        {
            delta += Time.deltaTime;
            if (delta >= 1)
            {
                delta = 0;
                try
                {
                    joystick.Poll();
                }
                catch
                {
                    joystick = FindObjectOfType <PlayerData>().controllers[playerNumber];
                    button1  = PlayerPrefs.GetInt(joystick.Information.ProductName + "1", 0);
                    button2  = PlayerPrefs.GetInt(joystick.Information.ProductName + "2", 2);
                    if ((joystick.Information.Type == SharpDX.DirectInput.DeviceType.Keyboard) == false)
                    {
                        keyboard = false;
                    }
                }
            }
            if (trapped == false)
            {
                if (keyboard)
                {
                    if (CustomControls.GetButton(joystick, stanga))
                    {
                        GetComponent <Rigidbody2D>().velocity = new Vector2(-speed, GetComponent <Rigidbody2D>().velocity.y);
                    }
                    else if (CustomControls.GetButton(joystick, dreapta))
                    {
                        GetComponent <Rigidbody2D>().velocity = new Vector2(speed, GetComponent <Rigidbody2D>().velocity.y);
                    }
                    else
                    {
                        GetComponent <Rigidbody2D>().velocity = new Vector2(0, GetComponent <Rigidbody2D>().velocity.y);
                    }
                    if (CustomControls.GetButton(joystick, sus))
                    {
                        GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, speed);
                    }
                    else if (CustomControls.GetButton(joystick, jos))
                    {
                        GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, -speed);
                    }
                    else
                    {
                        GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, 0);
                    }
                }
                else if ((CustomControls.GetAxis(joystick).Yaxis > 40000 || CustomControls.GetAxis(joystick).Yaxis < 20000 || CustomControls.GetAxis(joystick).Xaxis > 40000 || CustomControls.GetAxis(joystick).Xaxis < 20000))
                {
                    GetComponent <Rigidbody2D>().velocity = new Vector2(speed * (CustomControls.GetAxis(joystick).Xaxis - 32767) / 32767, -speed * (CustomControls.GetAxis(joystick).Yaxis - 32767) / 32767);
                }
                else
                {
                    GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);
                }
            }
            else
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);
            }

            if (keyboard)
            {
                if ((CustomControls.GetButton(joystick, stanga) || CustomControls.GetButton(joystick, dreapta) || CustomControls.GetButton(joystick, jos) || CustomControls.GetButton(joystick, sus)))
                {
                    float rotZ = transform.rotation.z;
                    transform.rotation = Quaternion.LookRotation(GetComponent <Rigidbody2D>().velocity * 100, new Vector3(0, 0, 1));
                    transform.rotation = new Quaternion(0, 0, transform.rotation.z, transform.rotation.w);
                    if (GetComponent <Rigidbody2D>().velocity == new Vector2(0, 0))
                    {
                        transform.rotation = new Quaternion(0, 0, rotZ, transform.rotation.w);
                    }
                }
            }
            else
            {
                if ((CustomControls.GetAxis(joystick).Yaxis > 40000 || CustomControls.GetAxis(joystick).Yaxis < 20000 || CustomControls.GetAxis(joystick).Xaxis > 40000 || CustomControls.GetAxis(joystick).Xaxis < 20000))
                {
                    float rotZ = transform.rotation.z;
                    transform.rotation = Quaternion.LookRotation(GetComponent <Rigidbody2D>().velocity * 100, new Vector3(0, 0, 1));
                    transform.rotation = new Quaternion(0, 0, transform.rotation.z, transform.rotation.w);
                    if (GetComponent <Rigidbody2D>().velocity == new Vector2(0, 0))
                    {
                        transform.rotation = new Quaternion(0, 0, rotZ, transform.rotation.w);
                    }
                }
            }
            if (CustomControls.GetButton(joystick, button1) && bombThrown == false)
            {
                bombThrown = true;
                GameObject bombClone = Instantiate(bomb);
                bombClone.GetComponent <ZombieInfection_bomb>().active = true;
                bombClone.transform.position = transform.position;
                bombClone.transform.rotation = transform.rotation;
                bombClone.GetComponent <Rigidbody2D>().velocity = -transform.up * bombForce;
            }
            if (CustomControls.GetButton(joystick, button2) && attacking == false)
            {
                attacking = true;
                GetComponent <CircleCollider2D>().enabled = true;
            }
            else
            {
                if (CustomControls.GetButton(joystick, button2) == true && attacking == true)
                {
                    GetComponent <CircleCollider2D>().enabled = false;
                }
                if (CustomControls.GetButton(joystick, button2) == false && attacking == true)
                {
                    attacking = false;
                }
            }
        }
    }
コード例 #26
0
ファイル: ManageDsn.cs プロジェクト: stefbear/DatabaseTools
		private void containerListView1_ItemCheck(object sender, CustomControls.ManagedListView.ContainerListViewEventArgs e)
		{
			bool isChecked = e.Item.Checked;
			//only one item must be selected
			//uncheck all other items
			containerListView1.BeginUpdate();
			for (int i=0; i<containerListView1.Items.Count; i++)
				containerListView1.Items[i].Checked = false;

			e.Item.Checked = isChecked;
			containerListView1.EndUpdate();
		}
コード例 #27
0
 public void WhenUserClicksOnForgotPassword()
 {
     CustomControls.click(PageObjects.Login_Screen(6), propertytype.CssSelector);
 }
コード例 #28
0
 void Update()
 {
     if (Time.timeScale != 0)
     {
         teamColor.transform.localEulerAngles = -transform.eulerAngles;
         if (ableToMove && tutorialAbleToMove)
         {
             if (grounded == false)
             {
                 if (GetComponent <Rigidbody2D>().velocity.y > 1)
                 {
                     GetComponent <Animator>().Play("jumpBomberman");
                     playindAirAnim = true;
                     playingAnim    = false;
                 }
                 else if (GetComponent <Rigidbody2D>().velocity.y < -1)
                 {
                     GetComponent <Animator>().Play("fallBomberman");
                     playindAirAnim = true;
                     playingAnim    = false;
                 }
                 else
                 {
                     playindAirAnim = false;
                 }
             }
             else
             {
                 playindAirAnim = false;
             }
             if (keyboard)
             {
                 if (CustomControls.GetButton(joystick, stanga))
                 {
                     GetComponent <Rigidbody2D>().velocity = new Vector2(-speed, GetComponent <Rigidbody2D>().velocity.y);
                     transform.eulerAngles = new Vector3(0, 180, 0);
                     if (playingAnim == false && playindAirAnim == false)
                     {
                         GetComponent <Animator>().Play("runBomberman");
                         playingAnim = true;
                     }
                 }
                 else if (CustomControls.GetButton(joystick, dreapta))
                 {
                     GetComponent <Rigidbody2D>().velocity = new Vector2(speed, GetComponent <Rigidbody2D>().velocity.y);
                     transform.eulerAngles = new Vector3(0, 0, 0);
                     if (playingAnim == false && playindAirAnim == false)
                     {
                         GetComponent <Animator>().Play("runBomberman");
                         playingAnim = true;
                     }
                 }
                 else
                 {
                     GetComponent <Rigidbody2D>().velocity = new Vector2(0, GetComponent <Rigidbody2D>().velocity.y);
                     if (playindAirAnim == false)
                     {
                         playingAnim = false;
                         GetComponent <Animator>().Play("idle");
                     }
                 }
             }
             else
             {
                 if (CustomControls.GetAxis(joystick).Xaxis < 20000)
                 {
                     GetComponent <Rigidbody2D>().velocity = new Vector2(speed * (CustomControls.GetAxis(joystick).Xaxis - 32767) / 32767, GetComponent <Rigidbody2D>().velocity.y);
                     transform.eulerAngles = new Vector3(0, 180, 0);
                     if (playingAnim == false && playindAirAnim == false)
                     {
                         GetComponent <Animator>().Play("runBomberman");
                         playingAnim = true;
                     }
                 }
                 else if (CustomControls.GetAxis(joystick).Xaxis > 40000)
                 {
                     GetComponent <Rigidbody2D>().velocity = new Vector2(speed * (CustomControls.GetAxis(joystick).Xaxis - 32767) / 32767, GetComponent <Rigidbody2D>().velocity.y);
                     transform.eulerAngles = new Vector3(0, 0, 0);
                     if (playingAnim == false && playindAirAnim == false)
                     {
                         GetComponent <Animator>().Play("runBomberman");
                         playingAnim = true;
                     }
                 }
                 else
                 {
                     GetComponent <Rigidbody2D>().velocity = new Vector2(0, GetComponent <Rigidbody2D>().velocity.y);
                     if (playindAirAnim == false)
                     {
                         playingAnim = false;
                         GetComponent <Animator>().Play("idle");
                     }
                 }
             }
             if (CustomControls.GetButton(joystick, button1))
             {
                 if (grounded == true)
                 {
                     GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, jumpHeight);
                     if (allowSound == true)
                     {
                         AudioSource.PlayClipAtPoint(jump, Camera.main.transform.position);
                         allowSound = false;
                         Invoke("AllowSound", 0.25f);
                     }
                 }
             }
             if (CustomControls.GetButton(joystick, button2))
             {
                 if (allowBomb)
                 {
                     GameObject bomba = Instantiate(bomb);
                     bomba.transform.position = transform.position;
                     bomba.GetComponent <Bombermen_bomb>().team   = team;
                     bomba.GetComponent <Bombermen_bomb>().parent = gameObject;
                     foreach (Bombermen_player player in FindObjectsOfType <Bombermen_player>())
                     {
                         Physics2D.IgnoreCollision(bomba.GetComponent <CircleCollider2D>(), player.GetComponent <BoxCollider2D>());
                     }
                     allowBomb = false;
                     Invoke("AllowBomb", 2.5f);
                 }
             }
         }
     }
 }
コード例 #29
0
 public void WhenUserClicksLoginButton()
 {
     CustomControls.click(PageObjects.Login_Screen(4), propertytype.CssSelector);
     delayfor.delay();
 }
コード例 #30
0
 public void ThenUserClickOnCreateANewAccount()
 {
     CustomControls.click(PageObjects.Create_new_Account(1), propertytype.XPath);
 }
コード例 #31
0
 private void automatedTestControl1_TestCompleted(object sender, CustomControls.TestCompletedEventArgs e)
 {
     btnCancel.Text = "&Close";
     btnCancel.Focus();
 }
コード例 #32
0
 public void GivenTheUsernameIs(string username)
 {
     CustomControls.Entertext("//input[@placeholder='Email/Username']", username, propertytype.XPath);
 }
コード例 #33
0
ファイル: Audio.cs プロジェクト: Narinyir/DantesPlayer
 public void VolumeDown(CustomControls.CustomSlider customSlider)
 {
     AudioControl.VolumeDown(this.DirectAudio, customSlider);
 }
コード例 #34
0
    // Update is called once per frame
    void Update()
    {
        bool ret = false;

        if (bot == false)
        {
            try
            {
                CustomControls.GetButton(joystick, button1);
                joystick.Poll();
                FindObjectOfType <ControllerDisconnect>().Reconnect(playerNumber);
            }
            catch
            {
                FindObjectOfType <ControllerDisconnect>().Disconnect(playerNumber);
                joystick = FindObjectOfType <PlayerData>().controllers[playerNumber];
                button1  = FindObjectOfType <PlayerData>().button1[playerNumber];
                button2  = FindObjectOfType <PlayerData>().button2[playerNumber];
                ret      = true;
            }
        }
        if (ret)
        {
            return;
        }
        if (bot == false)
        {
            delta += Time.deltaTime;
            if (delta >= 1)
            {
                delta = 0;
                try
                {
                    joystick.Poll();
                }
                catch
                {
                    joystick = FindObjectOfType <PlayerData>().controllers[playerNumber];
                    button1  = PlayerPrefs.GetInt(joystick.Information.ProductName + "1", 0);
                    button2  = PlayerPrefs.GetInt(joystick.Information.ProductName + "2", 2);
                    if ((joystick.Information.Type == SharpDX.DirectInput.DeviceType.Keyboard) == false)
                    {
                        keyboard = false;
                    }
                }
            }
        }
        if (Vel0)
        {
            GetComponent <Rigidbody2D>().velocity = Vector2.zero;
        }
        if (Time.timeScale != 0)
        {
            time += Time.deltaTime;
            teamColor.transform.localEulerAngles = -transform.eulerAngles;
            if (!bot)
            {
                if (ableToMove && tutorialAbleToMove)
                {
                    oldScale = GetComponent <Rigidbody2D>().gravityScale;
                    if (grounded == false)
                    {
                        if (GetComponent <Rigidbody2D>().gravityScale > 0)
                        {
                            if (GetComponent <Rigidbody2D>().velocity.y > 1)
                            {
                                GetComponent <Animator>().Play("jump");
                                playingMidAirAnim = true;
                                playingAnim       = false;
                            }
                            else if (GetComponent <Rigidbody2D>().velocity.y < -1)
                            {
                                GetComponent <Animator>().Play("fall");
                                playingMidAirAnim = true;
                                playingAnim       = false;
                            }
                            else
                            {
                                playingMidAirAnim = false;
                            }
                        }
                        else
                        {
                            if (GetComponent <Rigidbody2D>().velocity.y < -1)
                            {
                                GetComponent <Animator>().Play("jump");
                                playingMidAirAnim = true;
                                playingAnim       = false;
                            }
                            else if (GetComponent <Rigidbody2D>().velocity.y > 1)
                            {
                                GetComponent <Animator>().Play("fall");
                                playingMidAirAnim = true;
                                playingAnim       = false;
                            }
                            else
                            {
                                playingMidAirAnim = false;
                            }
                        }
                    }
                    else
                    {
                        playingMidAirAnim = false;
                    }

                    if (keyboard)
                    {
                        if (CustomControls.GetButton(joystick, stanga) && moveLeft)
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(-speed * speedAmplifier, GetComponent <Rigidbody2D>().velocity.y); if (playingAnim == false && playingMidAirAnim == false)
                            {
                                playingAnim = true; GetComponent <Animator>().Play("run");
                            }
                        }
                        else if (CustomControls.GetButton(joystick, dreapta) && moveRight)
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(speed * speedAmplifier, GetComponent <Rigidbody2D>().velocity.y); if (playingAnim == false && playingMidAirAnim == false)
                            {
                                playingAnim = true; GetComponent <Animator>().Play("run");
                            }
                        }
                        else
                        {
                            if (!freezing || !grounded)
                            {
                                GetComponent <Rigidbody2D>().velocity = new Vector2(0, GetComponent <Rigidbody2D>().velocity.y);
                            }
                            if (playingMidAirAnim == false)
                            {
                                playingAnim = false; GetComponent <Animator>().Play("idle");
                            }
                        }
                    }
                    else
                    {
                        if (CustomControls.GetAxis(joystick).Xaxis < 20000 && moveLeft)
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(speed * speedAmplifier * (CustomControls.GetAxis(joystick).Xaxis - 32767) / 32767, GetComponent <Rigidbody2D>().velocity.y); if (playingAnim == false && playingMidAirAnim == false)
                            {
                                playingAnim = true; GetComponent <Animator>().Play("run");
                            }
                        }
                        else if (CustomControls.GetAxis(joystick).Xaxis > 40000 && moveRight)
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(speed * speedAmplifier * (CustomControls.GetAxis(joystick).Xaxis - 32767) / 32767, GetComponent <Rigidbody2D>().velocity.y); if (playingAnim == false && playingMidAirAnim == false)
                            {
                                playingAnim = true; GetComponent <Animator>().Play("run");
                            }
                        }
                        else
                        {
                            if (!freezing || !grounded)
                            {
                                GetComponent <Rigidbody2D>().velocity = new Vector2(0, GetComponent <Rigidbody2D>().velocity.y);
                            }
                            if (playingMidAirAnim == false)
                            {
                                playingAnim = false; GetComponent <Animator>().Play("idle");
                            }
                        }
                    }
                    if (CustomControls.GetButton(joystick, button1) && grounded)
                    {
                        if (GetComponent <Rigidbody2D>().gravityScale < 0)
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, -jumpHeight * jumpHeightAmplifier);
                        }
                        else
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, jumpHeight * jumpHeightAmplifier);
                        }
                        jump.Play();
                    }
                    if (CustomControls.GetButton(joystick, button2) && action2Type != 0)
                    {
                        if (action2Type == 1)
                        {
                            if (GetComponent <Rigidbody2D>().gravityScale < 0)
                            {
                                GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, -jumpHeight * jumpHeightAmplifier);
                            }
                            else
                            {
                                GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, jumpHeight * jumpHeightAmplifier);
                            }
                            action2Type = 0;
                            jump.Play();
                        }
                        else if (action2Type == 2)
                        {
                            GameObject cloneMine = Instantiate(mine);
                            cloneMine.transform.position = transform.position;
                            cloneMine.GetComponent <ParkourMasters_Mine>().player = gameObject;
                            cloneMine.GetComponent <Rigidbody2D>().gravityScale   = oldScale;
                            cloneMine.transform.rotation   = transform.rotation;
                            cloneMine.transform.localScale = new Vector3(mineSize, mineSize, 1);

                            Physics2D.IgnoreCollision(GetComponent <BoxCollider2D>(), cloneMine.GetComponent <PolygonCollider2D>());
                            action2Type = 0;
                        }
                        else if (action2Type == 3)
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(dash, 0f);
                            oldScale = GetComponent <Rigidbody2D>().gravityScale;
                            GetComponent <Rigidbody2D>().gravityScale = 0;
                            ableToMove  = false;
                            action2Type = 0;
                            Invoke("StopDashing", 0.5f);
                        }
                    }
                }
            }
            else if (tutorialAbleToMove)
            {
                if (waypointIndex < waypoints.Count)
                {
                    transform.position = Vector2.MoveTowards(transform.position, new Vector2(waypoints[waypointIndex].transform.position.x, transform.position.y), speed * speedAmplifier * Time.deltaTime);
                }
                if (GetComponent <Rigidbody2D>().velocity.y > 1)
                {
                    GetComponent <Animator>().Play("jump");
                }
                else if (GetComponent <Rigidbody2D>().velocity.y < -1)
                {
                    GetComponent <Animator>().Play("fall");
                }
                else
                {
                    GetComponent <Animator>().Play("run");
                }
                if (waypointIndex < waypoints.Count)
                {
                    if (waypoints[waypointIndex].transform.position.y - transform.position.y > 0.25f && GetComponent <Rigidbody2D>().gravityScale == 1)
                    {
                        if (grounded)
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, jumpHeight * jumpHeightAmplifier);
                            jump.Play();
                        }
                    }
                    else if (waypoints[waypointIndex].transform.position.y - transform.position.y < -0.25f && GetComponent <Rigidbody2D>().gravityScale == -1)
                    {
                        if (grounded)
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, -jumpHeight * jumpHeightAmplifier);
                            jump.Play();
                        }
                    }
                    if (Vector2.Distance(transform.position, waypoints[waypointIndex].transform.position) < 0.5f)
                    {
                        waypointIndex++;
                    }
                }
            }
        }
    }
コード例 #35
0
 public void EnterLogInPopUp()
 {
     masukButton.Click();
     CustomControls.SwitchFrameTo(loginFrame);
 }
コード例 #36
0
    public void Update()
    {
        bool ret = false;

        if (bot == false)
        {
            try
            {
                CustomControls.GetButton(joystick, button1);
                joystick.Poll();
                FindObjectOfType <ControllerDisconnect>().Reconnect(playerNumber);
            }
            catch
            {
                FindObjectOfType <ControllerDisconnect>().Disconnect(playerNumber);
                joystick = FindObjectOfType <PlayerData>().controllers[playerNumber];
                button1  = FindObjectOfType <PlayerData>().button1[playerNumber];
                button2  = FindObjectOfType <PlayerData>().button2[playerNumber];
                ret      = true;
            }
        }
        if (ret)
        {
            return;
        }

        if (Time.timeScale != 0)
        {
            if (!bot)
            {
                if (tutorialAbleToMove)
                {
                    Movement();
                    Shoot();
                    Ultimate();
                }
            }
            else if (tutorialAbleToMove)
            {
                timeBetweenStyles += Time.deltaTime;
                if (difficulty == "easy")
                {
                    if (botShoot)
                    {
                        if (UnityEngine.Random.Range(1, 100000) % 20 == 0)
                        {
                            GetComponent <SpaceShooter_Player>().BotShoot();
                        }
                    }
                }
                else if (difficulty == "normal")
                {
                    if (botShoot)
                    {
                        if (UnityEngine.Random.Range(1, 100000) % 5 == 0)
                        {
                            GetComponent <SpaceShooter_Player>().BotShoot();
                        }
                    }
                }
                else
                {
                    GetComponent <SpaceShooter_Player>().BotShoot();
                }
                if (!isTrained)
                {
                    if (botPlayStyle == "aggresive")
                    {
                        if (currentTarget == null)
                        {
                            float      minDistance   = 9999;
                            GameObject currentPlayer = null;
                            players = FindObjectsOfType <SpaceShooter_Player>();
                            for (int i = 0; i < players.Length; i++)
                            {
                                if (players[i] != null)
                                {
                                    if (Vector2.Distance(players[i].transform.position, transform.position) < minDistance && players[i] != GetComponent <SpaceShooter_Player>() && players[i].team != GetComponent <SpaceShooter_Player>().team)
                                    {
                                        minDistance   = Vector2.Distance(players[i].transform.position, transform.position);
                                        currentPlayer = players[i].gameObject;
                                    }
                                }
                            }
                            currentTarget = currentPlayer;
                        }
                        if (timeBetweenStyles >= timeTillAggro && difficulty != "easy")
                        {
                            timeBetweenStyles = 0;
                            botPlayStyle      = "defensive";
                            currentTarget     = null;
                        }
                        if (currentTarget != null)
                        {
                            if (difficulty != "easy")
                            {
                                transform.position = Vector2.MoveTowards(transform.position, new Vector2(currentTarget.transform.position.x, transform.position.y), Time.deltaTime * shipSpeed / 4 * 3);
                            }
                            else
                            {
                                transform.position = Vector2.MoveTowards(transform.position, new Vector2(currentTarget.transform.position.x, transform.position.y), Time.deltaTime * shipSpeed / 2);
                            }
                        }
                    }
                    else
                    {
                        if (timeBetweenStyles >= timeTillDef)
                        {
                            timeBetweenStyles = 0;
                            botPlayStyle      = "aggresive";
                        }
                        if (target != null)
                        {
                            Vector3 newPos = Vector2.MoveTowards(transform.position, new Vector2(target.transform.position.x, transform.position.y), Time.deltaTime * shipSpeed / 4 * 3);
                            transform.position = transform.position + (transform.position - newPos);
                            if (newPos.x == transform.position.x)
                            {
                                newPos             = Vector2.MoveTowards(transform.position, new Vector2(target.transform.position.x + UnityEngine.Random.Range(0.1f, -0.1f), transform.position.y), Time.deltaTime * shipSpeed / 4 * 3);
                                transform.position = transform.position + (transform.position - newPos);
                            }
                        }
                    }
                }
                transform.position = new Vector3(transform.position.x, transform.position.y, 0);
            }
        }
        teamColor.transform.localEulerAngles = -transform.eulerAngles;
    }
コード例 #37
0
    void Update()
    {
        if (FindObjectOfType <PlayerData>() != null)
        {
            if (joystick != null)
            {
                bool ret = false;
                if (bot == false)
                {
                    try
                    {
                        joystick.Poll();
                    }
                    catch
                    {
                        joystick = FindObjectOfType <PlayerData>().controllers[playerNumber];
                        try
                        {
                            joystick.Poll();
                        }
                        catch
                        {
                            FindObjectOfType <PlayerData>().pendingControllers[playerNumber] = true;
                        }
                        button1      = FindObjectOfType <PlayerData>().button1[playerNumber];
                        button2      = FindObjectOfType <PlayerData>().button2[playerNumber];
                        ret          = true;
                        color1Index  = 0;
                        color2Index  = 0;
                        color1.color = colors[0];
                        color2.color = colors[0];
                        FindObjectOfType <PlayerData>().color1[playerNumber] = color1.color;
                        FindObjectOfType <PlayerData>().color2[playerNumber] = color2.color;
                        UI.SetActive(false);
                        joined = false;
                        botObj.SetActive(true);
                        FindObjectOfType <PlayerData>().players.Remove(playerNumber);
                        return;
                    }
                }
                if (ret)
                {
                    return;
                }
            }
            else
            {
                if (FindObjectOfType <PlayerData>().controllers[playerNumber] != null)
                {
                    joystick = FindObjectOfType <PlayerData>().controllers[playerNumber];
                    try
                    {
                        joystick.Poll();
                    }
                    catch
                    {
                        FindObjectOfType <PlayerData>().pendingControllers[playerNumber] = true;
                    }
                    button1 = FindObjectOfType <PlayerData>().button1[playerNumber];
                    button2 = FindObjectOfType <PlayerData>().button2[playerNumber];
                }
            }
        }

        timeTillScene += Time.deltaTime;
        if (joystick != null)
        {
            if (CustomControls.GetButton(joystick, button1))
            {
                Action1();
            }
            else
            {
                CancelAction1();
            }
            if (CustomControls.GetButton(joystick, button2))
            {
                Action2();
            }
            else
            {
                CancelAction2();
            }
            if (keyboard)
            {
                if (CustomControls.GetButton(joystick, dreapta))
                {
                    if (axis == false)
                    {
                        axis = true;
                        if (opposite == false)
                        {
                            SelectDreapta();
                        }
                        else
                        {
                            SelectStanga();
                        }
                    }
                }
                else if (CustomControls.GetButton(joystick, stanga))
                {
                    if (axis == false)
                    {
                        axis = true;
                        if (opposite == false)
                        {
                            SelectStanga();
                        }
                        else
                        {
                            SelectDreapta();
                        }
                    }
                }
                else
                {
                    axis = false;
                }
            }
            else
            {
                if (CustomControls.GetAxis(joystick).Xaxis > 40000)
                {
                    if (axis == false)
                    {
                        axis = true;
                        if (opposite == false)
                        {
                            SelectDreapta();
                        }
                        else
                        {
                            SelectStanga();
                        }
                    }
                }
                else if (CustomControls.GetAxis(joystick).Xaxis < 20000)
                {
                    if (axis == false)
                    {
                        axis = true;
                        if (opposite == false)
                        {
                            SelectStanga();
                        }
                        else
                        {
                            SelectDreapta();
                        }
                    }
                }
                else
                {
                    axis = false;
                }
            }
        }
    }
コード例 #38
0
ファイル: HolderForm.cs プロジェクト: Narinyir/DantesPlayer
 public static void HandleBarMovementAudio(
     CustomControls.CustomSlider slider, DirectXAllias::Audio audio)
 {
     if (CheckException.CheckNull(audio))
     {
         audio.CurrentPosition = slider.Value;
     }
 }
コード例 #39
0
    // Update is called once per frame
    void Update()
    {
        bool ret = false;

        if (bot == false)
        {
            try
            {
                CustomControls.GetButton(joystick, button1);
                joystick.Poll();
                FindObjectOfType <ControllerDisconnect>().Reconnect(playerNumber);
            }
            catch
            {
                FindObjectOfType <ControllerDisconnect>().Disconnect(playerNumber);
                joystick = FindObjectOfType <PlayerData>().controllers[playerNumber];
                button1  = FindObjectOfType <PlayerData>().button1[playerNumber];
                button2  = FindObjectOfType <PlayerData>().button2[playerNumber];
                ret      = true;
            }
        }
        if (ret)
        {
            return;
        }
        if (bot == false)
        {
            delta += Time.deltaTime;
            if (delta >= 1)
            {
                delta = 0;
                try
                {
                    joystick.Poll();
                }
                catch
                {
                    joystick = FindObjectOfType <PlayerData>().controllers[playerNumber];
                    button1  = PlayerPrefs.GetInt(joystick.Information.ProductName + "1", 0);
                    button2  = PlayerPrefs.GetInt(joystick.Information.ProductName + "2", 2);
                    if ((joystick.Information.Type == SharpDX.DirectInput.DeviceType.Keyboard) == false)
                    {
                        keyboard = false;
                    }
                }
            }
        }
        if (Time.timeScale != 0)
        {
            if (teamColor != null)
            {
                teamColor.transform.localEulerAngles = -transform.eulerAngles;
            }
            if (!bot)
            {
                if (dashAnim == false && tutorialAbleToMove)
                {
                    if (keyboard)
                    {
                        if (CustomControls.GetButton(joystick, stanga))
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(-speed, GetComponent <Rigidbody2D>().velocity.y);
                        }
                        else if (CustomControls.GetButton(joystick, dreapta))
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(speed, GetComponent <Rigidbody2D>().velocity.y);
                        }
                        else
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(0, GetComponent <Rigidbody2D>().velocity.y);
                        }
                        if (CustomControls.GetButton(joystick, sus))
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, speed);
                        }
                        else if (CustomControls.GetButton(joystick, jos))
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, -speed);
                        }
                        else if ((CustomControls.GetAxis(joystick).Yaxis > 40000 || CustomControls.GetAxis(joystick).Yaxis < 20000 || CustomControls.GetAxis(joystick).Xaxis > 40000 || CustomControls.GetAxis(joystick).Xaxis < 20000))
                        {
                            GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, 0);
                        }
                    }
                    else if ((CustomControls.GetAxis(joystick).Yaxis > 40000 || CustomControls.GetAxis(joystick).Yaxis < 20000 || CustomControls.GetAxis(joystick).Xaxis > 40000 || CustomControls.GetAxis(joystick).Xaxis < 20000))
                    {
                        GetComponent <Rigidbody2D>().velocity = new Vector2(speed * (CustomControls.GetAxis(joystick).Xaxis - 32767) / 32767, -speed * (CustomControls.GetAxis(joystick).Yaxis - 32767) / 32767);
                    }
                    else
                    {
                        GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);
                    }

                    if (keyboard)
                    {
                        if ((CustomControls.GetButton(joystick, stanga) || CustomControls.GetButton(joystick, dreapta) || CustomControls.GetButton(joystick, jos) || CustomControls.GetButton(joystick, sus)))
                        {
                            float rotZ = transform.rotation.z;
                            transform.rotation = Quaternion.LookRotation(GetComponent <Rigidbody2D>().velocity * 100, new Vector3(0, 0, 1));
                            transform.rotation = new Quaternion(0, 0, transform.rotation.z, transform.rotation.w);
                            if (GetComponent <Rigidbody2D>().velocity == new Vector2(0, 0))
                            {
                                transform.rotation = new Quaternion(0, 0, rotZ, transform.rotation.w);
                            }
                        }
                    }
                    else
                    {
                        if ((CustomControls.GetAxis(joystick).Yaxis > 40000 || CustomControls.GetAxis(joystick).Yaxis < 20000 || CustomControls.GetAxis(joystick).Xaxis > 40000 || CustomControls.GetAxis(joystick).Xaxis < 20000))
                        {
                            float rotZ = transform.rotation.z;
                            transform.rotation = Quaternion.LookRotation(GetComponent <Rigidbody2D>().velocity * 100, new Vector3(0, 0, 1));
                            transform.rotation = new Quaternion(0, 0, transform.rotation.z, transform.rotation.w);
                            if (GetComponent <Rigidbody2D>().velocity == new Vector2(0, 0))
                            {
                                transform.rotation = new Quaternion(0, 0, rotZ, transform.rotation.w);
                            }
                        }
                    }
                    if (CustomControls.GetButton(joystick, button1))
                    {
                        if (trap == true)
                        {
                            if (usedTrap == false)
                            {
                                GameObject trapClone = Instantiate(trapObj);
                                trapClone.transform.position = transform.position;
                                AudioSource.PlayClipAtPoint(beartrapsetup, Camera.main.transform.position);
                                usedTrap = true;
                            }
                        }
                        else
                        {
                            GetComponent <Rigidbody2D>().velocity = -transform.up * dashSpeed;
                            dashAnim = true;
                            AudioSource.PlayClipAtPoint(dash, Camera.main.transform.position);
                            Invoke("StopDash", 0.25f);
                        }
                    }
                    else
                    {
                        lockedRot = false;
                    }
                    if (CustomControls.GetButton(joystick, button2) && canAttack)
                    {
                        if (bulletPos.GetComponent <ZombieSurvival_wallDetect>().wall == null)
                        {
                            GameObject blt = Instantiate(bullet);
                            blt.transform.position = bulletPos.transform.position;
                            blt.GetComponent <ZombieSurvival_bullet>().damage = bltDmg;
                            blt.GetComponent <ZombieSurvival_bullet>().parent = gameObject;
                            blt.transform.rotation = transform.rotation;
                            blt.GetComponent <Rigidbody2D>().velocity = -transform.up * bltSpd;
                        }
                        GetComponent <AudioSource>().Play();
                        canAttack = false;
                        Invoke("CanAttack", atkSpd);
                    }
                }
            }
        }
    }
コード例 #40
0
ファイル: BasicCity.cs プロジェクト: Jiwan/Civilisation
        /// <summary>
        /// Renders the specified map viewer.
        /// </summary>
        /// <param name="mapViewer">The map viewer.</param>
        /// <param name="drawingContext">The drawing context.</param>
        /// <param name="playerColor">Color of the player.</param>
        public void Render(CustomControls.MapViewer mapViewer, System.Windows.Media.DrawingContext drawingContext, System.Windows.Media.Color playerColor)
        {
            if (mapViewer.IsInView(position))
            {
                Rect rect = mapViewer.GetRectangle((int)position.X, (int)position.Y);

                drawingContext.DrawImage(Tile, rect);
            }

            foreach (Point point in controlledCases)
            {
                if (mapViewer.IsInView(point))
                {
                    Rect rect = mapViewer.GetRectangle((int)point.X, (int)point.Y);

                    SolidColorBrush myBrush = new SolidColorBrush(playerColor);
                    myBrush.Opacity = 0.3;
                    drawingContext.DrawRectangle(myBrush, null, rect);
                }
            }
        }