Esempio n. 1
0
        internal bool UserRightMouseDown(BoxControl boxControl, int value)
        {
            // Right Mouse Button on a possibility
            // means user wants remove this possibility
            System.Diagnostics.Trace.WriteLine("PuzzleManager: received RMouse Down from " + boxControl.Name + ", value " + value);
            // strip the bc and convert to an integer
            string name = boxControl.Name;

            name = name.Replace("bc", "");
            int index = Int32.Parse(name);

            // check the puzzle possibilites at index
            if (_puzzle.Squares[index].RequestPossibilityRemove(value) == true)
            {
                _statusString = "You're right -- " + value.ToString() + " isn't possible in square " + name;
                OnPropertyChanged("StatusString");
                return(true);
            }
            else
            {
                _statusString = "WRONG -- you can't remove " + value.ToString() + " as a possibility from square " + name + ". Try again.";
                OnPropertyChanged("StatusString");
                return(false);
            }
        }
Esempio n. 2
0
        internal bool UserLeftMouseDown(BoxControl boxControl, int value)
        {
            // Left Mouse Button on a possibility
            // means user wants to set this value as the answer to this square
            System.Diagnostics.Trace.WriteLine("PuzzleManager: received LMouse Down from " + boxControl.Name + ", value " + value);
            // strip the bc and convert to an integer
            string name = boxControl.Name;

            name = name.Replace("bc", "");
            int index = Int32.Parse(name);

            // check the puzzle answers at index
            if (_puzzle.Squares[index].AnswerValue == value)
            {
                // set Solved
                _puzzle.Squares[index].SetSolved();
                _statusString = ("SOLVED square " + index + " with a value of " + value);
                OnPropertyChanged("StatusString");
                OnPropertyChanged("SolvedString");
                NewSolvePossiblesRemove(index, value);
                return(true);
            }
            else
            {
                _statusString = ("WRONG -- The answer to square " + index + " is not " + value + "... Try Again");
                OnPropertyChanged("StatusString");
                return(false);
            }
        }
 void Start()
 {
     incomePoints     = GameObject.FindGameObjectsWithTag("InPoints");
     gm               = GameObject.FindObjectOfType <GameManager>();
     scm              = GameObject.FindObjectOfType <ScoreManager>();
     incomePoints     = incomePoints.OrderBy(orderPlatform => orderPlatform.transform.position.z).ToArray();
     wpIndex          = incomePoints.Length - 1;
     finalEndPoint    = Vector3.zero;
     boxControlStates = BoxControl.spawn;
 }
        private void OnTriggerExit2D(Collider2D collision)
        {
            if (collision.tag == "Ladder")
            {
                can_climb_ladder = false;
            }

            if (collision.tag == "Box")
            {
                current_picked_box = null;
                can_pick_up        = false;
            }
            if (collision.tag == "LadderTree" && is_fighter)       // For fighter can climb tree   must a tag "LadderTree"
            {
                can_climb_ladder = false;
            }
        }
        private void OnTriggerEnter2D(Collider2D collision)
        {
            if (collision.tag == "Ladder")
            {
                can_climb_ladder = true;
            }

            if (collision.tag == "Box")
            {
                current_picked_box = collision.gameObject.GetComponent <BoxControl>();
                can_pick_up        = true;
            }
            if (collision.tag == "LadderTree" && is_fighter)        // For fighter can climb tree   must a tag "LadderTree"
            {
                can_climb_ladder = true;
            }
        }
Esempio n. 6
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="control"></param>
 public NameSpaceEditor(BoxControl <IEnclosesNameSpaces, NameSpace, AccessMode> control)
     : base(control)
 {
 }
Esempio n. 7
0
    // Update is called once per frame
    void Update()
    {
        BoxControl bc = box.GetComponent <BoxControl>();

        youCanJump = bc.AllGood;
    }
