コード例 #1
0
ファイル: AddActionBuildStep.cs プロジェクト: nghm/dotnet
        public Task BuildAsync(IEntityBuilder builder)
        {
            var endpointDescriptor = this._endpointDescriptorProvider.GetEndpointDescriptor(this._captureExpression, this._claimsPrincipal);

            if (endpointDescriptor == null)
            {
                return(Task.CompletedTask);
            }

            var method = endpointDescriptor.Method;
            var href   = this._hrefFactory.MakeHref(endpointDescriptor);
            var fields = this._fieldsFactory.MakeFields(new ActionArgument(endpointDescriptor.BodyArgument.Descriptor, endpointDescriptor.BodyArgument.Value));

            var action = new Actions.Action(this._name, href, method, fields);

            if (this._configureActionBuilder != null)
            {
                var actionBuilder = new ActionBuilder <TBody>(action);

                this._configureActionBuilder(actionBuilder);
            }

            builder.WithAction(action);

            return(Task.CompletedTask);
        }
コード例 #2
0
 public void OnActionEnd(Actions.Action action)
 {
     foreach (Plugin p in plugins)
     {
         p.Plug.OnActionEnd(action);
     }
 }
コード例 #3
0
 public override void OnActionEnd(Actions.Action action)
 {
     if (tagExplorer != null && action.Name == "builder_deleteitem")
     {
         tagExplorer.UpdateTreeSoon();
     }
 }
