示例#1
0
        public static Button CreateActionButton(ActionBase action, RenderContext context)
        {
            ActionConfig styling  = context.Config.Actions;
            var          uiButton = new Button()
            {
#if WPF
                HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
#endif
            };

            uiButton.SetBackgroundColor(styling.BackgroundColor, context);
            uiButton.SetBorderColor(styling.BackgroundColor, context);
            uiButton.SetThickness(context.Config.Actions.BorderThickness);
            uiButton.Style = context.GetStyle($"Adaptive.{action.Type}");

            xaml.TextBlock uiTitle = new xaml.TextBlock()
            {
                Text     = action.Title,
                FontSize = styling.FontSize,
                Margin   = new Thickness(styling.Padding.Left, styling.Padding.Top, styling.Padding.Right, styling.Padding.Bottom),
            };
            uiTitle.SetFontWeight(styling.FontWeight);
            uiTitle.SetColor(styling.TextColor, context);
            uiTitle.Style    = context.GetStyle($"Adaptive.Action.Title");
            uiButton.Content = uiTitle;
            string name = context.GetType().Name.Replace("Action", String.Empty);

            return(uiButton);
        }
示例#2
0
        /***************************************************/
        /****             Protected Methods             ****/
        /***************************************************/

        protected override IEnumerable <IBHoMObject> Read(IRequest request, ActionConfig actionConfig = null)
        {
            ICollection <ElementId> selected = this.UIDocument.Selection.GetElementIds();

            if (request == null)
            {
                BH.Engine.Reflection.Compute.RecordError("BHoM objects could not be read because provided IRequest is null.");
                return(new List <IBHoMObject>());
            }

            RevitPullConfig pullConfig = actionConfig as RevitPullConfig;

            if (pullConfig == null)
            {
                BH.Engine.Reflection.Compute.RecordError("BHoM objects could not be read because provided actionConfig is not a valid RevitPullConfig.");
                return(new List <IBHoMObject>());
            }

            Discipline?requestDiscipline = request.Discipline(pullConfig.Discipline);

            if (requestDiscipline == null)
            {
                BH.Engine.Reflection.Compute.RecordError("Conflicting disciplines have been detected.");
                return(new List <IBHoMObject>());
            }

            Discipline discipline = requestDiscipline.Value;

            if (discipline == Discipline.Undefined)
            {
                discipline = Discipline.Physical;
            }

            Dictionary <Document, IRequest> requestsByLinks = request.SplitRequestTreeByLinks(this.Document);

            if (requestsByLinks == null)
            {
                BH.Engine.Reflection.Compute.RecordError($"Pull failed due to issues with the request containing {nameof(FilterByLink)}. Please try to restructure the used Request and try again.");
                return(new List <IBHoMObject>());
            }

            RevitSettings settings = RevitSettings.DefaultIfNull();

            List <IBHoMObject> result = new List <IBHoMObject>();

            foreach (KeyValuePair <Document, IRequest> requestByLink in requestsByLinks)
            {
                result.AddRange(Read(requestByLink.Key, requestByLink.Value, pullConfig, discipline, settings));
            }

            bool?[] activePulls = new bool?[] { pullConfig.GeometryConfig?.PullEdges, pullConfig.GeometryConfig?.PullSurfaces, pullConfig.GeometryConfig?.PullMeshes, pullConfig.RepresentationConfig?.PullRenderMesh };
            if (activePulls.Count(x => x == true) > 1)
            {
                BH.Engine.Reflection.Compute.RecordWarning("Pull of more than one geometry/representation type has been specified in RevitPullConfig. Please consider this can be time consuming due to the amount of conversions.");
            }

            this.UIDocument.Selection.SetElementIds(selected);

            return(result);
        }
示例#3
0
        public bool MakeCall(String remoteUri)
        {
            bool ret;

            base.outgoing = true;
            base.ToUri    = remoteUri;

            ActionConfig config = new ActionConfig();

            switch (this.mediaType)
            {
            case MediaType.AudioVideo:
            case MediaType.Video:
                ret = this.session.callAudioVideo(remoteUri, config);
                break;

            case MediaType.Audio:
                ret = this.session.callAudio(remoteUri, config);
                break;

            default:
                throw new Exception("This session doesn't support this media type");
            }
            config.Dispose();

            return(ret);
        }
