示例#1
0
        public void AddLaneFlags(UIPanel parent, LaneData lane, NetLaneExt.Flags mask)
        {
            try {
                LogCalled("parent", lane.LaneID, mask);
                AddSpacePanel(parent, 6);
                var laneContainer = AddPanel(parent);
                laneContainer.padding = laneContainer.autoLayoutPadding = new RectOffset();

                var caption = LaneCaptionButton.Add(laneContainer, lane);

                var lanePanel = AddPanel(laneContainer);
                caption.SetTarget(lanePanel);

                foreach (var flag in mask.ExtractPow2Flags())
                {
                    LaneFlagToggle.Add(lanePanel, lane.LaneID, flag);
                }
                laneContainer.eventMouseEnter += (_, __) => HighlighLaneID = lane.LaneID;
                laneContainer.eventMouseLeave += (_, __) => {
                    if (HighlighLaneID == lane.LaneID)
                    {
                        HighlighLaneID = 0;
                    }
                };
                laneContainer.atlas            = TextureUtil.Ingame;
                laneContainer.backgroundSprite = "MenuPanelInfo";
            } catch (Exception ex) {
                Log.Exception(ex);
            }
        }
        public static LanePanelCollapsable Add(UIComponent parent, LaneData lane, NetLaneExt.Flags mask)
        {
            Log.Called();
            Assertion.AssertNotNull(parent, "parent");
            var ret = parent.AddUIComponent <LanePanelCollapsable>();

            Assertion.AssertNotNull(ret, "laneContainer");

            var caption = LaneCaptionButton.Add(ret, lane);

            var innerPanel = AddPanel(ret);

            caption.SetTarget(innerPanel);
            innerPanel.name = "lanePanel";

            foreach (var flag in mask.ExtractPow2Flags())
            {
                LaneFlagToggle.Add(innerPanel, lane.LaneID, flag);
            }

            return(ret);
        }