コード例 #4
0
        private void commitCueIn()
        {
            if (m_Element == null)
            {
                return;
            }
            listen = false;
            Actions.Action action = Actions.Actions.Instance.LastAction;
            if (action != null && action is Actions.CueInEffectChangeAction)
            {
                Actions.CueInEffectChangeAction eeca = action as Actions.CueInEffectChangeAction;
                if (eeca.Elements[0] == m_Element)
                {
                    eeca.SetData(cueInActive.Checked, getCueTime(cueInTime, m_Element.Effects.CueIn.Position));
                    eeca.Do(m_Project);
                    listen = true;
                    return;
                }
            }
            List <Ares.Data.IEffectsElement> elements = new List <Ares.Data.IEffectsElement>();

            elements.Add(m_Element);
            Actions.Actions.Instance.AddNew(new Actions.CueInEffectChangeAction(elements, cueInActive.Checked, getCueTime(cueInTime, m_Element.Effects.CueIn.Position)), m_Project);
            listen = true;
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: robertfall/LAD
        private static void Main(string[] args)
        {
            XmlConfigurator.Configure();
            var log = LogManager.GetLogger(typeof(Program));
            var context = DataModel.Default();
            context.Database.CommandTimeout = 5 * 60;

            var actions = new Actions.Action[] {
                new ScanOutLearners(),
                new ScanOutEmployees(),
                new ExpireLearners(),
                new ImportPhotos(),
                new CompleteEnrollments(),
                new NotifyCompletedLearners()
            };

            foreach (var action in actions)
            {
                try
                {
                    action.Execute(context, log);
                }
                catch (Exception e)
                {
                    log.Fatal($"Error occured while attempting to execute {action.GetType().Name}", e);
                }
            }
        }
コード例 #6
0
ファイル: Context.cs プロジェクト: UdiAzulay/Fetcher2
 public void Play(Actions.Action action, object data, bool skipSelf, bool startPauses)
 {
     if (IsRunning)
     {
         throw new WrongStateException();
     }
     _skipSelfExecute = skipSelf;
     CurrentAction    = action;
     State            = startPauses ? ContextState.Pause : ContextState.Paly;
     if (startPauses)
     {
         _continueEvent.Reset();
     }
     else
     {
         _continueEvent.Set();
     }
     if (_executeTask != null)
     {
         _executeTask.Dispose();
     }
     _breakEvent.Reset();
     lock (this) {
         _executeTask = new Task(Execute, data);
         _executeTask.Start();
     }
 }
コード例 #7
0
        public void EditAction(Actions.Action action)
        {
            string formKey = "Document_" + action.GetHashCode().ToString();
            var    doc     = Application.OpenForms[formKey] as Document;

            if (doc == null)
            {
                switch (action)
                {
                case Core.IScriptSource s:
                    doc = new TextDocument(this, s)
                    {
                        Name = formKey
                    }; break;
                }
                if (doc == null)
                {
                    return;
                }
                doc.Show();
            }
            else
            {
                doc.Focus();
            }
        }
コード例 #8
0
ファイル: RepeatableControl.cs プロジェクト: zBart/Ares
        private void Commit()
        {
            if (m_Element == null)
            {
                return;
            }
            listen = false;
            int repeatCount = loopButton.Checked ? -1 : (int)repeatCountUpDown.Value;

            Actions.Action action = Actions.Actions.Instance.LastAction;
            if (action != null && action is Actions.RepeatableElementChangeAction)
            {
                Actions.RepeatableElementChangeAction reca = action as Actions.RepeatableElementChangeAction;
                if (reca.Element == m_Element)
                {
                    reca.SetData(repeatCount,
                                 TimeConversion.GetTimeInMillis(fixedDelayUpDown, fixedUnitBox),
                                 TimeConversion.GetTimeInMillis(maxDelayUpDown, randomUnitBox));
                    reca.Do(m_Project);
                    listen = true;
                    return;
                }
            }
            Actions.Actions.Instance.AddNew(new Actions.RepeatableElementChangeAction(m_Element,
                                                                                      repeatCount,
                                                                                      TimeConversion.GetTimeInMillis(fixedDelayUpDown, fixedUnitBox),
                                                                                      TimeConversion.GetTimeInMillis(maxDelayUpDown, randomUnitBox)), m_Project);
            listen = true;
        }
コード例 #9
0
ファイル: LightEffectsEditor.cs プロジェクト: zBart/Ares
 private void Commit <T, V>(V val)
     where T : Actions.LightEffectsValueAction <V>
 {
     if (!m_Listen)
     {
         return;
     }
     m_Listen = false;
     try
     {
         Actions.Action action = Actions.Actions.Instance.LastAction;
         if (action != null && action is T)
         {
             T ac = action as T;
             ac.SetData(val);
             ac.Do(m_Project);
             return;
         }
         Actions.Actions.Instance.AddNew(
             (T)Activator.CreateInstance(typeof(T), m_Element, val),
             m_Project);
     }
     finally
     {
         m_Listen = true;
     }
 }
コード例 #10
0
        private IList <Actions.Action> BuildActionsForWatcher(StatusWatcher watcher, WatcherSection configWatcher)
        {
            var                  result = new List <Actions.Action>();
            IList <object>       listOfParameters;
            IList <PropertyInfo> properties;

            for (int j = 0; j < configWatcher.ContingenceActions.Count; j++)
            {
                var contingenceActionFromConfig = configWatcher.ContingenceActions[j];

                var type = Type.GetType(contingenceActionFromConfig.Type);
                var constructorInformation = type.GetConstructors().FirstOrDefault();

                listOfParameters = new List <object>();
                listOfParameters.Add(watcher);

                properties = contingenceActionFromConfig.GetType().GetProperties();
                foreach (var parameter in constructorInformation.GetParameters())
                {
                    if (parameter.Name.ToLower() != "statuswatcher")
                    {
                        listOfParameters.Add(
                            Convert.ChangeType(
                                properties.FirstOrDefault(x => x.Name.ToLower() == parameter.Name.ToLower()).GetValue(contingenceActionFromConfig),
                                parameter.ParameterType,
                                CultureInfo.InvariantCulture)
                            );
                    }
                }

                Actions.Action action = Activator.CreateInstance(type, listOfParameters.ToArray()) as Actions.Action;
                result.Add(action);
            }
            return(result);
        }
コード例 #11
0
 private void Commit()
 {
     if (m_Element == null)
     {
         return;
     }
     listen = false;
     Actions.Action action = Actions.Actions.Instance.LastAction;
     if (action != null && action is Actions.DelayableElementChangeAction)
     {
         Actions.DelayableElementChangeAction deca = action as Actions.DelayableElementChangeAction;
         if (deca.Element == m_Element)
         {
             deca.SetData(
                 TimeConversion.GetTimeInMillis(fixedDelayUpDown, fixedUnitBox),
                 TimeConversion.GetTimeInMillis(maxDelayUpDown, randomUnitBox));
             deca.Do(m_Project);
             listen = true;
             return;
         }
     }
     Actions.Actions.Instance.AddNew(new Actions.DelayableElementChangeAction(m_Element,
                                                                              TimeConversion.GetTimeInMillis(fixedDelayUpDown, fixedUnitBox),
                                                                              TimeConversion.GetTimeInMillis(maxDelayUpDown, randomUnitBox)), m_Project);
     listen = true;
 }
コード例 #12
0
 void mActions_OnItemAdded(object sender, Actions.Action item)
 {
     if (sender == Actions)
     {
         Validate();
     }
 }
コード例 #13
0
ファイル: Computer.cs プロジェクト: alls77/TestGame
        /// <summary>
        /// Set increased probability of recovery if health is less than critical
        /// </summary>
        public void checkHealth()
        {
            Actions.Action action = actions.Find(item => item.ActionName.Equals("recovery"));

            action.Probability = (Health <= criticalHealthValue())
                ? action.IncreasedProbability : action.NormalProbability;
        }
コード例 #14
0
        // This fills the list of available controls for the specified action
        private void FillControlsList(Actions.Action a)
        {
            actioncontrol.Items.Clear();

            // Fill combobox with special controls
            if (a.AllowMouse)
            {
                actioncontrol.Items.Add(new KeyControl(Keys.LButton, "LButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.MButton, "MButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.RButton, "RButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.XButton1, "XButton1"));
                actioncontrol.Items.Add(new KeyControl(Keys.XButton2, "XButton2"));
            }
            if (a.AllowScroll)
            {
                actioncontrol.Items.Add(new KeyControl(SpecialKeys.MScrollUp, "ScrollUp"));
                actioncontrol.Items.Add(new KeyControl(SpecialKeys.MScrollDown, "ScrollDown"));
            }
            if (a.AllowMouse && !a.DisregardShift)
            {
                actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Shift, "Shift+LButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Shift, "Shift+MButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Shift, "Shift+RButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Shift, "Shift+XButton1"));
                actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Shift, "Shift+XButton2"));
            }
            if (a.AllowScroll && !a.DisregardShift)
            {
                actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Shift, "Shift+ScrollUp"));
                actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Shift, "Shift+ScrollDown"));
            }
            if (a.AllowMouse && !a.DisregardControl)
            {
                actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Control, "Ctrl+LButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Control, "Ctrl+MButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Control, "Ctrl+RButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Control, "Ctrl+XButton1"));
                actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Control, "Ctrl+XButton2"));
            }
            if (a.AllowScroll && !a.DisregardControl)
            {
                actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Control, "Ctrl+ScrollUp"));
                actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Control, "Ctrl+ScrollDown"));
            }
            if (a.AllowMouse && !a.DisregardShift && !a.DisregardControl)
            {
                actioncontrol.Items.Add(new KeyControl(Keys.LButton | Keys.Shift | Keys.Control, "Ctrl+Shift+LButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.MButton | Keys.Shift | Keys.Control, "Ctrl+Shift+MButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.RButton | Keys.Shift | Keys.Control, "Ctrl+Shift+RButton"));
                actioncontrol.Items.Add(new KeyControl(Keys.XButton1 | Keys.Shift | Keys.Control, "Ctrl+Shift+XButton1"));
                actioncontrol.Items.Add(new KeyControl(Keys.XButton2 | Keys.Shift | Keys.Control, "Ctrl+Shift+XButton2"));
            }
            if (a.AllowScroll && !a.DisregardShift && !a.DisregardControl)
            {
                actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollUp | (int)Keys.Shift | (int)Keys.Control, "Ctrl+Shift+ScrollUp"));
                actioncontrol.Items.Add(new KeyControl((int)SpecialKeys.MScrollDown | (int)Keys.Shift | (int)Keys.Control, "Ctrl+Shift+ScrollDown"));
            }
        }