Esempio n. 8
0
        /// <summary>
        /// element选择
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GridElements_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var select = gridElements.SelectedValue;

            if (select != null)
            {
                WatchElement element = (WatchElement)select;
                foreach (UIElement item in canvasMain.Children)
                {
                    Selector.SetIsSelected(item, false);
                }
                if (element.DesignerControl.Visibility == Visibility.Visible)
                {
                    Selector.SetIsSelected(element.DesignerControl, true);
                }

                if (element.HWElement is HWImage)
                {
                    ImageControl image = new ImageControl();
                    image.WatchElement = element;
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(image);
                }
                else if (element.HWElement is HWBox)
                {
                    BoxControl boxControl = new BoxControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(boxControl);
                }
                else if (element.HWElement is HWLine)
                {
                    LineControl Line = new LineControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(Line);
                }
                else if (element.HWElement is HWCircle)
                {
                    CircleControl circelControl = new CircleControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(circelControl);
                }
                else if (element.HWElement is HWSelectImage)
                {
                    SelecteImageControl selecte = new SelecteImageControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(selecte);
                }
                else if (element.HWElement is HWTextareaWithOneWildCard)
                {
                    TextareaWithOneWildCardControl textCtrl = new TextareaWithOneWildCardControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(textCtrl);
                }
                else if (element.HWElement is HWTextareaWithTwoWildCard)
                {
                    TextareaWithTwoWildCardControl textCtrl = new TextareaWithTwoWildCardControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(textCtrl);
                }
                else if (element.HWElement is HWTextureMapper)
                {
                    TextureMapperControl texture = new TextureMapperControl
                    {
                        WatchElement = element
                    };
                    gridAttribute.Children.Clear();
                    gridAttribute.Children.Add(texture);
                }
                else
                {
                    gridAttribute.Children.Clear();
                }
            }
        }
    // Update is called once per frame
    void Update()
    {
        switch (boxStates)
        {
        case boxState.trackIn:
            if (transform.position != incomePoints[0].transform.position)
            {
                float step1 = moveSpeed * Time.deltaTime;
                transform.position = Vector3.MoveTowards(transform.position, incomePoints[wpIndex].transform.position, step1);
                if (transform.position == incomePoints[wpIndex].transform.position)
                {
                    whereIAm = incomePoints[wpIndex].name;
                    wpIndex--;
                    if (wpIndex < 0)
                    {
                        wpIndex = 0;
                    }
                    switch (wpIndex)
                    {
                    case 0:
                        boxControlStates = BoxControl.onPointD;
                        break;

                    case 1:
                        boxControlStates = BoxControl.onPointInstantiate_1;
                        break;

                    case 2:
                        boxControlStates = BoxControl.onPointC;
                        break;

                    case 3:
                        boxControlStates = BoxControl.onPointB;
                        break;

                    case 4:
                        boxControlStates = BoxControl.onPointA;
                        break;
                    }
                    //Debug.Log(wpIndex);
                }
            }
            else
            {
                boxStates = boxState.endOfTheTrackIn;
                if ((gm.players[1].GetComponent <UnitControler>().playerMoveIndex == 0 && gm.players[1].GetComponent <UnitControler>().playerStat == Units.unitStat.idle) && gm.players[1].GetComponent <UnitControler>().boxState == Units.unitBoxState.offHand)
                {
                    gm.players[1].transform.RotateAround(gm.players[1].transform.position, Vector3.up, 180);
                    gm.players[1].GetComponent <UnitControler>().rotationState = UnitControler.unitRotate.nonoriginal;
                    this.transform.SetParent(gm.players[1].GetComponent <UnitControler>().boxParent.transform, true);
                    this.gameObject.GetComponent <BoxUnit>().boxStates     = BoxUnit.boxState.playerHand;
                    gm.players[1].GetComponent <UnitControler>().boxState  = Units.unitBoxState.inHand;
                    gm.players[1].GetComponent <UnitControler>().activeBox = this.gameObject;
                    boxControlStates = BoxControl.inPlayerRightHand;
                }
                else
                {
                    boxControlStates = BoxControl.Fail;
                    //Debug.Log("START BUST!");
                    Destroy(this.gameObject);
                }
            }
            break;

        case boxState.onTrack:

            if (transform.position != endTrackPoint)
            {
                boxControlStates = BoxControl.inTrackStartPoint;
                float step2 = moveSpeed * Time.deltaTime;
                transform.position = Vector3.MoveTowards(transform.position, endTrackPoint, step2);
            }
            else
            {
                boxStates        = boxState.endOfTrack;
                boxControlStates = BoxControl.inTrackEndPoint;
                if (boxMoveDirection == TrackController.trackDirection.left)
                {
                    if (gm.players[0].GetComponent <UnitControler>().playerMoveIndex == trackIndex && gm.players[0].GetComponent <UnitControler>().playerStat == Units.unitStat.idle && gm.players[0].GetComponent <UnitControler>().boxState == Units.unitBoxState.offHand)
                    {
                        this.transform.SetParent(gm.players[0].GetComponent <UnitControler>().boxParent.transform, true);
                        this.gameObject.GetComponent <BoxUnit>().boxStates     = BoxUnit.boxState.playerHand;
                        gm.players[0].GetComponent <UnitControler>().boxState  = Units.unitBoxState.inHand;
                        gm.players[0].GetComponent <UnitControler>().activeBox = this.gameObject;
                        boxControlStates = BoxControl.inPlayerLeftHand;
                    }
                    else
                    {
                        //Debug.Log("BUST 2 LEFT!");
                        boxControlStates = BoxControl.Fail;
                        Destroy(this.gameObject);
                    }
                }
                else
                {
                    if (gm.players[1].GetComponent <UnitControler>().playerMoveIndex == trackIndex && gm.players[1].GetComponent <UnitControler>().playerStat == Units.unitStat.idle && gm.players[1].GetComponent <UnitControler>().boxState == Units.unitBoxState.offHand)
                    {
                        this.transform.SetParent(gm.players[1].GetComponent <UnitControler>().boxParent.transform, true);
                        this.gameObject.GetComponent <BoxUnit>().boxStates     = BoxUnit.boxState.playerHand;
                        gm.players[1].GetComponent <UnitControler>().boxState  = Units.unitBoxState.inHand;
                        gm.players[1].GetComponent <UnitControler>().activeBox = this.gameObject;
                        boxControlStates = BoxControl.inPlayerRightHand;
                    }
                    else
                    {
                        //Debug.Log("BUST 2 RIGHT!");
                        boxControlStates = BoxControl.Fail;
                        Destroy(this.gameObject);
                    }
                }
            }
            break;

        case boxState.trackOut:
            this.transform.parent = null;
            //Debug.Log(finalEndPoint);
            if (transform.position != finalEndPoint)
            {
                boxControlStates = BoxControl.onExitPlatform;
                float step3 = moveSpeed * Time.deltaTime;
                transform.position = Vector3.MoveTowards(transform.position, finalEndPoint, step3);
            }
            else
            {
                boxControlStates = BoxControl.onEnd;
                boxStates        = boxState.final;
                scm.Score        = scm.Score + rewardAmount;
                Destroy(this.gameObject);
            }
            break;
        }
    }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="control"></param>
 public RequirementSetEditor(BoxControl <IHoldsRequirementSets, RequirementSet, RequirementSetDependancy> control)
     : base(control)
 {
 }
