示例#1
0
 public void InputMessageEvent(NeoAxis.Component_InputProcessing sender, NeoAxis.UIControl playScreen, NeoAxis.Component_GameMode gameMode, NeoAxis.InputMessage message)
 {
     if (sender.IsKeyPressed(EKeys.Space) && message.GetType().ToString() == "NeoAxis.InputMessageKeyPress")
     {
         lifeValue = lifeValue + 1;
         OnSignal?.Invoke(lifeValue);
         //ScreenMessages.Add("Space");
     }
 }
        private void mouseUp(NeoAxis.UIControl sender, NeoAxis.EMouseButtons button)
        {
//          if(drag) {
//			    showdimg((UIImage)sender, false);
//				dragparent = null;
//				drag = false;

//                ScreenMessages.Add("MouseUp" + ", " + sender.GetPathFromRoot());
//			}
        }
        private void mouseDown(NeoAxis.UIControl sender, NeoAxis.EMouseButtons button)
        {
            if (!drag)
            {
                drag       = true;
                dragparent = (UIWindow)sender.Parent;
                windFrom   = dragparent.Name;
                indxFrom   = sender.Name;
                ScreenMessages.Add("windFrom = " + windFrom + ", indxFrom = " + indxFrom);
                var imagePath = InvUtils.getImagePath(SimulationApp.PlayerInv, int.Parse(indxFrom));
                showdimg((UIImage)sender, true, imagePath);


                dragsx = MousePosition.X;
                dragsy = MousePosition.Y;
                dragox = dragsx - ((UIImage)sender).GetScreenPosition().X;
                dragoy = dragsy - ((UIImage)sender).GetScreenPosition().Y;

                //ScreenMessages.Add("MouseDown " + dragsx + ", " + dragsy + ", " + sender.GetPathFromRoot());
            }
            else
            {
                indxTo = sender.Name;
                windTo = sender.Parent?.Name;
                ScreenMessages.Add("windTo = " + windTo + ", indxTo = " + indxTo);

                if (windFrom == "Window 1" && windTo == "Window 1" && indxFrom != "" && indxTo != "")
                {
                    /*var prevName = SimulationApp.PlayerInv.items[int.Parse(indxFrom)].Name;
                     * var prevcur = SimulationApp.PlayerInv.items[int.Parse(indxFrom)].Current;
                     * var res1 = InvUtils.GetItems(SimulationApp.PlayerInv, SimulationApp.PlayerInv.items[int.Parse(indxFrom)].Name, int.Parse(indxFrom), SimulationApp.PlayerInv.items[int.Parse(indxFrom)].Current);
                     * if(res1 >= 0) {
                     *      var res2 = InvUtils.AddItems(SimulationApp.PlayerInv, prevName, int.Parse(indxTo), prevcur);
                     * }*/
                    var res = InvUtils.tryMoveItems(SimulationApp.PlayerInv, int.Parse(indxFrom), int.Parse(indxTo));
                    if (res >= 0)
                    {
                        var res1 = InvUtils.MoveItems(SimulationApp.PlayerInv, int.Parse(indxFrom), int.Parse(indxTo));
                    }
                }

                windFrom = "";
                windTo   = "";
                indxFrom = "";
                indxTo   = "";

                showdimg((UIImage)sender, false, "");
                dragparent = null;
                drag       = false;
                RedrawImages();
                //ScreenMessages.Add("MouseDown1" + ", " + sender.GetPathFromRoot());
            }
        }
        private void mouseMove(NeoAxis.UIControl sender)
        {
            if (drag && dragimg == sender)
            {
                dragex = MousePosition.X - dragox;
                dragey = MousePosition.Y - dragoy;

                var pos = cpos;
                pos.Left = dragex;
                pos.Top  = dragey;
                ((UIImage)this.GetComponentByPath("DragImage")).Margin = pos;

                //ScreenMessages.Add("MouseMove " + dragex + ", " + dragey + ", " + sender.GetPathFromRoot());
            }
        }
        protected override bool OnKeyDown(KeyEvent e)
        {
            if (e.Key == EKeys.Escape)
            {
                if (drag)
                {
                    showdimg(null, false);
                    dragparent = null;
                    drag       = false;

                    //ScreenMessages.Add("Esc global");
                }

                return(true);
            }

            return(base.OnKeyDown(e));
        }
        public void showdimg(NeoAxis.UIImage img, bool show)
        {
            var dimg = (UIImage)this.GetComponentByPath("DragImage");

            if (show)
            {
                dragimg      = img;
                dimg.Margin  = cpos;
                dimg.Enabled = true;
                //ScreenMessages.Add("showdimg true, " + img?.GetPathFromRoot());
            }
            else
            {
                dragimg      = null;
                dimg.Margin  = cpos;
                dimg.Enabled = false;
                //ScreenMessages.Add("showdimg false, " + img?.GetPathFromRoot());
            }
        }
        public void showdimg(NeoAxis.UIImage img, bool show, String imagePath)
        {
            var dimg = (UIImage)this.GetComponentByPath("DragImage");

            if (show)
            {
                dragimg          = img;
                dimg.Margin      = cpos;
                dimg.SourceImage = ReferenceUtility.MakeReference <Component_Image>(imagePath);
                dimg.Enabled     = true;
                //ScreenMessages.Add("showdimg true, " + img?.GetPathFromRoot());
            }
            else
            {
                dragimg     = null;
                dimg.Margin = cpos;
                var imagePath1 = InvUtils.getImagePath(SimulationApp.PlayerInv, "Empty");
                dimg.SourceImage = ReferenceUtility.MakeReference <Component_Image>(imagePath1);
                dimg.Enabled     = false;
                //ScreenMessages.Add("showdimg false, " + img?.GetPathFromRoot());
            }
        }