コード例 #15
0
        private async Task ActionsHandler(SocketUserMessage message)
        {
            try {
                string         message_lower = message.Content.ToLower();
                string         commandName   = message_lower.Split(' ')[0];
                Actions.Action action        = DataManager.actions.GetValueOrDefault(commandName);

                if (action?.CheckChannelAccessibility(message) == false)
                {
                    await message.Channel.SendMessageAsync("Commande non accessible d'ici.");

                    return;
                }
                switch (action?.Accessibility)
                {
                case Actions.Action.AccessibilityType.Usable:
                    if (action.Type == Actions.Action.ActionType.Delete)
                    {
                        await message.DeleteAsync();
                    }
                    action.Use(message);
                    break;

                case Actions.Action.AccessibilityType.Visible:
                    if (message.Author.IsAdmin())
                    {
                        action.Use(message);
                    }
                    else
                    {
                        await message.Channel.SendMessageAsync("Il faut être admin pour utiliser cette commande.");
                    }
                    break;

                case Actions.Action.AccessibilityType.Invisible:
                    if (message.Author.Id == DataManager.master_id)
                    {
                        action.Use(message);
                    }
                    break;
                }

                if (action == null)
                {
                    foreach (var action_ in DataManager.otherActions)
                    {
                        Regex regex = new Regex(action_.Regex);
                        if (regex.Match(message_lower).Success)
                        {
                            action_.Use(message);
                        }
                    }
                }
            }
            catch (System.Exception e) {
                e.DisplayException("Nouveau mode de commande => " + System.Reflection.MethodBase.GetCurrentMethod().ToString());
            }
        }
