Esempio n. 1
0
        private void Push(FlexNode node = null)
        {
            if (m_Flexs == null)
            {
                m_Flexs = new Dictionary <int, FlexNode>();
            }
            if (m_FlexGOParent == null)
            {
                m_FlexGOParent = new GameObject("Flexs");
            }
            if (m_GizmosGO == null)
            {
                m_GizmosGO      = MazeMapGizmos.instance.gameObject;
                m_GizmosGO.name = "Maze Maker Gizmos";
            }

            OnFlexChange(true, node);
            OnOtherFlexChange();
            var flexType = (FlexType)m_SelectFlexTypeIdx;
            var n        = node ?? new FlexNode(m_Flexs.Count, flexType, m_FlexTime);
            var info     = new FlexGOInfo(n, m_FlexPosition, m_FlexForwardDir);
            var flexGO   = MazeManager.CreateFlex(info);

            flexGO.transform.localScale = Vector3.one * m_Scale;
            flexGO.transform.SetParent(m_FlexGOParent.transform);
            m_Flexs.Add(flexGO.transform.GetSiblingIndex(), n);
            UpdateGizmos();
            SaveToEditorPrebs();
        }
Esempio n. 2
0
        public ActionResult EditTableRow(string idfsSection, bool isNew, long idfRow, long key, string ffpresenterId)
        {
            FlexNode sectionNode = null;
            var      ff          = ModelStorage.Get(Session.SessionID, key, ffpresenterId) as FFPresenterModel;

            if ((ff != null) && (ff.CurrentTemplate != null) && (idfsSection.Length > 0) &&
                (ff.CurrentObservation.HasValue))
            {
                //проходим по всем столбцам-параметрами создаём фейковые ячейки данных
                //(пустые, удалятся при сохранении, если не будут введены данные)
                //отыскиваем нод для табличной секции
                sectionNode = ff.TemplateFlexNode.FindChildNodeSection(Convert.ToInt64(idfsSection));

                if (isNew)
                {
                    var idParameters = sectionNode.GetIDParametersForSection();
                    var numRow       = sectionNode.GetNumForNewRow(ff.ActivityParameters);

                    using (var manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance))
                    {
                        var idfRowNew = (new GetNewIDExtender <ActivityParameter>()).GetScalar(manager, null);
                        foreach (var parameter in ff.CurrentTemplate.ParameterTemplatesLookup)
                        {
                            if (!idParameters.Contains(parameter.idfsParameter))
                            {
                                continue;
                            }
                            ff.ActivityParameters.SetActivityParameterValue(
                                ff.CurrentTemplate
                                , ff.CurrentObservation.Value
                                , parameter.idfsParameter
                                , idfRowNew
                                , numRow
                                , DBNull.Value
                                , String.Empty);
                        }
                        sectionNode.idfRow = ViewBag.IdfRow = idfRowNew;
                    }
                }
                else
                {
                    sectionNode.idfRow = ViewBag.IdfRow = idfRow;
                }
            }
            ViewBag.IsNew         = isNew ? 1 : 0;
            ViewBag.IdfsSection   = idfsSection;
            ViewBag.FFKey         = key;
            ViewBag.FFPresenterId = ffpresenterId;
            ViewBag.UrlForReturn  = Session["ReturnUrl"];
            return(View("SectionTemplateTableEditRender", sectionNode));
        }
