private void handleEvent(ActionEvent obj)
 {
     if(obj == ActionEvent.BagChanged)
     {
         transition.ShowPage(new BookSelected());
     }
 }
Beispiel #2
0
	public static int AddDestroy(GameObject attackable, int index){
		ActionEvent actionEvent = new ActionEvent ();
		actionEvent.attackable = attackable;
		actionEvent.destroy = true;
		instance.actionEvents.Insert(index, actionEvent);
		return(instance.actionEvents.Count - 1);
	}
Beispiel #3
0
        protected override async Task<ActionEvent> NotifyActionEventAsync(ActionEvent actionEvent)
        {
            var type = actionEvent.Type;
            var typeName = type.GetDescription();
            var target = actionEvent.Target;

            switch (type)
            {
                case ActionEventType.EvtError:
                    {
                        var ex = (QQException)target;
                        Logger.LogError($"[Action={ActionName}, Result={typeName}, {ex}");
                        await _context.FireNotifyAsync(QQNotifyEvent.CreateEvent(QQNotifyEventType.Error, ex));
                        break;
                    }
                case ActionEventType.EvtRetry:
                    {
                        var ex = (QQException)target;
                        Logger.LogWarning($"[Action={ActionName}, Result={typeName}, RetryTimes={RetryTimes}][{ex.ToSimpleString()}]");
                        break;
                    }
                case ActionEventType.EvtCanceled:
                    Logger.LogWarning($"[Action={ActionName}, Result={typeName}, Target={target}]");
                    break;

                default:
                    Logger.LogDebug($"[Action={ActionName}, Result={typeName}]");
                    break;
            }
            return await base.NotifyActionEventAsync(actionEvent);
        }
Beispiel #4
0
	public static int AddShowCombatMenu(PartyMember partyMember, int index){
		ActionEvent actionEvent = new ActionEvent ();
		actionEvent.combatMenu = true;
		actionEvent.partyMember = partyMember;
		instance.actionEvents.Insert(index, actionEvent);
		return(instance.actionEvents.Count - 1);
	}
Beispiel #5
0
	public static int AddEvent(GameObject attacker, GameObject attackable, int damage, DamageTypes damageType, int index){
		ActionEvent actionEvent = new ActionEvent ();
		actionEvent.attackable = attackable;
		actionEvent.damage = damage;
		actionEvent.damageType = damageType;
		actionEvent.attacker = attacker;
		instance.actionEvents.Insert(index, actionEvent);
		return(instance.actionEvents.Count - 1);
	}
 private void handleEvent(ActionEvent obj)
 {
     switch (obj)
     {
         case ActionEvent.No_Account_Found:
             ModernDialog.ShowMessage("La carte de crédit n'a pas été reconnue", " Aucun Compte", MessageBoxButton.OK);
             break;
         case ActionEvent.PaymentRefused:
             ModernDialog.ShowMessage("Vous n'avez pas assez d'argent sur ce compte", "Paiement refusé", MessageBoxButton.OK);
             break;
         case ActionEvent.Pay_Success:
             ModernDialog.ShowMessage("Paiement effectué avec succès"," Paiement",MessageBoxButton.OK);
             break;
     }
 }
 protected virtual async Task<ActionEvent> NotifyActionEventAsync(ActionEvent actionEvent)
 {
     try
     {
         if (OnActionEvent != null) await OnActionEvent.Invoke(this, actionEvent);
         if (actionEvent.Type == ActionEventType.EvtRetry) ++RetryTimes;
         else RetryTimes = 0;
         return actionEvent;
     }
     catch (Exception ex)
     {
         ++RetryTimes;
         return await HandleExceptionAsync(ex);
     }
 }
Beispiel #8
0
    void OnTriggerEnter(Collider other)
    {
        ActionEvent interactable = other.GetComponent<ActionEvent>();

        if (interactable != null)
        {
            if (ParentEvent)
            {
                Init();
                m_currentEvent = interactable;
                m_triggerEvent = true;
                OnAction += ActionTrigger;
            }
        }
    }
Beispiel #9
0
        protected override void Perform(ActionEvent evt, Player player, MapElementInfo info, NVector pos,
                                        ActionHolder holder)
        {
            foreach (var data in holder.data)
            {
                if (!data.Key.StartsWith("res-"))
                {
                    continue;
                }

                string res = data.Key.Substring(4);


                if (!ProduceOneRes(evt, info, pos, ConvertHelper.Int(data.Value), res))
                {
                    return;
                }
            }
        }
Beispiel #10
0
 public EditWorkerViewModel(EditWorker editWorkerOpen, vwWorker workerEdit)
 {
     _editWorker         = editWorkerOpen;
     _worker             = workerEdit;
     _location           = new vwLocation();
     _gender             = new tblGender();
     _sector             = new tblSector();
     _manager            = new vwManager();
     LocationList        = _dbService.GetAllLocations();
     WorkerList          = _dbService.GetAllWorkerRecords();
     GenderList          = _dbService.GetAllGenders();
     SectorList          = _dbService.GetAllSectors();
     ManagerList         = _dbService.GetAllManagers();
     FirstNameBeforeEdit = _worker.FirstName;
     LastNameBeforeEdit  = _worker.LastName;
     JMBGBeforeEdit      = _worker.JMBG;
     actionEventObject   = new ActionEvent();
     actionEventObject.ActionPerformed += ActionPerformed;
 }