コード例 #16
0
ファイル: PrimativeFragment.cs プロジェクト: kwonus/Quelle
 public PrimativeFragment(Actions.Action segment, string fragment, byte adjacency, byte group)
     : base(segment, fragment, adjacency, group)
 {
     if (this.segment == null)
     {
         segment.Notify("error", "Major design/implementation error: aborting!");
         return;
     }
 }
コード例 #17
0
ファイル: Strips.cs プロジェクト: UdiAzulay/Fetcher2
        private ListViewItem ItemByAction(Actions.Action action)
        {
            var key = action.GetHashCode().ToString();

            if (!List.Items.ContainsKey(key))
            {
                return(null);
            }
            return(List.Items[key]);
        }
コード例 #18
0
 /// <summary>
 /// Get player's intended action and resets NextAction, indicating that the action has been handled.
 /// </summary>
 public Actions.Action PopAction()
 {
     if (NextAction != null)
     {
         var action = NextAction;
         NextAction = null;
         return(action);
     }
     return(null);
 }
コード例 #19
0
        /// <summary>
        /// Attaches the view model and the view.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="view">The view.</param>
        /// <param name="context">The context.</param>
        protected virtual void BindCore(object viewModel, DependencyObject view, object context)
        {
            Action.SetTarget(view, viewModel);

            var viewAware = viewModel as IViewAware;

            if (viewAware != null)
            {
                viewAware.AttachView(view, context);
                Log.Info("Attached view {0} to {1}.", view, viewModel);
            }
        }
コード例 #20
0
        public static Actions.ActionInfo GetActionInfoFromData(ActionData actionData)
        {
            Actions.Action A = (Actions.Action)Activator.CreateInstance(
                StringToClassTypeHolder.Get().GetActionType(actionData.mName));
            A.SetCostInfo(actionData.mHasCertainCost, actionData.mMinCost);
            A.Setup(actionData);

            ActionInfo AI = new ActionInfo(actionData.mDisplayName == null ? actionData.mName : actionData.mDisplayName,
                                           A, actionData.mSelectType, actionData.mSelectMin, actionData.mSelectMax);

            return(AI);
        }