示例#4
0
        /***************************************************/
        /**** Public Methods                            ****/
        /***************************************************/

        public IEnumerable <object> Pull(GetRequest request, ActionConfig actionConfig)
        {
            string response = Compute.MakeRequest(request);

            if (response == null)
            {
                return(new List <BHoMObject>());
            }

            // check if the response is a valid json
            if (response.StartsWith("{") || response.StartsWith("["))
            {
                return new List <object>()
                       {
                           Engine.Serialiser.Convert.FromJson(response)
                       }
            }
            ;

            else
            {
                return new List <object>()
                       {
                           response
                       }
            };
        }
示例#5
0
        public static ActionConfig WithParam(this ActionConfig actionConfig, string name, Type type)
        {
            actionConfig.Parameters = actionConfig.Parameters
                                      .Concat(new[] { new ActionParameter(name, type) }).ToArray();

            return(actionConfig);
        }
示例#6
0
        public static int Remove(BHoMAdapter adapter, object request = null, ActionConfig actionConfig = null, bool active = false)
        {
            if (!active)
            {
                return(0);
            }

            IRequest actualRequest = null;

            if (!adapter.SetupRemoveRequest(request, out actualRequest))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(request)}` input.");
                return(0);
            }

            ActionConfig removeConfig = null;

            if (!adapter.SetupRemoveConfig(actionConfig, out removeConfig))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(actionConfig)}` input.");
                return(0);
            }

            return(adapter.Remove(actualRequest, removeConfig));
        }
示例#7
0
        private async Task SelectAction(ConsoleKeyInfo keyInfo, ActionConfig actionConfig)
        {
            IScraper scraper;

            switch (keyInfo.KeyChar)
            {
            case '1':
                Console.WriteLine("Scrape free market selected.");
                scraper = new FreeMarketScraper(client);
                await RunScraper(actionConfig, scraper);

                ShowPrinterInterface(scraper);
                break;

            case 'x':
                Console.WriteLine("Exiting program...");
                break;

            default:
                Console.WriteLine("Option not supported.");
                break;
            }

            Console.WriteLine();
        }
示例#8
0
    public override void Execute(ActionSystem system, ActionConfig config)
    {
        var targetingSystem = system.GetComponent <TargetingSystem>();

        Debug.LogFormat("{0} {1} AttackActionBehavior", system.name, config.actionName);
        Debug.LogFormat("\t Target: {0}", targetingSystem.TargetWorldPosition());
    }
示例#9
0
        /***************************************************/
        /**** Adapter overload method                   ****/
        /***************************************************/

        //Method being called for any object already existing in the model in terms of comparers is found.
        //Default implementation first deletes these objects, then creates new ones, if not applicable for the software, override this method

        protected override bool IUpdate <T>(IEnumerable <T> objects, ActionConfig actionConfig = null)
        {
            bool success = true;

            success = Update(objects as dynamic);
            return(success);
        }
示例#10
0
        public static Output <List <object>, bool> Push(BHoMAdapter adapter, IEnumerable <object> objects, string tag = "",
                                                        PushType pushType = PushType.AdapterDefault, ActionConfig actionConfig = null,
                                                        bool active       = false)
        {
            var noOutput = BH.Engine.Reflection.Create.Output(new List <object>(), false);

            if (!active)
            {
                return(noOutput);
            }

            ActionConfig pushConfig = null;

            if (!adapter.SetupPushConfig(actionConfig, out pushConfig))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(actionConfig)}` input.");
                return(noOutput);
            }

            PushType pt = pushType;

            if (!adapter.SetupPushType(pushType, out pt))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(pushType)}` input.");
                return(noOutput);
            }

            List <object> result = adapter.Push(objects, tag, pt, pushConfig);

            return(BH.Engine.Reflection.Create.Output(result, objects?.Count() == result?.Count()));
        }