Beispiel #11
0
        public byte[] Execute(ActionEvent actionEvent, ActionContext context)
        {
            try
            {
                if (!InternalEventUpStream.InstanceLoaded)
                {
                    InternalEventUpStream.CreateEventUpStream(ConnectionString, EventHubName);
                    InternalEventUpStream.InstanceLoaded = true;
                }

                InternalEventUpStream.SendMessage(DataContext);
                actionEvent(this, context);
                return(null);
            }
            catch
            {
                actionEvent(this, null);
                return(null);
            }
        }
        public byte[] Execute(ActionEvent actionEvent, ActionContext context)
        {
            try
            {
                DataContext = EncodingDecoding.EncodingString2Bytes(To);
                //Console.WriteLine("In event before handle");
                //Console.WriteLine($"EVENT {context.BubblingConfiguration.MessageId} - {DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss.fff tt")}");

                actionEvent(this, context);

                return(null);
            }
            catch (Exception ex)
            {
                DataContext = EncodingDecoding.EncodingString2Bytes(ex.Message);
                ;
                actionEvent(this, context);
                return(null);
            }
        }
 public MainWindowViewModel(MainWindow mainOpen)
 {
     _main              = mainOpen;
     WorkerList         = _dataBaseService.GetAllWorkerRecords().ToList();
     LocationListFromDB = _dataBaseService.GetAllLocations();
     if (LocationListFromDB.Count == 0)
     {
         LocationListFromFile = LocationLoader.LoadLocations();
         _dataBaseService.AddLocationsToDataBase(LocationListFromFile);
     }
     actionEventObject = new ActionEvent();
     backgroundWorker1 = new BackgroundWorker()
     {
         WorkerReportsProgress      = true,
         WorkerSupportsCancellation = true,
     };
     backgroundWorker1.DoWork += DoWork;
     backgroundWorker1.RunWorkerAsync();
     actionEventObject.ActionPerformed += ActionPerformed;
 }
Beispiel #14
0
        protected override void Perform(ActionEvent evt, Player player, MapElementInfo info, NVector pos,
                                        ActionHolder holder)
        {
            UnitInfo self    = (UnitInfo)info;
            UnitInfo nonSelf = S.Unit().At(pos);

            //use the ap and heal the other
            //TODO Rate?
            if (self.data.ap >= nonSelf.data.hpMax - nonSelf.data.hp)
            {
                self.data.ap   -= nonSelf.data.hpMax + nonSelf.data.hp;
                nonSelf.data.hp = nonSelf.data.hpMax;
                nonSelf.AddNoti(S.T("healComplete"), DataAction().Icon);
                return;
            }

            nonSelf.data.hp += self.data.ap;
            nonSelf.AddNoti(S.T("healHp", self.data.ap), DataAction().Icon);
            self.data.ap = 0;
        }
 protected override Task <ActionEvent> HandleExceptionAsync(Exception ex)
 {
     // SyncUrl为空说明正在测试host
     if (Session.SyncUrl == null)
     {
         if (++RetryTimes < MaxReTryTimes)
         {
             return(NotifyActionEventAsync(ActionEvent.CreateEvent(ActionEventType.EvtRetry, ex)));
         }
         else
         {
             RetryTimes = 0;
             return(TestNextHost());
         }
     }
     else
     {
         return(base.HandleExceptionAsync(ex));
     }
 }