コード例 #21
0
ファイル: Player.cs プロジェクト: kgpasta/ManaMistEngine
        private void IncrementResources()
        {
            foreach (Entity entity in entities.Values)
            {
                Actions.Action action = entity.GetAction(ActionType.HARVEST);

                if (action != null)
                {
                    HarvestAction harvestAction = (HarvestAction)action;
                    resources.Increment(harvestAction.GetHarvestAmount());
                }
            }
        }
コード例 #22
0
ファイル: GameReplayTests.cs プロジェクト: shoferb/OYAOB
        public void Initialize()
        {
            testGR = new GameReplay(1, 1);
            User user1 = new User(1, "test1", "mo", "1234", 0, 5000, "*****@*****.**");
            User user2 = new User(1, "test2", "no", "1234", 0, 5000, "*****@*****.**");

            testAction1 = new CallAction(new Player(user1, 1000, 1),
                                         new Card(Suits.Hearts, 1), new Card(Suits.Hearts, 2), 10);
            testAction2 = new CallAction(new Player(user2, 1000, 1),
                                         new Card(Suits.Hearts, 3), new Card(Suits.Hearts, 4), 20);
            testGR.AddAction(testAction1);
            testGR.AddAction(testAction2);
        }
コード例 #23
0
        public void Initialize()
        {
            User       user1 = new User(1, "test1", "mo", "1234", 0, 5000, "*****@*****.**");
            List <int> ids   = new List <int>();

            ids.Add(1);
            _testRM     = new ReplayManager();
            _testGR     = new GameReplay(1, 1);
            _testAction = new CallAction(new Player(user1, 1000, 1),
                                         new Card(Suits.Hearts, 1), new Card(Suits.Hearts, 2), 10);
            _testGR.AddAction(_testAction);
            _testRM.AddGameReplay(_testGR, ids);
        }
コード例 #24
0
        // This updates the used keys info
        private void UpdateKeyUsedActions()
        {
            List <string> usedactions = new List <string>();

            // Anything selected?
            if (listactions.SelectedItems.Count > 0)
            {
                // Get info
                int thiskey = (int)listactions.SelectedItems[0].SubItems[1].Tag;
                if (thiskey != 0)
                {
                    // Find actions with same key
                    foreach (ListViewItem item in listactions.Items)
                    {
                        // Don't count the selected action
                        if (item != listactions.SelectedItems[0])
                        {
                            Actions.Action a    = General.Actions[item.Name];
                            int            akey = (int)item.SubItems[1].Tag;

                            // Check if the key combination matches
                            if ((thiskey & a.ShortcutMask) == (akey & a.ShortcutMask))
                            {
                                usedactions.Add(a.Title + "  (" + General.Actions.Categories[a.Category] + ")");
                            }
                        }
                    }
                }
            }

            // Update info
            if (usedactions.Count == 0)
            {
                keyusedlabel.Visible = false;
                keyusedlist.Visible  = false;
                keyusedlist.Items.Clear();
            }
            else
            {
                keyusedlist.Items.Clear();
                foreach (string a in usedactions)
                {
                    keyusedlist.Items.Add(a);
                }
                keyusedlabel.Visible = true;
                keyusedlist.Visible  = true;
            }
        }
コード例 #25
0
ファイル: Strips.cs プロジェクト: UdiAzulay/Fetcher2
        private void RefreshActions(Actions.Action action, int indent)
        {
            List.Items.Add(new ListViewItem()
            {
                Name = action.GetHashCode().ToString(), Text = action.GetType().Name, Tag = action, IndentCount = indent
            });
            var pa = action as Actions.ParentAction;

            if (pa == null)
            {
                return;
            }
            foreach (var v in pa.Children)
            {
                RefreshActions(v, indent + 1);
            }
        }