示例#11
0
        public async Task <ICollection <VmanPlayer> > Run(ActionConfig actionConfig)
        {
            Console.WriteLine($"TRACE: Processing {actionConfig.Pages} pages on free market with minimum age {actionConfig.MinimumAge}, maximum age {actionConfig.MaximumAge} and position {actionConfig.Position.Value}");

            var tasks = new List <Task <ICollection <VmanPlayer> > >();

            for (var i = 1; i <= actionConfig.Pages; i++)
            {
                tasks.Add(ProcessFreeMarketPage(actionConfig.MinimumAge, actionConfig.MaximumAge, actionConfig.Position, i));
            }

            try
            {
                await Task.WhenAll(tasks);
            }
            catch (Exception)
            {
                Console.WriteLine($"ERROR: Could not fetch price info. Do you have available spots on your squad?");
            }

            var playersFromAllPages = new List <VmanPlayer>();

            foreach (var task in tasks)
            {
                var players = await task;
                playersFromAllPages.AddRange(players);
            }

            Console.WriteLine($"TRACE: Finished processing free market");

            Players = playersFromAllPages;

            return(Players);
        }
示例#12
0
文件: Execute.cs 项目: BHoM/BHoM_UI
        public static Output <List <object>, bool> Execute(BHoMAdapter adapter, IExecuteCommand command, ActionConfig actionConfig = null, bool active = false)
        {
            Output <List <object>, bool> result = new Output <List <object>, bool>()
            {
                Item1 = null, Item2 = false
            };

            if (!active)
            {
                return(result);
            }

            ActionConfig executeConfig = null;

            if (!adapter.SetupExecuteConfig(actionConfig, out executeConfig))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(actionConfig)}` input.");
                return(result);
            }

            result = adapter.Execute(command, executeConfig); // Item1 is the result of the Execute; Item2 the `success` bool.

            return(result != null ? result : new Output <List <object>, bool>()
            {
                Item1 = null, Item2 = false
            });
        }
示例#13
0
        /***************************************************/
        /**** Public method - Read override             ****/
        /***************************************************/

        public IEnumerable <IResult> ReadResults(MeshResultRequest request, ActionConfig actionConfig)
        {
            List <IResult> results;
            List <int>     objectIds = GetObjectIDs(request);
            List <int>     loadCases = GetLoadcaseIDs(request);

            switch (request.ResultType)
            {
            case MeshResultType.Displacements:
                results = ExtractMeshDisplacement(objectIds, loadCases).ToList();
                break;

            case MeshResultType.Forces:
                results = ExtractMeshForce(objectIds, loadCases).ToList();
                break;

            case MeshResultType.Stresses:
                results = ExtractMeshStress(objectIds, loadCases, request.Layer).ToList();
                break;

            case MeshResultType.VonMises:
                results = ExtractMeshVonMises(objectIds, loadCases, request.Layer).ToList();
                break;

            default:
                Engine.Base.Compute.RecordError($"Result of type {request.ResultType} is not yet supported in the Lusas_Toolkit.");
                results = new List <IResult>();
                break;
            }
            results.Sort();
            return(results);
        }
示例#14
0
        static void RecClipLength()
        {
            ActionConfig cfg = ScriptableObject.CreateInstance <ActionConfig>();

            cfg.cfg = new ActionLens();
            Object[] os = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
            foreach (Object o in os)
            {
                if (o is GameObject)
                {
                    GameObject go   = o as GameObject;
                    ActionLen  alen = RecClipLength(go);
                    if (null != alen)
                    {
                        cfg.cfg.Add(go.name, alen);
                    }
                }
            }
            string path      = AssetDatabase.GetAssetPath(Selection.activeObject);
            string atlasPath = path + ".asset";

            AssetDatabase.CreateAsset(cfg, atlasPath);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
            Debug.Log("Action len rec done");
        }
示例#15
0
        public static IEnumerable <object> Pull(BHoMAdapter adapter, object request = null,
                                                PullType pullType = PullType.AdapterDefault, ActionConfig actionConfig = null,
                                                bool active       = false)
        {
            if (!active)
            {
                return(new List <object>());
            }

            IRequest actualRequest = null;

            if (!adapter.SetupPullRequest(request, out actualRequest))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(request)}` input.");
                return(null);
            }

            ActionConfig pullConfig = null;

            if (!adapter.SetupPullConfig(actionConfig, out pullConfig))
            {
                BH.Engine.Reflection.Compute.RecordError($"Invalid `{nameof(actionConfig)}` input.");
                return(null);
            }

            return(adapter.Pull(actualRequest, pullType, pullConfig));
        }
