示例#1
0
    void SwitchToPortraitLayout()
    {
        currentOrientationLayout = portrait;

        if (panelCountDownActive)
        {
            portrait.unpaidWaitPanel.gameObject.SetActive(true);
            landscape.unpaidWaitPanel.gameObject.SetActive(false);
        }

        if (bannerCountDownActive)
        {
            portrait.unpaidBanner.SetActive(true);
            portrait.unpaidBannerCountDownText.text = landscape.unpaidBannerCountDownText.text;
            landscape.unpaidBanner.SetActive(false);
        }

        Debug.LogError("Switched To Portrait Layout -- IAP UI");
    }
    void Start()
    {
        if (UIOrientationManager.instance.currentOrientation == UIOrientationManager.Orientation.Landscape)
        {
            currentOrientationLayout = landscape;
        }
        else if (UIOrientationManager.instance.currentOrientation == UIOrientationManager.Orientation.Portrait)
        {
            currentOrientationLayout = portrait;
        }

        if (devSettingsEnabled == true)
        {
            GameManager.instance.paidVersion = true;
        }

        UIOrientationManager.instance.OnSwitchedToPortrait  += SwitchToPortraitLayout;
        UIOrientationManager.instance.OnSwitchedToLandscape += SwitchToLandscapeLayout;
        InitializeUI();
    }
    public void OpenSettings()
    {
        //this.gameObject.SetActive(true);
        Debug.LogError("OpenSettings() beginning of function");
        AudioManager.instance.ClickSound();

        if (UIOrientationManager.instance.currentOrientation == UIOrientationManager.Orientation.Landscape)
        {
            currentOrientationLayout = landscape;
        }
        else if (UIOrientationManager.instance.currentOrientation == UIOrientationManager.Orientation.Portrait)
        {
            currentOrientationLayout = portrait;
        }

        currentOrientationLayout.panel.gameObject.SetActive(true);
        currentOrientationLayout.devSettingsButton.SetActive(devSettingsEnabled);
        areSettingsOpen = true;
        Debug.LogError("OpenSettings() called");
    }
        private MultiStageLayout ConfigureDirectedRouter()
        {
            ClassicTreeLayout tree = new ClassicTreeLayout
            {
                MinimumNodeDistance  = (int)Handler.GetValue(DIRECTED, MINIMAL_NODE_DISTANCE),
                MinimumLayerDistance = (int)Handler.GetValue(DIRECTED, MINIMAL_LAYER_DISTANCE)
            };

            OrientationLayout ol = (OrientationLayout)tree.OrientationLayout;
            string            orientationChoice = (string)Handler.GetValue(DIRECTED, ORIENTATION);

            ol.Orientation = enumOrient[orientationChoice];

            if ((bool)Handler.GetValue(DIRECTED, ORTHOGONAL_EDGE_ROUTING))
            {
                tree.EdgeRoutingStyle = yWorks.Layout.Tree.EdgeRoutingStyle.Orthogonal;
            }
            else
            {
                tree.EdgeRoutingStyle = yWorks.Layout.Tree.EdgeRoutingStyle.Plain;
            }

            tree.LeafPlacement         = childPlacementPolicies[(string)Handler.GetValue(DIRECTED, CHILD_PLACEMENT_POLICY)];
            tree.EnforceGlobalLayering = (bool)Handler.GetValue(DIRECTED, ENFORCE_GLOBAL_LAYERING);

            string portStyleChoice = (string)Handler.GetValue(DIRECTED, PORT_STYLE);

            tree.PortStyle = enumPortStyle[portStyleChoice];

            tree.ConsiderNodeLabels     = (bool)Handler.GetValue(DIRECTED, INTEGRATED_NODE_LABELING);
            tree.IntegratedEdgeLabeling = (bool)Handler.GetValue(DIRECTED, INTEGRATED_EDGE_LABELING);

            tree.VerticalAlignment = (double)Handler.GetValue(DIRECTED, VERTICAL_ALIGNMENT);
            tree.BusAlignment      = (double)Handler.GetValue(DIRECTED, BUS_ALIGNMENT);

            return(tree);
        }
        ///<inheritdoc/>
        protected override void ConfigureLayout()
        {
            LayoutGraph      graph = CurrentLayoutGraph;
            HierarchicLayout hl    = new HierarchicLayout();

            LayoutAlgorithm = hl;

            //  mark incremental elements if required
            IDataMap    incrementalElements;
            OptionGroup generalGroup  = (OptionGroup)Handler.GetGroupByName(GENERAL);
            OptionGroup currentGroup  = (OptionGroup)generalGroup.GetGroupByName(INTERACTION);
            OptionGroup groupingGroup = (OptionGroup)Handler.GetGroupByName(GROUPING);

            bool fromSketch        = (bool)currentGroup[USE_DRAWING_AS_SKETCH].Value;
            bool incrementalLayout = (bool)currentGroup[SELECTED_ELEMENTS_INCREMENTALLY].Value;
            bool selectedElements  = !IsEdgeSelectionEmpty() || !IsNodeSelectionEmpty();

            if (incrementalLayout && selectedElements)
            {
                // create storage for both nodes and edges
                incrementalElements = Maps.CreateHashedDataMap();
                // configure the mode
                hl.LayoutMode = LayoutMode.Incremental;
                IIncrementalHintsFactory ihf = hl.CreateIncrementalHintsFactory();

                foreach (Node node in graph.Nodes)
                {
                    if (IsSelected(node))
                    {
                        incrementalElements.Set(node, ihf.CreateLayerIncrementallyHint(node));
                    }
                }

                foreach (Edge edge in graph.Edges)
                {
                    if (IsSelected(edge))
                    {
                        incrementalElements.Set(edge, ihf.CreateSequenceIncrementallyHint(edge));
                    }
                }
                graph.AddDataProvider(HierarchicLayout.IncrementalHintsDpKey, incrementalElements);
            }
            else if (fromSketch)
            {
                hl.LayoutMode = LayoutMode.Incremental;
            }
            else
            {
                hl.LayoutMode = LayoutMode.FromScratch;
            }


            // cast to implementation simplex
            var np = (SimplexNodePlacer)hl.NodePlacer;

            np.BarycenterMode  = (bool)generalGroup[SYMMETRIC_PLACEMENT].Value;
            np.StraightenEdges = (bool)Handler.GetValue(EDGE_SETTINGS, EDGE_STRAIGHTENING_OPTIMIZATION_ENABLED);

            hl.ComponentLayoutEnabled = (bool)generalGroup[LAYOUT_COMPONENTS_SEPARATELY].Value;

            currentGroup = (OptionGroup)generalGroup.GetGroupByName(MINIMUM_DISTANCES);

            hl.MinimumLayerDistance = (double)currentGroup[MINIMUM_LAYER_DISTANCE].Value;
            hl.NodeToEdgeDistance   = (double)currentGroup[NODE_TO_EDGE_DISTANCE].Value;
            hl.NodeToNodeDistance   = (double)currentGroup[NODE_TO_NODE_DISTANCE].Value;
            hl.EdgeToEdgeDistance   = (double)currentGroup[EDGE_TO_EDGE_DISTANCE].Value;

            NodeLayoutDescriptor nld = hl.NodeLayoutDescriptor;
            EdgeLayoutDescriptor eld = hl.EdgeLayoutDescriptor;

            currentGroup = (OptionGroup)Handler.GetGroupByName(EDGE_SETTINGS);

            hl.AutomaticEdgeGrouping = (bool)currentGroup[AUTOMATIC_EDGE_GROUPING_ENABLED].Value;

            string edgeRoutingChoice = (string)currentGroup[EDGE_ROUTING].Value;

            eld.RoutingStyle = edgeRoutingEnum[edgeRoutingChoice];
            eld.MinimumFirstSegmentLength = (double)currentGroup[MINIMUM_FIRST_SEGMENT_LENGTH].Value;
            eld.MinimumLastSegmentLength  = (double)currentGroup[MINIMUM_LAST_SEGMENT_LENGTH].Value;

            eld.MinimumDistance = (double)currentGroup[MINIMUM_EDGE_DISTANCE].Value;
            eld.MinimumLength   = (double)currentGroup[MINIMUM_EDGE_LENGTH].Value;

            eld.MinimumSlope = (double)currentGroup[MINIMUM_SLOPE].Value;

            eld.SourcePortOptimization = (bool)currentGroup[PC_OPTIMIZATION_ENABLED].Value;
            eld.TargetPortOptimization = (bool)currentGroup[PC_OPTIMIZATION_ENABLED].Value;

            var isIncrementalModeEnabled = (fromSketch || (incrementalLayout && selectedElements));
            var recursiveRoutingMode     = Handler.GetValue(EDGE_SETTINGS, RECURSIVE_EDGE_ROUTING);

            if (!isIncrementalModeEnabled && recursiveRoutingMode == RECURSIVE_EDGE_ROUTING_DIRECTED)
            {
                eld.RecursiveEdgeStyle = RecursiveEdgeStyle.Directed;
            }
            else if (!isIncrementalModeEnabled && recursiveRoutingMode == RECURSIVE_EDGE_ROUTING_UNDIRECTED)
            {
                eld.RecursiveEdgeStyle = RecursiveEdgeStyle.Undirected;
            }
            else
            {
                eld.RecursiveEdgeStyle = RecursiveEdgeStyle.Off;
            }

            nld.MinimumDistance    = Math.Min(hl.NodeToNodeDistance, hl.NodeToEdgeDistance);
            nld.MinimumLayerHeight = 0;

            OptionGroup rankGroup            = (OptionGroup)Handler.GetGroupByName(RANKS);
            string      layerAlignmentChoice = (string)rankGroup[LAYER_ALIGNMENT].Value;

            nld.LayerAlignment = alignmentEnum[layerAlignmentChoice];

            ol = (OrientationLayout)hl.OrientationLayout;
            string orientationChoice = (string)generalGroup[ORIENTATION].Value;

            ol.Orientation = orientEnum[orientationChoice];

            OptionGroup labelingGroup = (OptionGroup)Handler.GetGroupByName(LABELING);

            currentGroup = (OptionGroup)labelingGroup.GetGroupByName(LABELING_EDGE_PROPERTIES);
            string el = (string)currentGroup[EDGE_LABELING].Value;

            if (!el.Equals(EDGE_LABELING_NONE))
            {
                if (el.Equals(EDGE_LABELING_GENERIC))
                {
                    var la = new GenericLabeling();
                    la.MaximumDuration = 0;
                    la.PlaceNodeLabels = false;
                    la.PlaceEdgeLabels = true;
                    la.AutoFlipping    = true;
                    la.ProfitModel     = new SimpleProfitModel();
                    hl.PrependStage(la);
                }
                else if (el.Equals(EDGE_LABELING_HIERARCHIC))
                {
                    bool copactEdgeLabelPlacement = (bool)currentGroup[COMPACT_EDGE_LABEL_PLACEMENT].Value;
                    if (hl.NodePlacer is SimplexNodePlacer)
                    {
                        np.LabelCompaction = copactEdgeLabelPlacement;
                    }
                    hl.IntegratedEdgeLabeling = true;
                }
            }
            else
            {
                hl.IntegratedEdgeLabeling = false;
            }

            currentGroup = (OptionGroup)labelingGroup.GetGroupByName(NODE_PROPERTIES);
            if ((bool)currentGroup[CONSIDER_NODE_LABELS].Value)
            {
                hl.ConsiderNodeLabels = true;
                hl.NodeLayoutDescriptor.NodeLabelMode = NodeLabelMode.ConsiderForDrawing;
            }
            else
            {
                hl.ConsiderNodeLabels = false;
            }

            string rp = (string)rankGroup[RANKING_POLICY].Value;

            hl.FromScratchLayeringStrategy = rankingPolicies[rp];
            if (rp.Equals(BFS_LAYERS))
            {
                CurrentLayoutGraph.AddDataProvider(BFSLayerer.CoreNodesDpKey, new SelectedNodesDP(this));
            }

            hl.ComponentArrangementPolicy = componentAlignmentEnum[(string)rankGroup[COMPONENT_ARRANGEMENT_POLICY].Value];

            //configure AsIsLayerer
            Object layerer = (hl.LayoutMode == LayoutMode.FromScratch)
                         ? hl.FromScratchLayerer
                         : hl.FixedElementsLayerer;

//      if (layerer is OldLayererWrapper) {
//        layerer = ((OldLayererWrapper)layerer).OldLayerer;
//      }
            if (layerer is AsIsLayerer)
            {
                AsIsLayerer ail = (AsIsLayerer)layerer;
                currentGroup          = (OptionGroup)rankGroup.GetGroupByName(FROM_SKETCH_PROPERTIES);
                ail.NodeHalo          = (double)currentGroup[HALO].Value;
                ail.NodeScalingFactor = (double)currentGroup[SCALE].Value;
                ail.MinimumNodeSize   = (double)currentGroup[MINIMUM_SIZE].Value;
                ail.MaximumNodeSize   = (double)currentGroup[MAXIMUM_SIZE].Value;
            }

            //configure grouping
            np.GroupCompactionStrategy = groupHorizCompactionEnum[(string)groupingGroup[GROUP_HORIZONTAL_COMPACTION].Value];

            if (!fromSketch && groupStrategyEnum[(string)groupingGroup[GROUP_LAYERING_STRATEGY].Value])
            {
                GroupAlignmentPolicy alignmentPolicy = groupAlignmentEnum[(string)groupingGroup[GROUP_ALIGNMENT].Value];
                hl.GroupAlignmentPolicy   = alignmentPolicy;
                hl.CompactGroups          = (bool)groupingGroup[GROUP_ENABLE_COMPACTION].Value;
                hl.RecursiveGroupLayering = true;
            }
            else
            {
                hl.RecursiveGroupLayering = false;
            }

            OptionGroup swimGroup = (OptionGroup)Handler.GetGroupByName(SWIMLANES);

            if ((bool)swimGroup[TREAT_ROOT_GROUPS_AS_SWIMLANES].Value)
            {
                TopLevelGroupToSwimlaneStage stage = new TopLevelGroupToSwimlaneStage();
                stage.OrderSwimlanesFromSketch = (bool)swimGroup[USE_ORDER_FROM_SKETCH].Value;
                stage.Spacing = (double)swimGroup[SWIMLANE_SPACING].Value;
                hl.AppendStage(stage);
            }

            hl.BackLoopRouting = (bool)Handler.GetValue(EDGE_SETTINGS, BACKLOOP_ROUTING);
            hl.MaximumDuration = ((int)Handler.GetValue(GENERAL, MAXIMUM_DURATION)) * 1000;


            bool gridEnabled = (bool)Handler.GetValue(GRID, GRID_ENABLED);

            if (gridEnabled)
            {
                hl.GridSpacing = (double)Handler.GetValue(GRID, GRID_SPACING);
                String             portAssignment = (string)Handler.GetValue(GRID, GRID_PORT_ASSIGNMENT);
                PortAssignmentMode gridPortAssignment;
                switch (portAssignment)
                {
                case GRID_PORT_ASSIGNMENT_ON_GRID:
                    gridPortAssignment = PortAssignmentMode.OnGrid;
                    break;

                case GRID_PORT_ASSIGNMENT_ON_SUBGRID:
                    gridPortAssignment = PortAssignmentMode.OnSubgrid;
                    break;

                default:
                    gridPortAssignment = PortAssignmentMode.Default;
                    break;
                }
                graph.AddDataProvider(HierarchicLayoutCore.NodeLayoutDescriptorDpKey,
                                      new NodeLayoutDescriptorAdapter(hl.NodeLayoutDescriptor, graph, gridPortAssignment));
            }
        }