コード例 #26
0
        public void MakeDecision()
        {
            if (Goal == Parent.Position || Goal.X == -1)
            {
                GoRogue.Coord zero = new GoRogue.Coord(0, 0);
                int           x;
                int           y;
                do
                {
                    x    = rand.Next(0, Parent.CurrentMap.Width);
                    y    = rand.Next(0, Parent.CurrentMap.Height);
                    Goal = new GoRogue.Coord(x, y);
                } while ((Goal - Parent.Position) == zero || !Parent.CurrentMap.GetWalkabilityMap()[x, y]);

                ActionType = new MoveTo((GameEntity)Parent, Goal);
            }
        }
コード例 #27
0
    private List <Folder> createNewFolders(int number_folders, int max_good_action, int max_bad_actions)
    {
        List <Folder> folders = new List <Folder>();

        while (folders.Count < number_folders)
        {
            Folder folder = Instantiate(prefab, transform.position, Quaternion.identity);
            folder.gameObject.transform.eulerAngles        = prefab.transform.eulerAngles + new Vector3(0, Random.Range(-20, 20));
            folder.avatar.gameObject.transform.eulerAngles = folder.gameObject.transform.eulerAngles + new Vector3(0, 0, Random.Range(-10, 10));
            int tmp_max_bad_action  = max_bad_actions;
            int tmp_max_good_action = max_good_action;
            while (tmp_max_good_action + tmp_max_bad_action != 0)
            {
                if (tmp_max_good_action > 0)
                {
                    Actions.Action action = Actions.instance.getRandomNiceAction();
                    if (!folder.actions.Contains(action))
                    {
                        folder.actions.Add(action);
                        tmp_max_good_action--;
                    }
                }
                if (tmp_max_bad_action > 0)
                {
                    Actions.Action action = Actions.instance.getRandomNaughtyAction();
                    if (!folder.actions.Contains(action))
                    {
                        folder.actions.Add(action);
                        tmp_max_bad_action--;
                    }
                }
            }
            for (int i = 0; i < folder.actions.Count; i++)
            {
                Actions.Action temp        = folder.actions[i];
                int            randomIndex = Random.Range(i, folder.actions.Count);
                folder.actions[i]           = folder.actions[randomIndex];
                folder.actions[randomIndex] = temp;
            }
            folders.Add(folder);
        }
        return(folders);
    }
コード例 #28
0
 public void CutSelection()
 {
     // Copy selected geometry
     if (DoCopySelection("Cut selected elements."))
     {
         // Get the delete action and check if it's bound
         Actions.Action deleteitem = General.Actions["builder_deleteitem"];
         if (deleteitem.BeginBound)
         {
             // Perform delete action
             deleteitem.Begin();
             deleteitem.End();
         }
         else
         {
             // Action not bound
             General.Interface.DisplayStatus(StatusType.Warning, "Cannot remove that in this mode.");
         }
     }
 }
コード例 #29
0
 void Decide(Actions.Action action)
 {
     // determine what player wants to do next
     if (action is Actions.Attack)
     {
         // hunt the given target
         CurrentBehavior = huntTarget;
         huntTarget.StartBehavior(((Actions.Attack)action).target);
     }
     else if (action is Actions.Move)
     {
         // move
         CurrentBehavior = moveToPosition;
         moveToPosition.StartBehavior(((Actions.Move)action).destination);
     }
     else
     {
         // auto attack when idle
         CurrentBehavior = autoAttack;
     }
 }