示例#16
0
        public void ActionConfig_Test_Parameters()
        {
            var ac = new ActionConfig();

            Assert.AreEqual(false, ac.Controled);
            Assert.AreEqual(null, ac.Events);
        }
示例#17
0
        /***************************************************/
        /**** Public method - Read override             ****/
        /***************************************************/

        public IEnumerable <IResult> ReadResults(BarResultRequest request,
                                                 ActionConfig actionConfig = null)
        {
            CheckAndSetUpCases(request);

            List <string> barIds = CheckGetBarIds(request);

            switch (request.ResultType)
            {
            case BarResultType.BarForce:
                return(ReadBarForce(barIds, request.Divisions));

            case BarResultType.BarDisplacement:
                return(ReadBarDisplacements(barIds, request.Divisions));

            case BarResultType.BarDeformation:
                Engine.Base.Compute.RecordError("SAP2000 cannot export localised BarDeformations." +
                                                "To get the full displacement of the bars in global coordinates, try pulling BarDisplacements");
                return(new List <IResult>());

            case BarResultType.BarStrain:
            case BarResultType.BarStress:
            default:
                Engine.Base.Compute.RecordError("Result extraction of type " + request.ResultType + " is not yet supported");
                return(new List <IResult>());
            }
        }
示例#18
0
    public override void RoundStartExecute()
    {
        ActionConfig config = new ActionConfig().WithValue1(value1);
        Action       action = ActionUtils.Instance.CreateAction("DotAction", caster, GetRole(), config);

        StartCoroutine(action.Apply());
    }
示例#19
0
        /***************************************************/
        /**** Public method - Read override             ****/
        /***************************************************/

        public IEnumerable <IResult> ReadResults(NodeResultRequest request, ActionConfig actionConfig)
        {
            List <IResult> results;
            List <int>     objectIds = GetObjectIDs(request);
            List <int>     loadCases = GetLoadcaseIDs(request);


            switch (request.ResultType)
            {
            case NodeResultType.NodeReaction:
                results = ExtractNodeReaction(objectIds, loadCases).ToList();
                break;

            case NodeResultType.NodeDisplacement:
                results = ExtractNodeDisplacement(objectIds, loadCases).ToList();
                break;

            default:
                Engine.Base.Compute.RecordError($"Result of type {request.ResultType} is not yet supported in the Lusas_Toolkit.");
                results = new List <IResult>();
                break;
            }
            results.Sort();
            return(results);
        }
示例#20
0
        /***************************************************/
        /**** Public method - Read override             ****/
        /***************************************************/

        public IEnumerable <IResult> ReadResults(MeshResultRequest request, ActionConfig actionConfig = null)
        {
            List <string> cases = GetAllCases(request.Cases);

            CheckAndSetUpCases(request);
            List <string> panelIds = CheckGetPanelIds(request);


            switch (request.ResultType)
            {
            case MeshResultType.Forces:
                return(ReadMeshForce(panelIds, request.Smoothing));

            case MeshResultType.Displacements:
                return(ReadMeshDisplacement(panelIds, request.Smoothing));

            case MeshResultType.Stresses:
                return(ReadMeshStress(panelIds, cases, request.Smoothing, request.Layer));

            case MeshResultType.VonMises:
            default:
                Engine.Base.Compute.RecordError("Result extraction of type " + request.ResultType + " is not yet supported");
                return(new List <IResult>());
            }
        }
示例#21
0
        public async Task SoftBanUser(SocketGuildUser user, TimeSpan?time = null, [Remainder] string reason = null)
        {
            if (!await IsActionable(user, Context.User as SocketGuildUser))
            {
                return;
            }

            var config = ModHandler.GetActionConfig(Context.Guild.Id);

            if (time == null)
            {
                time = config.SoftBanLength;
            }
            var expiryTime = DateTime.UtcNow + time.Value;

            await ReplyAsync($"You have been SoftBanned in {Context.Guild.Name} for {time.Value.GetReadableLength()}, Expires at: {expiryTime.ToShortDateString()} {expiryTime.ToShortTimeString()} \n**Reason:** {reason ?? "N/A"}");

            await Context.Guild.AddBanAsync(user, 0, reason);

            ModHandler.TimedActions.Users.Add(new Models.TimeTracker.User(user.Id, Context.Guild.Id, Models.TimeTracker.User.TimedAction.SoftBan, time.Value));
            ModHandler.Save(ModHandler.TimedActions, TimeTracker.DocumentName);
            var caseId = config.AddLogAction(user.Id, Context.User.Id, ActionConfig.Log.LogAction.SoftBan, reason);

            ModHandler.Save(config, ActionConfig.DocumentName(Context.Guild.Id));

            await ReplyAsync($"#{caseId} {user.Mention} has been SoftBanned for {time.Value.GetReadableLength()}, Expires at: {expiryTime.ToShortDateString()} {expiryTime.ToShortTimeString()} \n**Reason:** {reason ?? "N/A"}");

            await ModHandler.LogMessageAsync(Context, $"#{caseId} {user.Mention} has been SoftBanned for {time.Value.GetReadableLength()}, Expires at: {expiryTime.ToShortDateString()} {expiryTime.ToShortTimeString()}", user, reason);
        }