Beispiel #16
0
        /// <summary>
        /// Record the triggering of an action as an <see cref="ActionEventPtr">action event</see>.
        /// </summary>
        /// <param name="context"></param>
        /// <see cref="InputAction.performed"/>
        /// <see cref="InputAction.started"/>
        /// <see cref="InputAction.cancelled"/>
        /// <see cref="InputActionMap.actionTriggered"/>
        public unsafe void RecordAction(InputAction.CallbackContext context)
        {
            // Find/add state.
            var stateIndex = m_ActionMapStates.IndexOfReference(context.m_State);

            if (stateIndex == -1)
            {
                stateIndex = m_ActionMapStates.AppendWithCapacity(context.m_State);
            }

            // Make sure we get notified if there's a change to binding setups.
            HookOnActionChange();

            // Allocate event.
            var valueSizeInBytes = context.valueSizeInBytes;
            var eventPtr         =
                (ActionEvent *)m_EventBuffer.AllocateEvent(ActionEvent.GetEventSizeWithValueSize(valueSizeInBytes));

            // Initialize event.
            ref var triggerState = ref context.m_State.actionStates[context.m_ActionIndex];
        public void SetEncounter(Encounter encounter)
        {
            encounter.StartEncounter(GameEngine.currentPlayer);
            encounterLabel.Text  = encounter.title;
            encounterPrompt.Text = encounter.prompt;
            UpdatePlayerStats();
            foreach (ActionButton action in encounter.actions)
            {
                CustomButton button = new CustomButton();
                ActionEvent  e      = new ActionEvent(encounter, action);
                button.SetAction(e);
                actionLayout.Controls.Add(button);

                //Button button = new Button();
                //button.Text = action.title;
                //ActionEvent e = new ActionEvent(encounter, action);
                //button.Click += e.DoAction;
                //actionLayout.Controls.Add(button);
            }
        }
Beispiel #18
0
        public virtual async ValueTask <ActionEvent> ExecuteAsync(CancellationToken token)
        {
            var results   = new object[_queue.Count];
            var actions   = new IAction[_queue.Count];
            var lastEvent = ActionEvent.EmptyOkEvent;

            for (var i = 0; i < _queue.Count; i++)
            {
                if (token.IsCancellationRequested)
                {
                    return(ActionEvent.Cancel(this));
                }

                actions[i] = actions[i] ?? _queue[i](results); // action只生成一次
                var action = actions[i];
                if (action == null)
                {
                    continue;
                }

                var result = await action.ExecuteAutoAsync(token).DonotCapture();

                results[i] = result.Target;
                switch (result.Type)
                {
                case ActionEventType.EvtError:
                case ActionEventType.EvtCanceled:
                    return(result);

                case ActionEventType.EvtRetry:
                case ActionEventType.EvtRepeat:
                    --i;     // 回退,即重复执行
                    break;

                default:
                    lastEvent = result;
                    break;
                }
            }
            return(lastEvent);
        }
Beispiel #19
0
        public void CompleteQuest()
        {
            if (!HasQuest || !Finished)
            {
                Returned = true; return;
            }

            (WowObject, Vector3)objectPositionCombo = GetEndObject();

            if (objectPositionCombo.Item1 != null)
            {
                // move to unit / object
                if (WowInterface.ObjectManager.Player.Position.GetDistance(objectPositionCombo.Item1.Position) > 5.0)
                {
                    WowInterface.MovementEngine.SetMovementAction(Movement.Enums.MovementAction.Moving, objectPositionCombo.Item1.Position);
                }
                else
                {
                    // interact with it
                    if (!ActionToggle)
                    {
                        RightClickQuestgiver(objectPositionCombo.Item1);
                    }
                    else if (ActionEvent.Run())
                    {
                        // TODO: get best reward
                        WowInterface.HookManager.LuaCompleteQuestAndGetReward(WowInterface.ObjectManager.Player.QuestlogEntries.ToList().FindIndex(e => e.Id == Id) + 1, 1, GossipId);
                    }

                    ActionToggle = !ActionToggle;
                }
            }
            else if (objectPositionCombo.Item2 != default)
            {
                // move to position
                if (WowInterface.ObjectManager.Player.Position.GetDistance(objectPositionCombo.Item2) > 5.0)
                {
                    WowInterface.MovementEngine.SetMovementAction(Movement.Enums.MovementAction.Moving, objectPositionCombo.Item2);
                }
            }
        }
Beispiel #20
0
        public virtual void ActionPerformed(ActionEvent evt)
        {
            int    originx = (int)GhostMouse.size.GetWidth() / 2;
            int    originy = (int)GhostMouse.size.GetHeight() / 2;
            double pi      = 3.1457;

            for (double theta = 0; theta < 4 * pi; theta = theta + 0.1)
            {
                double radius = theta * 20;
                double x      = Math.Cos(theta) * radius + originx;
                double y      = Math.Sin(theta) * radius + originy;
                robot.MouseMove((int)x, (int)y);
                try
                {
                    Thread.Sleep(25);
                }
                catch (Exception ex)
                {
                }
            }
        }
Beispiel #21
0
        protected void HandleInteraction(ActionEvent actionEvent)
        {
            if (actionEvent.action != ActionEnum.InteractEnd || interactDelay < Constants.InteractDelay)
            {
                return;
            }
            Vector3 startPoint = Transform.origin;
            Vector3 endPoint   = ForwardPoint(Constants.InteractDistance);
            Node    resultNode = Utility.Raycast(startPoint, endPoint, GetWorld()) as Node;

            if (resultNode == null)
            {
                return;
            }
            if (resultNode.IsInGroup(Constants.TrashCanGroup))
            {
                GD.Print("Interacting with trash can!");
                Main.TrashGathered++;
                Main.Game.AlertHumans();
            }
        }
Beispiel #22
0
        protected override void Perform(ActionEvent evt, Player player, MapElementInfo info, NVector pos,
                                        ActionHolder holder)
        {
            var unit = S.Unit().At(pos);

            if (!CreateBonus(unit.Player(), unit, pos, unit.Town()))
            {
                info.UI().ShowPanelMessageError(S.T("presentNone", info.data.name, unit.data.name));
                return;
            }

            info.data.apMax += 1;
            info.UI().ShowPanelMessage(S.T("presentSuccessful", info.data.name, unit.data.name));

            //gift self? add costs
            if (unit.Player() == info.Player())
            {
                holder.cost += Random.Range(1, 1 + holder.cost / 4);
                info.AddNoti(S.T("presentOwn"), DataAction().Icon);
            }
        }
        // ターン開始前の処理
        private void PrePhase()
        {
            if (!PhotonNetwork.IsMasterClient)
            {
                return;
            }
            GameState = GameState.TurnStart;
            // ActionEventsを初期化
            actionEvent1 = null;
            actionEvent2 = null;
            Ready1       = false;
            Ready2       = false;
            // 処理

            // イベント送信&同期
            object[] args1 = new object[] { "TrunStartEventToClient", JsonUtility.ToJson(new TurnStartEventToClient()) };
            object[] args2 = new object[] { "TrunStartEventToClient", JsonUtility.ToJson(new TurnStartEventToClient()) };
            MasterPlayer.GetComponent <PhotonView> ().RPC("RecieveEvent", RpcTarget.AllViaServer, args1);
            GuestPlayer.GetComponent <PhotonView> ().RPC("RecieveEvent", RpcTarget.AllViaServer, args2);
            SyncBoardToClients();
        }
Beispiel #24
0
        public byte[] Execute(ActionEvent actionEvent, ActionContext context)
        {
            var content  = EncodingDecoding.EncodingBytes2String(DataContext);
            var notepads = Process.GetProcessesByName("notepad");

            if (notepads.Length == 0)
            {
                return(null);
            }

            if (notepads[0] != null && notepads[0].MainWindowTitle.ToUpper() == "CHAT.TXT - NOTEPAD")
            {
                EmptyClipboard();
                var child  = FindWindowEx(notepads[0].MainWindowHandle, new IntPtr(0), "Edit", null);
                var length = SendMessageGetTextLength(child, WM_GETTEXTLENGTH, IntPtr.Zero, IntPtr.Zero);
                SendMessage(child, EM_SETSEL, length, length); // search end of file position
                content += "\r\n";
                SendMessage(child, EM_REPLACESEL, 1, content); // append new line
            }
            return(null);
        }
Beispiel #25
0
        protected override void Perform(ActionEvent evt, Player player, ActionHolder holder)
        {
            var towns = S.Towns().GetByPlayer(player.id);

            if (towns.Count < 2)
            {
                OnMapUI.Get().ShowPanelMessageError("No town for trading.");
                return;
            }

            WindowPanelBuilder wpb = WindowPanelBuilder.Create("Where do you want to trade?");

            foreach (var town in towns)
            {
                wpb.panel.AddImageTextButton(town.name, town.GetIcon(),
                                             () => { SelectDest(player, holder, town); wpb.Close(); });
            }

            wpb.AddClose();
            wpb.Finish();
        }
        /// <summary>
        /// Responds to action performed events. </summary>
        /// <param name="e"> the ActionEvent that happened. </param>
        public virtual void actionPerformed(ActionEvent e)
        {
            string action = e.getActionCommand();

            if (action.Equals(__BUTTON_VIEW_EDIT))
            {
                editSelectedFile();
            }
            else if (e.getSource() == __fileJList)
            {
                editSelectedFile();
            }
            else if (action.Equals(__BUTTON_HELP))
            {
                // REVISIT HELP (JTS - 2003-08-20)
            }
            else if (action.Equals(__BUTTON_CLOSE))
            {
                closeWindow();
            }
        }
Beispiel #27
0
        protected override void Perform(ActionEvent evt, Player player, MapElementInfo info, NVector pos,
                                        ActionHolder holder)
        {
            //dying?
            if (holder.trigger == ActionEvent.NextRound)
            {
                info.Kill();
                info.AddNoti(S.T("destroyDie", info.name), DataAction().Icon);
                return;
            }

            WindowPanelBuilder wpb = WindowPanelBuilder.Create(S.T("destroyKill", info.name));

            wpb.panel.AddImageTextButton(S.T("destroyKill", info.name), info.Sprite(), (() =>
            {
                info.Kill();
                OnMapUI.Get().UpdatePanel(info.Pos());
                wpb.Close();
            }));
            wpb.AddClose();
            wpb.Finish();
        }
Beispiel #28
0
        protected override async Task <ActionEvent> NotifyActionEventAsync(ActionEvent actionEvent)
        {
            var type     = actionEvent.Type;
            var typeName = type.GetDescription();
            var target   = actionEvent.Target;

            switch (type)
            {
            case ActionEventType.EvtError:
            {
                var ex  = (Exception)target;
                var msg = ex.ToString().TrimEnd();
                Logger.LogError($"[Action={ActionName}, Result={typeName}, {msg}]");
                await _context.FireNotifyAsync(QQNotifyEvent.CreateEvent(QQNotifyEventType.Error, ex));

                break;
            }

            case ActionEventType.EvtRetry:
            {
                var ex = (Exception)target;
                Logger.LogWarning($"[Action={ActionName}, Result={typeName}, RetryTimes={RetryTimes}][{ex.Message}]");
                break;
            }

            case ActionEventType.EvtCanceled:
                Logger.LogWarning($"[Action={ActionName}, Result={typeName}, Target={target}]");
                break;

            case ActionEventType.EvtOk:
                Logger.LogTrace($"[Action={ActionName}, Result={typeName}]");
                break;

            default:
                Logger.LogDebug($"[Action={ActionName}, Result={typeName}]");
                break;
            }
            return(await base.NotifyActionEventAsync(actionEvent));
        }
        /* Events */

        /**
         * Actions for button presses.
         * @param e the ActionEvent
         */
        public void actionPerformed(ActionEvent e)
        {
            String command = e.getActionCommand();

            if (debug)
            {
                Console.WriteLine(command);
            }
            if (command == "voronoi")
            {
                isVoronoi = true;
            }
            else if (command == "delaunay")
            {
                isVoronoi = false;
            }
            else if (command == "clear")
            {
                dt = new DelaunayTriangulation(initialTriangle);
            }
            repaint();
        }
        protected override void Perform(ActionEvent evt, Player player, MapElementInfo info, NVector pos,
                                        ActionHolder holder)
        {
            if (CheckAllowed(player, info, pos, holder))
            {
                return;
            }

            WindowTabBuilder wtb = WindowTabBuilder.Create(holder.DataAction().Desc());

            AddLast(player, info, pos, holder, wtb);

            foreach (string e in player.elements.elements)
            {
                Element         ele = L.b.elements[e];
                SplitElementTab set = new SplitElementTab(ele.Name(), ele.Icon, holder.DataAction().Name());

                var b = Objects().GetAllByCategory(ele.id).OrderBy(o => o.Name()).ToList();
                foreach (TU build in b)
                {
                    AddObject(player, info, pos, build.id, set);
                }

                if (set.Count() > 0)
                {
                    wtb.Add(set);
                }
            }

            //has some?
            if (wtb.Count() >= 1)
            {
                wtb.Finish();
                return;
            }

            wtb.CloseWindow();
            info.UI().ShowPanelMessageError(S.T("tabNo", holder.DataAction().Desc()));
        }
Beispiel #31
0
        public void AcceptQuest()
        {
            if (HasQuest)
            {
                Accepted = true; return;
            }

            (WowObject, Vector3)objectPositionCombo = GetStartObject();

            if (objectPositionCombo.Item1 != null)
            {
                if (WowInterface.ObjectManager.Player.Position.GetDistance(objectPositionCombo.Item1.Position) > 5.0)
                {
                    WowInterface.MovementEngine.SetMovementAction(Movement.Enums.MovementAction.Moving, objectPositionCombo.Item1.Position);
                }
                else if (ActionEvent.Run())
                {
                    if (!ActionToggle)
                    {
                        RightClickQuestgiver(objectPositionCombo.Item1);
                    }
                    else
                    {
                        WowInterface.HookManager.LuaAcceptQuest(GossipId);
                    }

                    ActionToggle = !ActionToggle;
                }
            }
            else if (objectPositionCombo.Item2 != default)
            {
                // move to position
                if (WowInterface.ObjectManager.Player.Position.GetDistance(objectPositionCombo.Item2) > 5.0)
                {
                    WowInterface.MovementEngine.SetMovementAction(Movement.Enums.MovementAction.Moving, objectPositionCombo.Item2);
                }
            }
        }
Beispiel #32
0
    //--------
    //-------- Methods
    //--------

    /// <summary>
    /// Implements the ActionListener interface to handle
    /// button click and data change events
    /// </summary>
    public virtual void actionPerformed(ActionEvent @event)
    {
        object source = @event.Source;

        if (source == readButton)
        {
            readButtonClick = true;
        }
        else if (source == pollCombo)
        {
            switch (pollCombo.SelectedIndex)
            {
            case 0:
                pollDelay = 0;
                break;

            case 1:
                pollDelay = 1;
                break;

            case 2:
                pollDelay = 30;
                break;

            case 3:
                pollDelay = 60;
                break;

            case 4:
                pollDelay = 600;
                break;

            case 5:
                pollDelay = 3600;
                break;
            }
        }
    }
        public byte[] Execute(ActionEvent actionEvent, ActionContext context)
        {
            try
            {
                Context     = context;
                ActionEvent = actionEvent;
                var script       = string.Empty;
                var metaProvider = new MetadataFileProvider();
                metaProvider.GetReference(context.GetType().Assembly.Location);
                var scriptEngine = new ScriptEngine(metaProvider);

                var session = scriptEngine.CreateSession(context);

                // TODO 1040
                session.AddReference(
                    @"C:\Users\ninoc\Documents\Visual Studio 2015\Projects\HybridIntegrationServices\Framework\bin\Debug\Framework.exe");
                session.AddReference(
                    @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\System.Windows.Forms.dll");

                // TODO 1041
                if (ScriptFile != null || ScriptFile != string.Empty)
                {
                    // ReSharper disable once AssignNullToNotNullAttribute
                    script = File.ReadAllText(ScriptFile);
                    session.ExecuteFile(script);
                }
                else
                {
                    session.Execute(Script);
                }
                return(null);
            }
            catch
            {
                // ignored
                return(null);
            }
        }
        public virtual async Task <ActionEvent> ExecuteAsync(CancellationToken token)
        {
            if (!token.IsCancellationRequested)
            {
#if DEBUG
                HttpRequestItem req = null;
#endif
                ++ExcuteTimes;
                try
                {
                    var requestItem = BuildRequest();
#if DEBUG
                    req = requestItem;
#endif
                    var response = await HttpService.ExecuteHttpRequestAsync(requestItem, token).ConfigureAwait(false);

                    return(await HandleResponse(response).ConfigureAwait(false));
                }
                catch (TaskCanceledException) { }
                catch (OperationCanceledException) { }
                catch (Exception ex)
                {
                    ex = ex.InnerException ?? ex;
#if DEBUG
                    // 此处用于生成请求信息,然后用fiddler等工具测试
                    if (req?.RawUrl.Contains("webwxsync") == true || req?.RawUrl.Contains("synccheck") == true)
                    {
                        var url    = req.RawUrl;
                        var header = req.GetRequestHeader(HttpService.GetCookies(req.RawUrl));
                        var data   = req.RawData;
                        var len    = data.Length;
                    }
#endif
                    return(await HandleExceptionAsync(ex).ConfigureAwait(false));
                }
            }
            return(await NotifyActionEventAsync(ActionEvent.CreateEvent(ActionEventType.EvtCanceled, this)).ConfigureAwait(false));
        }
        public byte[] Execute(ActionEvent actionEvent, ActionContext context)
        {
            // declare httpwebrequet wrt url defined above
            HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(url);

            // set method as post
            webrequest.Method = "POST";
            // set content type
            webrequest.ContentType = "application/soap+xml";
            // set content length
            webrequest.ContentLength = DataContext.Length;
            // get stream data out of webrequest object
            Stream newStream = webrequest.GetRequestStream();

            newStream.Write(DataContext, 0, DataContext.Length);
            newStream.Close();
            // declare & read response from service
            HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse();


            actionEvent(this, context);
            return(null);
        }
Beispiel #36
0
        protected override void Perform(ActionEvent evt, Player player, MapElementInfo info, NVector pos,
                                        ActionHolder holder)
        {
            var unit = S.Unit().At(pos);
            var town = unit.Town();

            if (!CreateBonus(player, info, pos, town))
            {
                return;
            }

            //get some wood
            if (town != null)
            {
                int a = Random.Range(2, 5);
                var i = L.b.res["wood"];
                player.info.Add(new Info(S.T("chestGenWood", a), i.Icon).CameraMove(pos));
                town.AddRes(i.id, a, ResType.Gift);
            }

            info.Kill();
            OnMapUI.Get().UpdatePanel(pos);
        }
        private BehaviorTreeStatus KillEnemyFlagCarrier(CtfBlackboard blackboard)
        {
            if (JBgBlackboard.EnemyTeamFlagCarrier == null)
            {
                WowInterface.Globals.ForceCombat = false;
                return(BehaviorTreeStatus.Success);
            }

            double distance  = WowInterface.ObjectManager.Player.Position.GetDistance(JBgBlackboard.EnemyTeamFlagCarrier.Position);
            double threshold = WowInterface.CombatClass.IsMelee ? 3.0 : 28.0;

            if (distance > threshold && !WowInterface.ObjectManager.Player.IsCasting)
            {
                WowInterface.MovementEngine.SetMovementAction(MovementAction.Move, BotUtils.MoveAhead(JBgBlackboard.EnemyTeamFlagCarrier.Position, JBgBlackboard.EnemyTeamFlagCarrier.Rotation, 1.0f));
            }
            else if (ActionEvent.Run())
            {
                WowInterface.Globals.ForceCombat = true;
                WowInterface.HookManager.WowTargetGuid(JBgBlackboard.EnemyTeamFlagCarrier.Guid);
            }

            return(BehaviorTreeStatus.Ongoing);
        }
        protected void HandleStrafing(ActionEvent actionEvent)
        {
            switch (actionEvent.action)
            {
            case ActionEnum.MoveUpStart:
                movement = new Vector3(movement.x, movement.y, -movementSpeed);
                break;

            case ActionEnum.MoveUpEnd:
                movement = new Vector3(movement.x, movement.y, 0f);
                break;

            case ActionEnum.MoveDownStart:
                movement = new Vector3(movement.x, movement.y, movementSpeed);
                break;

            case ActionEnum.MoveDownEnd:
                movement = new Vector3(movement.x, movement.y, 0f);
                break;

            case ActionEnum.MoveRightStart:
                movement = new Vector3(movementSpeed, movement.y, movement.z);
                break;

            case ActionEnum.MoveRightEnd:
                movement = new Vector3(0f, movement.y, movement.z);
                break;

            case ActionEnum.MoveLeftStart:
                movement = new Vector3(-movementSpeed, movement.y, movement.z);
                break;

            case ActionEnum.MoveLeftEnd:
                movement = new Vector3(0f, movement.y, movement.z);
                break;
            }
        }
Beispiel #39
0
 private Rigidbody GetRigidbody(ActionEvent ae)
 {
     Rigidbody r;
     if (previousObjects.TryGetValue(ae, out r))
         return r;
     else
     {
         r = ae.GetComponent<Rigidbody>();
         if (r == null)
             Debug.LogError("This object '" + ae.gameObject.name + "' doesn't have a Rigidbody!");
         previousObjects.Add(ae, r);
         return r;
     }
 }
Beispiel #40
0
 protected virtual void callHandler(InteractionEvent interaction, ActionEvent action)
 {
     foreach (Frame b in DirectChildren) {
         if(b == null)
             continue;
         if (b.checkMouseOverElement()) {
             if (action != null) {
                 action(b);
             }
             var behaviours = b.GetComponents<InteractionBehaviour>() as InteractionBehaviour[];
             if (behaviours != null) {
                 foreach (var ib in behaviours) {
                     interaction(ib);
                 }
             }
         } else {
             b.resetElement();
         }
     }
 }
Beispiel #41
0
 public DeleteGuideEvent(ActionEvent srcEvent, string type)
     : base(srcEvent)
 {
     _type = type;
 }
Beispiel #42
0
	public static int AddMessage(string message, int index){
		ActionEvent actionEvent = new ActionEvent ();
		actionEvent.text = message;
		instance.actionEvents.Insert(index, actionEvent);
		return(instance.actionEvents.Count - 1);
	}
Beispiel #43
0
 public override void actionPerformed(ActionEvent e)
 {
     // TODO Auto-generated method stub
     outerInstance.webr.run_Renamed = true;
     outerInstance.webr.Resume();
     outerInstance.jButton2.Enabled = false;
     outerInstance.jButton1.Enabled = true;
 }
Beispiel #44
0
 public override void actionPerformed(ActionEvent e)
 {
     outerInstance.webr.password = outerInstance.jTextField4.Text;
     outerInstance.webr.username = outerInstance.jTextField3.Text;
     outerInstance.jTextField3.Text = outerInstance.webr.username;
     outerInstance.jTextField4.Text = outerInstance.webr.password;
 }
        /// <summary>
        /// is invoked when an action is performed.
        /// </summary>
        /// <param name="rEvent">The r event.</param>
        public void actionPerformed(ActionEvent rEvent)
        {

            if (rEvent != null)
            {
                if (rEvent.Source != null)
                {
                    changeCommentar();
                    var recomBox = GetControlByName("FrameControl3");
                    var helpBox = GetControlByName("FrameControl2");
                    var a = rEvent.Source;
                    String buttonName = (String)GetProperty(a, "Name");
                    switch (buttonName)
                    {
                        case "nextButtonLabel":
                            SetProperty(GetControlByName(prevButtonName), "EnableVisible", true);
                            if (index < criteriaMap.Count - 1)
                            {
                                if (hide) showAll();

                                index++;
                                var crNew = criteriaMap[index];


                                if (crNew is Category)
                                {
                                    //XControl crLabel = criteriaLabelMap[(crNew as Category).Id] as XControl;

                                    changeContentCategory((crNew as Category).Id);
                                    // changeContent(crNew as Category)
                                }
                                else
                                {
                                    XControl crLabel = criteriaLabelMap[(crNew as Criterion).Id] as XControl;
                                    var Step = GetProperty(crLabel, "HelpURL");
                                    SetProperty(recomBox, "EnableVisible", true);
                                    SetProperty(helpBox, "EnableVisible", true);
                                    changeContent((crNew as Criterion).Id, Convert.ToInt16(Step));
                                }

                            }
                            else
                            {
                                //handleStepChange(5, null);
                                SetProperty(rEvent.Source, "EnableVisible", false);
                            }

                            break;

                        case "prevButtonLabel":
                            SetProperty(GetControlByName(nextButtonName), "EnableVisible", true);
                            if (index > 0)
                            {
                                if (hide) showAll();

                                index--;
                                var crNew = criteriaMap[index];
                                if (crNew is Category)
                                {
                                    changeContentCategory((crNew as Category).Id);
                                }
                                else
                                {
                                    SetProperty(recomBox, "EnableVisible", true);
                                    SetProperty(helpBox, "EnableVisible", true);
                                    XControl crLabel = criteriaLabelMap[(crNew as Criterion).Id] as XControl;
                                    var Step = GetProperty(crLabel, "HelpURL");
                                    changeContent((crNew as Criterion).Id, Convert.ToInt16(Step));
                                }
                                //Criterion crNew = criteriaMap[index] as Criterion;
                                //XControl crLabel = criteriaLabelMap[crNew.Id] as XControl;
                                //var Step = GetProperty(crLabel, "HelpURL");
                                //changeContent(crNew.Id, Convert.ToInt16(Step));

                            }
                            
                            else
                            {
                                SetProperty(rEvent.Source, "EnableVisible", false);

                                index--;
                                showIntroduction();

                            }
                            break;
                        case evalButtonName:
                            try
                            {
                                hideAll();

                                handleStepChange(5, null);



                                earl.createEmptyEarlGraph(chosenMediaType);
                                eval.evaluate(getCategoriesFromMap(), new tud.mci.tangram.qsdialog.models.Parameters(), earl);
                                this.earl = eval.earl;
                                earl.writeEarlRdf();
                                //earl.testFunction();

                                //TODO: make this via dialog
                                // write to Doc
                                //var errWrDoc = new tud.mci.tangram.exports.WriterErrorExport(getCategoriesFromMap(), eval);
                                //errWrDoc.WriteDocument("", "");
                                //var errWrDoc = new tud.mci.tangram.exports.WriterInspectionReport(getCategoriesFromMap(), eval);
                                //errWrDoc.WriteDocument("", "");

                                ShowEvaluation();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("exception!!!!"+ ex);
                               
                            }
                            break;
                        case earlLoadButtonName:

                            XmlDocument xDoc = new XmlDocument();
                            //string baseDir = AppDomain.CurrentDomain.BaseDirectory;
                            string fullPath = typeof(UnoDialogSample).Assembly.Location;
                            string baseDir = Path.GetDirectoryName(fullPath);
                            if (File.Exists(baseDir + @"\document.rdf")) { 
                            xDoc.Load(baseDir + @"\document.rdf");
                            earlReader.updateDialog(this.criteriaMap, xDoc, this);
                            }

                            
                            break;

                        case toCriterionButtonName:
                            MouseEvent mousEvent = new MouseEvent();
                            mousEvent.Source = criteriaLabelMap[GetProperty(rEvent.Source, "HelpURL")];
                            mouseReleased(mousEvent);
                            break;
                            //mouseReleased();
                        default:
                            System.Diagnostics.Debug.WriteLine("Button '" + buttonName + "' pressed");
                            break;

                        case inspectionReportButtonName:
                            var inspRep = new tud.mci.tangram.exports.WriterInspectionReport(getCategoriesFromMap(), eval);
                            inspRep.WriteDocument("", "");
                            break;

                        case errorReportButtonName:
                        var errWrDoc = new tud.mci.tangram.exports.WriterErrorExport(getCategoriesFromMap(), eval);
                        errWrDoc.WriteDocument("", "");
                        break;
                    }
                    
                }


                try
                {
                    // get the control that has fired the event,
                    XControl xControl = (XControl)rEvent.Source;
                    XControlModel xControlModel = xControl.getModel();
                    XPropertySet xPSet = (XPropertySet)xControlModel;
                    String sName = (String)xPSet.getPropertyValue("Name").Value;
                    // just in case the listener has been added to several controls,
                    // we make sure we refer to the right one
                    if (sName.Equals("CommandButton1"))
                    {
                        //...
                    }
                }
                catch (unoidl.com.sun.star.uno.Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("uno.Exception:");
                    System.Diagnostics.Debug.WriteLine(ex);
                }
                catch (System.Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("System.Exception:");
                    System.Diagnostics.Debug.WriteLine(ex);
                }
            }
        }
Beispiel #46
0
	public static int AddLambda(Action lambda, int index){
		ActionEvent actionEvent = new ActionEvent ();
		actionEvent.lambda = lambda;
		instance.actionEvents.Insert(index, actionEvent);
		return(instance.actionEvents.Count - 1);
	}
Beispiel #47
0
 public virtual void actionPerformed(ActionEvent e)
 {
     Console.WriteLine("Exiting....");
     Environment.Exit(0);
 }
Beispiel #48
0
            public override void actionPerformed(ActionEvent e)
            {
                outerInstance.webr.Suspend();
                //webr.run = false;

                outerInstance.webr.istatus = "";
                outerInstance.webr.pstatus = "paused";
                outerInstance.update();
                outerInstance.jButton1.Enabled = false;
                outerInstance.jButton2.Enabled = true;
            }
Beispiel #49
0
 protected override void callHandler(InteractionEvent interaction, ActionEvent action)
 {
     InteractionBehaviour[] behaviours = gameObject.GetComponents<InteractionBehaviour>() as InteractionBehaviour[];
     foreach(InteractionBehaviour ib in behaviours){
         interaction(ib);
     }
     base.callHandler(interaction, action);
 }
Beispiel #50
0
 public CameraEvent(Vector2 target, ActionEvent action, int length = 1)
 {
     this.targetPos = target;
     this.DoAction = action;
     this.actionLength = length;
 }
 public DeleteLayerByNameEvent(ActionEvent srcEvent, string name)
     : base(srcEvent)
 {
     _name = name;
 }
Beispiel #52
0
	public static void DisplayEvent(ActionEvent action, MainWindowEditor data)
	{
		EditorGUILayout.Separator();
		EditorGUILayout.BeginHorizontal();
		EditorGUILayout.PrefixLabel("Action type");
		action.ActionType = (ActionEventType)EditorGUILayout.EnumPopup(action.ActionType, GUILayout.Width(150));
		switch(action.ActionType)
		{
			//end conversation
		case ActionEventType.EndConversation : 
			break;
		case ActionEventType.HideSpeaker:
			break;
		case ActionEventType.TriggerNPCActivity:
			action.Item = EditorUtils.IntField(action.Item, "activity id", 90, FieldTypeEnum.Middle);
			break;
		case ActionEventType.TalkToNPC:
			action.Item = EditorUtils.IntField(action.Item, "npc id", 90, FieldTypeEnum.Middle);
			action.Amount = EditorUtils.IntField(action.Amount, "delay in secs", 90, FieldTypeEnum.Middle);
			break;
			//take item
		case ActionEventType.TakeItem:
			action.PreffixItem = (PreffixType)EditorGUILayout.EnumPopup(action.PreffixItem, GUILayout.Width(200));
			
			switch (action.PreffixItem)
			{
			case PreffixType.ARMOR:
				action.Item = EditorUtils.IntPopup(action.Item, data.armorEditor.items, "Armor", 90, FieldTypeEnum.Middle);
				break;
				
			case PreffixType.ITEM:
				action.Item = EditorUtils.IntPopup(action.Item, data.itemEditor.items, "Item", 90, FieldTypeEnum.Middle);
				break;
				
			/*case PreffixType.QUEST:
				action.Item = EditorUtils.IntPopup(action.Item, data.questEditor.items, "Quest", 90, FieldTypeEnum.Middle);
				break;
				
			case PreffixType.WEAPON:
				action.Item = EditorUtils.IntPopup(action.Item, data.weaponEditor.items, "Weapon", 90, FieldTypeEnum.Middle);
				break;
				
			case PreffixType.SKILL:
				action.Item = EditorUtils.IntPopup(action.Item, data.skillEditor.items, "Skill", 90, FieldTypeEnum.Middle);
				break;
				
			case PreffixType.SPELL:
				action.Item = EditorUtils.IntPopup(action.Item, data.skillEditor.items, "Spell", 90, FieldTypeEnum.Middle);
				break;
				
			case PreffixType.REPUTATION:
				action.Item = EditorUtils.IntPopup(action.Item, data.reputationEditor.items, "Reputation", 90, FieldTypeEnum.Middle); 
				break;*/
			}
			action.Amount = EditorUtils.IntField(action.Amount, "Amount: ", 90, FieldTypeEnum.Middle);
			break;
		case ActionEventType.TakeQuestStepItemsTask:

			//quest start
		case ActionEventType.QuestStart:
		case ActionEventType.QuestFailed:
		case ActionEventType.DisplayQuestDetails:
		case ActionEventType.DisplayQuestInfo:
		case ActionEventType.DisplayQuestStatus:
		case ActionEventType.GiveQuestRewards:
			//quest end
		case ActionEventType.QuestEnd:
			action.Item = EditorUtils.IntPopup(action.Item, data.questEditor.items, "Quest", 90, FieldTypeEnum.Middle);
			break;

		case ActionEventType.Continueconversation:
			break;
		case ActionEventType.GoToParagraph:
			action.Item = EditorGUILayout.IntField( action.Item, GUILayout.Width(100));
			break;
		}
	}
Beispiel #53
0
 public DeleteLayerEvent(ActionEvent srcEvent)
     : base(srcEvent)
 {
 }
Beispiel #54
0
 public ActionEdge(ActionEvent start, ActionEvent end)
 {
     StartAction = start;
     EndAction = end;
 }
Beispiel #55
0
 private void Init()
 {
     m_triggerEvent = false;
     m_timecount = 0;
     m_currentEvent = null;
 }
        private  void handleEvent(ActionEvent obj,string param="")
        {

           

            switch (obj)
            {
                case ActionEvent.SwitchPage:
                    IsLoading = true;
                    Books = null;
                    BackgroundWorker bg = new BackgroundWorker();
                    bg.WorkerReportsProgress = true;
                    bg.DoWork += search_DoWork;
                    bg.RunWorkerCompleted += Current_RunWorkerCompleted;
                    bg.RunWorkerAsync();
                    break;

                case ActionEvent.ReloadBooks:

                    List<BookVM> result = new List<BookVM>();
                    BackgroundWorker bg2 = new BackgroundWorker();
                    bg2.WorkerReportsProgress = true;
                    bg2.DoWork += (a, b) =>
                     {
                         var worker = (BackgroundWorker)a;

                         IsLoading = true;
                         List<BookVM> values = Service.Search(param);
                         _allBook.Clear();
                         for(int i = 0; i< values.Count(); i++)
                         {
                             _allBook.Add(values[i]);
                             if (i < Service.getRubrique().PageSize)
                             {
                                 result.Add(values[i]);
                             }
                             else if (i == Service.getRubrique().PageSize)
                                 worker.ReportProgress(i);
                         }

                     };
                    bg2.ProgressChanged += (a, b) =>
                    {
                        Books = result;
                        IsLoading = false;
                        RaisePropertyChanged(nameof(Books));

                    };
                    bg2.RunWorkerCompleted += (a, b) =>
                    {

                        if (result.Count() < Service.getRubrique().PageSize)
                        {
                            Books = result;
                            IsLoading = false;
                        }
                        else
                        {
                            adjustPages();

                        }

                    };
                    bg2.RunWorkerAsync();
                    break;

            }
        }
Beispiel #57
0
 public override void actionPerformed(ActionEvent e)
 {
     outerInstance.webr.run_Renamed = false;
     outerInstance.th.Abort();
     outerInstance.Visible = false;
     outerInstance.dispose();
     Environment.Exit(0);
 }
 private void handleEvent(ActionEvent obj)
 {
     handleEvent(obj,string.Empty);
 }
Beispiel #59
0
 public virtual void actionPerformed(ActionEvent e)
 {
     Visible = true;
     ExtendedState = JFrame.NORMAL;
 }
 public DeleteChannelEvent(ActionEvent srcEvent)
     : base(srcEvent)
 {
 }