コード例 #30
0
ファイル: FileVolumeControl.cs プロジェクト: zBart/Ares
        private void Commit()
        {
            if (m_Element == null)
            {
                return;
            }
            listen = false;
            Actions.Action action = Actions.Actions.Instance.LastAction;
            if (action != null && action is Actions.ElementVolumeEffectsChangeAction)
            {
                Actions.ElementVolumeEffectsChangeAction eeca = action as Actions.ElementVolumeEffectsChangeAction;
                if (eeca.Elements[0] == m_Element)
                {
                    eeca.SetData(
                        randomButton.Checked,
                        volumeBar.Value,
                        (int)minRandomUpDown.Value,
                        (int)maxRandomUpDown.Value,
                        TimeConversion.GetTimeInMillis(fadeInUpDown, fadeInUnitBox),
                        TimeConversion.GetTimeInMillis(fadeOutUpDown, fadeOutUnitBox),
                        crossFadingBox.Checked);
                    eeca.Do(m_Project);
                    listen = true;
                    return;
                }
            }
            List <Ares.Data.IEffectsElement> elements = new List <Ares.Data.IEffectsElement>();

            elements.Add(m_Element);
            Actions.Actions.Instance.AddNew(new Actions.ElementVolumeEffectsChangeAction(elements,
                                                                                         randomButton.Checked,
                                                                                         volumeBar.Value,
                                                                                         (int)minRandomUpDown.Value,
                                                                                         (int)maxRandomUpDown.Value,
                                                                                         TimeConversion.GetTimeInMillis(fadeInUpDown, fadeInUnitBox),
                                                                                         TimeConversion.GetTimeInMillis(fadeOutUpDown, fadeOutUnitBox),
                                                                                         crossFadingBox.Checked)
                                            , m_Project);
            listen = true;
        }
コード例 #31
0
    void HandleCursorRay(RaycastHit hit, bool clicked)
    {
        NextAction = null;
        isMoving   = false;
        if (clicked)
        {
            // clicking -> attack or move
            var go   = hit.collider.gameObject;
            var unit = go.GetComponent <Unit> ();

            if (unit != null)
            {
                // clicked a unit -> attack if enemy
                // TODO: Move to Unit, then start attacking
                NextAction = new Actions.Attack {
                    target = unit
                };
            }
            else
            {
                // did not click on a unit -> start moving
                NextAction = new Actions.Move {
                    destination = hit.point
                };
                isMoving = true;
            }
        }
        else
        {
            // dragging -> keep moving, if already moving
            if (isMoving)
            {
                NextAction = new Actions.Move {
                    destination = hit.point
                };
            }
        }
    }