示例#22
0
 public ActionData(Action action)
 {
     this.actionName         = action.actionName;
     this.config             = action.config;
     this.config.actionTypes = action.config.actionTypes;
     this.actionStartTime    = action.actionStartTime;
 }
示例#23
0
        public async Task MuteUser(SocketGuildUser user, TimeSpan?time = null, [Remainder] string reason = null)
        {
            if (!await IsActionable(user, Context.User as SocketGuildUser))
            {
                return;
            }

            //Log this to some config file?
            var config   = ModHandler.GetActionConfig(Context.Guild.Id);
            var muteRole = await ModHandler.GetOrCreateMuteRole(config, Context.Guild);

            await user.AddRoleAsync(muteRole);

            if (time == null)
            {
                time = config.MuteLength;
            }

            ModHandler.TimedActions.Users.Add(new Models.TimeTracker.User(user.Id, Context.Guild.Id, Models.TimeTracker.User.TimedAction.Mute, time.Value));
            var caseId = config.AddLogAction(user.Id, Context.User.Id, ActionConfig.Log.LogAction.Mute, reason);

            ModHandler.Save(config, ActionConfig.DocumentName(Context.Guild.Id));

            ModHandler.Save(ModHandler.TimedActions, TimeTracker.DocumentName);
            var expiryTime = DateTime.UtcNow + time.Value;

            await ReplyAsync($"#{caseId} {user.Mention} has been muted for {time.Value.GetReadableLength()}, Expires at: {expiryTime.ToShortDateString()} {expiryTime.ToShortTimeString()}\n**Reason:** {reason ?? "N/A"}");

            await ModHandler.LogMessageAsync(Context, $"#{caseId} {user.Mention} has been muted for {time.Value.GetReadableLength()}, Expires at: {expiryTime.ToShortDateString()} {expiryTime.ToShortTimeString()}", user, reason);
        }
示例#24
0
        public async Task SetReason(int caseId, [Remainder] string reason)
        {
            var config = ModHandler.GetActionConfig(Context.Guild.Id);

            var action = config.LogActions.FirstOrDefault(x => x.CaseId == caseId);

            if (action == null)
            {
                await ReplyAsync("Invalid Case ID");

                return;
            }

            //Check if reason is updated or list needs to be re-updated
            if (action.Reason == null || action.Reason.Equals("N/A"))
            {
                action.Reason = reason;
                await ReplyAsync("Reason set.");

                await ModHandler.LogMessageAsync(Context, $"#{caseId} reason was set", null, reason);
            }
            else
            {
                action.Reason = $"**Original Reason**\n{action.Reason}**Updated Reason**\n{reason}";
                await ReplyAsync("Appended reason to message.");

                //TODO: Get user if possible.
                await ModHandler.LogMessageAsync(Context, $"#{caseId} reason was updated", null, reason);
            }

            ModHandler.Save(config, ActionConfig.DocumentName(Context.Guild.Id));
        }