Esempio n. 3
0
        private void OnFlexChange(bool isPush = true, FlexNode node = null)
        {
            if (m_Flexs.Count == 0)
            {
                return;
            }
            var flexGO   = m_FlexGOParent.transform.GetChild(m_Flexs.Keys.Last <int>()).gameObject;
            var flexType = m_Flexs.Values.Last <FlexNode>().type;

            if (isPush)
            {
                var preFlexTime = m_Flexs.Values.Last <FlexNode>().time;
                m_FlexTime = node != null ? node.time : m_FlexTime;
                var timeBetween = m_FlexTime - preFlexTime;
                m_FlexForwardDir = flexType == FlexType.Left
                    ? -flexGO.transform.right
                    : (flexType == FlexType.Right ? flexGO.transform.right : flexGO.transform.forward);
                m_FlexPosition += m_FlexForwardDir * m_Scale * (timeBetween / m_ReactTime);
            }
            else
            {
                var curFlexTime = m_Flexs.Values.Last <FlexNode>().time;
                var preFlexTime = 0f;
                if (m_Flexs.Count > 1)
                {
                    preFlexTime = m_Flexs.Values.ToList()[m_Flexs.Count - 2].time;
                }
                var timeBetween = curFlexTime - preFlexTime;

                if (m_Flexs.Count > 1)
                {
                    flexGO           = m_FlexGOParent.transform.GetChild(m_Flexs.Keys.ToList()[m_Flexs.Count - 2]).gameObject;;
                    m_FlexForwardDir = flexType == FlexType.Left
                        ? -flexGO.transform.right
                        : (flexType == FlexType.Right ? flexGO.transform.right : flexGO.transform.forward);
                }
                else
                {
                    m_FlexForwardDir = Vector3.zero;
                }
                m_FlexForwardDir = flexType == FlexType.Left
                   ? -flexGO.transform.right
                   : (flexType == FlexType.Right ? flexGO.transform.right : flexGO.transform.forward);

                m_FlexPosition -= m_FlexForwardDir * m_Scale * (timeBetween / m_ReactTime);
            }
        }
Esempio n. 4
0
        private static IEnumerable <FFTemplate> GetTemplate(FlexNode node)
        {
            var templates = new List <FFTemplate>();
            var t         = new FFTemplate();

            if (node.IsSection())
            {
                var s = node.GetSectionTemplate();
                //we shall not pass table sections
                if (!s.blnGrid)
                {
                    t.br = s.idfsSection;
                    t.ft = s.idfsFormTemplate;
                    if (s.idfsParentSection.HasValue)
                    {
                        t.brp = s.idfsParentSection.Value;
                        t.et  = (int)FFModelElementTypes.Label;
                    }
                    else
                    {
                        t.et = (int)FFModelElementTypes.Section;
                    }
                }
            }
            else if (node.IsParameter())
            {
                var p = node.GetParameterTemplate();
                //we shall not pass parameters from table sections
                var canProceed = !(p.ParentSection != null && p.ParentSection.blnGrid);
                if (canProceed)
                {
                    t.br = p.idfsParameter;
                    t.ft = p.idfsFormTemplate;
                    if (p.idfsSection.HasValue)
                    {
                        t.brp = p.idfsSection.Value;
                    }
                    t.et = (int)FFModelElementTypes.Parameter;
                    if (p.idfsEditor.HasValue)
                    {
                        t.ed = p.idfsEditor.Value;
                    }
                    t.rd = p.ReadOnly ? 1 : 0;
                    t.md = p.IsMandatory() ? 1 : 0;
                    if (p.idfsParameterType.HasValue)
                    {
                        t.pt = p.idfsParameterType.Value;
                    }
                    t.ptt = p.idfsParameterCaption.HasValue ? p.idfsParameterCaption.Value : 0;
                }
            }
            else if (node.IsLabel())
            {
                var l = node.GetLabel();
                if (l.idfsBaseReference.HasValue)
                {
                    t.br = l.idfsBaseReference.Value;
                    t.ft = l.idfsFormTemplate;
                    if (l.idfsSection.HasValue)
                    {
                        t.brp = l.idfsSection.Value;
                    }
                    t.et = (int)FFModelElementTypes.Label;
                }
            }
            if (t.br > 0)
            {
                templates.Add(t);
            }

            foreach (var n in node.ChildList)
            {
                templates.AddRange(GetTemplate((FlexNode)n));
            }

            return(templates);
        }
Esempio n. 5
0
 public ActionResult FlexNodeRender(FlexNode node, bool canUpdate = true)
 {
     ViewBag.CanUpdate     = canUpdate;
     node.FFModel.ReadOnly = !canUpdate;
     return(PartialView(node));
 }
Esempio n. 6
0
 public ActionResult LabelRender(FlexNode flexNode, bool canUpdate = true)
 {
     return(PartialView(flexNode));
 }
Esempio n. 7
0
 public ActionResult SectionTemplateTableRender(FlexNode flexNode, bool canUpdate = true)
 {
     ViewBag.CanUpdate = canUpdate;
     return(PartialView(flexNode));
 }
Esempio n. 8
0
 public ActionResult SectionTemplateRender(FlexNode flexNode, bool canUpdate = true)
 {
     return(PartialView(flexNode));
 }