コード例 #32
0
ファイル: Cache.cs プロジェクト: ISeeDEDPpl/Questor
        /// <summary>
        ///   Loads mission objectives from XML file
        /// </summary>
        /// <param name = "agentId"> </param>
        /// <param name = "pocketId"> </param>
        /// <param name = "missionMode"> </param>
        /// <returns></returns>
        public IEnumerable<Actions.Action> LoadMissionActions(long agentId, int pocketId, bool missionMode)
        {
            try
            {

                DirectAgentMission missiondetails = GetAgentMission(agentId, false);
                if (missiondetails == null && missionMode)
                {
                    return new Actions.Action[0];
                }

                if (missiondetails != null)
                {
                    Cache.Instance.SetmissionXmlPath(FilterPath(missiondetails.Name));
                    if (!File.Exists(Cache.Instance.MissionXmlPath))
                    {
                        //No mission file but we need to set some cache settings
                        OrbitDistance = Settings.Instance.OrbitDistance;
                        OptimalRange = Settings.Instance.OptimalRange;
                        AfterMissionSalvaging = Settings.Instance.AfterMissionSalvaging;
                        return new Actions.Action[0];
                    }

                    //
                    // this loads the settings from each pocket... but NOT any settings global to the mission
                    //
                    try
                    {
                        XDocument xdoc = XDocument.Load(Cache.Instance.MissionXmlPath);
                        if (xdoc.Root != null)
                        {
                            XElement xElement = xdoc.Root.Element("pockets");
                            if (xElement != null)
                            {
                                IEnumerable<XElement> pockets = xElement.Elements("pocket");
                                foreach (XElement pocket in pockets)
                                {
                                    if ((int)pocket.Attribute("id") != pocketId)
                                    {
                                        continue;
                                    }

                                    if (pocket.Element("orbitentitynamed") != null)
                                    {
                                        OrbitEntityNamed = (string)pocket.Element("orbitentitynamed");
                                    }

                                    if (pocket.Element("damagetype") != null)
                                    {
                                        MissionDamageType = (DamageType)Enum.Parse(typeof(DamageType), (string)pocket.Element("damagetype"), true);
                                    }

                                    if (pocket.Element("orbitdistance") != null) 	//Load OrbitDistance from mission.xml, if present
                                    {
                                        OrbitDistance = (int)pocket.Element("orbitdistance");
                                        Logging.Log("Cache", "Using Mission Orbit distance [" + OrbitDistance + "]", Logging.White);
                                    }
                                    else //Otherwise, use value defined in charname.xml file
                                    {
                                        OrbitDistance = Settings.Instance.OrbitDistance;
                                        Logging.Log("Cache", "Using Settings Orbit distance [" + OrbitDistance + "]", Logging.White);
                                    }

                                    if (pocket.Element("optimalrange") != null) 	//Load OrbitDistance from mission.xml, if present
                                    {
                                        OptimalRange = (int)pocket.Element("optimalrange");
                                        Logging.Log("Cache", "Using Mission OptimalRange [" + OptimalRange + "]", Logging.White);
                                    }
                                    else //Otherwise, use value defined in charname.xml file
                                    {
                                        OptimalRange = Settings.Instance.OptimalRange;
                                        Logging.Log("Cache", "Using Settings OptimalRange [" + OptimalRange + "]", Logging.White);
                                    }

                                    if (pocket.Element("afterMissionSalvaging") != null) 	//Load afterMissionSalvaging setting from mission.xml, if present
                                    {
                                        AfterMissionSalvaging = (bool)pocket.Element("afterMissionSalvaging");
                                    }

                                    if (pocket.Element("dronesKillHighValueTargets") != null) 	//Load afterMissionSalvaging setting from mission.xml, if present
                                    {
                                        DronesKillHighValueTargets = (bool)pocket.Element("dronesKillHighValueTargets");
                                    }
                                    else //Otherwise, use value defined in charname.xml file
                                    {
                                        DronesKillHighValueTargets = Settings.Instance.DronesKillHighValueTargets;

                                        //Logging.Log(string.Format("Cache: Using Character Setting DroneKillHighValueTargets  {0}", DronesKillHighValueTargets));
                                    }

                                    List<Actions.Action> actions = new List<Actions.Action>();
                                    XElement elements = pocket.Element("actions");
                                    if (elements != null)
                                    {
                                        foreach (XElement element in elements.Elements("action"))
                                        {
                                            Actions.Action action = new Actions.Action
                                            {
                                                State = (ActionState)Enum.Parse(typeof(ActionState), (string)element.Attribute("name"), true)
                                            };
                                            XAttribute xAttribute = element.Attribute("name");
                                            if (xAttribute != null && xAttribute.Value == "ClearPocket")
                                            {
                                                action.AddParameter("", "");
                                            }
                                            else
                                            {
                                                foreach (XElement parameter in element.Elements("parameter"))
                                                {
                                                    action.AddParameter((string)parameter.Attribute("name"), (string)parameter.Attribute("value"));
                                                }
                                            }
                                            actions.Add(action);
                                        }
                                    }

                                    return actions;
                                }

                                //actions.Add(action);
                            }
                            else
                            {
                                return new Actions.Action[0];
                            }
                        }
                        else
                        {
                            { return new Actions.Action[0]; }
                        }

                        // if we reach this code there is no mission XML file, so we set some things -- Assail

                        OptimalRange = Settings.Instance.OptimalRange;
                        OrbitDistance = Settings.Instance.OrbitDistance;
                        Logging.Log("Cache", "Using Settings Orbit distance [" + Settings.Instance.OrbitDistance + "]", Logging.White);

                        return new Actions.Action[0];
                    }
                    catch (Exception ex)
                    {
                        Logging.Log("Cache", "Error loading mission XML file [" + ex.Message + "]", Logging.Orange);
                        return new Actions.Action[0];
                    }
                }
                return new Actions.Action[0];
            }
            catch (Exception exception)
            {
                Logging.Log("Cache.LoadMissionActions", "Exception [" + exception + "]", Logging.Debug);
                return null;
            }
        }