示例#25
0
        public async Task HackBanAsync(ulong userId, [Remainder] string reason = null)
        {
            var gUser = Context.Guild.GetUser(userId);

            if (gUser != null)
            {
                if (!await IsActionable(gUser, Context.User as SocketGuildUser))
                {
                    return;
                }
            }

            var config = ModHandler.GetActionConfig(Context.Guild.Id);

            var caseId = config.AddLogAction(userId, Context.User.Id, ActionConfig.Log.LogAction.Ban, reason);

            ModHandler.Save(config, ActionConfig.DocumentName(Context.Guild.Id));

            await Context.Guild.AddBanAsync(userId, 0, reason);

            await ReplyAsync($"#{caseId} Hackbanned user with ID {userId}");

            if (gUser != null)
            {
                await ModHandler.LogMessageAsync(Context, $"#{caseId} Hackbanned user with ID {userId}", gUser, reason);
            }
            else
            {
                await ModHandler.LogMessageAsync(Context, $"#{caseId} Hackbanned user with ID {userId}", userId, reason);
            }
        }
示例#26
0
    public void ReLayout()
    {
        Vector3 tempTxtPos    = orgTextPos;
        Vector3 tempOptPos    = orgOptPos;
        Vector3 tempRewardPos = orgActionPos;

        for (int i = 0; i < allWindows.Count; i++)
        {
            CmConfig item = allWindows[i];
            if (item is TxtConfig)
            {
                TxtConfig txtConfig = item as TxtConfig;
                AddTextWind(ref orgTextPos, txtConfig);
            }
            else if (item is OptionConfig)
            {
                OptionConfig op = item as OptionConfig;
                AddOption(ref tempOptPos, op);
            }
            else if (item is ActionConfig)
            {
                ActionConfig action = item as ActionConfig;
                AddAction(ref tempRewardPos, action);
            }
            else if (item is SpaceConfig)
            {
                SpaceConfig space = item as SpaceConfig;
                orgTextPos.y -= space.LineCount * space.LineHeight;
            }
        }
    }
示例#27
0
        public bool SendFile(string path)
        {
            bool result;

            if (string.IsNullOrEmpty(path) || !System.IO.File.Exists(path))
            {
                MyMsrpSession.LOG.Error(string.Format("File ({0}) doesn't exist", path));
                result = false;
            }
            else if (this.mMediaType != MediaType.FileTransfer)
            {
                MyMsrpSession.LOG.Error("Invalid media type");
                result = false;
            }
            else
            {
                System.IO.FileInfo finfo = new System.IO.FileInfo(path);
                this.mFilePath = (this.mFilePath = finfo.FullName);
                this.mFileType = this.GetFileType(finfo.Extension);
                string       fileSelector = string.Format("name:\"{0}\" type:{1} size:{2}", finfo.Name, this.mFileType, finfo.Length);
                ActionConfig config       = new ActionConfig();
                config.setMediaString(twrap_media_type_t.twrap_media_msrp, "file-path", this.mFilePath).setMediaString(twrap_media_type_t.twrap_media_msrp, "file-selector", fileSelector).setMediaString(twrap_media_type_t.twrap_media_msrp, "accept-types", "message/CPIM application/octet-stream").setMediaString(twrap_media_type_t.twrap_media_msrp, "accept-wrapped-types", "application/octet-stream image/jpeg image/gif image/bmp image/png").setMediaString(twrap_media_type_t.twrap_media_msrp, "file-disposition", "attachment").setMediaString(twrap_media_type_t.twrap_media_msrp, "file-icon", "cid:icon@cetc7").setMediaString(twrap_media_type_t.twrap_media_msrp, "Failure-Report", this.FailureReport ? "yes" : "no").setMediaString(twrap_media_type_t.twrap_media_msrp, "Success-Report", this.SuccessReport ? "yes" : "no").setMediaInt(twrap_media_type_t.twrap_media_msrp, "chunck-duration", 25);
                bool ret = this.mSession.callMsrp(base.RemotePartyUri, config);
                config.Dispose();
                result = ret;
            }
            return(result);
        }
示例#28
0
        public bool UpdateMediaAttribute(MediaType mediaType, MediaAttr attribute, ActionConfig config)
        {
            bool ret = this.mSession.update(MediaTypeUtils.ConvertToNative(mediaType), (int)attribute, config);

            config.Dispose();
            return(ret);
        }
