コード例 #1
0
        public void WhenActionIsAddedThenActionIsNotExecuted()
        {
            ActionManager  manager    = new ActionManager();
            Mock <IAction> actionMock = new Mock <IAction>();

            manager.Add(actionMock.Object);
            actionMock.Verify(x => x.Do(), Times.Never());
        }
コード例 #2
0
        public void WhenActionIsAddedThenActionCanBeUndone()
        {
            ActionManager  manager    = new ActionManager();
            Mock <IAction> actionMock = new Mock <IAction>();

            manager.Add(actionMock.Object);
            Assert.IsTrue(manager.CanUndo());
            Assert.IsNotNull(manager.GetCurrentUndoAction());
        }
コード例 #3
0
            //public void Damage( Unit target_unit, int value )
            //{
            //    var game_main = GameMain.GetInstance();
            //    var g3d_map = game_main.g3d_map;
            //    var pos = g3d_map.GetScreenPositionByUnitTop(target_unit.map_x, target_unit.map_y);

            //    ActionManager.Add(new ActionDamage(15, pos.X, pos.Y, value, target_unit));
            //}
            public void ActionShoot(int start_map_x, int start_map_y, int start_height_offset, int target_map_x, int target_map_y, int target_height_offset)
            {
                var game_main = GameMain.GetInstance();
                var g3d_map   = game_main.g3d_map;

                var height_offset  = 1.0f;
                var route_as_shoot = new RouteAsShoot(start_map_x, start_map_y, height_offset, target_map_x, target_map_y, height_offset, 0);

                ActionManager.Add(new ActionShootArrow(0, route_as_shoot, true));
            }
コード例 #4
0
ファイル: Main.cs プロジェクト: welcometochristown/UsbEvent
        private void ActionCreate <T>(UsbDevice device) where T : EventAction, new ()
        {
            var action = new T()
            {
                device = device
            };

            if (action.EditAction() == DialogResult.OK)
            {
                ActionManager.Add(action);
                RefreshActions();
            }
        }
コード例 #5
0
        public ActionResult HuoDong(action info)
        {
            //查询出总经费
            MoneyManager aa  = new MoneyManager();
            money        mys = aa.GetByPK(1);

            if (info.actionneedmoney <= mys.overmoney)
            {
                ActionManager a  = new ActionManager();
                var           qq = a.Add(info);

                if (qq)
                {
                    //判断是否以批准,
                    if (info.actiontype.Equals("通过"))
                    {
                        if (mys.overmoney == null)
                        {
                            mys.overmoney = 0;
                        }
                        if (mys.openmoney == null)
                        {
                            mys.openmoney = 0;
                        }
                        //修改总经费
                        money my = new money();
                        if (my.overmoney == null)
                        {
                            my.overmoney = 0;
                        }
                        if (my.openmoney == null)
                        {
                            my.openmoney = 0;
                        }
                        my.sunId     = 1;
                        my.overmoney = (mys.overmoney - info.actionneedmoney);
                        my.openmoney = (mys.openmoney + info.actionneedmoney);
                        MoneyManager aq  = new MoneyManager();
                        var          boo = aq.Update(my);
                        if (boo)
                        {
                            return(Redirect("~/ZhengLiang/FinanceHT/HuoDong"));
                        }
                        else
                        {
                            return(Content("<script>alert('异常')</script>;window.location = '/ZhengLiang/FinanceHT/HuoDongJiLu');</script>"));
                        }
                    }
                    else
                    {
                        return(Redirect("~/ZhengLiang/FinanceHT/HuoDong"));
                    }
                }
                else
                {
                    return(Content("<script>alert('添加失败';window.location = '/ZhengLiang/FinanceHT/HuoDong');</script>"));
                }
            }
            else
            {
                return(Content("<script>alert('余额不足');window.location = '/ZhengLiang/FinanceHT/HuoDong';</script>"));
            }
        }
コード例 #6
0
        /// <summary>
        /// Constructs a demo object with the appropriate gui.
        /// </summary>
        public DemoWindow()
            : base("Moonfire Games' Gtk Demo")
        {
            // Create a window
            SetDefaultSize(1000, 800);
            DeleteEvent += OnWindowDelete;

            demoComponents = new DemoComponents();

            // Create a user action manager.
            var actionManager = new ActionManager(this);

            actionManager.Add(GetType().Assembly);

            demoConfiguratorsTab = new DemoConfiguratorsTab(this);

            actionManager.Add(demoConfiguratorsTab);

            demoActions = new DemoActions(actionManager);

            // Load the layout from the file system.
            layout = new ActionLayout(new FileInfo("ActionLayout1.xml"));
            actionManager.SetLayout(layout);

            // Load the keybinding from a file.
            keybindings = new ActionKeybindings(new FileInfo("ActionKeybindings1.xml"));
            actionManager.SetKeybindings(keybindings);

            // Create the window frame
            var box = new VBox();

            Add(box);

            // Create the components we need before the menu.
            notebook = new Notebook();

            actionManager.Add(new SwitchPageAction(notebook, 0, "Components"));
            actionManager.Add(new SwitchPageAction(notebook, 1, "Text Editor"));
            actionManager.Add(new SwitchPageAction(notebook, 2, "Actions"));
            actionManager.Add(new SwitchPageAction(notebook, 3, "Configurators"));

            // Create a notebook
            notebook.BorderWidth = 5;

            notebook.AppendPage(demoComponents, new Label("Components"));
            notebook.AppendPage(demoActions, new Label("Actions"));
            notebook.AppendPage(demoConfiguratorsTab, new Label("Configurators"));

            // Add the status bar
            statusbar = new Statusbar();
            statusbar.Push(0, "Welcome!");
            statusbar.HasResizeGrip = true;

            // Create the menu
            menubar = new MenuBar();

            // Back everything into place.
            box.PackStart(CreateGuiMenu(), false, false, 0);
            box.PackStart(notebook, true, true, 0);
            box.PackStart(statusbar, false, false, 0);
        }
コード例 #7
0
            public void Action(string script_path, dynamic param)
            {
                var de = new DrawEffect(script_manager.GetPath(script_path), param);

                ActionManager.Add(de);
            }