コード例 #1
0
        /// <summary>
        /// Sets the value.
        /// </summary>
        /// <param name="entityType">Type of the entity.</param>
        public void SetValue(EntityTypeCache entityType)
        {
            ItemId   = Constants.None.IdValue;
            ItemName = Constants.None.TextHtml;

            if (entityType != null)
            {
                ItemId   = entityType.Id.ToString();
                ItemName = ActionContainer.GetComponentName(entityType.Name);

                var action = ActionContainer.GetComponent(entityType.Name);
                if (action != null)
                {
                    var actionType = action.GetType();
                    var obj        = actionType.GetCustomAttributes(typeof(ActionCategoryAttribute), true).FirstOrDefault();
                    if (obj != null)
                    {
                        var actionCategory = obj as ActionCategoryAttribute;
                        if (actionCategory != null)
                        {
                            var categoryEntry = ActionContainer.Instance.Categories.Where(c => c.Value == actionCategory.CategoryName).FirstOrDefault();
                            InitialItemParentIds = categoryEntry.Key.ToString();
                        }
                    }
                }
            }
        }
コード例 #2
0
    void Init(int start_hour, int end_hour)
    {
        selectedTimeslot = -1;
        for (int i = start_hour; i < end_hour; i++)
        {
            GameObject timeslot = Instantiate(timeslotPrefab, TimeslotContainer.transform);
            timeslot.GetComponent <TimeSlotter>().Init(i - start_hour, i, this);
            timeslots.Add(timeslot);
            currentSchedule.Add(null);
            actionDistrictTarget.Add(-1);
            actionMessageTarget.Add(-1);
        }

        for (int i = 0; i < actions.Count; i++)
        {
            GameObject actionslot = Instantiate(actionslotPrefab, ActionContainer.transform);
            actionslot.GetComponent <ActionSlotter>().Init(actions[i], this, Desc);
            actionslots.Add(actionslot);
        }

        for (int i = 0; i < resourceslots.Count; i++)
        {
            Instantiate(resourceslots[i], ResourceContainer.transform);
        }
        MoneySlider     = GameObject.FindWithTag("Money");
        InfluenceSlider = GameObject.FindWithTag("Influence");
        if (levelData.advancedResourcesEnabled)
        {
            StressSlider   = GameObject.FindWithTag("Stress");
            CharismaSlider = GameObject.FindWithTag("Charisma");
        }
        LayoutRebuilder.ForceRebuildLayoutImmediate(ActionContainer.GetComponent <RectTransform>());

        if (isUsingDistricts)
        {
            miniMap = Instantiate(mapContainer, MapUi.transform.Find("Button"));
            bigMap  = Instantiate(mapContainer, MapUi.transform.Find("Map Container"));
            miniMap.GetComponent <MapController>().setMini();
            miniMap.GetComponent <MapController>().UpdateDistricts(districts);
            bigMap.GetComponent <MapController>().UpdateDistricts(districts);
            MapUi.SetActive(true);
            MapUi.GetComponentInChildren <MapButton>().Init(bigMap);
            SpeechUi.SetActive(true);
            for (int i = 0; i < campaignMessages.Count; i++)
            {
                GameObject messageslot = Instantiate(messageslotPrefab, SpeechContainer.transform) as GameObject;

                messageslot.GetComponent <MessageSlotter>().Init(campaignMessages[i], this, Desc, i);
                messageslots.Add(messageslot);
            }
            speechMap = Instantiate(mapContainer, SpeechUi.transform.Find("SpeechMap"));
            speechMap.GetComponent <MapController>().DisableDistricts(this);
            speechMap.GetComponent <MapController>().Buttonify(this);
            SpeechUi.SetActive(false);
        }
    }
コード例 #3
0
        /// <summary>
        /// Sets the values.
        /// </summary>
        /// <param name="entityTypes">The entity types.</param>
        /// <exception cref="System.NotSupportedException"></exception>
        public void SetValues(IEnumerable <EntityTypeCache> entityTypes)
        {
            var theEntityTypes = entityTypes.ToList();

            if (theEntityTypes.Any())
            {
                var ids       = new List <string>();
                var names     = new List <string>();
                var parentIds = new List <string>();

                foreach (var entityType in theEntityTypes)
                {
                    ids.Add(entityType.Id.ToString());
                    names.Add(ActionContainer.GetComponentName(entityType.Name));

                    var action = ActionContainer.GetComponent(entityType.Name);
                    if (action != null)
                    {
                        var actionType = action.GetType();
                        var obj        = actionType.GetCustomAttributes(typeof(ActionCategoryAttribute), true).FirstOrDefault();
                        if (obj != null)
                        {
                            var actionCategory = obj as ActionCategoryAttribute;
                            if (actionCategory != null)
                            {
                                parentIds.Add(string.Format("'{0}'", actionCategory.CategoryName.EscapeQuotes()));
                            }
                        }
                    }
                }

                InitialItemParentIds = parentIds.AsDelimited(",");
                ItemIds   = ids;
                ItemNames = names;
            }
            else
            {
                ItemId   = Constants.None.IdValue;
                ItemName = Constants.None.TextHtml;
            }
        }