示例#29
0
        /***************************************************/
        /****             Protected methods             ****/
        /***************************************************/

        protected override int Delete(IRequest request, ActionConfig actionConfig = null)
        {
            if (request == null)
            {
                BH.Engine.Reflection.Compute.RecordError("BHoM objects could not be read because provided IRequest is null.");
                return(0);
            }

            UIDocument        uiDocument   = this.UIDocument;
            Document          document     = this.Document;
            RevitRemoveConfig removeConfig = actionConfig as RevitRemoveConfig;

            IEnumerable <ElementId> worksetPrefilter = null;

            if (!removeConfig.IncludeClosedWorksets)
            {
                worksetPrefilter = document.ElementIdsByWorksets(document.OpenWorksetIds().Union(document.SystemWorksetIds()).ToList());
            }

            IEnumerable <ElementId> elementIds = request.IElementIds(uiDocument, worksetPrefilter).RemoveGridSegmentIds(document);

            List <ElementId> deletedIds = Delete(elementIds, document, removeConfig.RemovePinned);

            if (deletedIds == null)
            {
                return(0);
            }
            else
            {
                return(deletedIds.Count);
            }
        }
        private string GetAnimationName(int actionId, string prefix, AnimationType animationType)
        {
            string animationName = string.Empty;

            ActionConfig config = ActionConfigProvider.Instance.GetActionConfig(actionId);

            if (null != config)
            {
                switch (animationType)
                {
                case AnimationType.Idle:
                    animationName = string.Format("{0}{1}", prefix, config.Stand);
                    break;

                case AnimationType.Run:
                    animationName = string.Format("{0}{1}", prefix, config.Run);
                    break;

                case AnimationType.Dead:
                    animationName = string.Format("{0}{1}", prefix, config.Dead);
                    break;

                case AnimationType.Born:
                    animationName = string.Format("{0}{1}", prefix, config.Born);
                    break;
                }
            }
            return(animationName);
        }
示例#31
0
 public Action(ActionConfig config) { throw new Exception(); }
示例#32
0
 static ActionConfig()
 {
     instance = new ActionConfig();
     instance.TypeName = ConfigUtils.GetSetting("Game.Action.TypeName");
     if (string.IsNullOrEmpty(instance.TypeName))
     {
         string assemblyName = ConfigUtils.GetSetting("Game.Action.AssemblyName");
         if (!string.IsNullOrEmpty(assemblyName))
         {
             instance.TypeName = assemblyName + ".Action.Action{0}," + assemblyName;
         }
     }
     instance.ScriptTypeName = ConfigUtils.GetSetting("Game.Action.Script.TypeName", "Game.Script.Action{0}");
     instance.IpAddress = ConfigUtils.GetSetting("Game.IpAddress");
     if (string.IsNullOrEmpty(instance.IpAddress))
     {
         instance.IpAddress = GetLocalIp();
     }
     instance.Port = ConfigUtils.GetSetting("Game.Port", 9101);
     instance.IgnoreAuthorizeSet = new HashSet<int>();
 }
示例#33
0
	public void DefineActions(string keyId, ActionConfig config)
	{
		if (keyId == null || config == null)
			Debug.LogError("keyId and config can't be null in DefineActions");
		
		if (_actionBinds.ContainsKey(keyId))
			_actionBinds [keyId] = config;
		else
			_actionBinds.Add(keyId, config);
	}
示例#34
0
 static ActionConfig()
 {
     instance = new ActionConfig();
     instance.TypeName = ConfigUtils.GetSetting("Game.Action.TypeName");
     instance.IpAddress = ConfigUtils.GetSetting("Game.IpAddress");
     if (string.IsNullOrEmpty(instance.IpAddress))
     {
         instance.IpAddress = GetLocalIp();
     }
     instance.Port = ConfigUtils.GetSetting("Game.Port").ToInt();
 }
示例#35
0
 static ActionConfig()
 {
     instance = new ActionConfig();
     instance.TypeName = ConfigUtils.GetSetting("Game.Action.TypeName");
     if (string.IsNullOrEmpty(instance.TypeName))
     {
         string assemblyName = ConfigUtils.GetSetting("Game.Action.AssemblyName");
         if (!string.IsNullOrEmpty(assemblyName))
         {
             instance.TypeName = assemblyName + ".Action.Action{0}," + assemblyName;
         }
     }
     instance.IpAddress = ConfigUtils.GetSetting("Game.IpAddress");
     if (string.IsNullOrEmpty(instance.IpAddress))
     {
         instance.IpAddress = GetLocalIp();
     }
     instance.Port = ConfigUtils.GetSetting("Game.Port", 9101);
 }