Esempio n. 11
0
 /// <summary>
 ///     Factory for BoxEditor
 /// </summary>
 /// <param name="control"></param>
 /// <returns></returns>
 protected override BoxEditor <IHoldsRequirementSets, RequirementSet, RequirementSetDependancy> CreateBoxEditor(
     BoxControl <IHoldsRequirementSets, RequirementSet, RequirementSetDependancy> control)
 {
     return(new RequirementSetEditor(control));
 }
Esempio n. 12
0
        public void TestDotNetPrint()
        {
            var label = new Label()
            {
                Width        = 100,
                Height       = 60,
                GraphicsUnit = GraphicsUnit.Millimeter,
                Name         = "My Label Print"
            };
            Font  titleFont = new Font("黑体", 11, FontStyle.Bold);    //标题字体
            Font  fntTxt    = new Font("宋体", 10, FontStyle.Regular); //正文文字
            Font  fntTxt1   = new Font("宋体", 8, FontStyle.Regular);  //正文文字
            Brush brush     = new SolidBrush(Color.Black);           //画刷
            Pen   pen       = new Pen(Color.Black, 0.2f);            //线条颜色

            var boxControl = new BoxControl()
            {
                X      = 1,
                Y      = 1,
                Width  = 98,
                Height = 58,
                Pen    = pen
            };

            var titleText = new TextControl()
            {
                X       = 35,
                Y       = 2,
                Font    = titleFont,
                Brush   = brush,
                Content = "这里是抬头"
            };

            var horLine = new HorizontalLineControl()
            {
                X      = 2,
                Y      = 8,
                Pen    = pen,
                Length = 96
            };

            var qrCodeCntrol = new QrCodeControl()
            {
                X       = 2,
                Y       = 9,
                Height  = 30,
                Width   = 30,
                Content = "er wei ma bu zhi chi zhong wen ma ? 二维码不支持中文吗?",
            };

            var verLien = new VerticalLineControl()
            {
                X      = 33,
                Y      = 9,
                Pen    = pen,
                Length = 30
            };

            var contentText = new TextControl()
            {
                X       = 34,
                Y       = 9,
                Brush   = brush,
                Font    = fntTxt,
                Content = "物料编码"
            };

            var contentText1 = contentText.Copy() as TextControl;

            contentText1.X       = 51;
            contentText1.Font    = fntTxt1;
            contentText1.Content = "LSKJFDOWIEFW";

            label.Controls.Add(boxControl);
            label.Controls.Add(titleText);
            label.Controls.Add(horLine);
            label.Controls.Add(verLien);
            label.Controls.Add(qrCodeCntrol);
            label.Controls.Add(contentText);
            label.Controls.Add(contentText1);

            horLine        = horLine.Copy() as HorizontalLineControl;
            horLine.Y      = 40;
            horLine.Length = horLine.Length;
            label.Controls.Add(horLine);

            label.Print("Microsoft XPS Document Writer", 1);
        }
Esempio n. 13
0
 /// <summary>
 ///     Factory for BoxEditor
 /// </summary>
 /// <param name="control"></param>
 /// <returns></returns>
 protected override BoxEditor <StateMachine, State, Transition> CreateBoxEditor(
     BoxControl <StateMachine, State, Transition> control)
 {
     return(new StateEditor(control));
 }
Esempio n. 14
0
 /// <summary>
 ///     Factory for BoxEditor
 /// </summary>
 /// <param name="control"></param>
 /// <returns></returns>
 protected override BoxEditor <IEnclosesNameSpaces, NameSpace, AccessMode> CreateBoxEditor(
     BoxControl <IEnclosesNameSpaces, NameSpace, AccessMode> control)
 {
     return(new NameSpaceEditor(control));
 }
Esempio n. 15
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="control"></param>
 public StateEditor(BoxControl <StateMachine, State, Transition> control)
     : base(control)
 {
 }