コード例 #4
0
        /// <summary>
        /// Writes the <see cref="T:System.Web.UI.WebControls.CompositeControl" /> content to the specified <see cref="T:System.Web.UI.HtmlTextWriter" /> object, for display on the client.
        /// </summary>
        /// <param name="writer">An <see cref="T:System.Web.UI.HtmlTextWriter" /> that represents the output stream to render HTML content on the client.</param>
        public override void RenderControl(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel panel-widget workflow-action");
            writer.AddAttribute("data-key", _hfActionTypeGuid.Value);
            writer.RenderBeginTag("article");

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "clearfix clickable panel-heading");
            writer.RenderBeginTag("header");

            // Hidden Field to track expansion
            _hfExpanded.RenderControl(writer);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-left workflow-action-name");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _lblActionTypeName.Text = _tbActionTypeName.Text;
            _lblActionTypeName.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "pull-right");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            string criteriaExistsClass = _ddlCriteriaAttribute.SelectedValueAsGuid().HasValue ? " criteria-exists" : string.Empty;

            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link js-workflow-action-criteria{0}'><i class='fa fa-filter'></i></a>", criteriaExistsClass));
            writer.WriteLine("<a class='btn btn-xs btn-link workflow-action-reorder'><i class='fa fa-bars'></i></a>");
            writer.WriteLine(string.Format("<a class='btn btn-xs btn-link'><i class='workflow-action-state fa {0}'></i></a>",
                                           Expanded ? "fa fa-chevron-up" : "fa fa-chevron-down"));

            if (IsDeleteEnabled)
            {
                _lbDeleteActionType.Visible = true;

                _lbDeleteActionType.RenderControl(writer);
            }
            else
            {
                _lbDeleteActionType.Visible = false;
            }

            // Add/ChevronUpDown/Delete div
            writer.RenderEndTag();

            // header div
            writer.RenderEndTag();

            if (!Expanded)
            {
                // hide details if the name has already been filled in
                writer.AddStyleAttribute("display", "none");
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "panel-body");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            // add Criteria fields
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row conditional-run-criteria alert-warning");
            if (!_ddlCriteriaAttribute.SelectedValueAsGuid().HasValue)
            {
                writer.AddStyleAttribute("display", "none");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-xs-7");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _ddlCriteriaAttribute.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-xs-5");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _ddlCriteriaComparisonType.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();  // row

            writer.RenderEndTag();  // col-md-6

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            var comparisonType = _ddlCriteriaComparisonType.SelectedValueAsEnum <ComparisonType>();

            _tbddlCriteriaValue.Style["display"] = (comparisonType == ComparisonType.IsBlank || comparisonType == ComparisonType.IsNotBlank) ? "none" : "block";
            _tbddlCriteriaValue.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();

            // action edit fields
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "form-row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _tbActionTypeName.ValidationGroup = ValidationGroup;
            _tbActionTypeName.RenderControl(writer);
            writer.RenderEndTag();

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-md-6");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _cbIsActionCompletedOnSuccess.ValidationGroup = ValidationGroup;
            _cbIsActionCompletedOnSuccess.RenderControl(writer);
            _cbIsActivityCompletedOnSuccess.ValidationGroup = ValidationGroup;
            _cbIsActivityCompletedOnSuccess.RenderControl(writer);
            writer.RenderEndTag();

            writer.RenderEndTag();  // row

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "row");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-4");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            _wfatpEntityType.ValidationGroup = ValidationGroup;
            _wfatpEntityType.RenderControl(writer);
            writer.RenderEndTag();

            // Add an overview(description) of the selected action type
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "col-lg-8");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            EntityTypeCache entityType   = null;
            int?            entityTypeId = _wfatpEntityType.SelectedValueAsInt();

            if (entityTypeId.HasValue)
            {
                entityType = EntityTypeCache.Get(entityTypeId.Value);
                if (entityType != null)
                {
                    var component = ActionContainer.GetComponent(entityType.Name);
                    if (component != null)
                    {
                        string description   = string.Empty;
                        var    propAttribute = component.GetType().GetCustomAttributes(typeof(System.ComponentModel.DescriptionAttribute), false).FirstOrDefault();
                        if (propAttribute != null)
                        {
                            var descAttribute = propAttribute as System.ComponentModel.DescriptionAttribute;
                            if (descAttribute != null)
                            {
                                _rlEntityTypeOverview.Label = string.Format("'{0}' Overview", entityType.FriendlyName);
                                _rlEntityTypeOverview.Text  = descAttribute.Description;
                                _rlEntityTypeOverview.RenderControl(writer);
                            }
                        }
                    }
                }
            }
            writer.RenderEndTag();  // col-md-8

            writer.RenderEndTag();  // row

            if (entityType != null && entityType.Name == typeof(Rock.Workflow.Action.UserEntryForm).FullName)
            {
                _formEditor.ValidationGroup = ValidationGroup;
                _formEditor.RenderControl(writer);
            }

            _phActionAttributes.RenderControl(writer);

            // widget-content div
            writer.RenderEndTag();

            // article tag
            writer.RenderEndTag();
        }