//		public void showdimg(NeoAxis.UIImage img, bool show, String imagePath)
//		{
//			var dimg = (UIImage)this.GetComponentByPath("DragImage");
//			if(show) {
//				dragimg = img;
//				dimg.Margin = cpos;
//				dimg.SourceImage = ReferenceUtility.MakeReference<Component_Image>(imagePath);
//				dimg.Enabled = true;
//				//ScreenMessages.Add("showdimg true, " + img?.GetPathFromRoot());
//			} else {
//				dragimg = null;
//                dimg.Margin = cpos;
//                var imagePath1 = InvUtils.getImagePath(SimulationApp.PlayerInv, "Empty");
//                dimg.SourceImage = ReferenceUtility.MakeReference<Component_Image>(imagePath1);
//                dimg.Enabled = false;
//				//ScreenMessages.Add("showdimg false, " + img?.GetPathFromRoot());
//            }
//		}


        private void mouseDown(NeoAxis.UIControl sender, NeoAxis.EMouseButtons button)
        {
            if (!drag)
            {
                drag       = true;
                dragparent = (UIWindow)sender.Parent;
                windFrom   = dragparent.Name;
                indxFrom   = sender.Name;
                ScreenMessages.Add("windFrom = " + windFrom + ", indxFrom = " + indxFrom);
                //var imagePath = InvUtils.getImagePath(SimulationApp.PlayerInv, int.Parse(indxFrom));
                showdimg((UIImage)sender, true);


                dragsx = MousePosition.X;
                dragsy = MousePosition.Y;
                dragox = dragsx - ((UIImage)sender).GetScreenPosition().X;
                dragoy = dragsy - ((UIImage)sender).GetScreenPosition().Y;

                //ScreenMessages.Add("MouseDown " + dragsx + ", " + dragsy + ", " + sender.GetPathFromRoot());
            }
            else
            {
                indxTo = sender.Name;
                windTo = sender.Parent?.Name;
                ScreenMessages.Add("windTo = " + windTo + ", indxTo = " + indxTo);

                windFrom = "";
                windTo   = "";
                indxFrom = "";
                indxTo   = "";

                showdimg((UIImage)sender, false);
                dragparent = null;
                drag       = false;
                RedrawImages();
                //ScreenMessages.Add("MouseDown1" + ", " + sender.GetPathFromRoot());
            }
        }
 public void Image_MouseMove2(NeoAxis.UIControl sender)
 {
     mouseMove(sender);
 }
 public void Image_MouseUp2(NeoAxis.UIControl sender, NeoAxis.EMouseButtons button, ref bool handled)
 {
     //mouseUp(sender, button);
 }
 public void Image_MouseDown1(NeoAxis.UIControl sender, NeoAxis.EMouseButtons button, ref bool handled)
 {
     mouseDown(sender, button);
 }
        public void InputProcessing_InputMessageEvent(NeoAxis.Component_InputProcessing sender, NeoAxis.UIControl playScreen, NeoAxis.Component_GameMode gameMode, NeoAxis.InputMessage message)
        {
            var car = Owner.Parent.Parent;

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